{"instruction": "What is the reference documentation for audit annotations?", "response": "Audit AnnotationsThis page serves as a reference for the audit annotations of the kubernetes.io namespace. These annotations apply to Event object from API group audit.k8s.io.Note:The following annotations are not used within the Kubernetes API. When you enable auditing in your cluster, audit event data is written using Event from API group audit.k8s.io. The annotations apply to audit events. Audit events are different from objects in the Event API (API group events.k8s.io).k8s.io/deprecatedExample: k8s.io/deprecated: \"true\"Value must be \"true\" or \"false\". The value \"true\" indicates that the request used a deprecated API version.k8s.io/removed-releaseExample: k8s.io/removed-release: \"1.22\"Value must be in the format \"<MAJOR>.<MINOR>\". It is set to target the removal release on requests made to deprecated API versions with a target removal release.pod-security.kubernetes.io/exemptExample: pod-security.kubernetes.io/exempt: namespaceValue must be one of user, namespace, or runtimeClass which correspond to Pod Security Exemption dimensions. This annotation indicates on which dimension was based the exemption from the PodSecurity enforcement.pod-security.kubernetes.io/enforce-policyExample: pod-security.kubernetes.io/enforce-policy: restricted:latestValue must be privileged:<version>, baseline:<version>, restricted:<version> which correspond to Pod Security Standard levels accompanied by a version which must be latest or a valid Kubernetes version in the format v<MAJOR>.<MINOR>. This annotations informs about the enforcement level that allowed or denied the pod during PodSecurity admission.See Pod Security Standards for more information.pod-security.kubernetes.io/audit-violationsExample: pod-security.kubernetes.io/audit-violations: would violate PodSecurity \"restricted:latest\": allowPrivilegeEscalation != false (container \"example\" must set securityContext.allowPrivilegeEscalation=false), ...Value details an audit policy violation, it contains the Pod Security Standard level that was transgressed as well as the specific policies on the fields that were violated from the PodSecurity enforcement.See Pod Security Standards for more information.apiserver.latency.k8s.io/etcdExample: apiserver.latency.k8s.io/etcd: \"4.730661757s\"This annotation indiactes the measure of latency incurred inside the storage layer, it accounts for the time it takes to send data to the etcd and get the complete response back.The value of this audit annotation does not include the time incurred in admission, or validation.apiserver.latency.k8s.io/decode-response-objectExample: apiserver.latency.k8s.io/decode-response-object: \"450.6649ns\"This annotation records the time taken to decode the response received from the storage layer (etcd)apiserver.latency.k8s.io/apf-queue-waitExample: apiserver.latency.k8s.io/apf-queue-wait: \"100ns\"This annotation records the time that a request spent queued due to API server priorities.See API Priority and Fairness (APF) for more information about this mechanism.authorization.k8s.io/decisionExample: authorization.k8s.io/decision: \"forbid\"Value must be forbid or allow. This annotation indicates whether or not a request was authorized in Kubernetes audit logs.See Auditing for more information.authorization.k8s.io/reasonExample: authorization.k8s.io/reason: \"Human-readable reason for the decision\"This annotation gives reason for the decision in Kubernetes audit logs.See Auditing for more information.missing-san.invalid-cert.kubernetes.io/$hostnameExample: missing-san.invalid-cert.kubernetes.io/example-svc.example-namespace.svc: \"relies on a legacy Common Name field instead of the SAN extension for subject validation\"Used by Kubernetes version v1.24 and laterThis annotation indicates a webhook or aggregated API server is using an invalid certificate that is missing subjectAltNames. Support for these certificates was disabled by default in Kubernetes 1.19, and removed in Kubernetes 1.23.Requests to endpoints using these certificates ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/audit-annotations/", "id": "k8s_00000"}
{"instruction": "How do you change the reclaim policy of a persistentvolume in Kubernetes?", "response": "Change the Reclaim Policy of a PersistentVolumeThis page shows how to change the reclaim policy of a Kubernetes PersistentVolume.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Why change reclaim policy of a PersistentVolumePersistentVolumes can have various reclaim policies, including \"Retain\", \"Recycle\", and \"Delete\". For dynamically provisioned PersistentVolumes, the default reclaim policy is \"Delete\". This means that a dynamically provisioned volume is automatically deleted when a user deletes the corresponding PersistentVolumeClaim. This automatic behavior might be inappropriate if the volume contains precious data. In that case, it is more appropriate to use the \"Retain\" policy. With the \"Retain\" policy, if a user deletes a PersistentVolumeClaim, the corresponding PersistentVolume will not be deleted. Instead, it is moved to the Released phase, where all of its data can be manually recovered.Changing the reclaim policy of a PersistentVolumeList the PersistentVolumes in your cluster:kubectl get pv The output is similar to this:NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim1 manual 10s pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim2 manual 6s pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim3 manual 3s This list also includes the name of the claims that are bound to each volume for easier identification of dynamically provisioned volumes.Choose one of your PersistentVolumes and change its reclaim policy:kubectl patch pv <your-pv-name> -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}' where <your-pv-name> is the name of your chosen PersistentVolume.Note:On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote around any literals in the template. For example:kubectl patch pv <your-pv-name> -p \"{\\\"spec\\\":{\\\"persistentVolumeReclaimPolicy\\\":\\\"Retain\\\"}}\" Verify that your chosen PersistentVolume has the right policy:kubectl get pv The output is similar to this:NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim1 manual 40s pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Delete Bound default/claim2 manual 36s pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94 4Gi RWO Retain Bound default/claim3 manual 33s In the preceding output, you can see that the volume bound to claim default/claim3 has reclaim policy Retain. It will not be automatically deleted when a user deletes claim default/claim3.What's nextLearn more about PersistentVolumes.Learn more about PersistentVolumeClaims.ReferencesPersistentVolumePay attention to the .spec.persistentVolumeReclaimPolicy field of PersistentVolume.PersistentVolumeClaim", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/", "id": "k8s_00001"}
{"instruction": "Write a bash example for change the reclaim policy of a persistentvolume", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\nChange the Reclaim Policy of a PersistentVolume | where <your-pv-name> is the name of your chosen PersistentVolume.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/", "id": "k8s_00001_code_2"}
{"instruction": "Write a bash example for change the reclaim policy of a persistentvolume", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p \"{\\\"spec\\\":{\\\"persistentVolumeReclaimPolicy\\\":\\\"Retain\\\"}}\"\n```\n\nChange the Reclaim Policy of a PersistentVolume | Verify that your chosen PersistentVolume has the right policy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/", "id": "k8s_00001_code_3"}
{"instruction": "Write a bash example for change the reclaim policy of a persistentvolume", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\nChange the Reclaim Policy of a PersistentVolume | where <your-pv-name> is the name of your chosen PersistentVolume.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/", "id": "k8s_00001_code_4"}
{"instruction": "Write a bash example for change the reclaim policy of a persistentvolume", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p \"{\\\"spec\\\":{\\\"persistentVolumeReclaimPolicy\\\":\\\"Retain\\\"}}\"\n```\n\nChange the Reclaim Policy of a PersistentVolume | Verify that your chosen PersistentVolume has the right policy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/", "id": "k8s_00001_code_5"}
{"instruction": "How do you use a user namespace with a pod in Kubernetes?", "response": "Use a User Namespace With a PodFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: true)This page shows how to configure a user namespace for pods. This allows you to isolate the user running inside the container from the one in the host.A process running as root in a container can run as a different (non-root) user in the host; in other words, the process has full privileges for operations inside the user namespace, but is unprivileged for operations outside the namespace.You can use this feature to reduce the damage a compromised container can do to the host or other pods in the same node. There are several security vulnerabilities rated either HIGH or CRITICAL that were not exploitable when user namespaces is active. It is expected user namespace will mitigate some future vulnerabilities too.Without using a user namespace a container running as root, in the case of a container breakout, has root privileges on the node. And if some capability were granted to the container, the capabilities are valid on the host too. None of this is true when user namespaces are used.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.25.To check the version, enter kubectl version.🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationThe node OS needs to be LinuxYou need to exec commands in the hostYou need to be able to exec into podsYou need to enable the UserNamespacesSupport feature gateNote:The feature gate to enable user namespaces was previously named UserNamespacesStatelessPodsSupport, when only stateless pods were supported. Only Kubernetes v1.25 through to v1.27 recognise UserNamespacesStatelessPodsSupport.The cluster that you're using must include at least one node that meets the requirements for using user namespaces with Pods.If you have a mixture of nodes and only some of the nodes provide user namespace support for Pods, you also need to ensure that the user namespace Pods are scheduled to suitable nodes.Run a Pod that uses a user namespaceA user namespace for a pod is enabled setting the hostUsers field of .spec to false. For example:pods/user-namespaces-stateless.yaml apiVersion: v1 kind: Pod metadata: name: userns spec: hostUsers: false containers: - name: shell command: [\"sleep\", \"infinity\"] image: debian Create the pod on your cluster:kubectl apply -f https://k8s.io/examples/pods/user-namespaces-stateless.yaml Exec into the pod and run readlink /proc/self/ns/user:kubectl exec -ti userns -- bash Run this command:readlink /proc/self/ns/user The output is similar to:user:[4026531837] Also run:cat /proc/self/uid_map The output is similar to:0 833617920 65536 Then, open a shell in the host and run the same commands.The readlink command shows the user namespace the process is running in. It should be different when it is run on the host and inside the container.The last number of the uid_map file inside the container must be 65536, on the host it must be a bigger number.If you are running the kubelet inside a user namespace, you need to compare the output from running the command in the pod to the output of running in the host:readlink /proc/$pid/ns/user replacing $pid with the kubelet PID.Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party ", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002"}
{"instruction": "Write a yaml example for use a user namespace with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\nUse a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_7"}
{"instruction": "Write a bash example for use a user namespace with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/user-namespaces-stateless.yaml\n```\n\nUse a User Namespace With a Pod | Exec into the pod and run readlink /proc/self/ns/user:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_8"}
{"instruction": "Write a bash example for use a user namespace with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti userns -- bash\n```\n\nUse a User Namespace With a Pod | Run this command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_9"}
{"instruction": "Write a yaml example for use a user namespace with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\nUse a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_10"}
{"instruction": "Write a yaml example for use a user namespace with a pod", "response": "Here's a yaml example:\n\n```yaml\npods/user-namespaces-stateless.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\nUse a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_11"}
{"instruction": "Write a yaml example for use a user namespace with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\nUse a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_12"}
{"instruction": "Write a bash example for use a user namespace with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/user-namespaces-stateless.yaml\n```\n\nUse a User Namespace With a Pod | Exec into the pod and run readlink /proc/self/ns/user:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_13"}
{"instruction": "Write a bash example for use a user namespace with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti userns -- bash\n```\n\nUse a User Namespace With a Pod | Run this command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/", "id": "k8s_00002_code_14"}
{"instruction": "What is the reference documentation for kubeadm init?", "response": "kubeadm initThis command initializes a Kubernetes control plane node.SynopsisRun this command in order to set up the Kubernetes control planeThe \"init\" command executes the following phases:preflight Run pre-flight checks certs Certificate generation /ca Generate the self-signed Kubernetes CA to provision identities for other Kubernetes components /apiserver Generate the certificate for serving the Kubernetes API /apiserver-kubelet-client Generate the certificate for the API server to connect to kubelet /front-proxy-ca Generate the self-signed CA to provision identities for front proxy /front-proxy-client Generate the certificate for the front proxy client /etcd-ca Generate the self-signed CA to provision identities for etcd /etcd-server Generate the certificate for serving etcd /etcd-peer Generate the certificate for etcd nodes to communicate with each other /etcd-healthcheck-client Generate the certificate for liveness probes to healthcheck etcd /apiserver-etcd-client Generate the certificate the apiserver uses to access etcd /sa Generate a private key for signing service account tokens along with its public key kubeconfig Generate all kubeconfig files necessary to establish the control plane and the admin kubeconfig file /admin Generate a kubeconfig file for the admin to use and for kubeadm itself /super-admin Generate a kubeconfig file for the super-admin /kubelet Generate a kubeconfig file for the kubelet to use *only* for cluster bootstrapping purposes /controller-manager Generate a kubeconfig file for the controller manager to use /scheduler Generate a kubeconfig file for the scheduler to use etcd Generate static Pod manifest file for local etcd /local Generate the static Pod manifest file for a local, single-node local etcd instance control-plane Generate all static Pod manifest files necessary to establish the control plane /apiserver Generates the kube-apiserver static Pod manifest /controller-manager Generates the kube-controller-manager static Pod manifest /scheduler Generates the kube-scheduler static Pod manifest kubelet-start Write kubelet settings and (re)start the kubelet wait-control-plane Wait for the control plane to start upload-config Upload the kubeadm and kubelet configuration to a ConfigMap /kubeadm Upload the kubeadm ClusterConfiguration to a ConfigMap /kubelet Upload the kubelet component config to a ConfigMap upload-certs Upload certificates to kubeadm-certs mark-control-plane Mark a node as a control-plane bootstrap-token Generates bootstrap tokens used to join a node to a cluster kubelet-finalize Updates settings relevant to the kubelet after TLS bootstrap /enable-client-cert-rotation Enable kubelet client certificate rotation addon Install required addons for passing conformance tests /coredns Install the CoreDNS addon to a Kubernetes cluster /kube-proxy Install the kube-proxy addon to a Kubernetes cluster show-join-command Show the join command for control-plane and worker node kubeadm init [flags] Options--apiserver-advertise-address stringThe IP address the API Server will advertise it's listening on. If not set the default network interface will be used.--apiserver-bind-port int32 Default: 6443Port for the API Server to bind to.--apiserver-cert-extra-sans stringsOptional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names.--cert-dir string Default: \"/etc/kubernetes/pki\"The path where to save and store the certificates.--certificate-key stringKey used to encrypt the control-plane certificates in the kubeadm-certs Secret. The certificate key is a hex encoded string that is an AES key of size 32 bytes.--config stringPath to a kubeadm configuration file.--control-plane-endpoint stringSpecify a stable IP address or DNS name for the control plane.--cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/", "id": "k8s_00003"}
{"instruction": "Explain customizing components with the kubeadm api in Kubernetes", "response": "Customizing components with the kubeadm APIThis page covers how to customize the components that kubeadm deploys. For control plane components you can use flags in the ClusterConfiguration structure or patches per-node. For the kubelet and kube-proxy you can use KubeletConfiguration and KubeProxyConfiguration, accordingly.All of these options are possible via the kubeadm configuration API. For more details on each field in the configuration you can navigate to our API reference pages.Note:Customizing the CoreDNS deployment of kubeadm is currently not supported. You must manually patch the kube-system/coredns ConfigMap and recreate the CoreDNS Pods after that. Alternatively, you can skip the default CoreDNS deployment and deploy your own variant. For more details on that see Using init phases with kubeadm.Note:To reconfigure a cluster that has already been created see Reconfiguring a kubeadm cluster.Customizing the control plane with flags in ClusterConfigurationThe kubeadm ClusterConfiguration object exposes a way for users to override the default flags passed to control plane components such as the APIServer, ControllerManager, Scheduler and Etcd. The components are defined using the following structures:apiServercontrollerManagerscheduleretcdThese structures contain a common extraArgs field, that consists of name / value pairs. To override a flag for a control plane component:Add the appropriate extraArgs to your configuration.Add flags to the extraArgs field.Run kubeadm init with --config <YOUR CONFIG YAML>.Note:You can generate a ClusterConfiguration object with default values by running kubeadm config print init-defaults and saving the output to a file of your choice.Note:The ClusterConfiguration object is currently global in kubeadm clusters. This means that any flags that you add, will apply to all instances of the same component on different nodes. To apply individual configuration per component on different nodes you can use patches.Note:Duplicate flags (keys), or passing the same flag --foo multiple times, is currently not supported. To workaround that you must use patches.APIServer flagsFor details, see the reference documentation for kube-apiserver.Example usage:apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration kubernetesVersion: v1.16.0 apiServer: extraArgs: - name: \"enable-admission-plugins\" value: \"AlwaysPullImages,DefaultStorageClass\" - name: \"audit-log-path\" value: \"/home/johndoe/audit.log\" ControllerManager flagsFor details, see the reference documentation for kube-controller-manager.Example usage:apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration kubernetesVersion: v1.16.0 controllerManager: extraArgs: - name: \"cluster-signing-key-file\" value: \"/home/johndoe/keys/ca.key\" - name: \"deployment-controller-sync-period\" value: \"50\" Scheduler flagsFor details, see the reference documentation for kube-scheduler.Example usage:apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration kubernetesVersion: v1.16.0 scheduler: extraArgs: - name: \"config\" value: \"/etc/kubernetes/scheduler-config.yaml\" extraVolumes: - name: schedulerconfig hostPath: /home/johndoe/schedconfig.yaml mountPath: /etc/kubernetes/scheduler-config.yaml readOnly: true pathType: \"File\" Etcd flagsFor details, see the etcd server documentation.Example usage:apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration etcd: local: extraArgs: - name: \"election-timeout\" value: 1000 Customizing with patchesFEATURE STATE: Kubernetes v1.22 [beta]Kubeadm allows you to pass a directory with patch files to InitConfiguration and JoinConfiguration on individual nodes. These patches can be used as the last customization step before component configuration is written to disk.You can pass this file to kubeadm init with --config <YOUR CONFIG YAML>:apiVersion: kubeadm.k8s.io/v1beta4 kind: InitConfiguration patches: directory: /home/user/somedir Note:For kubeadm init you can pass a file containing both a ClusterConfiguration and InitConfigurat", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\napiServer:\n  extraArgs:\n  - name: \"enable-admission-plugins\"\n    value: \"AlwaysPullImages,DefaultStorageClass\"\n  - name: \"audit-log-path\"\n    value: \"/home/johndoe/audit.log\"\n```\n\nCustomizing components with the kubeadm API | For details, see the reference documentation for kube-controller-manager.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_17"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-key-file\"\n    value: \"/home/johndoe/keys/ca.key\"\n  - name: \"deployment-controller-sync-period\"\n    value: \"50\"\n```\n\nCustomizing components with the kubeadm API | For details, see the reference documentation for kube-scheduler.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_18"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\nscheduler:\n  extraArgs:\n  - name: \"config\"\n    value: \"/etc/kubernetes/scheduler-config.yaml\"\n  extraVolumes:\n    - name: schedulerconfig\n      hostPath: /home/johndoe/schedconfig.yaml\n      mountPath: /etc/kubernetes/scheduler-config.yaml\n      readOnly: true\n      pathType: \"File\"\n```\n\nCustomizing components with the kubeadm API | For details, see the etcd server documentation.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_19"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\netcd:\n  local:\n    extraArgs:\n    - name: \"election-timeout\"\n      value: 1000\n```\n\nCustomizing components with the kubeadm API | Kubeadm allows you to pass a directory with patch files to InitConfiguration and JoinConfiguration on individual nodes. These patches can be used as the last customization step before component config", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_20"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\npatches:\n  directory: /home/user/somedir\n```\n\nCustomizing components with the kubeadm API | You can pass this file to kubeadm join with --config <YOUR CONFIG YAML>:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_21"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\npatches:\n  directory: /home/user/somedir\n```\n\nCustomizing components with the kubeadm API | The directory must contain files named target[suffix][+patchtype].extension. For example, kube-apiserver0+merge.yaml or just etcd.json.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_22"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\napiServer:\n  extraArgs:\n  - name: \"enable-admission-plugins\"\n    value: \"AlwaysPullImages,DefaultStorageClass\"\n  - name: \"audit-log-path\"\n    value: \"/home/johndoe/audit.log\"\n```\n\nCustomizing components with the kubeadm API | For details, see the reference documentation for kube-controller-manager.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_23"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-key-file\"\n    value: \"/home/johndoe/keys/ca.key\"\n  - name: \"deployment-controller-sync-period\"\n    value: \"50\"\n```\n\nCustomizing components with the kubeadm API | For details, see the reference documentation for kube-scheduler.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_24"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\nscheduler:\n  extraArgs:\n  - name: \"config\"\n    value: \"/etc/kubernetes/scheduler-config.yaml\"\n  extraVolumes:\n    - name: schedulerconfig\n      hostPath: /home/johndoe/schedconfig.yaml\n      mountPath: /etc/kubernetes/scheduler-config.yaml\n      readOnly: true\n      pathType: \"File\"\n```\n\nCustomizing components with the kubeadm API | For details, see the etcd server documentation.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_25"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\netcd:\n  local:\n    extraArgs:\n    - name: \"election-timeout\"\n      value: 1000\n```\n\nCustomizing components with the kubeadm API | Kubeadm allows you to pass a directory with patch files to InitConfiguration and JoinConfiguration on individual nodes. These patches can be used as the last customization step before component config", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_26"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\npatches:\n  directory: /home/user/somedir\n```\n\nCustomizing components with the kubeadm API | You can pass this file to kubeadm join with --config <YOUR CONFIG YAML>:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_27"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\npatches:\n  directory: /home/user/somedir\n```\n\nCustomizing components with the kubeadm API | The directory must contain files named target[suffix][+patchtype].extension. For example, kube-apiserver0+merge.yaml or just etcd.json.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_28"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\napiServer:\n  extraArgs:\n  - name: \"enable-admission-plugins\"\n    value: \"AlwaysPullImages,DefaultStorageClass\"\n  - name: \"audit-log-path\"\n    value: \"/home/johndoe/audit.log\"\n```\n\nCustomizing components with the kubeadm API | For details, see the reference documentation for kube-controller-manager.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_29"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-key-file\"\n    value: \"/home/johndoe/keys/ca.key\"\n  - name: \"deployment-controller-sync-period\"\n    value: \"50\"\n```\n\nCustomizing components with the kubeadm API | For details, see the reference documentation for kube-scheduler.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_30"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: v1.16.0\nscheduler:\n  extraArgs:\n  - name: \"config\"\n    value: \"/etc/kubernetes/scheduler-config.yaml\"\n  extraVolumes:\n    - name: schedulerconfig\n      hostPath: /home/johndoe/schedconfig.yaml\n      mountPath: /etc/kubernetes/scheduler-config.yaml\n      readOnly: true\n      pathType: \"File\"\n```\n\nCustomizing components with the kubeadm API | For details, see the etcd server documentation.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_31"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\netcd:\n  local:\n    extraArgs:\n    - name: \"election-timeout\"\n      value: 1000\n```\n\nCustomizing components with the kubeadm API | Kubeadm allows you to pass a directory with patch files to InitConfiguration and JoinConfiguration on individual nodes. These patches can be used as the last customization step before component config", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_32"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\npatches:\n  directory: /home/user/somedir\n```\n\nCustomizing components with the kubeadm API | You can pass this file to kubeadm join with --config <YOUR CONFIG YAML>:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_33"}
{"instruction": "Write a yaml example for customizing components with the kubeadm api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\npatches:\n  directory: /home/user/somedir\n```\n\nCustomizing components with the kubeadm API | The directory must contain files named target[suffix][+patchtype].extension. For example, kube-apiserver0+merge.yaml or just etcd.json.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/", "id": "k8s_00004_code_34"}
{"instruction": "Explain the Kubernetes concept: Extending Kubernetes", "response": "Extending KubernetesDifferent ways to change the behavior of your Kubernetes cluster.Kubernetes is highly configurable and extensible. As a result, there is rarely a need to fork or submit patches to the Kubernetes project code.This guide describes the options for customizing a Kubernetes cluster. It is aimed at cluster operators who want to understand how to adapt their Kubernetes cluster to the needs of their work environment. Developers who are prospective Platform Developers or Kubernetes Project Contributors will also find it useful as an introduction to what extension points and patterns exist, and their trade-offs and limitations.Customization approaches can be broadly divided into configuration, which only involves changing command line arguments, local configuration files, or API resources; and extensions, which involve running additional programs, additional network services, or both. This document is primarily about extensions.ConfigurationConfiguration files and command arguments are documented in the Reference section of the online documentation, with a page for each binary:kube-apiserverkube-controller-managerkube-schedulerkubeletkube-proxyCommand arguments and configuration files may not always be changeable in a hosted Kubernetes service or a distribution with managed installation. When they are changeable, they are usually only changeable by the cluster operator. Also, they are subject to change in future Kubernetes versions, and setting them may require restarting processes. For those reasons, they should be used only when there are no other options.Built-in policy APIs, such as ResourceQuota, NetworkPolicy and Role-based Access Control (RBAC), are built-in Kubernetes APIs that provide declaratively configured policy settings. APIs are typically usable even with hosted Kubernetes services and with managed Kubernetes installations. The built-in policy APIs follow the same conventions as other Kubernetes resources such as Pods. When you use a policy APIs that is stable, you benefit from a defined support policy like other Kubernetes APIs. For these reasons, policy APIs are recommended over configuration files and command arguments where suitable.ExtensionsExtensions are software components that extend and deeply integrate with Kubernetes. They adapt it to support new types and new kinds of hardware.Many cluster administrators use a hosted or distribution instance of Kubernetes. These clusters come with extensions pre-installed. As a result, most Kubernetes users will not need to install extensions and even fewer users will need to author new ones.Extension patternsKubernetes is designed to be automated by writing client programs. Any program that reads and/or writes to the Kubernetes API can provide useful automation. Automation can run on the cluster or off it. By following the guidance in this doc you can write highly available and robust automation. Automation generally works with any Kubernetes cluster, including hosted clusters and managed installations.There is a specific pattern for writing client programs that work well with Kubernetes called the controller pattern. Controllers typically read an object's .spec, possibly do things, and then update the object's .status.A controller is a client of the Kubernetes API. When Kubernetes is the client and calls out to a remote service, Kubernetes calls this a webhook. The remote service is called a webhook backend. As with custom controllers, webhooks do add a point of failure.Note:Outside of Kubernetes, the term “webhook” typically refers to a mechanism for asynchronous notifications, where the webhook call serves as a one-way notification to another system or component. In the Kubernetes ecosystem, even synchronous HTTP callouts are often described as “webhooks”.In the webhook model, Kubernetes makes a network request to a remote service. With the alternative binary Plugin model, Kubernetes executes a binary (program). Binary plugins are used by the kubelet (", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/", "id": "k8s_00005"}
{"instruction": "What is the reference documentation for kubectl api-resources?", "response": "kubectl api-resourcesSynopsisPrint the supported API resources on the server.kubectl api-resources [flags] Examples # Print the supported API resources kubectl api-resources # Print the supported API resources with more information kubectl api-resources -o wide # Print the supported API resources sorted by a column kubectl api-resources --sort-by=name # Print the supported namespaced resources kubectl api-resources --namespaced=true # Print the supported non-namespaced resources kubectl api-resources --namespaced=false # Print the supported API resources with a specific APIGroup kubectl api-resources --api-group=rbac.authorization.k8s.io Options--api-group stringLimit to resources in the specified API group.--cachedUse the cached list of resources if available.--categories stringsLimit to resources that belong to the specified categories.-h, --helphelp for api-resources--namespaced Default: trueIf false, non-namespaced resources will be returned, otherwise returning namespaced resources by default.--no-headersWhen using the default or custom-column output format, don't print headers (default print headers).-o, --output stringOutput format. One of: (json, yaml, name, wide).--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--sort-by stringIf non-empty, sort list of resources using specified field. The field can be either 'name' or 'kind'.--verbs stringsLimit to resources that support the specified verbs.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provide", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_api-resources/", "id": "k8s_00006"}
{"instruction": "Write a bash example for kubectl api-resources", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\nkubectl api-resources | Limit to resources in the specified API group.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_api-resources/", "id": "k8s_00006_code_37"}
{"instruction": "Write a bash example for kubectl api-resources", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\nkubectl api-resources | Limit to resources in the specified API group.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_api-resources/", "id": "k8s_00006_code_38"}
{"instruction": "How do you horizontalpodautoscaler walkthrough in Kubernetes?", "response": "HorizontalPodAutoscaler WalkthroughA HorizontalPodAutoscaler (HPA for short) automatically updates a workload resource (such as a Deployment or StatefulSet), with the aim of automatically scaling the workload to match demand.Horizontal scaling means that the response to increased load is to deploy more Pods. This is different from vertical scaling, which for Kubernetes would mean assigning more resources (for example: memory or CPU) to the Pods that are already running for the workload.If the load decreases, and the number of Pods is above the configured minimum, the HorizontalPodAutoscaler instructs the workload resource (the Deployment, StatefulSet, or other similar resource) to scale back down.This document walks you through an example of enabling HorizontalPodAutoscaler to automatically manage scale for an example web app. This example workload is Apache httpd running some PHP code.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.23.To check the version, enter kubectl version.If you're running an older release of Kubernetes, refer to the version of the documentation for that release (see available documentation versions).To follow this walkthrough, you also need to use a cluster that has a Metrics Server deployed and configured. The Kubernetes Metrics Server collects resource metrics from the kubelets in your cluster, and exposes those metrics through the Kubernetes API, using an APIService to add new kinds of resource that represent metric readings.To learn how to deploy the Metrics Server, see the metrics-server documentation.If you are running Minikube, run the following command to enable metrics-server:minikube addons enable metrics-server Run and expose php-apache serverTo demonstrate a HorizontalPodAutoscaler, you will first start a Deployment that runs a container using the hpa-example image, and expose it as a Service using the following manifest:application/php-apache.yaml apiVersion: apps/v1 kind: Deployment metadata: name: php-apache spec: selector: matchLabels: run: php-apache template: metadata: labels: run: php-apache spec: containers: - name: php-apache image: registry.k8s.io/hpa-example ports: - containerPort: 80 resources: limits: cpu: 500m requests: cpu: 200m --- apiVersion: v1 kind: Service metadata: name: php-apache labels: run: php-apache spec: ports: - port: 80 selector: run: php-apache To do so, run the following command:kubectl apply -f https://k8s.io/examples/application/php-apache.yaml deployment.apps/php-apache created service/php-apache created Create the HorizontalPodAutoscalerNow that the server is running, create the autoscaler using kubectl. The kubectl autoscale subcommand, part of kubectl, helps you do this.You will shortly run a command that creates a HorizontalPodAutoscaler that maintains between 1 and 10 replicas of the Pods controlled by the php-apache Deployment that you created in the first step of these instructions.Roughly speaking, the HPA controller will increase and decrease the number of replicas (by updating the Deployment) to maintain an average CPU utilization across all Pods of 50%. The Deployment then updates the ReplicaSet - this is part of how all Deployments work in Kubernetes - and then the ReplicaSet either adds or removes Pods based on the change to its .spec.Since each pod requests 200 milli-cores by kubectl run, this means an average CPU usage of 100 milli-cores. See Algorithm details for more details on the algorithm.Create the HorizontalPodAutoscaler:kubectl autoscale deployment php-apache --cpu=50% --min=1 --max=10 horizon", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_40"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/php-apache.yaml\n```\n\nHorizontalPodAutoscaler Walkthrough | Now that the server is running, create the autoscaler using kubectl. The kubectl autoscale subcommand, part of kubectl, helps you do this.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_41"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment php-apache --cpu=50% --min=1 --max=10\n```\n\nHorizontalPodAutoscaler Walkthrough | You can check the current status of the newly-made HorizontalPodAutoscaler, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_42"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | You should see the replica count matching the figure from the HorizontalPodAutoscaler", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_43"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | Once CPU utilization dropped to 0, the HPA automatically scaled the number of replicas back down to 1.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_44"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get hpa php-apache -o yaml > /tmp/hpa-v2.yaml\n```\n\nHorizontalPodAutoscaler Walkthrough | Open the /tmp/hpa-v2.yaml file in an editor, and you should see YAML which looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_45"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n      current:\n        averageUtilization: 0\n        averageValue: 0\n```\n\nHorizontalPodAutoscaler Walkthrough | Notice that the targetCPUUtilizationPercentage field has been replaced with an array called metrics. The CPU utilization metric is a resource metric, since it is represented as a percentage of a resou", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_46"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: requests-per-second\n  describedObject:\n    apiVersion: networking.k8s.io/v1\n    kind: Ingress\n    name: main-route\n  target:\n    type: Value\n    value: 2k\n```\n\nHorizontalPodAutoscaler Walkthrough | If you provide multiple such metric blocks, the HorizontalPodAutoscaler will consider each metric in turn. The HorizontalPodAutoscaler will calculate proposed replica counts for each metric, and then", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_47"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n  - type: Pods\n    pods:\n      metric:\n        name: packets-per-second\n      target:\n        type: AverageValue\n        averageValue: 1k\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      target:\n        type: Value\n        value: 10k\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n    current:\n      averageUtilization: 0\n      averageValue: 0\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      current:\n        value: 10k\n```\n\nHorizontalPodAutoscaler Walkthrough | Then, your HorizontalPodAutoscaler would attempt to ensure that each pod was consuming roughly 50% of its requested CPU, serving 1000 packets per second, and that all pods behind the main-route Ingres", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_48"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl describe hpa cm-test\n```\n\nHorizontalPodAutoscaler Walkthrough | For this HorizontalPodAutoscaler, you can see several conditions in a healthy state. The first, AbleToScale, indicates whether or not the HPA is able to fetch and update scales, as well as whether or", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_49"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\nHorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_50"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/hpa/php-apache.yaml\n```\n\nHorizontalPodAutoscaler Walkthrough |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_51"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_52"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n      current:\n        averageUtilization: 0\n        averageValue: 0\n```\n\nHorizontalPodAutoscaler Walkthrough | Notice that the targetCPUUtilizationPercentage field has been replaced with an array called metrics. The CPU utilization metric is a resource metric, since it is represented as a percentage of a resou", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_53"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\ntype: Pods\npods:\n  metric:\n    name: packets-per-second\n  target:\n    type: AverageValue\n    averageValue: 1k\n```\n\nHorizontalPodAutoscaler Walkthrough | The second alternative metric type is object metrics. These metrics describe a different object in the same namespace, instead of describing Pods. The metrics are not necessarily fetched from the obje", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_54"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: requests-per-second\n  describedObject:\n    apiVersion: networking.k8s.io/v1\n    kind: Ingress\n    name: main-route\n  target:\n    type: Value\n    value: 2k\n```\n\nHorizontalPodAutoscaler Walkthrough | If you provide multiple such metric blocks, the HorizontalPodAutoscaler will consider each metric in turn. The HorizontalPodAutoscaler will calculate proposed replica counts for each metric, and then", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_55"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n  - type: Pods\n    pods:\n      metric:\n        name: packets-per-second\n      target:\n        type: AverageValue\n        averageValue: 1k\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      target:\n        type: Value\n        value: 10k\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n    current:\n      averageUtilization: 0\n      averageValue: 0\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      current:\n        value: 10k\n```\n\nHorizontalPodAutoscaler Walkthrough | Then, your HorizontalPodAutoscaler would attempt to ensure that each pod was consuming roughly 50% of its requested CPU, serving 1000 packets per second, and that all pods behind the main-route Ingres", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_56"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: http_requests\n    selector: {matchLabels: {verb: GET}}\n```\n\nHorizontalPodAutoscaler Walkthrough | This selector uses the same syntax as the full Kubernetes label selectors. The monitoring pipeline determines how to collapse multiple series into a single value, if the name and selector match multip", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_57"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\n- type: External\n  external:\n    metric:\n      name: queue_messages_ready\n      selector:\n        matchLabels:\n          queue: \"worker_tasks\"\n    target:\n      type: AverageValue\n      averageValue: 30\n```\n\nHorizontalPodAutoscaler Walkthrough | When possible, it's preferable to use the custom metric target types instead of external metrics, since it's easier for cluster administrators to secure the custom metrics API. The external metrics AP", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_58"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\nHorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_59"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napplication/php-apache.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_60"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_61"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/php-apache.yaml\n```\n\nHorizontalPodAutoscaler Walkthrough | Now that the server is running, create the autoscaler using kubectl. The kubectl autoscale subcommand, part of kubectl, helps you do this.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_62"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment php-apache --cpu=50% --min=1 --max=10\n```\n\nHorizontalPodAutoscaler Walkthrough | You can check the current status of the newly-made HorizontalPodAutoscaler, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_63"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | You should see the replica count matching the figure from the HorizontalPodAutoscaler", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_64"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\nHorizontalPodAutoscaler Walkthrough | Once CPU utilization dropped to 0, the HPA automatically scaled the number of replicas back down to 1.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_65"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get hpa php-apache -o yaml > /tmp/hpa-v2.yaml\n```\n\nHorizontalPodAutoscaler Walkthrough | Open the /tmp/hpa-v2.yaml file in an editor, and you should see YAML which looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_66"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n      current:\n        averageUtilization: 0\n        averageValue: 0\n```\n\nHorizontalPodAutoscaler Walkthrough | Notice that the targetCPUUtilizationPercentage field has been replaced with an array called metrics. The CPU utilization metric is a resource metric, since it is represented as a percentage of a resou", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_67"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: requests-per-second\n  describedObject:\n    apiVersion: networking.k8s.io/v1\n    kind: Ingress\n    name: main-route\n  target:\n    type: Value\n    value: 2k\n```\n\nHorizontalPodAutoscaler Walkthrough | If you provide multiple such metric blocks, the HorizontalPodAutoscaler will consider each metric in turn. The HorizontalPodAutoscaler will calculate proposed replica counts for each metric, and then", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_68"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n  - type: Pods\n    pods:\n      metric:\n        name: packets-per-second\n      target:\n        type: AverageValue\n        averageValue: 1k\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      target:\n        type: Value\n        value: 10k\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n    current:\n      averageUtilization: 0\n      averageValue: 0\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      current:\n        value: 10k\n```\n\nHorizontalPodAutoscaler Walkthrough | Then, your HorizontalPodAutoscaler would attempt to ensure that each pod was consuming roughly 50% of its requested CPU, serving 1000 packets per second, and that all pods behind the main-route Ingres", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_69"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl describe hpa cm-test\n```\n\nHorizontalPodAutoscaler Walkthrough | For this HorizontalPodAutoscaler, you can see several conditions in a healthy state. The first, AbleToScale, indicates whether or not the HPA is able to fetch and update scales, as well as whether or", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_70"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napplication/hpa/php-apache.yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\nHorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_71"}
{"instruction": "Write a yaml example for horizontalpodautoscaler walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\nHorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_72"}
{"instruction": "Write a bash example for horizontalpodautoscaler walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/hpa/php-apache.yaml\n```\n\nHorizontalPodAutoscaler Walkthrough |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/", "id": "k8s_00007_code_73"}
{"instruction": "What is the reference documentation for kubectl auth can-i?", "response": "kubectl auth can-iSynopsisCheck whether an action is allowed.VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that starts with \"/\". NAME is the name of a particular Kubernetes resource. This command pairs nicely with impersonation. See --as global flag.kubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL] Examples # Check to see if I can create pods in any namespace kubectl auth can-i create pods --all-namespaces # Check to see if I can list deployments in my current namespace kubectl auth can-i list deployments.apps # Check to see if service account \"foo\" of namespace \"dev\" can list pods in the namespace \"prod\" # You must be allowed to use impersonation for the global option \"--as\" kubectl auth can-i list pods --as=system:serviceaccount:dev:foo -n prod # Check to see if I can do everything in my current namespace (\"*\" means all) kubectl auth can-i '*' '*' # Check to see if I can get the job named \"bar\" in namespace \"foo\" kubectl auth can-i list jobs.batch/bar -n foo # Check to see if I can read pod logs kubectl auth can-i get pods --subresource=log # Check to see if I can access the URL /logs/ kubectl auth can-i get /logs/ # Check to see if I can approve certificates.k8s.io kubectl auth can-i approve certificates.k8s.io # List all allowed actions in namespace \"foo\" kubectl auth can-i --list --namespace=foo Options-A, --all-namespacesIf true, check the specified action in all namespaces.-h, --helphelp for can-i--listIf true, prints all allowed actions.--no-headersIf true, prints allowed actions without headers-q, --quietIf true, suppress output and just return the exit code.--subresource stringSubResource such as pod/log or deployment/scaleParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_can-i/", "id": "k8s_00008"}
{"instruction": "Write a bash example for kubectl auth can-i", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]\n```\n\nkubectl auth can-i | If true, check the specified action in all namespaces.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_can-i/", "id": "k8s_00008_code_75"}
{"instruction": "Write a bash example for kubectl auth can-i", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]\n```\n\nkubectl auth can-i | If true, check the specified action in all namespaces.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_can-i/", "id": "k8s_00008_code_76"}
{"instruction": "What is the reference documentation for kubernetes api?", "response": "Kubernetes APIKubernetes' API is the application that serves Kubernetes functionality through a RESTful interface and stores the state of the cluster.Kubernetes resources and \"records of intent\" are all stored as API objects, and modified via RESTful calls to the API. The API allows configuration to be managed in a declarative way. Users can interact with the Kubernetes API directly, or via tools like kubectl. The core Kubernetes API is flexible and can also be extended to support custom resources.Workload ResourcesService ResourcesConfig and Storage ResourcesAuthentication ResourcesAuthorization ResourcesPolicy ResourcesExtend ResourcesCluster ResourcesCommon DefinitionsOther ResourcesCommon Parameters", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/", "id": "k8s_00009"}
{"instruction": "What is the reference documentation for kube-proxy configuration (v1alpha1)?", "response": "kube-proxy Configuration (v1alpha1)Resource TypesKubeProxyConfigurationFormatOptionsAppears in:LoggingConfigurationFormatOptions contains options for the different logging formats.FieldDescriptiontext [Required]TextOptions[Alpha] Text contains options for logging format \"text\". Only available when the LoggingAlphaOptions feature gate is enabled.json [Required]JSONOptions[Alpha] JSON contains options for logging format \"json\". Only available when the LoggingAlphaOptions feature gate is enabled.JSONOptionsAppears in:FormatOptionsJSONOptions contains options for logging format \"json\".FieldDescriptionOutputRoutingOptions [Required]OutputRoutingOptions(Members of OutputRoutingOptions are embedded into this type.) No description provided.LogFormatFactoryLogFormatFactory provides support for a certain additional, non-default log format.LoggingConfigurationAppears in:KubeProxyConfigurationKubeletConfigurationLoggingConfiguration contains logging options.FieldDescriptionformat [Required]stringFormat Flag specifies the structure of log messages. default value of format is textflushFrequency [Required]TimeOrMetaDurationMaximum time between log flushes. If a string, parsed as a duration (i.e. \"1s\") If an int, the maximum number of nanoseconds (i.e. 1s = 1000000000). Ignored if the selected logging backend writes log messages without buffering.verbosity [Required]VerbosityLevelVerbosity is the threshold that determines which log messages are logged. Default is zero which logs only the most important messages. Higher values enable additional messages. Error messages are always logged.vmodule [Required]VModuleConfigurationVModule overrides the verbosity threshold for individual files. Only supported for \"text\" log format.options [Required]FormatOptions[Alpha] Options holds additional parameters that are specific to the different logging formats. Only the options for the selected format get used, but all of them get validated. Only available when the LoggingAlphaOptions feature gate is enabled.LoggingOptionsLoggingOptions can be used with ValidateAndApplyWithOptions to override certain global defaults.FieldDescriptionErrorStream [Required]io.WriterErrorStream can be used to override the os.Stderr default.InfoStream [Required]io.WriterInfoStream can be used to override the os.Stdout default.OutputRoutingOptionsAppears in:JSONOptionsTextOptionsOutputRoutingOptions contains options that are supported by both \"text\" and \"json\".FieldDescriptionsplitStream [Required]bool[Alpha] SplitStream redirects error messages to stderr while info messages go to stdout, with buffering. The default is to write both to stdout, without buffering. Only available when the LoggingAlphaOptions feature gate is enabled.infoBufferSize [Required]k8s.io/apimachinery/pkg/api/resource.QuantityValue[Alpha] InfoBufferSize sets the size of the info stream when using split streams. The default is zero, which disables buffering. Only available when the LoggingAlphaOptions feature gate is enabled.TextOptionsAppears in:FormatOptionsTextOptions contains options for logging format \"text\".FieldDescriptionOutputRoutingOptions [Required]OutputRoutingOptions(Members of OutputRoutingOptions are embedded into this type.) No description provided.TimeOrMetaDurationAppears in:LoggingConfigurationTimeOrMetaDuration is present only for backwards compatibility for the flushFrequency field, and new fields should use metav1.Duration.FieldDescriptionDuration [Required]meta/v1.DurationDuration holds the duration- [Required]boolSerializeAsString controls whether the value is serialized as a string or an integerVModuleConfiguration(Alias of []k8s.io/component-base/logs/api/v1.VModuleItem)Appears in:LoggingConfigurationVModuleConfiguration is a collection of individual file names or patterns and the corresponding verbosity threshold.VerbosityLevel(Alias of uint32)Appears in:LoggingConfigurationVerbosityLevel represents a klog or logr verbosity threshold.ClientConnectionConfigurationAppears in:KubeProxy", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kube-proxy-config.v1alpha1/", "id": "k8s_00010"}
{"instruction": "What is the reference documentation for kubeadm reset?", "response": "kubeadm resetPerforms a best effort revert of changes made by kubeadm init or kubeadm join.SynopsisPerforms a best effort revert of changes made to this host by 'kubeadm init' or 'kubeadm join'The \"reset\" command executes the following phases:preflight Run reset pre-flight checks remove-etcd-member Remove a local etcd member. cleanup-node Run cleanup node. kubeadm reset [flags] Options--cert-dir string Default: \"/etc/kubernetes/pki\"The path to the directory where the certificates are stored. If specified, clean this directory.--cleanup-tmp-dirCleanup the \"/etc/kubernetes/tmp\" directory--config stringPath to a kubeadm configuration file.--cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.--dry-runDon't apply any changes; just output what would be done.-f, --forceReset the node without prompting for confirmation.-h, --helphelp for reset--ignore-preflight-errors stringsA list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--skip-phases stringsList of phases to be skippedOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.Reset workflowkubeadm reset is responsible for cleaning up a node local file system from files that were created using the kubeadm init or kubeadm join commands. For control-plane nodes reset also removes the local stacked etcd member of this node from the etcd cluster.kubeadm reset phase can be used to execute the separate phases of the above workflow. To skip a list of phases you can use the --skip-phases flag, which works in a similar way to the kubeadm join and kubeadm init phase runners.kubeadm reset also supports the --config flag for passing a ResetConfiguration structure.Cleanup of external etcd memberskubeadm reset will not delete any etcd data if external etcd is used. This means that if you run kubeadm init again using the same etcd endpoints, you will see state from previous clusters.To wipe etcd data it is recommended you use a client like etcdctl, such as:etcdctl del \"\" --prefix See the etcd documentation for more information.Cleanup of CNI configurationCNI plugins use the directory /etc/cni/net.d to store their configuration. The kubeadm reset command does not cleanup that directory. Leaving the configuration of a CNI plugin on a host can be problematic if the same host is later used as a new Kubernetes node and a different CNI plugin happens to be deployed in that cluster. It can result in a configuration conflict between CNI plugins.To cleanup the directory, backup its contents if needed and then execute the following command:sudo rm -rf /etc/cni/net.d Cleanup of network traffic rulesThe kubeadm reset command does not clean any iptables, nftables or IPVS rules applied to the host by kube-proxy. A control loop in kube-proxy ensures that the rules on each node host are synchronized. For additional details please see Virtual IPs and Service Proxies.Leaving the rules without cleanup should not cause any issues if the host is later reused as a Kubernetes node or if it will serve a different purpose.If you wish to perform this cleanup, you can use the same kube-proxy container which was used in your cluster and the --cleanup flag of the kube-proxy binary:docker run --privileged --rm registry.k8s.io/kube-proxy:v1.34.0 sh -c \"kube-proxy --cleanup && echo DONE\" The output of the above command should print DONE at the end. Instead of Docker, you can use your preferred container runtime to start the container.Cleanup of $HOME/.kubeThe $HOME/.kube directory typically ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/", "id": "k8s_00011"}
{"instruction": "Write a bash example for kubeadm reset", "response": "Here's a bash example:\n\n```bash\ndocker run --privileged --rm registry.k8s.io/kube-proxy:v1.34.0 sh -c \"kube-proxy --cleanup && echo DONE\"\n```\n\nkubeadm reset | The output of the above command should print DONE at the end. Instead of Docker, you can use your preferred container runtime to start the container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/", "id": "k8s_00011_code_80"}
{"instruction": "Write a bash example for kubeadm reset", "response": "Here's a bash example:\n\n```bash\netcdctl del \"\" --prefix\n```\n\nkubeadm reset | See the etcd documentation for more information.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/", "id": "k8s_00011_code_81"}
{"instruction": "Write a bash example for kubeadm reset", "response": "Here's a bash example:\n\n```bash\nsudo rm -rf /etc/cni/net.d\n```\n\nkubeadm reset | The kubeadm reset command does not clean any iptables, nftables or IPVS rules applied to the host by kube-proxy. A control loop in kube-proxy ensures that the rules on each node host are synchronized.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/", "id": "k8s_00011_code_82"}
{"instruction": "Write a bash example for kubeadm reset", "response": "Here's a bash example:\n\n```bash\ndocker run --privileged --rm registry.k8s.io/kube-proxy:v1.34.0 sh -c \"kube-proxy --cleanup && echo DONE\"\n```\n\nkubeadm reset | The output of the above command should print DONE at the end. Instead of Docker, you can use your preferred container runtime to start the container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/", "id": "k8s_00011_code_83"}
{"instruction": "Write a bash example for kubeadm reset", "response": "Here's a bash example:\n\n```bash\nyq eval -i '.spec.containers[0].command = []' /etc/kubernetes/manifests/kube-apiserver.yaml\ntimeout 60 sh -c 'while pgrep kube-apiserver >/dev/null; do sleep 1; done' || true\n```\n\nkubeadm reset |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/", "id": "k8s_00011_code_84"}
{"instruction": "Write a bash example for kubeadm reset", "response": "Here's a bash example:\n\n```bash\ndocker run --privileged --rm registry.k8s.io/kube-proxy:v1.34.0 sh -c \"kube-proxy --cleanup && echo DONE\"\n```\n\nkubeadm reset | The output of the above command should print DONE at the end. Instead of Docker, you can use your preferred container runtime to start the container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/", "id": "k8s_00011_code_85"}
{"instruction": "What is the reference documentation for kubelet configuration (v1alpha1)?", "response": "Kubelet Configuration (v1alpha1)Resource TypesCredentialProviderConfigImagePullIntentImagePulledRecordCredentialProviderConfigCredentialProviderConfig is the configuration containing information about each exec credential provider. Kubelet reads this configuration from disk and enables each provider as specified by the CredentialProvider type.FieldDescriptionapiVersionstringkubelet.config.k8s.io/v1alpha1kindstringCredentialProviderConfigproviders [Required][]CredentialProviderproviders is a list of credential provider plugins that will be enabled by the kubelet. Multiple providers may match against a single image, in which case credentials from all providers will be returned to the kubelet. If multiple providers are called for a single image, the results are combined. If providers return overlapping auth keys, the value from the provider earlier in this list is attempted first.ImagePullIntentImagePullIntent is a record of the kubelet attempting to pull an image.FieldDescriptionapiVersionstringkubelet.config.k8s.io/v1alpha1kindstringImagePullIntentimage [Required]stringImage is the image spec from a Container's image field. The filename is a SHA-256 hash of this value. This is to avoid filename-unsafe characters like ':' and '/'.ImagePulledRecordImagePullRecord is a record of an image that was pulled by the kubelet.If there are no records in the kubernetesSecrets field and both nodeWideCredentials and anonymous are false, credentials must be re-checked the", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubelet-config.v1alpha1/", "id": "k8s_00012"}
{"instruction": "How do you managing secrets using configuration file in Kubernetes?", "response": "Managing Secrets using Configuration FileCreating Secret objects using resource configuration file.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesCreate the SecretYou can define the Secret object in a manifest first, in JSON or YAML format, and then create that object. The Secret resource contains two maps: data and stringData. The data field is used to store arbitrary data, encoded using base64. The stringData field is provided for convenience, and it allows you to provide the same data as unencoded strings. The keys of data and stringData must consist of alphanumeric characters, -, _ or ..The following example stores two strings in a Secret using the data field.Convert the strings to base64:echo -n 'admin' | base64 echo -n '1f2d1e2e67df' | base64 Note:The serialized JSON and YAML values of Secret data are encoded as base64 strings. Newlines are not valid within these strings and must be omitted. When using the base64 utility on Darwin/macOS, users should avoid using the -b option to split long lines. Conversely, Linux users should add the option -w 0 to base64 commands or the pipeline base64 | tr -d '\\n' if the -w option is not available.The output is similar to:YWRtaW4= MWYyZDFlMmU2N2Rm Create the manifest:apiVersion: v1 kind: Secret metadata: name: mysecret type: Opaque data: username: YWRtaW4= password: MWYyZDFlMmU2N2Rm Note that the name of a Secret object must be a valid DNS subdomain name.Create the Secret using kubectl apply:kubectl apply -f ./secret.yaml The output is similar to:secret/mysecret created To verify that the Secret was created and to decode the Secret data, refer to Managing Secrets using kubectl.Specify unencoded data when creating a SecretFor certain scenarios, you may wish to use the stringData field instead. This field allows you to put a non-base64 encoded string directly into the Secret, and the string will be encoded for you when the Secret is created or updated.A practical example of this might be where you are deploying an application that uses a Secret to store a configuration file, and you want to populate parts of that configuration file during your deployment process.For example, if your application uses the following configuration file:apiUrl: \"https://my.api.com/api/v1\" username: \"<user>\" password: \"<password>\" You could store this in a Secret using the following definition:apiVersion: v1 kind: Secret metadata: name: mysecret type: Opaque stringData: config.yaml: | apiUrl: \"https://my.api.com/api/v1\" username: <user> password: <password> Note:The stringData field for a Secret does not work well with server-side apply.When you retrieve the Secret data, the command returns the encoded values, and not the plaintext values you provided in stringData.For example, if you run the following command:kubectl get secret mysecret -o yaml The output is similar to:apiVersion: v1 data: config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19 kind: Secret metadata: creationTimestamp: 2018-11-15T20:40:59Z name: mysecret namespace: default resourceVersion: \"7225\" uid: c280ad2e-e916-11e8-98f2-025000000001 type: Opaque Specify both data and stringDataIf you specify a field in both data and stringData, the value from stringData is used.For example, if you define the following Secret:apiVersion: v1 kind: Secret metadata: name: mysecret type: Opaque data: username: YWRtaW4= stringData: username: administrator Note:The stringData field for a Secret does not work well with server-side apply.The Secret object is created as follows:apiVersion: v1 data: username: YWRta", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: MWYyZDFlMmU2N2Rm\n```\n\nManaging Secrets using Configuration File | Note that the name of a Secret object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_88"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\nManaging Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_89"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\nstringData:\n  config.yaml: |\n    apiUrl: \"https://my.api.com/api/v1\"\n    username: <user>\n    password: <password>\n```\n\nManaging Secrets using Configuration File | When you retrieve the Secret data, the command returns the encoded values, and not the plaintext values you provided in stringData.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_90"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl get secret mysecret -o yaml\n```\n\nManaging Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_91"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:40:59Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7225\"\n  uid: c280ad2e-e916-11e8-98f2-025000000001\ntype: Opaque\n```\n\nManaging Secrets using Configuration File | If you specify a field in both data and stringData, the value from stringData is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_92"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\nstringData:\n  username: administrator\n```\n\nManaging Secrets using Configuration File | The Secret object is created as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_93"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  username: YWRtaW5pc3RyYXRvcg==\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:46:46Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7579\"\n  uid: 91460ecb-e917-11e8-98f2-025000000001\ntype: Opaque\n```\n\nManaging Secrets using Configuration File | YWRtaW5pc3RyYXRvcg== decodes to administrator.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_94"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: YmlyZHNhcmVudHJlYWw=\n```\n\nManaging Secrets using Configuration File | Apply the manifest to your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_95"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\nManaging Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_96"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret mysecret\n```\n\nManaging Secrets using Configuration File |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_97"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: MWYyZDFlMmU2N2Rm\n```\n\nManaging Secrets using Configuration File | Note that the name of a Secret object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_98"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiUrl: \"https://my.api.com/api/v1\"\nusername: \"<user>\"\npassword: \"<password>\"\n```\n\nManaging Secrets using Configuration File | You could store this in a Secret using the following definition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_99"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\nstringData:\n  config.yaml: |\n    apiUrl: \"https://my.api.com/api/v1\"\n    username: <user>\n    password: <password>\n```\n\nManaging Secrets using Configuration File | When you retrieve the Secret data, the command returns the encoded values, and not the plaintext values you provided in stringData.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_100"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:40:59Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7225\"\n  uid: c280ad2e-e916-11e8-98f2-025000000001\ntype: Opaque\n```\n\nManaging Secrets using Configuration File | If you specify a field in both data and stringData, the value from stringData is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_101"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\nstringData:\n  username: administrator\n```\n\nManaging Secrets using Configuration File | The Secret object is created as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_102"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  username: YWRtaW5pc3RyYXRvcg==\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:46:46Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7579\"\n  uid: 91460ecb-e917-11e8-98f2-025000000001\ntype: Opaque\n```\n\nManaging Secrets using Configuration File | YWRtaW5pc3RyYXRvcg== decodes to administrator.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_103"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: YmlyZHNhcmVudHJlYWw=\n```\n\nManaging Secrets using Configuration File | Apply the manifest to your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_104"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side\n```\n\nManaging Secrets using Configuration File | To delete the Secret you have created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_105"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: MWYyZDFlMmU2N2Rm\n```\n\nManaging Secrets using Configuration File | Note that the name of a Secret object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_106"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\nManaging Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_107"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\nstringData:\n  config.yaml: |\n    apiUrl: \"https://my.api.com/api/v1\"\n    username: <user>\n    password: <password>\n```\n\nManaging Secrets using Configuration File | When you retrieve the Secret data, the command returns the encoded values, and not the plaintext values you provided in stringData.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_108"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl get secret mysecret -o yaml\n```\n\nManaging Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_109"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:40:59Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7225\"\n  uid: c280ad2e-e916-11e8-98f2-025000000001\ntype: Opaque\n```\n\nManaging Secrets using Configuration File | If you specify a field in both data and stringData, the value from stringData is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_110"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\nstringData:\n  username: administrator\n```\n\nManaging Secrets using Configuration File | The Secret object is created as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_111"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  username: YWRtaW5pc3RyYXRvcg==\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:46:46Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7579\"\n  uid: 91460ecb-e917-11e8-98f2-025000000001\ntype: Opaque\n```\n\nManaging Secrets using Configuration File | YWRtaW5pc3RyYXRvcg== decodes to administrator.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_112"}
{"instruction": "Write a yaml example for managing secrets using configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: YmlyZHNhcmVudHJlYWw=\n```\n\nManaging Secrets using Configuration File | Apply the manifest to your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_113"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\nManaging Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_114"}
{"instruction": "Write a bash example for managing secrets using configuration file", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret mysecret\n```\n\nManaging Secrets using Configuration File |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-config-file/", "id": "k8s_00013_code_115"}
{"instruction": "How do you cloud controller manager administration in Kubernetes?", "response": "Cloud Controller Manager AdministrationFEATURE STATE: Kubernetes v1.11 [beta]Since cloud providers develop and release at a different pace compared to the Kubernetes project, abstracting the provider-specific code to the cloud-controller-manager binary allows cloud vendors to evolve independently from the core Kubernetes code.The cloud-controller-manager can be linked to any cloud provider that satisfies cloudprovider.Interface. For backwards compatibility, the cloud-controller-manager provided in the core Kubernetes project uses the same cloud libraries as kube-controller-manager. Cloud providers already supported in Kubernetes core are expected to use the in-tree cloud-controller-manager to transition out of Kubernetes core.AdministrationRequirementsEvery cloud has their own set of requirements for running their own cloud provider integration, it should not be too different from the requirements when running kube-controller-manager. As a general rule of thumb you'll need:cloud authentication/authorization: your cloud may require a token or IAM rules to allow access to their APIskubernetes authentication/authorization: cloud-controller-manager may need RBAC rules set to speak to the kubernetes apiserverhigh availability: like kube-controller-manager, you may want a high available setup for cloud controller manager using leader election (on by default).Running cloud-controller-managerSuccessfully running cloud-controller-manager requires some changes to your cluster configuration.kubelet, kube-apiserver, and kube-controller-manager must be set according to the user's usage of external CCM. If the user has an external CCM (not the internal cloud controller loops in the Kubernetes Controller Manager), then --cloud-provider=external must be specified. Otherwise, it should not be specified.Keep in mind that setting up your cluster to use cloud controller manager will change your cluster behaviour in a few ways:Components that specify --cloud-provider=external will add a taint node.cloudprovider.kubernetes.io/uninitialized with an effect NoSchedule during initialization. This marks the node as needing a second initialization from an external controller before it can be scheduled work. Note that in the event that cloud controller manager is not available, new nodes in the cluster will be left unschedulable. The taint is important since the scheduler may require cloud specific information about nodes such as their region or type (high cpu, gpu, high memory, spot instance, etc).cloud information about nodes in the cluster will no longer be retrieved using local metadata, but instead all API calls to retrieve node information will go through cloud controller manager. This may mean you can restrict access to your cloud API on the kubelets for better security. For larger clusters you may want to consider if cloud controller manager will hit rate limits since it is now responsible for almost all API calls to your cloud from within the cluster.The cloud controller manager can implement:Node controller - responsible for updating kubernetes nodes using cloud APIs and deleting kubernetes nodes that were deleted on your cloud.Service controller - responsible for loadbalancers on your cloud against services of type LoadBalancer.Route controller - responsible for setting up network routes on your cloudany other features you would like to implement if you are running an out-of-tree provider.ExamplesIf you are using a cloud that is currently supported in Kubernetes core and would like to adopt cloud controller manager, see the cloud controller manager in kubernetes core.For cloud controller managers not in Kubernetes core, you can find the respective projects in repositories maintained by cloud vendors or by SIGs.For providers already in Kubernetes core, you can run the in-tree cloud controller manager as a DaemonSet in your cluster, use the following as a guideline:admin/cloud/ccm-example.yaml # This is an example of how to set up cloud-controlle", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/", "id": "k8s_00014"}
{"instruction": "Write a yaml example for cloud controller manager administration", "response": "Here's a yaml example:\n\n```yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\nCloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/", "id": "k8s_00014_code_117"}
{"instruction": "Write a yaml example for cloud controller manager administration", "response": "Here's a yaml example:\n\n```yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\nCloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/", "id": "k8s_00014_code_118"}
{"instruction": "Write a yaml example for cloud controller manager administration", "response": "Here's a yaml example:\n\n```yaml\nadmin/cloud/ccm-example.yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\nCloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/", "id": "k8s_00014_code_119"}
{"instruction": "Write a yaml example for cloud controller manager administration", "response": "Here's a yaml example:\n\n```yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\nCloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/", "id": "k8s_00014_code_120"}
{"instruction": "How do you declare network policy in Kubernetes?", "response": "Declare Network PolicyThis document helps you get started using the Kubernetes NetworkPolicy API to declare network policies that govern how pods communicate with each other.Note: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.8.To check the version, enter kubectl version.Make sure you've configured a network provider with network policy support. There are a number of network providers that support NetworkPolicy, including:AntreaCalicoCiliumKube-routerRomanaWeave NetCreate an nginx deployment and expose it via a serviceTo see how Kubernetes network policy works, start off by creating an nginx Deployment.kubectl create deployment nginx --image=nginx deployment.apps/nginx created Expose the Deployment through a Service called nginx.kubectl expose deployment nginx --port=80 service/nginx exposed The above commands create a Deployment with an nginx Pod and expose the Deployment through a Service named nginx. The nginx Pod and Deployment are found in the default namespace.kubectl get svc,pod NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes 10.100.0.1 <none> 443/TCP 46m service/nginx 10.100.0.16 <none> 80/TCP 33s NAME READY STATUS RESTARTS AGE pod/nginx-701339712-e0qfq 1/1 Running 0 35s Test the service by accessing it from another PodYou should be able to access the new nginx service from other Pods. To access the nginx Service from another Pod in the default namespace, start a busybox container:kubectl run busybox --rm -ti --image=busybox -- /bin/sh In your shell, run the following command:wget --spider --timeout=1 nginx Connecting to nginx (10.100.0.16:80) remote file exists Limit access to the nginx serviceTo limit the access to the nginx service so that only Pods with the label access: true can query it, create a NetworkPolicy object as follows:service/networking/nginx-policy.yaml apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: access-nginx spec: podSelector: matchLabels: app: nginx ingress: - from: - podSelector: matchLabels: access: \"true\" The name of a NetworkPolicy object must be a valid DNS subdomain name.Note:NetworkPolicy includes a podSelector which selects the grouping of Pods to which the policy applies. You can see this policy selects Pods with the label app=nginx. The label was automatically added to the Pod in the nginx Deployment. An empty podSelector selects all pods in the namespace.Assign the policy to the serviceUse kubectl to create a NetworkPolicy from the above nginx-policy.yaml file:kubectl apply -f https://k8s.io/examples/service/networking/nginx-policy.yaml networkpolicy.networking.k8s.io/access-nginx created Test access to the service when access label is not definedWhen you attempt to access the nginx Service from a Pod without the correct labels, the request times out:kubectl run busybox --rm -ti --image=busybox -- /bin/sh In your shell, run the command:wget --spider --timeout=1 nginx Connecting to nginx (10.100.0.16:80) wget: download timed out Define access label and test againYou can create a Pod with the correct labels to see that the request is allowed:kubectl run busybox --rm -ti --labels=\"access=true\" --image=busybox -- /bin/sh In your shell, run the command:wget --spider --timeout=1 nginx Connecting to nginx (10.100.0.16:80) remot", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx\n```\n\nDeclare Network Policy | Expose the Deployment through a Service called nginx.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_122"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80\n```\n\nDeclare Network Policy | The above commands create a Deployment with an nginx Pod and expose the Deployment through a Service named nginx. The nginx Pod and Deployment are found in the default namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_123"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\nDeclare Network Policy | In your shell, run the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_124"}
{"instruction": "Write a yaml example for declare network policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\nDeclare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_125"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/nginx-policy.yaml\n```\n\nDeclare Network Policy | When you attempt to access the nginx Service from a Pod without the correct labels, the request times out:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_126"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\nDeclare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_127"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --labels=\"access=true\" --image=busybox -- /bin/sh\n```\n\nDeclare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_128"}
{"instruction": "Write a yaml example for declare network policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\nDeclare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_129"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx\n```\n\nDeclare Network Policy | Expose the Deployment through a Service called nginx.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_130"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80\n```\n\nDeclare Network Policy | The above commands create a Deployment with an nginx Pod and expose the Deployment through a Service named nginx. The nginx Pod and Deployment are found in the default namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_131"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\nDeclare Network Policy | In your shell, run the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_132"}
{"instruction": "Write a yaml example for declare network policy", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/nginx-policy.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\nDeclare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_133"}
{"instruction": "Write a yaml example for declare network policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\nDeclare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_134"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/nginx-policy.yaml\n```\n\nDeclare Network Policy | When you attempt to access the nginx Service from a Pod without the correct labels, the request times out:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_135"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\nDeclare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_136"}
{"instruction": "Write a bash example for declare network policy", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --labels=\"access=true\" --image=busybox -- /bin/sh\n```\n\nDeclare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/", "id": "k8s_00015_code_137"}
{"instruction": "What is the reference documentation for kubectl quick reference?", "response": "kubectl Quick ReferenceThis page contains a list of commonly used kubectl commands and flags.Note:These instructions are for Kubernetes v1.34. To check the version, use the kubectl version command.Kubectl autocompleteBASHsource <(kubectl completion bash) # set up autocomplete in bash into the current shell, bash-completion package should be installed first. echo \"source <(kubectl completion bash)\" >> ~/.bashrc # add autocomplete permanently to your bash shell. You can also use a shorthand alias for kubectl that also works with completion:alias k=kubectl complete -o default -F __start_kubectl k ZSHsource <(kubectl completion zsh) # set up autocomplete in zsh into the current shell echo '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell FISHNote:Requires kubectl version 1.23 or above.echo 'kubectl completion fish | source' > ~/.config/fish/completions/kubectl.fish && source ~/.config/fish/completions/kubectl.fish A note on --all-namespacesAppending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:kubectl -AKubectl context and configurationSet which Kubernetes cluster kubectl communicates with and modifies configuration information. See Authenticating Across Clusters with kubeconfig documentation for detailed config file information.kubectl config view # Show Merged kubeconfig settings. # use multiple kubeconfig files at the same time and view merged config KUBECONFIG=~/.kube/config:~/.kube/kubconfig2 kubectl config view # Show merged kubeconfig settings and raw certificate data and exposed secrets kubectl config view --raw # get the password for the e2e user kubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}' # get the certificate for the e2e user kubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d kubectl config view -o jsonpath='{.users[].name}' # display the first user kubectl config view -o jsonpath='{.users[*].name}' # get a list of users kubectl config get-contexts # display list of contexts kubectl config get-contexts -o name # get all context names kubectl config current-context # display the current-context kubectl config use-context my-cluster-name # set the default context to my-cluster-name kubectl config set-cluster my-cluster-name # set a cluster entry in the kubeconfig # configure the URL to a proxy server to use for requests made by this client in the kubeconfig kubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url # add a new user to your kubeconf that supports basic auth kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword # permanently save the namespace for all subsequent kubectl commands in that context. kubectl config set-context --current --namespace=ggckad-s2 # set a context utilizing a specific username and namespace. kubectl config set-context gce --user=cluster-admin --namespace=foo \\ && kubectl config use-context gce kubectl config unset users.foo # delete user foo # short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace) alias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f' alias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f' Kubectl applyapply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes applications on production. See Kubectl Book.Creating objectsKubernetes manifests can be defined in YAML or JSON. The file extension .yaml, .yml, and .json can be used.kubectl apply -f ./my-manifest.yaml # create resource(s) kubectl apply -f ./my1.yaml -f ./my2", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\nkubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_139"}
{"instruction": "Write a yaml example for kubectl quick reference", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_140"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_141"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_142"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_143"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_144"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_145"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_146"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_147"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_148"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\nkubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_149"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\nkubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_150"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nsource <(kubectl completion bash) # set up autocomplete in bash into the current shell, bash-completion package should be installed first.\necho \"source <(kubectl completion bash)\" >> ~/.bashrc # add autocomplete permanently to your bash shell.\n```\n\nkubectl Quick Reference | You can also use a shorthand alias for kubectl that also works with completion:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_151"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nalias k=kubectl\ncomplete -o default -F __start_kubectl k\n```\n\nkubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_152"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nsource <(kubectl completion zsh)  # set up autocomplete in zsh into the current shell\necho '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell\n```\n\nkubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_153"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\necho 'kubectl completion fish | source' > ~/.config/fish/completions/kubectl.fish && source ~/.config/fish/completions/kubectl.fish\n```\n\nkubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_154"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\nkubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_155"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_156"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\n# Get commands with basic output\nkubectl get services                          # List all services in the namespace\nkubectl get pods --all-namespaces             # List all pods in all namespaces\nkubectl get pods -o wide                      # List all pods in the current namespace, with more details\nkubectl get deployment my-dep                 # List a particular deployment\nkubectl get pods                              # List all pods in the namespace\nkubectl get pod my-pod -o yaml                # Get a pod's YAML\n\n# Describe commands with verbose output\nkubectl describe nodes my-node\nkubectl describe pods my-pod\n\n# List Services Sorted by Name\nkubectl get services --sort-by=.metadata.name\n\n# List pods Sorted by Restart Count\nkubectl get pods --sort-by='.status.containerStatuses[0].restartCount'\n\n# List PersistentVolumes sorted by capacity\nkubectl get pv --sort-by=.spec.capacity.storage\n\n# Get the version label of all pods with label app=cassandra\nkubectl get pods --selector=app=cassandra -o \\\n  jsonpath='{.items[*].metadata.labels.version}'\n\n# Retrieve the value of a key with dots, e.g. 'ca.crt'\nkubectl get configmap myconfig \\\n  -o jsonpath='{.data.ca\\.crt}'\n\n# Retrieve a base64 encoded value with dashes instead of underscores.\nkubectl get secret my-secret --template='{{index .data \"key-name-with-dashes\"}}'\n\n# Get all worker nodes (use a selector to exclude results that have a label\n# named 'node-role.kubernetes.io/control-plane')\nkubectl get node --selector='!node-role.kubernetes.io/control-plane'\n\n# Get all running pods in the namespace\nkubectl get pods --field-selector=status.phase=Running\n\n# Get ExternalIPs of all nodes\nkubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type==\"ExternalIP\")].address}'\n\n# List Names of Pods that belong to Particular RC\n# \"jq\" command useful for transformations that are too complex for jsonpath, it can be found at https://jqlang.github.io/jq/\nsel=${$(kubectl get rc my-rc --output=json | jq -j '.spec.selector | to_entries | .[] | \"\\(.key)=\\(.value),\"')%?}\necho $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name})\n\n# Show labels for all pods (or any other Kubernetes object that supports labelling)\nkubectl get pods --show-labels\n\n# Check which nodes are ready\nJSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \\\n && kubectl get nodes -o jsonpath=\"$JSONPATH\" | grep \"Ready=True\"\n\n# Check which nodes are ready with custom-columns\nkubectl get node -o custom-columns='NODE_NAME:.metadata.name,STATUS:.status.conditions[?(@.type==\"Ready\")].status'\n\n# Output decoded secrets without external tools\nkubectl get secret my-secret -o go-template='{{range $k,$v := .data}}{{\"### \"}}{{$k}}{{\"\\n\"}}{{$v|base64decode}}{{\"\\n\\n\"}}{{end}}'\n\n# List all Secrets currently in use by a pod\nkubectl get pods -o json | jq '.items[].spec.containers[].env[]?.valueFrom.secretKeyRef.name' | grep -v null | sort | uniq\n\n# List all containerIDs of initContainer of all pods\n# Helpful when cleaning up stopped containers, while avoiding removal of initContainers.\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*].status.initContainerStatuses[*]}{.containerID}{\"\\n\"}{end}' | cut -d/ -f3\n\n# List Events sorted by timestamp\nkubectl get events --sort-by=.metadata.creationTimestamp\n\n# List all warning events\nkubectl events --types=Warning\n\n# Compares the current state of the cluster against the state that the cluster would be in if the manifest was applied.\nkubectl diff -f ./my-manifest.yaml\n\n# Produce a period-delimited tree of all keys returned for nodes\n# Helpful when locating a key within a complex nested JSON structure\nkubectl get nodes -o json | jq -c 'paths|join(\".\")'\n\n# Produce a period-delimited tree of all keys returned for pods, etc\nkubectl get pods -o json | jq -c 'paths|join(\".\")'\n\n# Produce ENV for all pods, assuming you have a default container for the pods, default namespace and the `env` command is supported.\n# Helpful when running any supported command across all pods, not just `env`\nfor pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod -- env; done\n\n# Get a deployment's status subresource\nkubectl get deployment nginx-deployment --subresource=status\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_157"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_158"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\n# Partially update a node\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n\n# Update a container's image; spec.containers[*].name is required because it's a merge key\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n\n# Update a container's image using a json patch with positional arrays\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n\n# Disable a deployment livenessProbe using a json patch with positional arrays\nkubectl patch deployment valid-deployment  --type json   -p='[{\"op\": \"remove\", \"path\": \"/spec/template/spec/containers/0/livenessProbe\"}]'\n\n# Add a new element to a positional array\nkubectl patch sa default --type='json' -p='[{\"op\": \"add\", \"path\": \"/secrets/1\", \"value\": {\"name\": \"whatever\" } }]'\n\n# Update a deployment's replica count by patching its scale subresource\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":2}}'\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_159"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_160"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_161"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_162"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_163"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_164"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\ntar cf - /tmp/foo | kubectl exec -i -n my-namespace my-pod -- tar xf - -C /tmp/bar           # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl exec -n my-namespace my-pod -- tar cf - /tmp/foo | tar xf - -C /tmp/bar    # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_165"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_166"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_167"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\nkubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_168"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\nkubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_169"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\n# All images running in a cluster\nkubectl get pods -A -o=custom-columns='DATA:spec.containers[*].image'\n\n# All images running in namespace: default, grouped by Pod\nkubectl get pods --namespace default --output=custom-columns=\"NAME:.metadata.name,IMAGE:.spec.containers[*].image\"\n\n # All images excluding \"registry.k8s.io/coredns:1.6.2\"\nkubectl get pods -A -o=custom-columns='DATA:spec.containers[?(@.image!=\"registry.k8s.io/coredns:1.6.2\")].image'\n\n# All fields under metadata regardless of name\nkubectl get pods -A -o=custom-columns='DATA:metadata.*'\n```\n\nkubectl Quick Reference | More examples in the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_170"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\nkubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_171"}
{"instruction": "Write a yaml example for kubectl quick reference", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_172"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\nkubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_173"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_174"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_175"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_176"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_177"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_178"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_179"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\nkubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_180"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\nkubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_181"}
{"instruction": "Write a bash example for kubectl quick reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\nkubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/quick-reference/", "id": "k8s_00016_code_182"}
{"instruction": "Explain the Kubernetes concept: EndpointSlices", "response": "EndpointSlicesThe EndpointSlice API is the mechanism that Kubernetes uses to let your Service scale to handle large numbers of backends, and allows the cluster to update its list of healthy backends efficiently.FEATURE STATE: Kubernetes v1.21 [stable]Kubernetes' EndpointSlice API provides a way to track network endpoints within a Kubernetes cluster.EndpointSlice APIIn Kubernetes, an EndpointSlice contains references to a set of network endpoints. The control plane automatically creates EndpointSlices for any Kubernetes Service that has a selector specified. These EndpointSlices include references to all the Pods that match the Service selector. EndpointSlices group network endpoints together by unique combinations of IP family, protocol, port number, and Service name. The name of a EndpointSlice object must be a valid DNS subdomain name.As an example, here's a sample EndpointSlice object, that's owned by the example Kubernetes Service.apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: example-abc labels: kubernetes.io/service-name: example addressType: IPv4 ports: - name: http protocol: TCP port: 80 endpoints: - addresses: - \"10.1.2.3\" conditions: ready: true hostname: pod-1 nodeName: node-1 zone: us-west2-a By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to a maximum of 1000.EndpointSlices act as the source of truth for kube-proxy when it comes to how to route internal traffic.Address typesEndpointSlices support two address types:IPv4IPv6Each EndpointSlice object represents a specific IP address type. If you have a Service that is available via IPv4 and IPv6, there will be at least two EndpointSlice objects (one for IPv4, and one for IPv6).ConditionsThe EndpointSlice API stores conditions about endpoints that may be useful for consumers. The three conditions are serving, terminating, and ready.ServingFEATURE STATE: Kubernetes v1.26 [stable]The serving condition indicates that the endpoint is currently serving responses, and so it should be used as a target for Service traffic. For endpoints backed by a Pod, this maps to the Pod's Ready condition.TerminatingFEATURE STATE: Kubernetes v1.26 [stable]The terminating condition indicates that the endpoint is terminating. For endpoints backed by a Pod, this condition is set when the Pod is first deleted (that is, when it receives a deletion timestamp, but most likely before the Pod's containers exit).Service proxies will normally ignore endpoints that are terminating, but they may route traffic to endpoints that are both serving and terminating if all available endpoints are terminating. (This helps to ensure that no Service traffic is lost during rolling updates of the underlying Pods.)ReadyThe ready condition is essentially a shortcut for checking \"serving and not terminating\" (though it will also always be true for Services with spec.publishNotReadyAddresses set to true).Topology informationEach endpoint within an EndpointSlice can contain relevant topology information. The topology information includes the location of the endpoint and information about the corresponding Node and zone. These are available in the following per endpoint fields on EndpointSlices:nodeName - The name of the Node this endpoint is on.zone - The zone this endpoint is in.ManagementMost often, the control plane (specifically, the endpoint slice controller) creates and manages EndpointSlice objects. There are a variety of other use cases for EndpointSlices, such as service mesh implementations, that could result in other entities or controllers managing additional sets of EndpointSlices.To ensure that multiple entities can manage EndpointSlices without interfering with each other, Kubernetes defines the label endpointslice.kubernetes.io/managed-by, which indicates the entity managing an EndpointSlice. The endpoint slice controller sets endpoints", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/", "id": "k8s_00017"}
{"instruction": "Write a yaml example for endpointslices", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\nEndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/", "id": "k8s_00017_code_184"}
{"instruction": "Write a yaml example for endpointslices", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\nEndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/", "id": "k8s_00017_code_185"}
{"instruction": "Write a yaml example for endpointslices", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\nEndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/", "id": "k8s_00017_code_186"}
{"instruction": "What is the reference documentation for scheduling policies?", "response": "Scheduling PoliciesIn Kubernetes versions before v1.23, a scheduling policy can be used to specify the predicates and priorities process. For example, you can set a scheduling policy by running kube-scheduler --policy-config-file <filename> or kube-scheduler --policy-configmap <ConfigMap>.This scheduling policy is not supported since Kubernetes v1.23. Associated flags policy-config-file, policy-configmap, policy-configmap-namespace and use-legacy-policy-config are also not supported. Instead, use the Scheduler Configuration to achieve similar behavior.What's nextLearn about schedulingLearn about kube-scheduler ConfigurationRead the kube-scheduler configuration reference (v1)", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/scheduling/policies/", "id": "k8s_00018"}
{"instruction": "Explain the Kubernetes concept: System Logs", "response": "System LogsSystem component logs record events happening in cluster, which can be very useful for debugging. You can configure log verbosity to see more or less detail. Logs can be as coarse-grained as showing errors within a component, or as fine-grained as showing step-by-step traces of events (like HTTP access logs, pod state changes, controller actions, or scheduler decisions).Warning:In contrast to the command line flags described here, the log output itself does not fall under the Kubernetes API stability guarantees: individual log entries and their formatting may change from one release to the next!Klogklog is the Kubernetes logging library. klog generates log messages for the Kubernetes system components.Kubernetes is in the process of simplifying logging in its components. The following klog command line flags are deprecated starting with Kubernetes v1.23 and removed in Kubernetes v1.26:--add-dir-header--alsologtostderr--log-backtrace-at--log-dir--log-file--log-file-max-size--logtostderr--one-output--skip-headers--skip-log-headers--stderrthresholdOutput will always be written to stderr, regardless of the output format. Output redirection is expected to be handled by the component which invokes a Kubernetes component. This can be a POSIX shell or a tool like systemd.In some cases, for example a distroless container or a Windows system service, those options are not available. Then the kube-log-runner binary can be used as wrapper around a Kubernetes component to redirect output. A prebuilt binary is included in several Kubernetes base images under its traditional name as /go-runner and as kube-log-runner in server and node release archives.This table shows how kube-log-runner invocations correspond to shell redirection:UsagePOSIX shell (such as bash)kube-log-runner <options> <cmd>Merge stderr and stdout, write to stdout2>&1kube-log-runner (default behavior)Redirect both into log file1>>/tmp/log 2>&1kube-log-runner -log-file=/tmp/logCopy into log file and to stdout2>&1 | tee -a /tmp/logkube-log-runner -log-file=/tmp/log -also-stdoutRedirect only stdout into log file>/tmp/logkube-log-runner -log-file=/tmp/log -redirect-stderr=falseKlog outputAn example of the traditional klog native format:I1025 00:15:15.525108 1 httplog.go:79] GET /api/v1/namespaces/kube-system/pods/metrics-server-v0.3.1-57c75779f-9p8wg: (1.512ms) 200 [pod_nanny/v0.0.0 (linux/amd64) kubernetes/$Format 10.56.1.19:51756] The message string may contain line breaks:I1025 00:15:15.525108 1 example.go:79] This is a message which has a line break. Structured LoggingFEATURE STATE: Kubernetes v1.23 [beta]Warning:Migration to structured log messages is an ongoing process. Not all log messages are structured in this version. When parsing log files, you must also handle unstructured log messages.Log formatting and value serialization are subject to change.Structured logging introduces a uniform structure in log messages allowing for programmatic extraction of information. You can store and process structured logs with less effort and cost. The code which generates a log message determines whether it uses the traditional unstructured klog output or structured logging.The default formatting of structured log messages is as text, with a format that is backward compatible with traditional klog:<klog header> \"<message>\" <key1>=\"<value1>\" <key2>=\"<value2>\" ... Example:I1025 00:15:15.525108 1 controller_utils.go:116] \"Pod status updated\" pod=\"kube-system/kubedns\" status=\"ready\" Strings are quoted. Other values are formatted with %+v, which may cause log messages to continue on the next line depending on the data.I1025 00:15:15.525108 1 example.go:116] \"Example\" data=\"This is text with a line break\\nand \\\"quotation marks\\\".\" someInt=1 someFloat=0.1 someStruct={StringField: First line, second line.} Contextual LoggingFEATURE STATE: Kubernetes v1.30 [beta]Contextual logging builds on top of structured logging. It is primarily about how developers use logging calls: code base", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-logs/", "id": "k8s_00019"}
{"instruction": "Write a bash example for system logs", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/<insert-node-name-here>/proxy/logs/?query=/<insert-log-file-name-here>\"\n```\n\nSystem Logs | The kubelet uses heuristics to retrieve logs. This helps if you are not aware whether a given system service is writing logs to the operating system's native logger like journald or to a log file in /", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-logs/", "id": "k8s_00019_code_189"}
{"instruction": "Write a bash example for system logs", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/<insert-node-name-here>/proxy/logs/?query=/<insert-log-file-name-here>\"\n```\n\nSystem Logs | The kubelet uses heuristics to retrieve logs. This helps if you are not aware whether a given system service is writing logs to the operating system's native logger like journald or to a log file in /", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-logs/", "id": "k8s_00019_code_190"}
{"instruction": "Explain the Kubernetes concept: About cgroup v2", "response": "About cgroup v2On Linux, control groups constrain resources that are allocated to processes.The kubelet and the underlying container runtime need to interface with cgroups to enforce resource management for pods and containers which includes cpu/memory requests and limits for containerized workloads.There are two versions of cgroups in Linux: cgroup v1 and cgroup v2. cgroup v2 is the new generation of the cgroup API.What is cgroup v2?FEATURE STATE: Kubernetes v1.25 [stable]cgroup v2 is the next version of the Linux cgroup API. cgroup v2 provides a unified control system with enhanced resource management capabilities.cgroup v2 offers several improvements over cgroup v1, such as the following:Single unified hierarchy design in APISafer sub-tree delegation to containersNewer features like Pressure Stall InformationEnhanced resource allocation management and isolation across multiple resourcesUnified accounting for different types of memory allocations (network memory, kernel memory, etc)Accounting for non-immediate resource changes such as page cache write backsSome Kubernetes features exclusively use cgroup v2 for enhanced resource management and isolation. For example, the MemoryQoS feature improves memory QoS and relies on cgroup v2 primitives.Using cgroup v2The recommended way to use cgroup v2 is to use a Linux distribution that enables and uses cgroup v2 by default.To check if your distribution uses cgroup v2, refer to Identify cgroup version on Linux nodes.Requirementscgroup v2 has the following requirements:OS distribution enables cgroup v2Linux Kernel version is 5.8 or laterContainer runtime supports cgroup v2. For example:containerd v1.4 and latercri-o v1.20 and laterThe kubelet and the container runtime are configured to use the systemd cgroup driverLinux Distribution cgroup v2 supportFor a list of Linux distributions that use cgroup v2, refer to the cgroup v2 documentationContainer Optimized OS (since M97)Ubuntu (since 21.10, 22.04+ recommended)Debian GNU/Linux (since Debian 11 bullseye)Fedora (since 31)Arch Linux (since April 2021)RHEL and RHEL-like distributions (since 9)To check if your distribution is using cgroup v2, refer to your distribution's documentation or follow the instructions in Identify the cgroup version on Linux nodes.You can also enable cgroup v2 manually on your Linux distribution by modifying the kernel cmdline boot arguments. If your distribution uses GRUB, systemd.unified_cgroup_hierarchy=1 should be added in GRUB_CMDLINE_LINUX under /etc/default/grub, followed by sudo update-grub. However, the recommended approach is to use a distribution that already enables cgroup v2 by default.Migrating to cgroup v2To migrate to cgroup v2, ensure that you meet the requirements, then upgrade to a kernel version that enables cgroup v2 by default.The kubelet automatically detects that the OS is running on cgroup v2 and performs accordingly with no additional configuration required.There should not be any noticeable difference in the user experience when switching to cgroup v2, unless users are accessing the cgroup file system directly, either on the node or from within the containers.cgroup v2 uses a different API than cgroup v1, so if there are any applications that directly access the cgroup file system, they need to be updated to newer versions that support cgroup v2. For example:Some third-party monitoring and security agents may depend on the cgroup filesystem. Update these agents to versions that support cgroup v2.If you run cAdvisor as a stand-alone DaemonSet for monitoring pods and containers, update it to v0.43.0 or later.If you deploy Java applications, prefer to use versions which fully support cgroup v2:OpenJDK / HotSpot: jdk8u372, 11.0.16, 15 and laterIBM Semeru Runtimes: 8.0.382.0, 11.0.20.0, 17.0.8.0, and laterIBM Java: 8.0.8.6 and laterIf you are using the uber-go/automaxprocs package, make sure the version you use is v1.5.1 or higher.Identify the cgroup version on Linux NodesThe cgroup version d", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/cgroups/", "id": "k8s_00020"}
{"instruction": "Explain the Kubernetes concept: Managing Workloads", "response": "Managing WorkloadsYou've deployed your application and exposed it via a Service. Now what? Kubernetes provides a number of tools to help you manage your application deployment, including scaling and updating.Organizing resource configurationsMany applications require multiple resources to be created, such as a Deployment along with a Service. Management of multiple resources can be simplified by grouping them together in the same file (separated by --- in YAML). For example:application/nginx-app.yaml apiVersion: v1 kind: Service metadata: name: my-nginx-svc labels: app: nginx spec: type: LoadBalancer ports: - port: 80 selector: app: nginx --- apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Multiple resources can be created the same way as a single resource:kubectl apply -f https://k8s.io/examples/application/nginx-app.yaml service/my-nginx-svc created deployment.apps/my-nginx created The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the Service as they are created by the controller(s), such as Deployment.kubectl apply also accepts multiple -f arguments:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \\ -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same directory. If the tiers of your application bind to each other using DNS, you can deploy all of the components of your stack together.A URL can also be specified as a configuration source, which is handy for deploying directly from manifests in your source control system:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml deployment.apps/my-nginx created If you need to define more manifests, such as adding a ConfigMap, you can do that too.External toolsThis section lists only the most common tools used for managing workloads on Kubernetes. To see a larger list, view Application definition and image build in the CNCF Landscape.Helm🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationHelm is a tool for managing packages of pre-configured Kubernetes resources. These packages are known as Helm charts.KustomizeKustomize traverses a Kubernetes manifest to add, remove or update configuration options. It is available both as a standalone binary and as a native feature of kubectl.Bulk operations in kubectlResource creation isn't the only operation that kubectl can perform in bulk. It can also extract resource names from configuration files in order to perform other operations, in particular to delete the same resources you created:kubectl delete -f https://k8s.io/examples/application/nginx-app.yaml deployment.apps \"my-nginx\" deleted service \"my-nginx-svc\" deleted In the case of two resources, you can specify both resources on the command line using the resource/name syntax:kubectl delete deployments/my-nginx services/my-nginx-svc For larger numbers of resources, you'll find it easier to specify the selector (label query) specified using -l or --selector, to filter resources by their labels:kubectl delete deployment,services -l app=nginx deployment.apps \"my-nginx\" deleted service \"my-nginx-svc\" deleted Chaining and filteringBecause kubectl outputs resource names in the same syntax it accepts, you can chain operations using $() or xargs:kubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ ) kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ | xargs -i k", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021"}
{"instruction": "Write a yaml example for managing workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nManaging Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_193"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\nManaging Workloads | The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_194"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \\\n  -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\nManaging Workloads | It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same direct", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_195"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\nManaging Workloads | If you need to define more manifests, such as adding a ConfigMap, you can do that too.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_196"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\nManaging Workloads | In the case of two resources, you can specify both resources on the command line using the resource/name syntax:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_197"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/my-nginx services/my-nginx-svc\n```\n\nManaging Workloads | For larger numbers of resources, you'll find it easier to specify the selector (label query) specified using -l or --selector, to filter resources by their labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_198"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,services -l app=nginx\n```\n\nManaging Workloads | Because kubectl outputs resource names in the same syntax it accepts, you can chain operations using $() or xargs:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_199"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ )\nkubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ | xargs -i kubectl get '{}'\n```\n\nManaging Workloads | The output might be similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_200"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development\n```\n\nManaging Workloads | Instead, specify the --recursive or -R command line argument along with the --filename/-f argument:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_201"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development --recursive\n```\n\nManaging Workloads | The --recursive argument works with any operation that accepts the --filename/-f argument such as: kubectl create, kubectl get, kubectl delete, kubectl describe, or even kubectl rollout.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_202"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/namespaces -f project/k8s/development --recursive\n```\n\nManaging Workloads | If you're interested in learning more about kubectl, go ahead and read Command line tool (kubectl).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_203"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-nginx --image=nginx:1.14.2\n```\n\nManaging Workloads | Ensure that there is 1 replica:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_204"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas 1 deployments/my-nginx --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\": 1}}'\n```\n\nManaging Workloads | and allow Kubernetes to add more temporary replicas during a rollout, by setting a surge maximum of 100%:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_205"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch --type='merge' -p '{\"spec\":{\"strategy\":{\"rollingUpdate\":{\"maxSurge\": \"100%\" }}}}'\n```\n\nManaging Workloads | To update to version 1.16.1, change .spec.template.spec.containers[0].image from nginx:1.14.2 to nginx:1.16.1 using kubectl edit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_206"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n# Change the manifest to use the newer container image, then save your changes\n```\n\nManaging Workloads | That's it! The Deployment will declaratively update the deployed nginx application progressively behind the scene. It ensures that only a certain number of old replicas may be down while they are bein", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_207"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-deployment.yaml\n\n# wait for rollout to finish\nkubectl rollout status deployment/my-deployment --timeout 10m # 10 minute timeout\n```\n\nManaging Workloads | or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_208"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f backing-stateful-component.yaml\n\n# don't wait for rollout to finish, just check the status\nkubectl rollout status statefulsets/backing-stateful-component --watch=false\n```\n\nManaging Workloads | You can also pause, resume or cancel a rollout. Visit kubectl rollout to learn more.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_209"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods my-nginx-v4-9gw19 description='my frontend running nginx'\nkubectl get pods my-nginx-v4-9gw19 -o yaml\n```\n\nManaging Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_210"}
{"instruction": "Write a yaml example for managing workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: pod\nmetadata:\n  annotations:\n    description: my frontend running nginx\n...\n```\n\nManaging Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_211"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/my-nginx --replicas=1\n```\n\nManaging Workloads | Now you only have one pod managed by the deployment.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_212"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nManaging Workloads | To have the system automatically choose the number of nginx replicas as needed, ranging from 1 to 3, do:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_213"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\nManaging Workloads | To learn more about the underlying mechanism, read server-side apply.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_214"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n```\n\nManaging Workloads | This is equivalent to first get the resource, edit it in text editor, and then apply the resource with the updated version:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_215"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment my-nginx -o yaml > /tmp/nginx.yaml\nvi /tmp/nginx.yaml\n# do some edit, and then save the file\n\nkubectl apply -f /tmp/nginx.yaml\ndeployment.apps/my-nginx configured\n\nrm /tmp/nginx.yaml\n```\n\nManaging Workloads | This allows you to do more significant changes more easily. Note that you can specify the editor with your EDITOR or KUBE_EDITOR environment variables.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_216"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force\n```\n\nManaging Workloads | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_217"}
{"instruction": "Write a yaml example for managing workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nManaging Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_218"}
{"instruction": "Write a yaml example for managing workloads", "response": "Here's a yaml example:\n\n```yaml\nselector:\n   app: guestbook\n   tier: frontend\n```\n\nManaging Workloads | You can tweak the number of replicas of the stable and canary releases to determine the ratio of each release that will receive live production traffic (in this case, 3:1). Once you're confident, you", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_219"}
{"instruction": "Write a yaml example for managing workloads", "response": "Here's a yaml example:\n\n```yaml\napplication/nginx-app.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nManaging Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_220"}
{"instruction": "Write a yaml example for managing workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nManaging Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_221"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\nManaging Workloads | The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_222"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \\\n  -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\nManaging Workloads | It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same direct", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_223"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\nManaging Workloads | If you need to define more manifests, such as adding a ConfigMap, you can do that too.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_224"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\nManaging Workloads | In the case of two resources, you can specify both resources on the command line using the resource/name syntax:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_225"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/my-nginx services/my-nginx-svc\n```\n\nManaging Workloads | For larger numbers of resources, you'll find it easier to specify the selector (label query) specified using -l or --selector, to filter resources by their labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_226"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,services -l app=nginx\n```\n\nManaging Workloads | Because kubectl outputs resource names in the same syntax it accepts, you can chain operations using $() or xargs:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_227"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ )\nkubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ | xargs -i kubectl get '{}'\n```\n\nManaging Workloads | The output might be similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_228"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development\n```\n\nManaging Workloads | Instead, specify the --recursive or -R command line argument along with the --filename/-f argument:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_229"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development --recursive\n```\n\nManaging Workloads | The --recursive argument works with any operation that accepts the --filename/-f argument such as: kubectl create, kubectl get, kubectl delete, kubectl describe, or even kubectl rollout.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_230"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/namespaces -f project/k8s/development --recursive\n```\n\nManaging Workloads | If you're interested in learning more about kubectl, go ahead and read Command line tool (kubectl).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_231"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-nginx --image=nginx:1.14.2\n```\n\nManaging Workloads | Ensure that there is 1 replica:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_232"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas 1 deployments/my-nginx --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\": 1}}'\n```\n\nManaging Workloads | and allow Kubernetes to add more temporary replicas during a rollout, by setting a surge maximum of 100%:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_233"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch --type='merge' -p '{\"spec\":{\"strategy\":{\"rollingUpdate\":{\"maxSurge\": \"100%\" }}}}'\n```\n\nManaging Workloads | To update to version 1.16.1, change .spec.template.spec.containers[0].image from nginx:1.14.2 to nginx:1.16.1 using kubectl edit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_234"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n# Change the manifest to use the newer container image, then save your changes\n```\n\nManaging Workloads | That's it! The Deployment will declaratively update the deployed nginx application progressively behind the scene. It ensures that only a certain number of old replicas may be down while they are bein", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_235"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-deployment.yaml\n\n# wait for rollout to finish\nkubectl rollout status deployment/my-deployment --timeout 10m # 10 minute timeout\n```\n\nManaging Workloads | or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_236"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f backing-stateful-component.yaml\n\n# don't wait for rollout to finish, just check the status\nkubectl rollout status statefulsets/backing-stateful-component --watch=false\n```\n\nManaging Workloads | You can also pause, resume or cancel a rollout. Visit kubectl rollout to learn more.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_237"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods my-nginx-v4-9gw19 description='my frontend running nginx'\nkubectl get pods my-nginx-v4-9gw19 -o yaml\n```\n\nManaging Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_238"}
{"instruction": "Write a yaml example for managing workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: pod\nmetadata:\n  annotations:\n    description: my frontend running nginx\n...\n```\n\nManaging Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_239"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/my-nginx --replicas=1\n```\n\nManaging Workloads | Now you only have one pod managed by the deployment.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_240"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nManaging Workloads | To have the system automatically choose the number of nginx replicas as needed, ranging from 1 to 3, do:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_241"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\nManaging Workloads | To learn more about the underlying mechanism, read server-side apply.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_242"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n```\n\nManaging Workloads | This is equivalent to first get the resource, edit it in text editor, and then apply the resource with the updated version:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_243"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment my-nginx -o yaml > /tmp/nginx.yaml\nvi /tmp/nginx.yaml\n# do some edit, and then save the file\n\nkubectl apply -f /tmp/nginx.yaml\ndeployment.apps/my-nginx configured\n\nrm /tmp/nginx.yaml\n```\n\nManaging Workloads | This allows you to do more significant changes more easily. Note that you can specify the editor with your EDITOR or KUBE_EDITOR environment variables.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_244"}
{"instruction": "Write a bash example for managing workloads", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force\n```\n\nManaging Workloads | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/management/", "id": "k8s_00021_code_245"}
{"instruction": "What is the reference documentation for kubectl config set?", "response": "kubectl config setSynopsisSet an individual value in a kubeconfig file.PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.PROPERTY_VALUE is the new value you want to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used.Specifying an attribute name that already exists will merge new fields on top of existing values.kubectl config set PROPERTY_NAME PROPERTY_VALUE Examples # Set the server field on the my-cluster cluster to https://1.2.3.4 kubectl config set clusters.my-cluster.server https://1.2.3.4 # Set the certificate-authority-data field on the my-cluster cluster kubectl config set clusters.my-cluster.certificate-authority-data $(echo \"cert_data_here\" | base64 -i -) # Set the cluster field in the my-context context to my-cluster kubectl config set contexts.my-context.cluster my-cluster # Set the client-key-data field in the cluster-admin user using --set-raw-bytes option kubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true Options-h, --helphelp for set--set-raw-bytes tristate[=true]When writing a []byte PROPERTY_VALUE, write the given string directly without base64 decoding.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic auth", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set/", "id": "k8s_00022"}
{"instruction": "Write a bash example for kubectl config set", "response": "Here's a bash example:\n\n```bash\nkubectl config set PROPERTY_NAME PROPERTY_VALUE\n```\n\nkubectl config set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set/", "id": "k8s_00022_code_247"}
{"instruction": "Write a bash example for kubectl config set", "response": "Here's a bash example:\n\n```bash\nkubectl config set PROPERTY_NAME PROPERTY_VALUE\n```\n\nkubectl config set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set/", "id": "k8s_00022_code_248"}
{"instruction": "What is the reference documentation for kubeadm token?", "response": "kubeadm tokenBootstrap tokens are used for establishing bidirectional trust between a node joining the cluster and a control-plane node, as described in authenticating with bootstrap tokens.kubeadm init creates an initial token with a 24-hour TTL. The following commands allow you to manage such a token and also to create and manage new ones.kubeadm token createCreate bootstrap tokens on the serverSynopsisThis command will create a bootstrap token for you. You can specify the usages for this token, the \"time to live\" and an optional human friendly description.The [token] is the actual token to write. This should be a securely generated random token of the form \"[a-z0-9]{6}.[a-z0-9]{16}\". If no [token] is given, kubeadm will generate a random token instead.kubeadm token create [token] Options--certificate-key stringWhen used together with '--print-join-command', print the full 'kubeadm join' flag needed to join the cluster as a control-plane. To create a new certificate key you must use 'kubeadm init phase upload-certs --upload-certs'.--config stringPath to a kubeadm configuration file.--description stringA human friendly description of how this token is used.--groups strings Default: \"system:bootstrappers:kubeadm:default-node-token\"Extra groups that this token will authenticate as when used for authentication. Must match \"\\Asystem:bootstrappers:[a-z0-9:-]{0,255}[a-z0-9]\\z\"-h, --helphelp for create--print-join-commandInstead of printing only the token, print the full 'kubeadm join' flag needed to join the cluster using the token.--ttl duration Default: 24h0m0sThe duration before the token is automatically deleted (e.g. 1s, 2m, 3h). If set to '0', the token will never expire--usages strings Default: \"signing,authentication\"Describes the ways in which this token can be used. You can pass --usages multiple times or provide a comma separated list of options. Valid options: [signing,authentication]Options inherited from parent commands--dry-runWhether to enable dry-run mode or not--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm token deleteDelete bootstrap tokens on the serverSynopsisThis command will delete a list of bootstrap tokens for you.The [token-value] is the full Token of the form \"[a-z0-9]{6}.[a-z0-9]{16}\" or the Token ID of the form \"[a-z0-9]{6}\" to delete.kubeadm token delete [token-value] ... Options-h, --helphelp for deleteOptions inherited from parent commands--dry-runWhether to enable dry-run mode or not--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm token generateGenerate and print a bootstrap token, but do not create it on the serverSynopsisThis command will print out a randomly-generated bootstrap token that can be used with the \"init\" and \"join\" commands.You don't have to use this command in order to generate a token. You can do so yourself as long as it is in the format \"[a-z0-9]{6}.[a-z0-9]{16}\". This command is provided for convenience to generate tokens in the given format.You can also use \"kubeadm init\" without specifying a token and it will generate and print one for you.kubeadm token generate [flags] Options-h, --helphelp for generateOptions inherited from parent commands--dry-runWhether to enable dry-run mode or not--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--rootfs strin", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-token/", "id": "k8s_00023"}
{"instruction": "What is the reference documentation for kubeadm upgrade?", "response": "kubeadm upgradekubeadm upgrade is a user-friendly command that wraps complex upgrading logic behind one command, with support for both planning an upgrade and actually performing it.kubeadm upgrade guidanceThe steps for performing an upgrade using kubeadm are outlined in this document. For older versions of kubeadm, please refer to older documentation sets of the Kubernetes website.You can use kubeadm upgrade diff to see the changes that would be applied to static pod manifests.In Kubernetes v1.15.0 and later, kubeadm upgrade apply and kubeadm upgrade node will also automatically renew the kubeadm managed certificates on this node, including those stored in kubeconfig files. To opt-out, it is possible to pass the flag --certificate-renewal=false. For more details about certificate renewal see the certificate management documentation.Note:The commands kubeadm upgrade apply and kubeadm upgrade plan have a legacy --config flag which makes it possible to reconfigure the cluster, while performing planning or upgrade of that particular control-plane node. Please be aware that the upgrade workflow was not designed for this scenario and there are reports of unexpected results.kubeadm upgrade planSynopsisCheck which versions are available to upgrade to and validate whether your current cluster is upgradeable. This command can only run on the control plane nodes where the kubeconfig file \"admin.conf\" exists. To skip the internet check, pass in the optional [version] parameter.kubeadm upgrade plan [version] [flags] Options--allow-experimental-upgradesShow unstable versions of Kubernetes as an upgrade alternative and allow upgrading to an alpha/beta/release candidate versions of Kubernetes.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--allow-release-candidate-upgradesShow release candidate versions of Kubernetes as an upgrade alternative and allow upgrading to a release candidate versions of Kubernetes.--config stringPath to a kubeadm configuration file.--etcd-upgrade Default: truePerform the upgrade of etcd.-h, --helphelp for plan--ignore-preflight-errors stringsA list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.-o, --output string Default: \"text\"Output format. One of: text|json|yaml|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file.--print-configSpecifies whether the configuration file that will be used in the upgrade should be printed or not.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm upgrade applySynopsisUpgrade your Kubernetes cluster to the specified versionThe \"apply [version]\" command executes the following phases:preflight Run preflight checks before upgrade control-plane Upgrade the control plane upload-config Upload the kubeadm and kubelet configurations to ConfigMaps /kubeadm Upload the kubeadm ClusterConfiguration to a ConfigMap /kubelet Upload the kubelet configuration to a ConfigMap kubelet-config Upgrade the kubelet configuration for this node bootstrap-token Configures bootstrap token and cluster-info RBAC rules addon Upgrade the default kubeadm addons /coredns Upgrade the CoreDNS addon /kube-proxy Upgrade the kube-proxy addon post-upgrade Run post upgrade tasks kubeadm upgrade apply [version] Options--allow-experimental-upgradesShow unstable versions of Kubernetes as an upgrade alternative and allow upgrading to an alpha/beta/release candi", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-upgrade/", "id": "k8s_00024"}
{"instruction": "How do you administration with kubeadm in Kubernetes?", "response": "Administration with kubeadmIf you don't yet have a cluster, visit bootstrapping clusters with kubeadm.The tasks in this section are aimed at people administering an existing cluster:Adding Linux worker nodesAdding Windows worker nodesUpgrading kubeadm clustersUpgrading Linux nodesUpgrading Windows nodesConfiguring a cgroup driverCertificate Management with kubeadmReconfiguring a kubeadm clusterChanging The Kubernetes Package Repository", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/", "id": "k8s_00025"}
{"instruction": "How do you guaranteed scheduling for critical add-on pods in Kubernetes?", "response": "Guaranteed Scheduling For Critical Add-On PodsKubernetes core components such as the API server, scheduler, and controller-manager run on a control plane node. However, add-ons must run on a regular cluster node. Some of these add-ons are critical to a fully functional cluster, such as metrics-server, DNS, and UI. A cluster may stop working properly if a critical add-on is evicted (either manually or as a side effect of another operation like upgrade) and becomes pending (for example when the cluster is highly utilized and either there are other pending pods that schedule into the space vacated by the evicted critical add-on pod or the amount of resources available on the node changed for some other reason).Note that marking a pod as critical is not meant to prevent evictions entirely; it only prevents the pod from becoming permanently unavailable. A static pod marked as critical can't be evicted. However, non-static pods marked as critical are always rescheduled.Marking pod as criticalTo mark a Pod as critical, set priorityClassName for that Pod to system-cluster-critical or system-node-critical. system-node-critical is the highest available priority, even higher than system-cluster-critical.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/", "id": "k8s_00026"}
{"instruction": "How do you force delete statefulset pods in Kubernetes?", "response": "Force Delete StatefulSet PodsThis page shows how to delete Pods which are part of a stateful set, and explains the considerations to keep in mind when doing so.Before you beginThis is a fairly advanced task and has the potential to violate some of the properties inherent to StatefulSet.Before proceeding, make yourself familiar with the considerations enumerated below.StatefulSet considerationsIn normal operation of a StatefulSet, there is never a need to force delete a StatefulSet Pod. The StatefulSet controller is responsible for creating, scaling and deleting members of the StatefulSet. It tries to ensure that the specified number of Pods from ordinal 0 through N-1 are alive and ready. StatefulSet ensures that, at any time, there is at most one Pod with a given identity running in a cluster. This is referred to as at most one semantics provided by a StatefulSet.Manual force deletion should be undertaken with caution, as it has the potential to violate the at most one semantics inherent to StatefulSet. StatefulSets may be used to run distributed and clustered applications which have a need for a stable network identity and stable storage. These applications often have configuration which relies on an ensemble of a fixed number of members with fixed identities. Having multiple members with the same identity can be disastrous and may lead to data loss (e.g. split brain scenario in quorum-based systems).Delete PodsYou can perform a graceful pod deletion with the following command:kubectl delete pods <pod> For the above to lead to graceful termination, the Pod must not specify a pod.Spec.TerminationGracePeriodSeconds of 0. The practice of setting a pod.Spec.TerminationGracePeriodSeconds of 0 seconds is unsafe and strongly discouraged for StatefulSet Pods. Graceful deletion is safe and will ensure that the Pod shuts down gracefully before the kubelet deletes the name from the apiserver.A Pod is not deleted automatically when a node is unreachable. The Pods running on an unreachable Node enter the 'Terminating' or 'Unknown' state after a timeout. Pods may also enter these states when the user attempts graceful deletion of a Pod on an unreachable Node. The only ways in which a Pod in such a state can be removed from the apiserver are as follows:The Node object is deleted (either by you, or by the Node Controller).The kubelet on the unresponsive Node starts responding, kills the Pod and removes the entry from the apiserver.Force deletion of the Pod by the user.The recommended best practice is to use the first or second approach. If a Node is confirmed to be dead (e.g. permanently disconnected from the network, powered down, etc), then delete the Node object. If the Node is suffering from a network partition, then try to resolve this or wait for it to resolve. When the partition heals, the kubelet will complete the deletion of the Pod and free up its name in the apiserver.Normally, the system completes the deletion once the Pod is no longer running on a Node, or the Node is deleted by an administrator. You may override this by force deleting the Pod.Force DeletionForce deletions do not wait for confirmation from the kubelet that the Pod has been terminated. Irrespective of whether a force deletion is successful in killing a Pod, it will immediately free up the name from the apiserver. This would let the StatefulSet controller create a replacement Pod with that same identity; this can lead to the duplication of a still-running Pod, and if said Pod can still communicate with the other members of the StatefulSet, will violate the at most one semantics that StatefulSet is designed to guarantee.When you force delete a StatefulSet pod, you are asserting that the Pod in question will never again make contact with other Pods in the StatefulSet and its name can be safely freed up for a replacement to be created.If you want to delete a Pod forcibly using kubectl version >= 1.5, do the following:kubectl delete pods <pod> --grace-period=0 --force", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod>\n```\n\nForce Delete StatefulSet Pods | For the above to lead to graceful termination, the Pod must not specify a pod.Spec.TerminationGracePeriodSeconds of 0. The practice of setting a pod.Spec.TerminationGracePeriodSeconds of 0 seconds is", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_254"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0 --force\n```\n\nForce Delete StatefulSet Pods | If you're using any version of kubectl <= 1.4, you should omit the --force option and use:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_255"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0\n```\n\nForce Delete StatefulSet Pods | If even after these commands the pod is stuck on Unknown state, use the following command to remove the pod from the cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_256"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod <pod> -p '{\"metadata\":{\"finalizers\":null}}'\n```\n\nForce Delete StatefulSet Pods | Always perform force deletion of StatefulSet Pods carefully and with complete knowledge of the risks involved.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_257"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod>\n```\n\nForce Delete StatefulSet Pods | For the above to lead to graceful termination, the Pod must not specify a pod.Spec.TerminationGracePeriodSeconds of 0. The practice of setting a pod.Spec.TerminationGracePeriodSeconds of 0 seconds is", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_258"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0 --force\n```\n\nForce Delete StatefulSet Pods | If you're using any version of kubectl <= 1.4, you should omit the --force option and use:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_259"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0\n```\n\nForce Delete StatefulSet Pods | If even after these commands the pod is stuck on Unknown state, use the following command to remove the pod from the cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_260"}
{"instruction": "Write a bash example for force delete statefulset pods", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod <pod> -p '{\"metadata\":{\"finalizers\":null}}'\n```\n\nForce Delete StatefulSet Pods | Always perform force deletion of StatefulSet Pods carefully and with complete knowledge of the risks involved.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/", "id": "k8s_00027_code_261"}
{"instruction": "How do you upgrading kubeadm clusters in Kubernetes?", "response": "Upgrading kubeadm clustersThis page explains how to upgrade a Kubernetes cluster created with kubeadm from version 1.33.x to version 1.34.x, and from version 1.34.x to 1.34.y (where y > x). Skipping MINOR versions when upgrading is unsupported. For more details, please visit Version Skew Policy.To see information about upgrading clusters created using older versions of kubeadm, please refer to following pages instead:Upgrading a kubeadm cluster from 1.32 to 1.33Upgrading a kubeadm cluster from 1.31 to 1.32Upgrading a kubeadm cluster from 1.30 to 1.31Upgrading a kubeadm cluster from 1.29 to 1.30The Kubernetes project recommends upgrading to the latest patch releases promptly, and to ensure that you are running a supported minor release of Kubernetes. Following this recommendation helps you to stay secure.The upgrade workflow at high level is the following:Upgrade a primary control plane node.Upgrade additional control plane nodes.Upgrade worker nodes.Before you beginMake sure you read the release notes carefully.The cluster should use a static control plane and etcd pods or external etcd.Make sure to back up any important components, such as app-level state stored in a database. kubeadm upgrade does not touch your workloads, only components internal to Kubernetes, but backups are always a best practice.Swap must be disabled.Additional informationThe instructions below outline when to drain each node during the upgrade process. If you are performing a minor version upgrade for any kubelet, you must first drain the node (or nodes) that you are upgrading. In the case of control plane nodes, they could be running CoreDNS Pods or other critical workloads. For more information see Draining nodes.The Kubernetes project recommends that you match your kubelet and kubeadm versions. You can instead use a version of kubelet that is older than kubeadm, provided it is within the range of supported versions. For more details, please visit kubeadm's skew against the kubelet.All containers are restarted after upgrade, because the container spec hash value is changed.To verify that the kubelet service has successfully restarted after the kubelet has been upgraded, you can execute systemctl status kubelet or view the service logs with journalctl -xeu kubelet.kubeadm upgrade supports --config with a UpgradeConfiguration API type which can be used to configure the upgrade process.kubeadm upgrade does not support reconfiguration of an existing cluster. Follow the steps in Reconfiguring a kubeadm cluster instead.Considerations when upgrading etcdBecause the kube-apiserver static pod is running at all times (even if you have drained the node), when you perform a kubeadm upgrade which includes an etcd upgrade, in-flight requests to the server will stall while the new etcd static pod is restarting. As a workaround, it is possible to actively stop the kube-apiserver process a few seconds before starting the kubeadm upgrade apply command. This permits to complete in-flight requests and close existing connections, and minimizes the consequence of the etcd downtime. This can be done as follows on control plane nodes:killall -s SIGTERM kube-apiserver # trigger a graceful kube-apiserver shutdown sleep 20 # wait a little bit to permit completing in-flight requests kubeadm upgrade ... # execute a kubeadm upgrade command Changing the package repositoryIf you're using the community-owned package repositories (pkgs.k8s.io), you need to enable the package repository for the desired Kubernetes minor release. This is explained in Changing the Kubernetes package repository document.Note: The legacy package repositories (apt.kubernetes.io and yum.kubernetes.io) have been deprecated and frozen starting from September 13, 2023. Using the new package repositories hosted at pkgs.k8s.io is strongly recommended and required in order to install Kubernetes versions released after September 13, 2023. The deprecated legacy repositories, and their contents, might be removed at an", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/", "id": "k8s_00028"}
{"instruction": "Explain the Kubernetes concept: Storage Classes", "response": "Storage ClassesThis document describes the concept of a StorageClass in Kubernetes. Familiarity with volumes and persistent volumes is suggested.A StorageClass provides a way for administrators to describe the classes of storage they offer. Different classes might map to quality-of-service levels, or to backup policies, or to arbitrary policies determined by the cluster administrators. Kubernetes itself is unopinionated about what classes represent.The Kubernetes concept of a storage class is similar to “profiles” in some other storage system designs.StorageClass objectsEach StorageClass contains the fields provisioner, parameters, and reclaimPolicy, which are used when a PersistentVolume belonging to the class needs to be dynamically provisioned to satisfy a PersistentVolumeClaim (PVC).The name of a StorageClass object is significant, and is how users can request a particular class. Administrators set the name and other parameters of a class when first creating StorageClass objects.As an administrator, you can specify a default StorageClass that applies to any PVCs that don't request a specific class. For more details, see the PersistentVolumeClaim concept.Here's an example of a StorageClass:storage/storageclass-low-latency.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: low-latency annotations: storageclass.kubernetes.io/is-default-class: \"false\" provisioner: csi-driver.example-vendor.example reclaimPolicy: Retain # default value is Delete allowVolumeExpansion: true mountOptions: - discard # this might enable UNMAP / TRIM at the block storage layer volumeBindingMode: WaitForFirstConsumer parameters: guaranteedReadWriteLatency: \"true\" # provider-specific Default StorageClassYou can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.When a PVC does not specify a storageClassName, the default StorageClass is used.If you set the storageclass.kubernetes.io/is-default-class annotation to true on more than one StorageClass in your cluster, and you then create a PersistentVolumeClaim with no storageClassName set, Kubernetes uses the most recently created default StorageClass.Note:You should try to only have one StorageClass in your cluster that is marked as the default. The reason that Kubernetes allows you to have multiple default StorageClasses is to allow for seamless migration.You can create a PersistentVolumeClaim without specifying a storageClassName for the new PVC, and you can do so even when no default StorageClass exists in your cluster. In this case, the new PVC creates as you defined it, and the storageClassName of that PVC remains unset until a default becomes available.You can have a cluster without any default StorageClass. If you don't mark any StorageClass as default (and one hasn't been set for you by, for example, a cloud provider), then Kubernetes cannot apply that defaulting for PersistentVolumeClaims that need it.If or when a default StorageClass becomes available, the control plane identifies any existing PVCs without storageClassName. For the PVCs that either have an empty value for storageClassName or do not have this key, the control plane then updates those PVCs to set storageClassName to match the new default StorageClass. If you have an existing PVC where the storageClassName is \"\", and you configure a default StorageClass, then this PVC will not get updated.In order to keep binding to PVs with storageClassName set to \"\" (while a default StorageClass is present), you need to set the storageClassName of the associated PVC to \"\".ProvisionerEach StorageClass has a provisioner that determines what volume plugin is used for provisioning PVs. This field must be specified.Volume PluginInternal ProvisionerConfig ExampleAzureFile✓Azure FileCephFS--FC--FlexVolume--iSCSI--Local-LocalNFS-NFSPortworxVolume✓Portworx VolumeRBD-Ceph RBDVsphereVolume✓vSphereYou are not restricted to specifying the \"internal\" ", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_264"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_265"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_266"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_267"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_268"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_269"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\nStorage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_270"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\nStorage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_271"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_272"}
{"instruction": "Write a bash example for storage classes", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\nStorage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_273"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_274"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_275"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_276"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_277"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_278"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_279"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_280"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_281"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_282"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\nStorage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_283"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\nStorage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_284"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_285"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_286"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_287"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_288"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass-low-latency.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_289"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_290"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/pod-volume-binding.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_291"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_292"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-topology.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_293"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_294"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-ebs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_295"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_296"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-efs.yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_297"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_298"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-nfs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_299"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_300"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\nStorage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_301"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\nStorage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_302"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-ceph-rbd.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_303"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_304"}
{"instruction": "Write a bash example for storage classes", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\nStorage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_305"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-azure-file.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_306"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_307"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-portworx-volume.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_308"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_309"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-local.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_310"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes/", "id": "k8s_00029_code_311"}
{"instruction": "What is the reference documentation for kubectl set env?", "response": "kubectl set envSynopsisUpdate environment variables on a pod template.List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replication controllers or deployment configurations). View or modify the environment variable definitions on all containers in the specified pods or pod templates, or just those that match a wildcard.If \"--env -\" is passed, environment variables can be read from STDIN using the standard env syntax.Possible resources include (case insensitive): pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs) kubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N Examples # Update deployment 'registry' with a new environment variable kubectl set env deployment/registry STORAGE_DIR=/local # List the environment variables defined on a deployments 'sample-build' kubectl set env deployment/sample-build --list # List the environment variables defined on all pods kubectl set env pods --all --list # Output modified deployment in YAML, and does not alter the object on the server kubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml # Update all containers in all replication controllers in the project to have ENV=prod kubectl set env rc --all ENV=prod # Import environment from a secret kubectl set env --from=secret/mysecret deployment/myapp # Import environment from a config map with a prefix kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp # Import specific keys from a config map kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp # Remove the environment variable ENV from container 'c1' in all deployment configs kubectl set env deployments --all --containers=\"c1\" ENV- # Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server kubectl set env -f deploy.json ENV- # Set some of the local shell environment into a deployment config on the server env | grep RAILS_ | kubectl set env -e - deployment/registry Options--allIf true, select all resources in the namespace of the specified resource types--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.-c, --containers string Default: \"*\"The names of containers in the selected pod templates to change - may use wildcards--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.-e, --env stringsSpecify a key-value pair for an environment variable to set into each container.--field-manager string Default: \"kubectl-set\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files the resource to update the env--from stringThe name of a resource from which to inject environment variables-h, --helphelp for env--keys stringsComma-separated list of keys to import from specified resource-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--listIf true, display the environment and any changes in the standard format. this flag will removed when we have kubectl view env.--localIf true, set env will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--overwrite Default: trueIf true, allow environment to be overwritten, otherwise reject updates that overwrite existing environment.--prefix stringPrefix to append to variable names-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when yo", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_env/", "id": "k8s_00030"}
{"instruction": "Write a bash example for kubectl set env", "response": "Here's a bash example:\n\n```bash\nkubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N\n```\n\nkubectl set env | If true, select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_env/", "id": "k8s_00030_code_313"}
{"instruction": "Write a bash example for kubectl set env", "response": "Here's a bash example:\n\n```bash\nkubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N\n```\n\nkubectl set env | If true, select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_env/", "id": "k8s_00030_code_314"}
{"instruction": "How do you fine parallel processing using a work queue in Kubernetes?", "response": "Fine Parallel Processing Using a Work QueueIn this example, you will run a Kubernetes Job that runs multiple parallel tasks as worker processes, each running as a separate Pod.In this example, as each pod is created, it picks up one unit of work from a task queue, processes it, and repeats until the end of the queue is reached.Here is an overview of the steps in this example:Start a storage service to hold the work queue. In this example, you will use Redis to store work items. In the previous example, you used RabbitMQ. In this example, you will use Redis and a custom work-queue client library; this is because AMQP does not provide a good way for clients to detect when a finite-length work queue is empty. In practice you would set up a store such as Redis once and reuse it for the work queues of many jobs, and other things.Create a queue, and fill it with messages. Each message represents one task to be done. In this example, a message is an integer that we will do a lengthy computation on.Start a Job that works on tasks from the queue. The Job starts several pods. Each pod takes one task from the message queue, processes it, and repeats until the end of the queue is reached.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou will need a container image registry where you can upload images to run in your cluster. The example uses Docker Hub, but you could adapt it to a different container image registry.This task example also assumes that you have Docker installed locally. You use Docker to build container images.Be familiar with the basic, non-parallel, use of Job.Starting RedisFor this example, for simplicity, you will start a single instance of Redis. See the Redis Example for an example of deploying Redis scalably and redundantly.You could also download the following files directly:redis-pod.yamlredis-service.yamlDockerfilejob.yamlrediswq.pyworker.pyTo start a single instance of Redis, you need to create the redis pod and redis service:kubectl apply -f https://k8s.io/examples/application/job/redis/redis-pod.yaml kubectl apply -f https://k8s.io/examples/application/job/redis/redis-service.yaml Filling the queue with tasksNow let's fill the queue with some \"tasks\". In this example, the tasks are strings to be printed.Start a temporary interactive pod for running the Redis CLI.kubectl run -i --tty temp --image redis --command \"/bin/sh\" Waiting for pod default/redis2-c7h78 to be running, status is Pending, pod ready: false Hit enter for command prompt Now hit enter, start the Redis CLI, and create a list with some work items in it.redis-cli -h redis redis:6379> rpush job2 \"apple\" (integer) 1 redis:6379> rpush job2 \"banana\" (integer) 2 redis:6379> rpush job2 \"cherry\" (integer) 3 redis:6379> rpush job2 \"date\" (integer) 4 redis:6379> rpush job2 \"fig\" (integer) 5 redis:6379> rpush job2 \"grape\" (integer) 6 redis:6379> rpush job2 \"lemon\" (integer) 7 redis:6379> rpush job2 \"melon\" (integer) 8 redis:6379> rpush job2 \"orange\" (integer) 9 redis:6379> lrange job2 0 -1 1) \"apple\" 2) \"banana\" 3) \"cherry\" 4) \"date\" 5) \"fig\" 6) \"grape\" 7) \"lemon\" 8) \"melon\" 9) \"orange\" So, the list with key job2 will be the work queue.Note: if you do not have Kube DNS setup correctly, you may need to change the first step of the above block to redis-cli -h $REDIS_SERVICE_HOST.Create a container imageNow you are ready to create an image that will process the work in that queue.You're going to use a Python worker program with a Redis client to read the messages from the message queue.A simple Redis work queue client library is provided, called rediswq.py (Download).The \"worke", "category": "tasks", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-pod.yaml\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-service.yaml\n```\n\nFine Parallel Processing Using a Work Queue | Now let's fill the queue with some \"tasks\". In this example, the tasks are strings to be printed.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_316"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty temp --image redis --command \"/bin/sh\"\n```\n\nFine Parallel Processing Using a Work Queue | Now hit enter, start the Redis CLI, and create a list with some work items in it.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_317"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-2 .\n```\n\nFine Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_318"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-2 <username>/job-wq-2\ndocker push <username>/job-wq-2\n```\n\nFine Parallel Processing Using a Work Queue | You need to push to a public repository or configure your cluster to be able to access your private repository.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_319"}
{"instruction": "Write a yaml example for fine parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\nFine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_320"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-2\n```\n\nFine Parallel Processing Using a Work Queue | You can wait for the Job to succeed, with a timeout:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_321"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl logs pods/job-wq-2-7r7b2\n```\n\nFine Parallel Processing Using a Work Queue | As you can see, one of the pods for this Job worked on several work units.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_322"}
{"instruction": "Write a yaml example for fine parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\nFine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_323"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-pod.yaml\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-service.yaml\n```\n\nFine Parallel Processing Using a Work Queue | Now let's fill the queue with some \"tasks\". In this example, the tasks are strings to be printed.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_324"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty temp --image redis --command \"/bin/sh\"\n```\n\nFine Parallel Processing Using a Work Queue | Now hit enter, start the Redis CLI, and create a list with some work items in it.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_325"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-2 .\n```\n\nFine Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_326"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-2 <username>/job-wq-2\ndocker push <username>/job-wq-2\n```\n\nFine Parallel Processing Using a Work Queue | You need to push to a public repository or configure your cluster to be able to access your private repository.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_327"}
{"instruction": "Write a yaml example for fine parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napplication/job/redis/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\nFine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_328"}
{"instruction": "Write a yaml example for fine parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\nFine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_329"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-2\n```\n\nFine Parallel Processing Using a Work Queue | You can wait for the Job to succeed, with a timeout:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_330"}
{"instruction": "Write a bash example for fine parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl logs pods/job-wq-2-7r7b2\n```\n\nFine Parallel Processing Using a Work Queue | As you can see, one of the pods for this Job worked on several work units.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/", "id": "k8s_00031_code_331"}
{"instruction": "What is the reference documentation for official cve feed?", "response": "Official CVE FeedFEATURE STATE: Kubernetes v1.27 [beta]This is a community maintained list of official CVEs announced by the Kubernetes Security Response Committee. See Kubernetes Security and Disclosure Information for more details.The Kubernetes project publishes a programmatically accessible feed of published security issues in JSON feed and RSS feed formats. You can access it by executing the following commands:Link to JSON formatcurl -Lv https://k8s.io/docs/reference/issues-security/official-cve-feed/index.json Link to RSS formatcurl -Lv https://k8s.io/docs/reference/issues-security/official-cve-feed/feed.xml Official Kubernetes CVE List (last updated: 27 Sep 2025 10:53:07 UTC)CVE IDIssue SummaryCVE GitHub Issue URLCVE-2025-9708Kubernetes C# Client: improper certificate validation in custom CA mode may lead to man-in-the-middle attacks#134063CVE-2025-7445secrets-store-sync-controller discloses service account tokens in logs#133897CVE-2025-5187Nodes can delete themselves by adding an OwnerReference#133471CVE-2025-7342VM images built with Kubernetes Image Builder Nutanix or OVA providers use default credentials for Windows images if user did not override#133115CVE-2025-4563Nodes can bypass dynamic resource allocation authorization checks#132151CVE-2025-1974ingress-nginx admission controller RCE escalation#131009CVE-2025-1098ingress-nginx controller configuration injection via unsanitized mirror annotations#131008CVE-2025-1097ingress-nginx controller configuration injection via unsanitized auth-tls-match-cn annotation#131007CVE-2025-24514ingress-nginx controller configuration injection via unsanitized auth-url annotation#131006CVE-2025-24513ingress-nginx controller auth secret file path traversal vulnerability#131005CVE-2025-1767GitRepo Volume Inadvertent Local Repository Access#130786CVE-2025-0426Node Denial of Service via kubelet Checkpoint API#130016CVE-2024-9042Command Injection affecting Windows nodes via nodes/*/logs/query API#129654CVE-2024-10220Arbitrary command execution through gitRepo volume#128885CVE-2024-9594VM images built with Image Builder with some providers use default credentials during builds#128007CVE-2024-9486VM images built with Image Builder and Proxmox provider use default credentials#128006CVE-2024-7646Ingress-nginx Annotation Validation Bypass#126744CVE-2024-7598Network restriction bypass via race condition during namespace termination#126587CVE-2024-5321Incorrect permissions on Windows containers logs#126161CVE-2024-3744azure-file-csi-driver discloses service account tokens in logs#124759CVE-2024-3177Bypassing mountable secrets policy imposed by the ServiceAccount admission plugin#124336CVE-2023-5528Insufficient input sanitization in in-tree storage plugin leads to privilege escalation on Windows nodes#121879CVE-2023-5044Code injection via nginx.ingress.kubernetes.io/permanent-redirect annotation#126817CVE-2023-5043Ingress nginx annotation injection causes arbitrary command execution#126816CVE-2022-4886ingress-nginx path sanitization can be bypassed#126815CVE-2023-3955Insufficient input sanitization on Windows nodes leads to privilege escalation#119595CVE-2023-3893Insufficient input sanitization on kubernetes-csi-proxy leads to privilege escalation#119594CVE-2023-3676Insufficient input sanitization on Windows nodes leads to privilege escalation#119339CVE-2023-2431Bypass of seccomp profile enforcement#118690CVE-2023-2728Bypassing policies imposed by the ImagePolicyWebhook and bypassing mountable secrets policy imposed by the ServiceAccount admission plugin#118640CVE-2023-2727Bypassing policies imposed by the ImagePolicyWebhook and bypassing mountable secrets policy imposed by the ServiceAccount admission plugin#118640CVE-2023-2878secrets-store-csi-driver discloses service account tokens in logs#118419CVE-2022-3294Node address isn't always verified when proxying#113757CVE-2022-3162Unauthorized read of Custom Resources#113756CVE-2022-3172Aggregated API server can cause clients to be redirected (SSRF)", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/issues-security/official-cve-feed/", "id": "k8s_00032"}
{"instruction": "What is the reference documentation for kubectl top?", "response": "kubectl topSynopsisDisplay resource (CPU/memory) usage.This command provides a view of recent resource consumption for nodes and pods. It fetches metrics from the Metrics Server, which aggregates this data from the kubelet on each node. The Metrics Server must be installed and running in the cluster for this command to work.The metrics shown are specifically optimized for Kubernetes autoscaling decisions, such as those made by the Horizontal Pod Autoscaler (HPA) and Vertical Pod Autoscaler (VPA). Because of this, the values may not match those from standard OS tools like 'top', as the metrics are designed to provide a stable signal for autoscalers rather than for pinpoint accuracy.When to use this command:For on-the-fly spot-checks of resource usage (e.g. identify which pods are consuming the most resources at a glance, or get a quick sense of the load on your nodes)Understand current resource consumption patternsValidate the behavior of your HPA or VPA configurations by seeing the metrics they use for scaling decisions.It is not intended to be a replacement for full-featured monitoring solutions. Its primary design goal is to provide a low-overhead signal for autoscalers, not to be a perfectly accurate monitoring tool. For high-accuracy reporting, historical analysis, dashboarding, or alerting, you should use a dedicated monitoring solution.kubectl top [flags] Options-h, --helphelp for topParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token st", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/", "id": "k8s_00033"}
{"instruction": "What is the reference documentation for kubectl version?", "response": "kubectl versionSynopsisPrint the client and server version information for the current context.kubectl version [flags] Examples # Print the client and server versions for the current context kubectl version Options--clientIf true, shows client version only (no server required).-h, --helphelp for version-o, --output stringOne of 'yaml' or 'json'.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_version/", "id": "k8s_00034"}
{"instruction": "Write a bash example for kubectl version", "response": "Here's a bash example:\n\n```bash\nkubectl version [flags]\n```\n\nkubectl version | If true, shows client version only (no server required).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_version/", "id": "k8s_00034_code_335"}
{"instruction": "Write a bash example for kubectl version", "response": "Here's a bash example:\n\n```bash\nkubectl version [flags]\n```\n\nkubectl version | If true, shows client version only (no server required).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_version/", "id": "k8s_00034_code_336"}
{"instruction": "Explain the Kubernetes concept: Nodes", "response": "NodesKubernetes runs your workload by placing containers into Pods to run on Nodes. A node may be a virtual or physical machine, depending on the cluster. Each node is managed by the control plane and contains the services necessary to run Pods.Typically you have several nodes in a cluster; in a learning or resource-limited environment, you might have only one node.The components on a node include the kubelet, a container runtime, and the kube-proxy.ManagementThere are two main ways to have Nodes added to the API server:The kubelet on a node self-registers to the control planeYou (or another human user) manually add a Node objectAfter you create a Node object, or the kubelet on a node self-registers, the control plane checks whether the new Node object is valid. For example, if you try to create a Node from the following JSON manifest:{ \"kind\": \"Node\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"10.240.79.157\", \"labels\": { \"name\": \"my-first-k8s-node\" } } } Kubernetes creates a Node object internally (the representation). Kubernetes checks that a kubelet has registered to the API server that matches the metadata.name field of the Node. If the node is healthy (i.e. all necessary services are running), then it is eligible to run a Pod. Otherwise, that node is ignored for any cluster activity until it becomes healthy.Note:Kubernetes keeps the object for the invalid Node and continues checking to see whether it becomes healthy.You, or a controller, must explicitly delete the Node object to stop that health checking.The name of a Node object must be a valid DNS subdomain name.Node name uniquenessThe name identifies a Node. Two Nodes cannot have the same name at the same time. Kubernetes also assumes that a resource with the same name is the same object. In case of a Node, it is implicitly assumed that an instance using the same name will have the same state (e.g. network settings, root disk contents) and attributes like node labels. This may lead to inconsistencies if an instance was modified without changing its name. If the Node needs to be replaced or updated significantly, the existing Node object needs to be removed from API server first and re-added after the update.Self-registration of NodesWhen the kubelet flag --register-node is true (the default), the kubelet will attempt to register itself with the API server. This is the preferred pattern, used by most distros.For self-registration, the kubelet is started with the following options:--kubeconfig - Path to credentials to authenticate itself to the API server.--cloud-provider - How to talk to a cloud provider to read metadata about itself.--register-node - Automatically register with the API server.--register-with-taints - Register the node with the given list of taints (comma separated <key>=<value>:<effect>).No-op if register-node is false.--node-ip - Optional comma-separated list of the IP addresses for the node. You can only specify a single address for each address family. For example, in a single-stack IPv4 cluster, you set this value to be the IPv4 address that the kubelet should use for the node. See configure IPv4/IPv6 dual stack for details of running a dual-stack cluster.If you don't provide this argument, the kubelet uses the node's default IPv4 address, if any; if the node has no IPv4 addresses then the kubelet uses the node's default IPv6 address.--node-labels - Labels to add when registering the node in the cluster (see label restrictions enforced by the NodeRestriction admission plugin).--node-status-update-frequency - Specifies how often kubelet posts its node status to the API server.When the Node authorization mode and NodeRestriction admission plugin are enabled, kubelets are only authorized to create/modify their own Node resource.Note:As mentioned in the Node name uniqueness section, when Node configuration needs to be updated, it is a good practice to re-register the node with the API server. For example, if the kubelet is being restarted with a new se", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/nodes/", "id": "k8s_00035"}
{"instruction": "Write a bash example for nodes", "response": "Here's a bash example:\n\n```bash\nkubectl cordon $NODENAME\n```\n\nNodes | See Safely Drain a Node for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/nodes/", "id": "k8s_00035_code_338"}
{"instruction": "Write a bash example for nodes", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\nNodes | See Node Status for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/nodes/", "id": "k8s_00035_code_339"}
{"instruction": "Write a bash example for nodes", "response": "Here's a bash example:\n\n```bash\nkubectl cordon $NODENAME\n```\n\nNodes | See Safely Drain a Node for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/nodes/", "id": "k8s_00035_code_340"}
{"instruction": "Write a bash example for nodes", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\nNodes | See Node Status for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/nodes/", "id": "k8s_00035_code_341"}
{"instruction": "How do you distribute credentials securely using secrets in Kubernetes?", "response": "Distribute Credentials Securely Using SecretsThis page shows how to securely inject sensitive data, such as passwords and encryption keys, into Pods.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesConvert your secret data to a base-64 representationSuppose you want to have two pieces of secret data: a username my-app and a password 39528$vdg7Jb. First, use a base64 encoding tool to convert your username and password to a base64 representation. Here's an example using the commonly available base64 program:echo -n 'my-app' | base64 echo -n '39528$vdg7Jb' | base64 The output shows that the base-64 representation of your username is bXktYXBw, and the base-64 representation of your password is Mzk1MjgkdmRnN0pi.Caution:Use a local tool trusted by your OS to decrease the security risks of external tools.Create a SecretHere is a configuration file you can use to create a Secret that holds your username and password:pods/inject/secret.yaml apiVersion: v1 kind: Secret metadata: name: test-secret data: username: bXktYXBw password: Mzk1MjgkdmRnN0pi Create the Secretkubectl apply -f https://k8s.io/examples/pods/inject/secret.yaml View information about the Secret:kubectl get secret test-secret Output:NAME TYPE DATA AGE test-secret Opaque 2 1m View more detailed information about the Secret:kubectl describe secret test-secret Output:Name: test-secret Namespace: default Labels: <none> Annotations: <none> Type: Opaque Data ==== password: 13 bytes username: 7 bytes Create a Secret directly with kubectlIf you want to skip the Base64 encoding step, you can create the same Secret using the kubectl create secret command. For example:kubectl create secret generic test-secret --from-literal='username=my-app' --from-literal='password=39528$vdg7Jb' This is more convenient. The detailed approach shown earlier runs through each step explicitly to demonstrate what is happening.Create a Pod that has access to the secret data through a VolumeHere is a configuration file you can use to create a Pod:pods/inject/secret-pod.yaml apiVersion: v1 kind: Pod metadata: name: secret-test-pod spec: containers: - name: test-container image: nginx volumeMounts: # name must match the volume name below - name: secret-volume mountPath: /etc/secret-volume readOnly: true # The secret data is exposed to Containers in the Pod through a Volume. volumes: - name: secret-volume secret: secretName: test-secret Create the Pod:kubectl apply -f https://k8s.io/examples/pods/inject/secret-pod.yaml Verify that your Pod is running:kubectl get pod secret-test-pod Output:NAME READY STATUS RESTARTS AGE secret-test-pod 1/1 Running 0 42m Get a shell into the Container that is running in your Pod:kubectl exec -i -t secret-test-pod -- /bin/bash The secret data is exposed to the Container through a Volume mounted under /etc/secret-volume.In your shell, list the files in the /etc/secret-volume directory:# Run this in the shell inside the container ls /etc/secret-volume The output shows two files, one for each piece of secret data:password username In your shell, display the contents of the username and password files:# Run this in the shell inside the container echo \"$( cat /etc/secret-volume/username )\" echo \"$( cat /etc/secret-volume/password )\" The output is your username and password:my-app 39528$vdg7Jb Modify your image or command line so that the program looks for files in the mountPath directory. Each key in the Secret data map becomes a file name in this directory.Project Secret keys to specific file pathsYou can also control the paths within the volume where Secret keys are projected. Use the .spec.volume", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\nDistribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_343"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret.yaml\n```\n\nDistribute Credentials Securely Using Secrets | View information about the Secret:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_344"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl get secret test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_345"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_346"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal='username=my-app' --from-literal='password=39528$vdg7Jb'\n```\n\nDistribute Credentials Securely Using Secrets | This is more convenient. The detailed approach shown earlier runs through each step explicitly to demonstrate what is happening.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_347"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_348"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret-pod.yaml\n```\n\nDistribute Credentials Securely Using Secrets | Verify that your Pod is running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_349"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl get pod secret-test-pod\n```\n\nDistribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_350"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t secret-test-pod -- /bin/bash\n```\n\nDistribute Credentials Securely Using Secrets | The secret data is exposed to the Container through a Volume mounted under /etc/secret-volume.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_351"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      items:\n      - key: username\n        path: my-group/my-username\n```\n\nDistribute Credentials Securely Using Secrets | When you deploy this Pod, the following happens:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_352"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      defaultMode: 0400\n```\n\nDistribute Credentials Securely Using Secrets | The Secret is mounted on /etc/foo; all the files created by the secret volume mount have permission 0400.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_353"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\n```\n\nDistribute Credentials Securely Using Secrets | Assign the backend-username value defined in the Secret to the SECRET_USERNAME environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_354"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_355"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-single-secret-env-variable.yaml\n```\n\nDistribute Credentials Securely Using Secrets | In your shell, display the content of SECRET_USERNAME container environment variable.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_356"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t env-single-secret -- /bin/sh -c 'echo $SECRET_USERNAME'\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_357"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\nkubectl create secret generic db-user --from-literal=db-username='db-admin'\n```\n\nDistribute Credentials Securely Using Secrets | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_358"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_359"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-multiple-secret-env-variable.yaml\n```\n\nDistribute Credentials Securely Using Secrets | In your shell, display the container environment variables.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_360"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envvars-multiple-secrets -- /bin/sh -c 'env | grep _USERNAME'\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_361"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'\n```\n\nDistribute Credentials Securely Using Secrets | Use envFrom to define all of the Secret's data as container environment variables. The key from the Secret becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_362"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_363"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-secret-envFrom.yaml\n```\n\nDistribute Credentials Securely Using Secrets | In your shell, display username and password container environment variables.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_364"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envfrom-secret -- /bin/sh -c 'echo \"username: $username\\npassword: $password\\n\"'\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_365"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic prod-db-secret --from-literal=username=produser --from-literal=password=Y4nys7f11\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_366"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-db-secret --from-literal=username=testuser --from-literal=password=iluvtests\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_367"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password='S!B\\*d$zDsb='\n```\n\nDistribute Credentials Securely Using Secrets | You do not need to escape special characters in passwords from files (--from-file).", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_368"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: List\nitems:\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: prod-db-client-pod\n    labels:\n      name: prod-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: prod-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: test-db-client-pod\n    labels:\n      name: test-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\nEOF\n```\n\nDistribute Credentials Securely Using Secrets | Apply all those objects on the API server by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_369"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod.yaml\n```\n\nDistribute Credentials Securely Using Secrets | Both containers will have the following files present on their filesystems with the values for each container's environment:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_370"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: prod-db-client-pod\n  labels:\n    name: prod-db-client\nspec:\n  serviceAccount: prod-db-client\n  containers:\n  - name: db-client-container\n    image: myClientImage\n```\n\nDistribute Credentials Securely Using Secrets |", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_371"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\nDistribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_372"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret\n```\n\nDistribute Credentials Securely Using Secrets | This is more convenient. The detailed approach shown earlier runs through each step explicitly to demonstrate what is happening.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_373"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_374"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      items:\n      - key: username\n        path: my-group/my-username\n```\n\nDistribute Credentials Securely Using Secrets | When you deploy this Pod, the following happens:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_375"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      defaultMode: 0400\n```\n\nDistribute Credentials Securely Using Secrets | The Secret is mounted on /etc/foo; all the files created by the secret volume mount have permission 0400.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_376"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_377"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_378"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_379"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: prod-db-client-pod\n  labels:\n    name: prod-db-client\nspec:\n  serviceAccount: prod-db-client\n  containers:\n  - name: db-client-container\n    image: myClientImage\n```\n\nDistribute Credentials Securely Using Secrets |", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_380"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\npods/inject/secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\nDistribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_381"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\nDistribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_382"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret.yaml\n```\n\nDistribute Credentials Securely Using Secrets | View information about the Secret:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_383"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl get secret test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_384"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_385"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal='username=my-app' --from-literal='password=39528$vdg7Jb'\n```\n\nDistribute Credentials Securely Using Secrets | This is more convenient. The detailed approach shown earlier runs through each step explicitly to demonstrate what is happening.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_386"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\npods/inject/secret-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_387"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_388"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret-pod.yaml\n```\n\nDistribute Credentials Securely Using Secrets | Verify that your Pod is running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_389"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl get pod secret-test-pod\n```\n\nDistribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_390"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t secret-test-pod -- /bin/bash\n```\n\nDistribute Credentials Securely Using Secrets | The secret data is exposed to the Container through a Volume mounted under /etc/secret-volume.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_391"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      items:\n      - key: username\n        path: my-group/my-username\n```\n\nDistribute Credentials Securely Using Secrets | When you deploy this Pod, the following happens:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_392"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      defaultMode: 0400\n```\n\nDistribute Credentials Securely Using Secrets | The Secret is mounted on /etc/foo; all the files created by the secret volume mount have permission 0400.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_393"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\n```\n\nDistribute Credentials Securely Using Secrets | Assign the backend-username value defined in the Secret to the SECRET_USERNAME environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_394"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\npods/inject/pod-single-secret-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_395"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_396"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-single-secret-env-variable.yaml\n```\n\nDistribute Credentials Securely Using Secrets | In your shell, display the content of SECRET_USERNAME container environment variable.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_397"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t env-single-secret -- /bin/sh -c 'echo $SECRET_USERNAME'\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_398"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\nkubectl create secret generic db-user --from-literal=db-username='db-admin'\n```\n\nDistribute Credentials Securely Using Secrets | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_399"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\npods/inject/pod-multiple-secret-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_400"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_401"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-multiple-secret-env-variable.yaml\n```\n\nDistribute Credentials Securely Using Secrets | In your shell, display the container environment variables.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_402"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envvars-multiple-secrets -- /bin/sh -c 'env | grep _USERNAME'\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_403"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'\n```\n\nDistribute Credentials Securely Using Secrets | Use envFrom to define all of the Secret's data as container environment variables. The key from the Secret becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_404"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\npods/inject/pod-secret-envFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_405"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\nDistribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_406"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-secret-envFrom.yaml\n```\n\nDistribute Credentials Securely Using Secrets | In your shell, display username and password container environment variables.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_407"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envfrom-secret -- /bin/sh -c 'echo \"username: $username\\npassword: $password\\n\"'\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_408"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic prod-db-secret --from-literal=username=produser --from-literal=password=Y4nys7f11\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_409"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-db-secret --from-literal=username=testuser --from-literal=password=iluvtests\n```\n\nDistribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_410"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password='S!B\\*d$zDsb='\n```\n\nDistribute Credentials Securely Using Secrets | You do not need to escape special characters in passwords from files (--from-file).", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_411"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: List\nitems:\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: prod-db-client-pod\n    labels:\n      name: prod-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: prod-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: test-db-client-pod\n    labels:\n      name: test-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\nEOF\n```\n\nDistribute Credentials Securely Using Secrets | Apply all those objects on the API server by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_412"}
{"instruction": "Write a bash example for distribute credentials securely using secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod.yaml\n```\n\nDistribute Credentials Securely Using Secrets | Both containers will have the following files present on their filesystems with the values for each container's environment:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_413"}
{"instruction": "Write a yaml example for distribute credentials securely using secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: prod-db-client-pod\n  labels:\n    name: prod-db-client\nspec:\n  serviceAccount: prod-db-client\n  containers:\n  - name: db-client-container\n    image: myClientImage\n```\n\nDistribute Credentials Securely Using Secrets |", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/", "id": "k8s_00036_code_414"}
{"instruction": "Explain the Kubernetes concept: Metrics For Kubernetes System Components", "response": "Metrics For Kubernetes System ComponentsSystem component metrics can give a better look into what is happening inside them. Metrics are particularly useful for building dashboards and alerts.Kubernetes components emit metrics in Prometheus format. This format is structured plain text, designed so that people and machines can both read it.Metrics in KubernetesIn most cases metrics are available on /metrics endpoint of the HTTP server. For components that don't expose endpoint by default, it can be enabled using --bind-address flag.Examples of those components:kube-controller-managerkube-proxykube-apiserverkube-schedulerkubeletIn a production environment you may want to configure Prometheus Server or some other metrics scraper to periodically gather these metrics and make them available in some kind of time series database.Note that kubelet also exposes metrics in /metrics/cadvisor, /metrics/resource and /metrics/probes endpoints. Those metrics do not have the same lifecycle.If your cluster uses RBAC, reading metrics requires authorization via a user, group or ServiceAccount with a ClusterRole that allows accessing /metrics. For example:apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: prometheus rules: - nonResourceURLs: - \"/metrics\" verbs: - get Metric lifecycleAlpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metricAlpha metrics have no stability guarantees. These metrics can be modified or deleted at any time.Stable metrics are guaranteed to not change. This means:A stable metric without a deprecated signature will not be deleted or renamedA stable metric's type will not be modifiedDeprecated metrics are slated for deletion, but are still available for use. These metrics include an annotation about the version in which they became deprecated.For example:Before deprecation# HELP some_counter this counts things # TYPE some_counter counter some_counter 0 After deprecation# HELP some_counter (Deprecated since 1.15.0) this counts things # TYPE some_counter counter some_counter 0 Hidden metrics are no longer published for scraping, but are still available for use. To use a hidden metric, please refer to the Show hidden metrics section.Deleted metrics are no longer published and cannot be used.Show hidden metricsAs described above, admins can enable hidden metrics through a command-line flag on a specific binary. This intends to be used as an escape hatch for admins if they missed the migration of the metrics deprecated in the last release.The flag show-hidden-metrics-for-version takes a version for which you want to show metrics deprecated in that release. The version is expressed as x.y, where x is the major version, y is the minor version. The patch version is not needed even though a metrics can be deprecated in a patch release, the reason for that is the metrics deprecation policy runs against the minor release.The flag can only take the previous minor version as it's value. All metrics hidden in previous will be emitted if admins set the previous version to show-hidden-metrics-for-version. The too old version is not allowed because this violates the metrics deprecated policy.Take metric A as an example, here assumed that A is deprecated in 1.n. According to metrics deprecated policy, we can reach the following conclusion:In release 1.n, the metric is deprecated, and it can be emitted by default.In release 1.n+1, the metric is hidden by default and it can be emitted by command line show-hidden-metrics-for-version=1.n.In release 1.n+2, the metric should be removed from the codebase. No escape hatch anymore.If you're upgrading from release 1.12 to 1.13, but still depend on a metric A deprecated in 1.12, you should set hidden metrics via command line: --show-hidden-metrics=1.12 and remember to remove this metric dependency before upgrading to 1.14Component metricskube-controller-manager metricsController manager metrics provide important insight into the performance and health of ", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-metrics/", "id": "k8s_00037"}
{"instruction": "Write a yaml example for metrics for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\nMetrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-metrics/", "id": "k8s_00037_code_416"}
{"instruction": "Write a yaml example for metrics for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\nMetrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-metrics/", "id": "k8s_00037_code_417"}
{"instruction": "Write a yaml example for metrics for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\n\"metric1,label2\": \"v1,v2,v3\"\n\"metric2,label1\": \"v1,v2,v3\"\n```\n\nMetrics For Kubernetes System Components | Additionally, the cardinality_enforcement_unexpected_categorizations_total meta-metric records the count of unexpected categorizations during cardinality enforcement, that is, whenever a label value i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-metrics/", "id": "k8s_00037_code_418"}
{"instruction": "Write a yaml example for metrics for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\nMetrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-metrics/", "id": "k8s_00037_code_419"}
{"instruction": "What is the reference documentation for kubectl cp?", "response": "kubectl cpSynopsisCopy files and directories to and from containers.kubectl cp <file-spec-src> <file-spec-dest> Examples # !!!Important Note!!! # Requires that the 'tar' binary is present in your container # image. If 'tar' is not present, 'kubectl cp' will fail. # # For advanced use cases, such as symlinks, wildcard expansion or # file mode preservation, consider using 'kubectl exec'. # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace> tar cf - /tmp/foo | kubectl exec -i -n <some-namespace> <some-pod> -- tar xf - -C /tmp/bar # Copy /tmp/foo from a remote pod to /tmp/bar locally kubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container> # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace> kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar # Copy /tmp/foo from a remote pod to /tmp/bar locally kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar Options-c, --container stringContainer name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen-h, --helphelp for cp--no-preserveThe copied file/directory's ownership and permissions will not be preserved in the container--retries intSet number of retries to complete a copy operation from a container. Specify 0 to disable or any negative value for infinite retrying. The default is 0 (no retry).Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database p", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cp/", "id": "k8s_00038"}
{"instruction": "Write a bash example for kubectl cp", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest>\n```\n\nkubectl cp | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cp/", "id": "k8s_00038_code_421"}
{"instruction": "Write a bash example for kubectl cp", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest>\n```\n\nkubectl cp | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cp/", "id": "k8s_00038_code_422"}
{"instruction": "Explain the Kubernetes concept: Annotations", "response": "AnnotationsYou can use Kubernetes annotations to attach arbitrary non-identifying metadata to objects. Clients such as tools and libraries can retrieve this metadata.Attaching metadata to objectsYou can use either labels or annotations to attach metadata to Kubernetes objects. Labels can be used to select objects and to find collections of objects that satisfy certain conditions. In contrast, annotations are not used to identify and select objects. The metadata in an annotation can be small or large, structured or unstructured, and can include characters not permitted by labels. It is possible to use labels as well as annotations in the metadata of the same object.Annotations, like labels, are key/value maps:\"metadata\": { \"annotations\": { \"key1\" : \"value1\", \"key2\" : \"value2\" } } Note:The keys and the values in the map must be strings. In other words, you cannot use numeric, boolean, list or other types for either the keys or the values.Here are some examples of information that could be recorded in annotations:Fields managed by a declarative configuration layer. Attaching these fields as annotations distinguishes them from default values set by clients or servers, and from auto-generated fields and fields set by auto-sizing or auto-scaling systems.Build, release, or image information like timestamps, release IDs, git branch, PR numbers, image hashes, and registry address.Pointers to logging, monitoring, analytics, or audit repositories.Client library or tool information that can be used for debugging purposes: for example, name, version, and build information.User or tool/system provenance information, such as URLs of related objects from other ecosystem components.Lightweight rollout tool metadata: for example, config or checkpoints.Phone or pager numbers of persons responsible, or directory entries that specify where that information can be found, such as a team web site.Directives from the end-user to the implementations to modify behavior or engage non-standard features.Instead of using annotations, you could store this type of information in an external database or directory, but that would make it much harder to produce shared client libraries and tools for deployment, management, introspection, and the like.Syntax and character setAnnotations are key/value pairs. Valid annotation keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/).If the prefix is omitted, the annotation Key is presumed to be private to the user. Automated system components (e.g. kube-scheduler, kube-controller-manager, kube-apiserver, kubectl, or other third-party automation) which add annotations to end-user objects must specify a prefix.The kubernetes.io/ and k8s.io/ prefixes are reserved for Kubernetes core components.For example, here's a manifest for a Pod that has the annotation imageregistry: https://hub.docker.com/ :apiVersion: v1 kind: Pod metadata: name: annotations-demo annotations: imageregistry: \"https://hub.docker.com/\" spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 What's nextLearn more about Labels and Selectors.Find Well-known labels, Annotations and Taints", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/", "id": "k8s_00039"}
{"instruction": "Write a yaml example for annotations", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nAnnotations |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/", "id": "k8s_00039_code_424"}
{"instruction": "Write a yaml example for annotations", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nAnnotations |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/", "id": "k8s_00039_code_425"}
{"instruction": "Write a yaml example for annotations", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nAnnotations |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/", "id": "k8s_00039_code_426"}
{"instruction": "How do you check whether dockershim removal affects you in Kubernetes?", "response": "Check whether dockershim removal affects youThe dockershim component of Kubernetes allows the use of Docker as a Kubernetes's container runtime. Kubernetes' built-in dockershim component was removed in release v1.24.This page explains how your cluster could be using Docker as a container runtime, provides details on the role that dockershim plays when in use, and shows steps you can take to check whether any workloads could be affected by dockershim removal.Finding if your app has a dependencies on DockerIf you are using Docker for building your application containers, you can still run these containers on any container runtime. This use of Docker does not count as a dependency on Docker as a container runtime.When alternative container runtime is used, executing Docker commands may either not work or yield unexpected output. This is how you can find whether you have a dependency on Docker:Make sure no privileged Pods execute Docker commands (like docker ps), restart the Docker service (commands such as systemctl restart docker.service), or modify Docker-specific files such as /etc/docker/daemon.json.Check for any private registries or image mirror settings in the Docker configuration file (like /etc/docker/daemon.json). Those typically need to be reconfigured for another container runtime.Check that scripts and apps running on nodes outside of your Kubernetes infrastructure do not execute Docker commands. It might be:SSH to nodes to troubleshoot;Node startup scripts;Monitoring and security agents installed on nodes directly.Third-party tools that perform above mentioned privileged operations. See Migrating telemetry and security agents from dockershim for more information.Make sure there are no indirect dependencies on dockershim behavior. This is an edge case and unlikely to affect your application. Some tooling may be configured to react to Docker-specific behaviors, for example, raise alert on specific metrics or search for a specific log message as part of troubleshooting instructions. If you have such tooling configured, test the behavior on a test cluster before migration.Dependency on Docker explainedA container runtime is software that can execute the containers that make up a Kubernetes pod. Kubernetes is responsible for orchestration and scheduling of Pods; on each node, the kubelet uses the container runtime interface as an abstraction so that you can use any compatible container runtime.In its earliest releases, Kubernetes offered compatibility with one container runtime: Docker. Later in the Kubernetes project's history, cluster operators wanted to adopt additional container runtimes. The CRI was designed to allow this kind of flexibility - and the kubelet began supporting CRI. However, because Docker existed before the CRI specification was invented, the Kubernetes project created an adapter component, dockershim. The dockershim adapter allows the kubelet to interact with Docker as if Docker were a CRI compatible runtime.You can read about it in Kubernetes Containerd integration goes GA blog post.Switching to Containerd as a container runtime eliminates the middleman. All the same containers can be run by container runtimes like Containerd as before. But now, since containers schedule directly with the container runtime, they are not visible to Docker. So any Docker tooling or fancy UI you might have used before to check on these containers is no longer available.You cannot get container information using docker ps or docker inspect commands. As you cannot list containers, you cannot get logs, stop containers, or execute something inside a container using docker exec.Note:If you're running workloads via Kubernetes, the best way to stop a container is through the Kubernetes API rather than directly through the container runtime (this advice applies for all container runtimes, not only Docker).You can still pull images or build them using docker build command. But images built or pulled by Docker would not be visi", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/check-if-dockershim-removal-affects-you/", "id": "k8s_00040"}
{"instruction": "What is the reference documentation for kubectl create configmap?", "response": "kubectl create configmapSynopsisCreate a config map based on a file, directory, or specified literal value.A single config map may package one or more key/value pairs.When creating a config map based on a file, the key will default to the basename of the file, and the value will default to the file content. If the basename is an invalid key, you may specify an alternate key.When creating a config map based on a directory, each file whose basename is a valid key in the directory will be packaged into the config map. Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).kubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none] Examples # Create a new config map named my-config based on folder bar kubectl create configmap my-config --from-file=path/to/bar # Create a new config map named my-config with specified keys instead of file basenames on disk kubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt # Create a new config map named my-config with key1=config1 and key2=config2 kubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2 # Create a new config map named my-config from the key=value pairs in the file kubectl create configmap my-config --from-file=path/to/bar # Create a new config map named my-config from an env file kubectl create configmap my-config --from-env-file=path/to/foo.env --from-env-file=path/to/bar.env Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--append-hashAppend a hash of the configmap to its name.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--from-env-file stringsSpecify the path to a file to read lines of key=val pairs to create a configmap.--from-file stringsKey file can be specified using its file path, in which case file basename will be used as configmap key, or optionally with a key and file path, in which case the given key will be used. Specifying a directory will iterate each named file in the directory whose basename is a valid configmap key.--from-literal stringsSpecify a key and literal value to insert in configmap (i.e. mykey=somevalue)-h, --helphelp for configmap-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_configmap/", "id": "k8s_00041"}
{"instruction": "Write a bash example for kubectl create configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\nkubectl create configmap | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_configmap/", "id": "k8s_00041_code_429"}
{"instruction": "Write a bash example for kubectl create configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\nkubectl create configmap | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_configmap/", "id": "k8s_00041_code_430"}
{"instruction": "What is the reference documentation for kubectl top pod?", "response": "kubectl top podSynopsisDisplay resource (CPU/memory) usage of pods.The 'top pod' command allows you to see the resource consumption of pods.Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.kubectl top pod [NAME | -l label] Examples # Show metrics for all pods in the default namespace kubectl top pod # Show metrics for all pods in the given namespace kubectl top pod --namespace=NAMESPACE # Show metrics for a given pod and its containers kubectl top pod POD_NAME --containers # Show metrics for the pods defined by label name=myLabel kubectl top pod -l name=myLabel Options-A, --all-namespacesIf present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.--containersIf present, print usage of containers within a pod.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-h, --helphelp for pod--no-headersIf present, print output without headers.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-swapPrint pod resources related to swap memory.--sort-by stringIf non-empty, sort pods list using specified field. The field can be either 'cpu' or 'memory'.--sumPrint the sum of the resource usage--use-protocol-buffers Default: trueEnables using protocol-buffers to access Metrics API.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/kubectl_top_pod/", "id": "k8s_00042"}
{"instruction": "Write a bash example for kubectl top pod", "response": "Here's a bash example:\n\n```bash\nkubectl top pod [NAME | -l label]\n```\n\nkubectl top pod | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/kubectl_top_pod/", "id": "k8s_00042_code_432"}
{"instruction": "Write a bash example for kubectl top pod", "response": "Here's a bash example:\n\n```bash\nkubectl top pod [NAME | -l label]\n```\n\nkubectl top pod | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/kubectl_top_pod/", "id": "k8s_00042_code_433"}
{"instruction": "How do you autoscale the dns service in a cluster in Kubernetes?", "response": "Autoscale the DNS Service in a ClusterThis page shows how to enable and configure autoscaling of the DNS service in your Kubernetes cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.This guide assumes your nodes use the AMD64 or Intel 64 CPU architecture.Make sure Kubernetes DNS is enabled.Determine whether DNS horizontal autoscaling is already enabledList the Deployments in your cluster in the kube-system namespace:kubectl get deployment --namespace=kube-system The output is similar to this:NAME READY UP-TO-DATE AVAILABLE AGE ... kube-dns-autoscaler 1/1 1 1 ... ... If you see \"kube-dns-autoscaler\" in the output, DNS horizontal autoscaling is already enabled, and you can skip to Tuning autoscaling parameters.Get the name of your DNS DeploymentList the DNS deployments in your cluster in the kube-system namespace:kubectl get deployment -l k8s-app=kube-dns --namespace=kube-system The output is similar to this:NAME READY UP-TO-DATE AVAILABLE AGE ... coredns 2/2 2 2 ... ... If you don't see a Deployment for DNS services, you can also look for it by name:kubectl get deployment --namespace=kube-system and look for a deployment named coredns or kube-dns.Your scale target isDeployment/<your-deployment-name> where <your-deployment-name> is the name of your DNS Deployment. For example, if the name of your Deployment for DNS is coredns, your scale target is Deployment/coredns.Note:CoreDNS is the default DNS service for Kubernetes. CoreDNS sets the label k8s-app=kube-dns so that it can work in clusters that originally used kube-dns.Enable DNS horizontal autoscalingIn this section, you create a new Deployment. The Pods in the Deployment run a container based on the cluster-proportional-autoscaler-amd64 image.Create a file named dns-horizontal-autoscaler.yaml with this content:admin/dns/dns-horizontal-autoscaler.yaml kind: ServiceAccount apiVersion: v1 metadata: name: kube-dns-autoscaler namespace: kube-system --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: system:kube-dns-autoscaler rules: - apiGroups: [\"\"] resources: [\"nodes\"] verbs: [\"list\", \"watch\"] - apiGroups: [\"\"] resources: [\"replicationcontrollers/scale\"] verbs: [\"get\", \"update\"] - apiGroups: [\"apps\"] resources: [\"deployments/scale\", \"replicasets/scale\"] verbs: [\"get\", \"update\"] # Remove the configmaps rule once below issue is fixed: # kubernetes-incubator/cluster-proportional-autoscaler#16 - apiGroups: [\"\"] resources: [\"configmaps\"] verbs: [\"get\", \"create\"] --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: system:kube-dns-autoscaler subjects: - kind: ServiceAccount name: kube-dns-autoscaler namespace: kube-system roleRef: kind: ClusterRole name: system:kube-dns-autoscaler apiGroup: rbac.authorization.k8s.io --- apiVersion: apps/v1 kind: Deployment metadata: name: kube-dns-autoscaler namespace: kube-system labels: k8s-app: kube-dns-autoscaler kubernetes.io/cluster-service: \"true\" spec: selector: matchLabels: k8s-app: kube-dns-autoscaler template: metadata: labels: k8s-app: kube-dns-autoscaler spec: priorityClassName: system-cluster-critical securityContext: seccompProfile: type: RuntimeDefault supplementalGroups: [ 65534 ] fsGroup: 65534 nodeSelector: kubernetes.io/os: linux containers: - name: autoscaler image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4 resources: requests: cpu: \"20m\" memory: \"10Mi\" command: - /cluster-proportional-autoscaler - --namespace=kube-system - --configmap=kube-dns-autoscaler # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.b", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_435"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -l k8s-app=kube-dns --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_436"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | and look for a deployment named coredns or kube-dns.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_437"}
{"instruction": "Write a yaml example for autoscale the dns service in a cluster", "response": "Here's a yaml example:\n\n```yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\nAutoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_438"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f dns-horizontal-autoscaler.yaml\n```\n\nAutoscale the DNS Service in a Cluster | The output of a successful command is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_439"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_440"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap kube-dns-autoscaler --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | Look for this line:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_441"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment --replicas=0 kube-dns-autoscaler --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_442"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output displays 0 in the DESIRED and CURRENT columns:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_443"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment kube-dns-autoscaler --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_444"}
{"instruction": "Write a yaml example for autoscale the dns service in a cluster", "response": "Here's a yaml example:\n\n```yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\nAutoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_445"}
{"instruction": "Write a yaml example for autoscale the dns service in a cluster", "response": "Here's a yaml example:\n\n```yaml\nlinear: '{\"coresPerReplica\":256,\"min\":1,\"nodesPerReplica\":16}'\n```\n\nAutoscale the DNS Service in a Cluster | Modify the fields according to your needs. The \"min\" field indicates the minimal number of DNS backends. The actual number of backends is calculated using this equation:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_446"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_447"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -l k8s-app=kube-dns --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_448"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | and look for a deployment named coredns or kube-dns.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_449"}
{"instruction": "Write a yaml example for autoscale the dns service in a cluster", "response": "Here's a yaml example:\n\n```yaml\nadmin/dns/dns-horizontal-autoscaler.yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\nAutoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_450"}
{"instruction": "Write a yaml example for autoscale the dns service in a cluster", "response": "Here's a yaml example:\n\n```yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\nAutoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_451"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f dns-horizontal-autoscaler.yaml\n```\n\nAutoscale the DNS Service in a Cluster | The output of a successful command is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_452"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_453"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap kube-dns-autoscaler --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | Look for this line:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_454"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment --replicas=0 kube-dns-autoscaler --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_455"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output displays 0 in the DESIRED and CURRENT columns:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_456"}
{"instruction": "Write a bash example for autoscale the dns service in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment kube-dns-autoscaler --namespace=kube-system\n```\n\nAutoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/", "id": "k8s_00043_code_457"}
{"instruction": "Explain running in multiple zones in Kubernetes", "response": "Running in multiple zonesThis page describes running Kubernetes across multiple zones.BackgroundKubernetes is designed so that a single Kubernetes cluster can run across multiple failure zones, typically where these zones fit within a logical grouping called a region. Major cloud providers define a region as a set of failure zones (also called availability zones) that provide a consistent set of features: within a region, each zone offers the same APIs and services.Typical cloud architectures aim to minimize the chance that a failure in one zone also impairs services in another zone.Control plane behaviorAll control plane components support running as a pool of interchangeable resources, replicated per component.When you deploy a cluster control plane, place replicas of control plane components across multiple failure zones. If availability is an important concern, select at least three failure zones and replicate each individual control plane component (API server, scheduler, etcd, cluster controller manager) across at least three failure zones. If you are running a cloud controller manager then you should also replicate this across all the failure zones you selected.Note:Kubernetes does not provide cross-zone resilience for the API server endpoints. You can use various techniques to improve availability for the cluster API server, including DNS round-robin, SRV records, or a third-party load balancing solution with health checking.Node behaviorKubernetes automatically spreads the Pods for workload resources (such as Deployment or StatefulSet) across different nodes in a cluster. This spreading helps reduce the impact of failures.When nodes start up, the kubelet on each node automatically adds labels to the Node object that represents that specific kubelet in the Kubernetes API. These labels can include zone information.If your cluster spans multiple zones or regions, you can use node labels in conjunction with Pod topology spread constraints to control how Pods are spread across your cluster among fault domains: regions, zones, and even specific nodes. These hints enable the scheduler to place Pods for better expected availability, reducing the risk that a correlated failure affects your whole workload.For example, you can set a constraint to make sure that the 3 replicas of a StatefulSet are all running in different zones to each other, whenever that is feasible. You can define this declaratively without explicitly defining which availability zones are in use for each workload.Distributing nodes across zonesKubernetes' core does not create nodes for you; you need to do that yourself, or use a tool such as the Cluster API to manage nodes on your behalf.Using tools such as the Cluster API you can define sets of machines to run as worker nodes for your cluster across multiple failure domains, and rules to automatically heal the cluster in case of whole-zone service disruption.Manual zone assignment for PodsYou can apply node selector constraints to Pods that you create, as well as to Pod templates in workload resources such as Deployment, StatefulSet, or Job.Storage access for zonesWhen persistent volumes are created, Kubernetes automatically adds zone labels to any PersistentVolumes that are linked to a specific zone. The scheduler then ensures, through its NoVolumeZoneConflict predicate, that pods which claim a given PersistentVolume are only placed into the same zone as that volume.Please note that the method of adding zone labels can depend on your cloud provider and the storage provisioner you’re using. Always refer to the specific documentation for your environment to ensure correct configuration.You can specify a StorageClass for PersistentVolumeClaims that specifies the failure domains (zones) that the storage in that class may use. To learn about configuring a StorageClass that is aware of failure domains or zones, see Allowed topologies.NetworkingBy itself, Kubernetes does not include zone-aware networking. You can u", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/best-practices/multiple-zones/", "id": "k8s_00044"}
{"instruction": "What is the reference documentation for kubernetes z-pages?", "response": "Kubernetes z-pagesProvides runtime diagnostics for Kubernetes components, offering insights into component runtime status and configuration flags.FEATURE STATE: Kubernetes v1.32 [alpha]Kubernetes core components can expose a suite of z-endpoints to make it easier for users to debug their cluster and its components. These endpoints are strictly to be used for human inspection to gain real time debugging information of a component binary. Avoid automated scraping of data returned by these endpoints; in Kubernetes 1.34 these are an alpha feature and the response format may change in future releases.z-pagesKubernetes v1.34 allows you to enable z-pages to help you troubleshoot problems with its core control plane components. These special debugging endpoints provide internal information about running components. For Kubernetes 1.34, components serve the following endpoints (when enabled):z-pagesstatuszflagzstatuszEnabled using the ComponentStatusz feature gate, the /statusz endpoint displays high level information about the component such as its Kubernetes version, emulation version, start time and more.The /statusz response from the API server is similar to:kube-apiserver statusz Warning: This endpoint is not meant to be machine parseable, has no formatting compatibility guarantees and is for debugging purposes only. Started: Wed Oct 16 21:03:43 UTC 2024 Up: 0 hr 00 min 16 sec Go version: go1.23.2 Binary version: 1.32.0-alpha.0.1484&#43;5eeac4f21a491b-dirty Emulation version: 1.32.0-alpha.0.1484 flagzEnabled using the ComponentFlagz feature gate, the /flagz endpoint shows you the command line arguments that were used to start a component.The /flagz data for the API server looks something like:kube-apiserver flags Warning: This endpoint is not meant to be machine parseable, has no formatting compatibility guarantees and is for debugging purposes only. advertise-address=192.168.8.2 contention-profiling=false enable-priority-and-fairness=true profiling=true authorization-mode=[Node,RBAC] authorization-webhook-cache-authorized-ttl=5m0s authorization-webhook-cache-unauthorized-ttl=30s authorization-webhook-version=v1beta1 default-watch-cache-size=100", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/zpages/", "id": "k8s_00045"}
{"instruction": "How do you pull an image from a private registry in Kubernetes?", "response": "Pull an Image from a Private RegistryThis page shows how to create a Pod that uses a Secret to pull an image from a private container image registry or repository. There are many private registries in use. This task uses Docker Hub as an example registry.🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationBefore you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo do this exercise, you need the docker command line tool, and a Docker ID for which you know the password.If you are using a different private container registry, you need the command line tool for that registry and any login information for the registry.Log in to Docker HubOn your laptop, you must authenticate with a registry in order to pull a private image.Use the docker tool to log in to Docker Hub. See the log in section of Docker ID accounts for more information.docker login When prompted, enter your Docker ID, and then the credential you want to use (access token, or the password for your Docker ID).The login process creates or updates a config.json file that holds an authorization token. Review how Kubernetes interprets this file.View the config.json file:cat ~/.docker/config.json The output contains a section similar to this:{ \"auths\": { \"https://index.docker.io/v1/\": { \"auth\": \"c3R...zE2\" } } } Note:If you use a Docker credentials store, you won't see that auth entry but a credsStore entry with the name of the store as value. In that case, you can create a secret directly. See Create a Secret by providing credentials on the command line.Create a Secret based on existing credentialsA Kubernetes cluster uses the Secret of kubernetes.io/dockerconfigjson type to authenticate with a container registry to pull a private image.If you already ran docker login, you can copy that credential into Kubernetes:kubectl create secret generic regcred \\ --from-file=.dockerconfigjson=<path/to/.docker/config.json> \\ --type=kubernetes.io/dockerconfigjson If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it. Be sure to:set the name of the data item to .dockerconfigjsonbase64 encode the Docker configuration file and then paste that string, unbroken as the value for field data[\".dockerconfigjson\"]set type to kubernetes.io/dockerconfigjsonExample:apiVersion: v1 kind: Secret metadata: name: myregistrykey namespace: awesomeapps data: .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg== type: kubernetes.io/dockerconfigjson If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfigjson]: invalid value ..., it means the base64 encoded string in the data was successfully decoded, but could not be parsed as a .docker/config.json file.Create a Secret by providing credentials on the command lineCreate this Secret, naming it regcred:kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email> where:<your-registry-server> is your Private Docker Registry FQDN. Use https://index.docker.io/v1/ for DockerHub.<your-name> is your Docker username.<your-pword> is your Docker password.<your-email> is your", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic regcred \\\n    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \\\n    --type=kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it. Be sure to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_461"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_462"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>\n```\n\nPull an Image from a Private Registry | where:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_463"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=yaml\n```\n\nPull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_464"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_465"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=\"jsonpath={.data.\\.dockerconfigjson}\" | base64 --decode\n```\n\nPull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_466"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\nPull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_467"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-private-reg-pod.yaml\nkubectl get pod private-reg\n```\n\nPull an Image from a Private Registry | Also, in case the Pod fails to start with the status ImagePullBackOff, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_468"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod private-reg\n```\n\nPull an Image from a Private Registry | If you then see an event with the reason set to FailedToRetrieveImagePullSecret, Kubernetes can't find a Secret with name (regcred, in this example).", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_469"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_470"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_471"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\nPull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_472"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic regcred \\\n    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \\\n    --type=kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it. Be sure to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_473"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_474"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>\n```\n\nPull an Image from a Private Registry | where:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_475"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=yaml\n```\n\nPull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_476"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\nPull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_477"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=\"jsonpath={.data.\\.dockerconfigjson}\" | base64 --decode\n```\n\nPull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_478"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\npods/private-reg-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\nPull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_479"}
{"instruction": "Write a yaml example for pull an image from a private registry", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\nPull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_480"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-private-reg-pod.yaml\nkubectl get pod private-reg\n```\n\nPull an Image from a Private Registry | Also, in case the Pod fails to start with the status ImagePullBackOff, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_481"}
{"instruction": "Write a bash example for pull an image from a private registry", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod private-reg\n```\n\nPull an Image from a Private Registry | If you then see an event with the reason set to FailedToRetrieveImagePullSecret, Kubernetes can't find a Secret with name (regcred, in this example).", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/", "id": "k8s_00046_code_482"}
{"instruction": "Explain the Kubernetes concept: Node Shutdowns", "response": "Node ShutdownsIn a Kubernetes cluster, a node can be shut down in a planned graceful way or unexpectedly because of reasons such as a power outage or something else external. A node shutdown could lead to workload failure if the node is not drained before the shutdown. A node shutdown can be either graceful or non-graceful.Graceful node shutdownThe kubelet attempts to detect node system shutdown and terminates pods running on the node.Kubelet ensures that pods follow the normal pod termination process during the node shutdown. During node shutdown, the kubelet does not accept new Pods (even if those Pods are already bound to the node).Enabling graceful node shutdownFEATURE STATE: Kubernetes v1.21 [beta] (enabled by default: true)On Linux, the graceful node shutdown feature is controlled with the GracefulNodeShutdown feature gate which is enabled by default in 1.21.Note:The graceful node shutdown feature depends on systemd since it takes advantage of systemd inhibitor locks to delay the node shutdown with a given duration.FEATURE STATE: Kubernetes v1.34 [beta] (enabled by default: true)On Windows, the graceful node shutdown feature is controlled with the WindowsGracefulNodeShutdown feature gate which is introduced in 1.32 as an alpha feature. In Kubernetes 1.34 the feature is Beta and is enabled by default.Note:The Windows graceful node shutdown feature depends on kubelet running as a Windows service, it will then have a registered service control handler to delay the preshutdown event with a given duration.Windows graceful node shutdown can not be cancelled.If kubelet is not running as a Windows service, it will not be able to set and monitor the Preshutdown event, the node will have to go through the Non-Graceful Node Shutdown procedure mentioned above.In the case where the Windows graceful node shutdown feature is enabled, but the kubelet is not running as a Windows service, the kubelet will continue running instead of failing. However, it will log an error indicating that it needs to be run as a Windows service.Configuring graceful node shutdownNote that by default, both configuration options described below, shutdownGracePeriod and shutdownGracePeriodCriticalPods, are set to zero, thus not activating the graceful node shutdown functionality. To activate the feature, both options should be configured appropriately and set to non-zero values.Once the kubelet is notified of a node shutdown, it sets a NotReady condition on the Node, with the reason set to \"node is shutting down\". The kube-scheduler honors this condition and does not schedule any Pods onto the affected node; other third-party schedulers are expected to follow the same logic. This means that new Pods won't be scheduled onto that node and therefore none will start.The kubelet also rejects Pods during the PodAdmission phase if an ongoing node shutdown has been detected, so that even Pods with a toleration for node.kubernetes.io/not-ready:NoSchedule do not start there.When kubelet is setting that condition on its Node via the API, the kubelet also begins terminating any Pods that are running locally.During a graceful shutdown, kubelet terminates pods in two phases:Terminate regular pods running on the node.Terminate critical pods running on the node.The graceful node shutdown feature is configured with two KubeletConfiguration options:shutdownGracePeriod:Specifies the total duration that the node should delay the shutdown by. This is the total grace period for pod termination for both regular and critical pods.shutdownGracePeriodCriticalPods:Specifies the duration used to terminate critical pods during a node shutdown. This value should be less than shutdownGracePeriod.Note:There are cases when Node termination was cancelled by the system (or perhaps manually by an administrator). In either of those situations the Node will return to the Ready state. However, Pods which already started the process of termination will not be restored by kubelet and will need to be r", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/node-shutdown/", "id": "k8s_00047"}
{"instruction": "Write a yaml example for node shutdowns", "response": "Here's a yaml example:\n\n```yaml\nshutdownGracePeriodByPodPriority:\n  - priority: 100000\n    shutdownGracePeriodSeconds: 10\n  - priority: 10000\n    shutdownGracePeriodSeconds: 180\n  - priority: 1000\n    shutdownGracePeriodSeconds: 120\n  - priority: 0\n    shutdownGracePeriodSeconds: 60\n```\n\nNode Shutdowns | The above table implies that any pod with priority value >= 100000 will get just 10 seconds to shut down, any pod with value >= 10000 and < 100000 will get 180 seconds to shut down, any pod with value", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/node-shutdown/", "id": "k8s_00047_code_484"}
{"instruction": "Explain the Kubernetes concept: The Kubernetes API", "response": "The Kubernetes APIThe Kubernetes API lets you query and manipulate the state of objects in Kubernetes. The core of Kubernetes' control plane is the API server and the HTTP API that it exposes. Users, the different parts of your cluster, and external components all communicate with one another through the API server.The core of Kubernetes' control plane is the API server. The API server exposes an HTTP API that lets end users, different parts of your cluster, and external components communicate with one another.The Kubernetes API lets you query and manipulate the state of API objects in Kubernetes (for example: Pods, Namespaces, ConfigMaps, and Events).Most operations can be performed through the kubectl command-line interface or other command-line tools, such as kubeadm, which in turn use the API. However, you can also access the API directly using REST calls. Kubernetes provides a set of client libraries for those looking to write applications using the Kubernetes API.Each Kubernetes cluster publishes the specification of the APIs that the cluster serves. There are two mechanisms that Kubernetes uses to publish these API specifications; both are useful to enable automatic interoperability. For example, the kubectl tool fetches and caches the API specification for enabling command-line completion and other features. The two supported mechanisms are as follows:The Discovery API provides information about the Kubernetes APIs: API names, resources, versions, and supported operations. This is a Kubernetes specific term as it is a separate API from the Kubernetes OpenAPI. It is intended to be a brief summary of the available resources and it does not detail specific schema for the resources. For reference about resource schemas, please refer to the OpenAPI document.The Kubernetes OpenAPI Document provides (full) OpenAPI v2.0 and 3.0 schemas for all Kubernetes API endpoints. The OpenAPI v3 is the preferred method for accessing OpenAPI as it provides a more comprehensive and accurate view of the API. It includes all the available API paths, as well as all resources consumed and produced for every operations on every endpoints. It also includes any extensibility components that a cluster supports. The data is a complete specification and is significantly larger than that from the Discovery API.Discovery APIKubernetes publishes a list of all group versions and resources supported via the Discovery API. This includes the following for each resource:NameCluster or namespaced scopeEndpoint URL and supported verbsAlternative namesGroup, version, kindThe API is available in both aggregated and unaggregated form. The aggregated discovery serves two endpoints, while the unaggregated discovery serves a separate endpoint for each group version.Aggregated discoveryFEATURE STATE: Kubernetes v1.30 [stable] (enabled by default: true)Kubernetes offers stable support for aggregated discovery, publishing all resources supported by a cluster through two endpoints (/api and /apis). Requesting this endpoint drastically reduces the number of requests sent to fetch the discovery data from the cluster. You can access the data by requesting the respective endpoints with an Accept header indicating the aggregated discovery resource: Accept: application/json;v=v2;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList.Without indicating the resource type using the Accept header, the default response for the /api and /apis endpoint is an unaggregated discovery document.The discovery document for the built-in resources can be found in the Kubernetes GitHub repository. This Github document can be used as a reference of the base set of the available resources if a Kubernetes cluster is not available to query.The endpoint also supports ETag and protobuf encoding.Unaggregated discoveryWithout discovery aggregation, discovery is published in levels, with the root endpoints publishing discovery information for downstream documents.A list of all group versions supported by a cl", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/kubernetes-api/", "id": "k8s_00048"}
{"instruction": "Write a bash example for the kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl apply --dry-run=server\n```\n\nThe Kubernetes API | Kubernetes supports publishing a description of its APIs as OpenAPI v3.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/kubernetes-api/", "id": "k8s_00048_code_486"}
{"instruction": "Write a yaml example for the kubernetes api", "response": "Here's a yaml example:\n\n```yaml\n{\n    \"paths\": {\n        ...,\n        \"api/v1\": {\n            \"serverRelativeURL\": \"/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF\"\n        },\n        \"apis/admissionregistration.k8s.io/v1\": {\n            \"serverRelativeURL\": \"/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597\"\n        },\n        ....\n    }\n}\n```\n\nThe Kubernetes API | The relative URLs are pointing to immutable OpenAPI descriptions, in order to improve client-side caching. The proper HTTP caching headers are also set by the API server for that purpose (Expires to 1", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/kubernetes-api/", "id": "k8s_00048_code_487"}
{"instruction": "How do you use an http proxy to access the kubernetes api in Kubernetes?", "response": "Use an HTTP Proxy to Access the Kubernetes APIThis page shows how to use an HTTP proxy to access the Kubernetes API.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.If you do not already have an application running in your cluster, start a Hello world application by entering this command:kubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0 --port=8080 Using kubectl to start a proxy serverThis command starts a proxy to the Kubernetes API server:kubectl proxy --port=8080 Exploring the Kubernetes APIWhen the proxy server is running, you can explore the API using curl, wget, or a browser.Get the API versions:curl http://localhost:8080/api/ The output should look similar to this:{ \"kind\": \"APIVersions\", \"versions\": [ \"v1\" ], \"serverAddressByClientCIDRs\": [ { \"clientCIDR\": \"0.0.0.0/0\", \"serverAddress\": \"10.0.2.15:8443\" } ] } Get a list of pods:curl http://localhost:8080/api/v1/namespaces/default/pods The output should look similar to this:{ \"kind\": \"PodList\", \"apiVersion\": \"v1\", \"metadata\": { \"resourceVersion\": \"33074\" }, \"items\": [ { \"metadata\": { \"name\": \"kubernetes-bootcamp-2321272333-ix8pt\", \"generateName\": \"kubernetes-bootcamp-2321272333-\", \"namespace\": \"default\", \"uid\": \"ba21457c-6b1d-11e6-85f7-1ef9f1dab92b\", \"resourceVersion\": \"33003\", \"creationTimestamp\": \"2016-08-25T23:43:30Z\", \"labels\": { \"pod-template-hash\": \"2321272333\", \"run\": \"kubernetes-bootcamp\" }, ... } What's nextLearn more about kubectl proxy.", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/http-proxy-access-api/", "id": "k8s_00049"}
{"instruction": "Write a bash example for use an http proxy to access the kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0 --port=8080\n```\n\nUse an HTTP Proxy to Access the Kubernetes API | This command starts a proxy to the Kubernetes API server:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/http-proxy-access-api/", "id": "k8s_00049_code_489"}
{"instruction": "Write a bash example for use an http proxy to access the kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse an HTTP Proxy to Access the Kubernetes API | When the proxy server is running, you can explore the API using curl, wget, or a browser.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/http-proxy-access-api/", "id": "k8s_00049_code_490"}
{"instruction": "Write a bash example for use an http proxy to access the kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse an HTTP Proxy to Access the Kubernetes API | When the proxy server is running, you can explore the API using curl, wget, or a browser.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/http-proxy-access-api/", "id": "k8s_00049_code_491"}
{"instruction": "Write a bash example for use an http proxy to access the kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0 --port=8080\n```\n\nUse an HTTP Proxy to Access the Kubernetes API | This command starts a proxy to the Kubernetes API server:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/http-proxy-access-api/", "id": "k8s_00049_code_492"}
{"instruction": "How do you managing secrets using kubectl in Kubernetes?", "response": "Managing Secrets using kubectlCreating Secret objects using kubectl command line.This page shows you how to create, edit, manage, and delete Kubernetes Secrets using the kubectl command-line tool.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesCreate a SecretA Secret object stores sensitive data such as credentials used by Pods to access services. For example, you might need a Secret to store the username and password needed to access a database.You can create the Secret by passing the raw data in the command, or by storing the credentials in files that you pass in the command. The following commands create a Secret that stores the username admin and the password S!B\\*d$zDsb=.Use raw dataRun the following command:kubectl create secret generic db-user-pass \\ --from-literal=username=admin \\ --from-literal=password='S!B\\*d$zDsb=' You must use single quotes '' to escape special characters such as $, \\, *, =, and ! in your strings. If you don't, your shell will interpret these characters.Note:The stringData field for a Secret does not work well with server-side apply.Use source filesStore the credentials in files:echo -n 'admin' > ./username.txt echo -n 'S!B\\*d$zDsb=' > ./password.txt The -n flag ensures that the generated files do not have an extra newline character at the end of the text. This is important because when kubectl reads a file and encodes the content into a base64 string, the extra newline character gets encoded too. You do not need to escape special characters in strings that you include in a file.Pass the file paths in the kubectl command:kubectl create secret generic db-user-pass \\ --from-file=./username.txt \\ --from-file=./password.txt The default key name is the file name. You can optionally set the key name using --from-file=[key=]source. For example:kubectl create secret generic db-user-pass \\ --from-file=username=./username.txt \\ --from-file=password=./password.txt With either method, the output is similar to:secret/db-user-pass created Verify the SecretCheck that the Secret was created:kubectl get secrets The output is similar to:NAME TYPE DATA AGE db-user-pass Opaque 2 51s View the details of the Secret:kubectl describe secret db-user-pass The output is similar to:Name: db-user-pass Namespace: default Labels: <none> Annotations: <none> Type: Opaque Data ==== password: 12 bytes username: 5 bytes The commands kubectl get and kubectl describe avoid showing the contents of a Secret by default. This is to protect the Secret from being exposed accidentally, or from being stored in a terminal log.Decode the SecretView the contents of the Secret you created:kubectl get secret db-user-pass -o jsonpath='{.data}' The output is similar to:{ \"password\": \"UyFCXCpkJHpEc2I9\", \"username\": \"YWRtaW4=\" } Decode the password data:echo 'UyFCXCpkJHpEc2I9' | base64 --decode The output is similar to:S!B\\*d$zDsb= Caution:This is an example for documentation purposes. In practice, this method could cause the command with the encoded data to be stored in your shell history. Anyone with access to your computer could find the command and decode the secret. A better approach is to combine the view and decode commands.kubectl get secret db-user-pass -o jsonpath='{.data.password}' | base64 --decode Edit a SecretYou can edit an existing Secret object unless it is immutable. To edit a Secret, run the following command:kubectl edit secrets <secret-name> This opens your default editor and allows you to update the base64 encoded Secret values in the data field, such as in the following example:# Please edit the object below. Lines beginning with a '#' will be i", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-literal=username=admin \\\n    --from-literal=password='S!B\\*d$zDsb='\n```\n\nManaging Secrets using kubectl | You must use single quotes '' to escape special characters such as $, \\, *, =, and ! in your strings. If you don't, your shell will interpret these characters.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_494"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=./username.txt \\\n    --from-file=./password.txt\n```\n\nManaging Secrets using kubectl | The default key name is the file name. You can optionally set the key name using --from-file=[key=]source. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_495"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=username=./username.txt \\\n    --from-file=password=./password.txt\n```\n\nManaging Secrets using kubectl | With either method, the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_496"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret db-user-pass\n```\n\nManaging Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_497"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data}'\n```\n\nManaging Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_498"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data.password}' | base64 --decode\n```\n\nManaging Secrets using kubectl | You can edit an existing Secret object unless it is immutable. To edit a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_499"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl edit secrets <secret-name>\n```\n\nManaging Secrets using kubectl | This opens your default editor and allows you to update the base64 encoded Secret values in the data field, such as in the following example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_500"}
{"instruction": "Write a yaml example for managing secrets using kubectl", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file, it will be\n# reopened with the relevant failures.\n#\napiVersion: v1\ndata:\n  password: UyFCXCpkJHpEc2I9\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  creationTimestamp: \"2022-06-28T17:44:13Z\"\n  name: db-user-pass\n  namespace: default\n  resourceVersion: \"12708504\"\n  uid: 91becd59-78fa-4c85-823f-6d44436242ac\ntype: Opaque\n```\n\nManaging Secrets using kubectl | To delete a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_501"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\nManaging Secrets using kubectl |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_502"}
{"instruction": "Write a yaml example for managing secrets using kubectl", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file, it will be\n# reopened with the relevant failures.\n#\napiVersion: v1\ndata:\n  password: UyFCXCpkJHpEc2I9\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  creationTimestamp: \"2022-06-28T17:44:13Z\"\n  name: db-user-pass\n  namespace: default\n  resourceVersion: \"12708504\"\n  uid: 91becd59-78fa-4c85-823f-6d44436242ac\ntype: Opaque\n```\n\nManaging Secrets using kubectl | To delete a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_503"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-literal=username=admin \\\n    --from-literal=password='S!B\\*d$zDsb='\n```\n\nManaging Secrets using kubectl | You must use single quotes '' to escape special characters such as $, \\, *, =, and ! in your strings. If you don't, your shell will interpret these characters.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_504"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=./username.txt \\\n    --from-file=./password.txt\n```\n\nManaging Secrets using kubectl | The default key name is the file name. You can optionally set the key name using --from-file=[key=]source. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_505"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=username=./username.txt \\\n    --from-file=password=./password.txt\n```\n\nManaging Secrets using kubectl | With either method, the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_506"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret db-user-pass\n```\n\nManaging Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_507"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data}'\n```\n\nManaging Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_508"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data.password}' | base64 --decode\n```\n\nManaging Secrets using kubectl | You can edit an existing Secret object unless it is immutable. To edit a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_509"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl edit secrets <secret-name>\n```\n\nManaging Secrets using kubectl | This opens your default editor and allows you to update the base64 encoded Secret values in the data field, such as in the following example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_510"}
{"instruction": "Write a yaml example for managing secrets using kubectl", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file, it will be\n# reopened with the relevant failures.\n#\napiVersion: v1\ndata:\n  password: UyFCXCpkJHpEc2I9\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  creationTimestamp: \"2022-06-28T17:44:13Z\"\n  name: db-user-pass\n  namespace: default\n  resourceVersion: \"12708504\"\n  uid: 91becd59-78fa-4c85-823f-6d44436242ac\ntype: Opaque\n```\n\nManaging Secrets using kubectl | To delete a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_511"}
{"instruction": "Write a bash example for managing secrets using kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\nManaging Secrets using kubectl |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/", "id": "k8s_00050_code_512"}
{"instruction": "Explain the Kubernetes concept: Windows in Kubernetes", "response": "Windows in KubernetesKubernetes supports nodes that run Microsoft Windows.Kubernetes supports worker nodes running either Linux or Microsoft Windows.🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationThe CNCF and its parent the Linux Foundation take a vendor-neutral approach towards compatibility. It is possible to join your Windows server as a worker node to a Kubernetes cluster.You can install and set up kubectl on Windows no matter what operating system you use within your cluster.If you are using Windows nodes, you can read:Networking On WindowsWindows Storage In KubernetesResource Management for Windows NodesConfigure RunAsUserName for Windows Pods and ContainersCreate A Windows HostProcess PodConfigure Group Managed Service Accounts for Windows Pods and ContainersSecurity For Windows NodesWindows Debugging TipsGuide for Scheduling Windows Containers in Kubernetesor, for an overview, read:Windows containers in KubernetesGuide for Running Windows Containers in KubernetesItems on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/windows/", "id": "k8s_00051"}
{"instruction": "How do you perform a rolling update on a daemonset in Kubernetes?", "response": "Perform a Rolling Update on a DaemonSetThis page shows how to perform a rolling update on a DaemonSet.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesDaemonSet Update StrategyDaemonSet has two update strategy types:OnDelete: With OnDelete update strategy, after you update a DaemonSet template, new DaemonSet pods will only be created when you manually delete old DaemonSet pods. This is the same behavior of DaemonSet in Kubernetes version 1.5 or before.RollingUpdate: This is the default update strategy.With RollingUpdate update strategy, after you update a DaemonSet template, old DaemonSet pods will be killed, and new DaemonSet pods will be created automatically, in a controlled fashion. At most one pod of the DaemonSet will be running on each node during the whole update process.Performing a Rolling UpdateTo enable the rolling update feature of a DaemonSet, you must set its .spec.updateStrategy.type to RollingUpdate.You may want to set .spec.updateStrategy.rollingUpdate.maxUnavailable (default to 1), .spec.minReadySeconds (default to 0) and .spec.updateStrategy.rollingUpdate.maxSurge (defaults to 0) as well.Creating a DaemonSet with RollingUpdate update strategyThis YAML file specifies a DaemonSet with an update strategy as 'RollingUpdate'controllers/fluentd-daemonset.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: fluentd-elasticsearch namespace: kube-system labels: k8s-app: fluentd-logging spec: selector: matchLabels: name: fluentd-elasticsearch updateStrategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 template: metadata: labels: name: fluentd-elasticsearch spec: tolerations: # these tolerations are to have the daemonset runnable on control plane nodes # remove them if your control plane nodes should not run pods - key: node-role.kubernetes.io/control-plane operator: Exists effect: NoSchedule - key: node-role.kubernetes.io/master operator: Exists effect: NoSchedule containers: - name: fluentd-elasticsearch image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1 volumeMounts: - name: varlog mountPath: /var/log - name: varlibdockercontainers mountPath: /var/lib/docker/containers readOnly: true terminationGracePeriodSeconds: 30 volumes: - name: varlog hostPath: path: /var/log - name: varlibdockercontainers hostPath: path: /var/lib/docker/containers After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:kubectl create -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml Alternatively, use kubectl apply to create the same DaemonSet if you plan to update the DaemonSet with kubectl apply.kubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml Checking DaemonSet RollingUpdate update strategyCheck the update strategy of your DaemonSet, and make sure it's set to RollingUpdate:kubectl get ds/fluentd-elasticsearch -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}' -n kube-system If you haven't created the DaemonSet in the system, check your DaemonSet manifest with the following command instead:kubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml --dry-run=client -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}' The output from both commands should be:RollingUpdate If the output isn't RollingUpdate, go back and modify the DaemonSet object or manifest accordingly.Updating a DaemonSet templateAny updates to a RollingUpdate DaemonSet .spec.template will trigger a rolling update. Let's update the DaemonSet by applying a new YAML file. This can be done with several different kubectl commands.controllers/fluentd-daemonset-update.yaml apiVersion: apps/v1 kin", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_515"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\nPerform a Rolling Update on a DaemonSet | Alternatively, use kubectl apply to create the same DaemonSet if you plan to update the DaemonSet with kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_516"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\nPerform a Rolling Update on a DaemonSet | Check the update strategy of your DaemonSet, and make sure it's set to RollingUpdate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_517"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get ds/fluentd-elasticsearch -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}' -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | If you haven't created the DaemonSet in the system, check your DaemonSet manifest with the following command instead:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_518"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml --dry-run=client -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}'\n```\n\nPerform a Rolling Update on a DaemonSet | The output from both commands should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_519"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_520"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset-update.yaml\n```\n\nPerform a Rolling Update on a DaemonSet | If you update DaemonSets using imperative commands, use kubectl edit :", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_521"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl edit ds/fluentd-elasticsearch -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | If you only need to update the container image in the DaemonSet template, i.e. .spec.template.spec.containers[*].image, use kubectl set image:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_522"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl set image ds/fluentd-elasticsearch fluentd-elasticsearch=quay.io/fluentd_elasticsearch/fluentd:v2.6.0 -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | Finally, watch the rollout status of the latest DaemonSet rolling update:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_523"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/fluentd-elasticsearch -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | When the rollout is complete, the output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_524"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l name=fluentd-elasticsearch -o wide -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | Once you've found those nodes, delete some non-DaemonSet pods from the node to make room for new DaemonSet pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_525"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl delete ds fluentd-elasticsearch -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_526"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_527"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_528"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/fluentd-daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_529"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_530"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\nPerform a Rolling Update on a DaemonSet | Alternatively, use kubectl apply to create the same DaemonSet if you plan to update the DaemonSet with kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_531"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\nPerform a Rolling Update on a DaemonSet | Check the update strategy of your DaemonSet, and make sure it's set to RollingUpdate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_532"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get ds/fluentd-elasticsearch -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}' -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | If you haven't created the DaemonSet in the system, check your DaemonSet manifest with the following command instead:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_533"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml --dry-run=client -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}'\n```\n\nPerform a Rolling Update on a DaemonSet | The output from both commands should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_534"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/fluentd-daemonset-update.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_535"}
{"instruction": "Write a yaml example for perform a rolling update on a daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\nPerform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_536"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset-update.yaml\n```\n\nPerform a Rolling Update on a DaemonSet | If you update DaemonSets using imperative commands, use kubectl edit :", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_537"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl edit ds/fluentd-elasticsearch -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | If you only need to update the container image in the DaemonSet template, i.e. .spec.template.spec.containers[*].image, use kubectl set image:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_538"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl set image ds/fluentd-elasticsearch fluentd-elasticsearch=quay.io/fluentd_elasticsearch/fluentd:v2.6.0 -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | Finally, watch the rollout status of the latest DaemonSet rolling update:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_539"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/fluentd-elasticsearch -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | When the rollout is complete, the output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_540"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l name=fluentd-elasticsearch -o wide -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet | Once you've found those nodes, delete some non-DaemonSet pods from the node to make room for new DaemonSet pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_541"}
{"instruction": "Write a bash example for perform a rolling update on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl delete ds fluentd-elasticsearch -n kube-system\n```\n\nPerform a Rolling Update on a DaemonSet |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/", "id": "k8s_00052_code_542"}
{"instruction": "What is the reference documentation for common parameters?", "response": "Common ParametersallowWatchBookmarksallowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored.continueThe continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-parameters/common-parameters/", "id": "k8s_00053"}
{"instruction": "What is the reference documentation for node metrics data?", "response": "Node metrics dataMechanisms for accessing metrics at node, volume, pod and container level, as seen by the kubelet.The kubelet gathers metric statistics at the node, volume, pod and container level, and emits this information in the Summary API.You can send a proxied request to the stats summary API via the Kubernetes API server.Here is an example of a Summary API request for a node named minikube:kubectl get --raw \"/api/v1/nodes/minikube/proxy/stats/summary\" Here is the same API call using curl:# You need to run \"kubectl proxy\" first # Change 8080 to the port that \"kubectl proxy\" assigns curl http://localhost:8080/api/v1/nodes/minikube/proxy/stats/summary Note:Beginning with metrics-server 0.6.x, metrics-server queries the /metrics/resource kubelet endpoint, and not /stats/summary.Summary metrics API sourceBy default, Kubernetes fetches node summary metrics data using an embedded cAdvisor that runs within the kubelet. If you enable the PodAndContainerStatsFromCRI feature gate in your cluster, and you use a container runtime that supports statistics access via Container Runtime Interface (CRI), then the kubelet fetches Pod- and container-level metric data using CRI, and not via cAdvisor.Pressure Stall Information (PSI)FEATURE STATE: Kubernetes v1.34 [beta]As a beta feature, Kubernetes lets you configure kubelet to collect Linux kernel Pressure Stall Information (PSI) for CPU, memory, and I/O usage. The information is collected at node, pod and container level. See Summary API for detailed schema. This feature is enabled by default, by setting the KubeletPSI feature gate. The information is also exposed in Prometheus metrics.You can learn how to interpret the PSI metrics in Understand PSI Metrics.RequirementsPressure Stall Information requires:Linux kernel versions 4.20 or later.cgroup v2What's nextThe task pages for Troubleshooting Clusters discuss how to use a metrics pipeline that rely on these data.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/node-metrics/", "id": "k8s_00054"}
{"instruction": "Write a bash example for node metrics data", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/minikube/proxy/stats/summary\"\n```\n\nNode metrics data | Here is the same API call using curl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/node-metrics/", "id": "k8s_00054_code_545"}
{"instruction": "Write a bash example for node metrics data", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/minikube/proxy/stats/summary\"\n```\n\nNode metrics data | Here is the same API call using curl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/node-metrics/", "id": "k8s_00054_code_546"}
{"instruction": "What is the reference documentation for validatingwebhookconfiguration?", "response": "ValidatingWebhookConfigurationValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.apiVersion: admissionregistration.k8s.io/v1import \"k8s.io/api/admissionregistration/v1\"ValidatingWebhookConfigurationValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.apiVersion: admissionregistration.k8s.io/v1kind: ValidatingWebhookConfigurationmetadata (ObjectMeta)Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.webhooks ([]ValidatingWebhook)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeWebhooks is a list of webhooks and the affected resources and operations.ValidatingWebhook describes an admission webhook and the resources and operations it applies to.webhooks.admissionReviewVersions ([]string), requiredAtomic: will be replaced during a mergeAdmissionReviewVersions is an ordered list of preferred AdmissionReview versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.webhooks.clientConfig (WebhookClientConfig), requiredClientConfig defines how to communicate with the hook. RequiredWebhookClientConfig contains the information to make a TLS connection with the webhookwebhooks.clientConfig.caBundle ([]byte)caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.webhooks.clientConfig.service (ServiceReference)service is a reference to the service for this webhook. Either service or url must be specified.If the webhook is running within the cluster, then you should use service.ServiceReference holds a reference to Service.legacy.k8s.iowebhooks.clientConfig.service.name (string), requiredname is the name of the service. Requiredwebhooks.clientConfig.service.namespace (string), requirednamespace is the namespace of the service. Requiredwebhooks.clientConfig.service.path (string)path is an optional URL path which will be sent in any request to this service.webhooks.clientConfig.service.port (int32)If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. port should be a valid port number (1-65535, inclusive).webhooks.clientConfig.url (string)url gives the location of the webhook, in standard URL form (scheme://host:port/path). Exactly one of url or service must be specified.The host should not refer to a service running in the cluster; use the service field instead. The host might be resolved via external DNS in some apiservers (e.g., kube-apiserver cannot resolve in-cluster DNS as that would be a layering violation). host may also be an IP address.Please note that using localhost or 127.0.0.1 as a host is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.The scheme must be \"https\"; the URL must begin with \"https://\".A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.webhooks.name (string), requiredThe name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/validating-webhook-configuration-v1/", "id": "k8s_00055"}
{"instruction": "Write a yaml example for validatingwebhookconfiguration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\nValidatingWebhookConfiguration | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/validating-webhook-configuration-v1/", "id": "k8s_00055_code_548"}
{"instruction": "Explain the Kubernetes concept: Services, Load Balancing, and Networking", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Services, Load Balancing, and NetworkingConcepts and resources behind networking in Kubernetes.1: Service2: Ingress3: Ingress Controllers4: Gateway API5: EndpointSlices6: Network Policies7: DNS for Services and Pods8: IPv4/IPv6 dual-stack9: Topology Aware Routing10: Networking on Windows11: Service ClusterIP allocation12: Service Internal Traffic PolicyThe Kubernetes network modelThe Kubernetes network model is built out of several pieces:Each pod in a cluster gets its own unique cluster-wide IP address.A pod has its own private network namespace which is shared by all of the containers within the pod. Processes running in different containers in the same pod can communicate with each other over localhost.The pod network (also called a cluster network) handles communication between pods. It ensures that (barring intentional network segmentation):All pods can communicate with all other pods, whether they are on the same node or on different nodes. Pods can communicate with each other directly, without the use of proxies or address translation (NAT).On Windows, this rule does not apply to host-network pods.Agents on a node (such as system daemons, or kubelet) can communicate with all pods on that node.The Service API lets you provide a stable (long lived) IP address or hostname for a service implemented by one or more backend pods, where the individual pods making up the service can change over time.Kubernetes automatically manages EndpointSlice objects to provide information about the pods currently backing a Service.A service proxy implementation monitors the set of Service and EndpointSlice objects, and programs the data plane to route service traffic to its backends, by using operating system or cloud provider APIs to intercept or rewrite packets.The Gateway API (or its predecessor, Ingress) allows you to make Services accessible to clients that are outside the cluster.A simpler, but less-configurable, mechanism for cluster ingress is available via the Service API's type: LoadBalancer, when using a supported Cloud Provider.NetworkPolicy is a built-in Kubernetes API that allows you to control traffic between pods, or between pods and the outside world.In older container systems, there was no automatic connectivity between containers on different hosts, and so it was often necessary to explicitly create links between containers, or to map container ports to host ports to make them reachable by containers on other hosts. This is not needed in Kubernetes; Kubernetes's model is that pods can be treated much like VMs or physical hosts from the perspectives of port allocation, naming, service discovery, load balancing, application configuration, and migration.Only a few parts of this model are implemented by Kubernetes itself. For the other parts, Kubernetes defines the APIs, but the corresponding functionality is provided by external components, some of which are optional:Pod network namespace setup is handled by system-level software implementing the Container Runtime Interface.The pod network itself is managed by a pod network implementation. On Linux, most container runtimes use the Container Networking Interface (CNI) to interact with the pod network implementation, so these implementations are often called CNI plugins.Kubernetes provides a default implementation of service proxying, called kube-proxy, but some pod network implementations instead use their own service proxy that is more tightly integrated with the rest of the implementation.NetworkPolicy is generally also implemented by the pod network implementation. (Some simpler pod network implementations don't implement NetworkPolicy, or an administrator may choose to configure the pod network without NetworkPolicy support. In these cases, the API will still be present, but it will have no effect.)There are many implementations of the Gateway API, some of whi", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_550"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\n1 - Service | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_551"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n1 - Service | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_552"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\n1 - Service | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_553"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\n1 - Service | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_554"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\n1 - Service | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_555"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\n1 - Service | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_556"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\n1 - Service | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_557"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\n1 - Service | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_558"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_559"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_560"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\n2 - Ingress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_561"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_562"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_563"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\n2 - Ingress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_564"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\n2 - Ingress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_565"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_566"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_567"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\n2 - Ingress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_568"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_569"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress simple-fanout-example\n```\n\n2 - Ingress | The Ingress controller provisions an implementation-specific load balancer that satisfies the Ingress, as long as the Services (service1, service2) exist. When it has done so, you can see the address", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_570"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_571"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_572"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\n2 - Ingress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_573"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_574"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_575"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl edit ingress test\n```\n\n2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_576"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n2 - Ingress | You can achieve the same outcome by invoking kubectl replace -f on a modified Ingress YAML file.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_577"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\n4 - Gateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_578"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\n4 - Gateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_579"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\n4 - Gateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_580"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\n4 - Gateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_581"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\n4 - Gateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_582"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\n5 - EndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_583"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_584"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_585"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_586"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_587"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_588"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_589"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_590"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl label namespace frontend namespace=frontend\nkubectl label namespace backend namespace=backend\n```\n\n6 - Network Policies | Add the labels under namespaceSelector in your NetworkPolicy document. For example:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_591"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\n6 - Network Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_592"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n7 - DNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_593"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\n7 - DNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_594"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_595"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dns-example -- cat /etc/resolv.conf\n```\n\n7 - DNS for Services and Pods | The output is similar to this:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_596"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_597"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_598"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_599"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_600"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_601"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_602"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_603"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_604"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\n8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_605"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\n9 - Topology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_606"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\n11 - Service ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_607"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\n12 - Service Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_608"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_609"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\n1 - Service | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_610"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n1 - Service | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_611"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\n1 - Service | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_612"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/<service-name> forwardedPort:servicePort\n```\n\n1 - Service | An ExternalName Service is a special case of Service that does not have selectors and uses DNS names instead. For more information, see the ExternalName section.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_613"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\n1 - Service | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_614"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\n1 - Service | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_615"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\n1 - Service | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_616"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    networking.gke.io/load-balancer-type: \"Internal\"\n```\n\n1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/aws-load-balancer-internal: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_617"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/aws-load-balancer-internal: \"true\"\n```\n\n1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_618"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"\n```\n\n1 - Service | metadata: name: my-service annotations: service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: \"private\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_619"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: \"private\"\n```\n\n1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/openstack-internal-load-balancer: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_620"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/openstack-internal-load-balancer: \"true\"\n```\n\n1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/cce-load-balancer-internal-vpc: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_621"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/cce-load-balancer-internal-vpc: \"true\"\n```\n\n1 - Service | metadata: annotations: service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxx", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_622"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  annotations:\n    service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxx\n```\n\n1 - Service | metadata: annotations: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: \"intranet\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_623"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  annotations:\n    service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: \"intranet\"\n```\n\n1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/oci-load-balancer-internal: true", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_624"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/oci-load-balancer-internal: true\n```\n\n1 - Service | Services of type ExternalName map a Service to a DNS name, not to a typical selector such as my-service or cassandra. You specify these Services with the spec.externalName parameter.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_625"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\n1 - Service | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_626"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\n1 - Service | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_627"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_628"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_629"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\n2 - Ingress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_630"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_631"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_632"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\n2 - Ingress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_633"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\n2 - Ingress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_634"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_635"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_636"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\n2 - Ingress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_637"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_638"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_639"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_640"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\n2 - Ingress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_641"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_642"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - backend:\n          service:\n            name: service1\n            port:\n              number: 80\n        path: /foo\n        pathType: Prefix\n  - host: bar.baz.com\n    http:\n      paths:\n      - backend:\n          service:\n            name: service2\n            port:\n              number: 80\n        path: /foo\n        pathType: Prefix\n..\n```\n\n2 - Ingress | After you save your changes, kubectl updates the resource in the API server, which tells the Ingress controller to reconfigure the load balancer.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_643"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\n4 - Gateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_644"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\n4 - Gateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_645"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\n4 - Gateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_646"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\n4 - Gateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_647"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\n4 - Gateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_648"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\n5 - EndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_649"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_650"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n  - from:\n    - namespaceSelector:\n        matchLabels:\n          user: alice\n      podSelector:\n        matchLabels:\n          role: client\n  ...\n```\n\n6 - Network Policies | This policy contains a single from element allowing connections from Pods with the label role=client in namespaces with the label user=alice. But the following policy is different:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_651"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n  - from:\n    - namespaceSelector:\n        matchLabels:\n          user: alice\n    - podSelector:\n        matchLabels:\n          role: client\n  ...\n```\n\n6 - Network Policies | It contains two elements in the from array, and allows connections from Pods in the local Namespace with the label role=client, or from any Pod in any namespace with the label user=alice.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_652"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_653"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_654"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_655"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_656"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_657"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_658"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\n6 - Network Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_659"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n...\n  spec:\n    podSelector:\n      matchLabels:\n        role: client\n  ...\n```\n\n6 - Network Policies | a hostNetwork pod is selected by a podSelector or namespaceSelector in an ingress or egress rule.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_660"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n    - from:\n      - podSelector:\n          matchLabels:\n            role: client\n  ...\n```\n\n6 - Network Policies | At the same time, since hostNetwork pods have the same IP addresses as the nodes they reside on, their connections will be treated as node connections. For example, you can allow traffic from a hostNe", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_661"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n7 - DNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_662"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\n7 - DNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_663"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_664"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_665"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_666"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_667"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_668"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_669"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_670"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\n8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_671"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ipFamilyPolicy: SingleStack\n```\n\n8 - IPv4/IPv6 dual-stack | After:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_672"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ipFamilyPolicy: PreferDualStack\n```\n\n8 - IPv4/IPv6 dual-stack | To change a Service from dual-stack to single-stack, change .spec.ipFamilyPolicy from PreferDualStack or RequireDualStack to SingleStack. When you change this Service from dual-stack to single-stack,", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_673"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\n9 - Topology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_674"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\n11 - Service ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_675"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\n12 - Service Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_676"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/simple-service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_677"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_678"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\n1 - Service | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_679"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n1 - Service | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_680"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\n1 - Service | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_681"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\n1 - Service | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_682"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\n1 - Service | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_683"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\n1 - Service | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_684"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\n1 - Service | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_685"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\n1 - Service | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_686"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/minimal-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_687"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_688"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/ingress-resource-backend.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_689"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_690"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\n2 - Ingress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_691"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/ingress-wildcard-host.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_692"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_693"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/external-lb.yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_694"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_695"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\n2 - Ingress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_696"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\n2 - Ingress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_697"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/default-ingressclass.yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_698"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_699"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/test-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_700"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_701"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\n2 - Ingress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_702"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/simple-fanout-example.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_703"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_704"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress simple-fanout-example\n```\n\n2 - Ingress | The Ingress controller provisions an implementation-specific load balancer that satisfies the Ingress, as long as the Services (service1, service2) exist. When it has done so, you can see the address", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_705"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/name-virtual-host-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_706"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_707"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/name-virtual-host-ingress-no-third-host.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_708"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_709"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\n2 - Ingress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_710"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/tls-example-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_711"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_712"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_713"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl edit ingress test\n```\n\n2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_714"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n2 - Ingress | You can achieve the same outcome by invoking kubectl replace -f on a modified Ingress YAML file.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_715"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\n4 - Gateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_716"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\n4 - Gateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_717"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\n4 - Gateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_718"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\n4 - Gateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_719"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\n4 - Gateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_720"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\n5 - EndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_721"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/networkpolicy.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_722"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_723"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-ingress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_724"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_725"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-allow-all-ingress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_726"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_727"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-egress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_728"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_729"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-allow-all-egress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_730"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_731"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-all.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_732"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_733"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/networkpolicy-multiport-egress.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_734"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_735"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl label namespace frontend namespace=frontend\nkubectl label namespace backend namespace=backend\n```\n\n6 - Network Policies | Add the labels under namespaceSelector in your NetworkPolicy document. For example:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_736"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\n6 - Network Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_737"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n7 - DNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_738"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\n7 - DNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_739"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/custom-dns.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_740"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_741"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dns-example -- cat /etc/resolv.conf\n```\n\n7 - DNS for Services and Pods | The output is similar to this:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_742"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_743"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_744"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_745"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_746"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-ipfamilies-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_747"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_748"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_749"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_750"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_751"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_752"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_753"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_754"}
{"instruction": "Write a bash example for services, load balancing, and networking", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_755"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\n8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_756"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\n9 - Topology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_757"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\n11 - Service ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_758"}
{"instruction": "Write a yaml example for services, load balancing, and networking", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\n12 - Service Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/_print/", "id": "k8s_00056_code_759"}
{"instruction": "Explain roles and responsibilities in Kubernetes", "response": "Roles and responsibilitiesAnyone can contribute to Kubernetes. As your contributions to SIG Docs grow, you can apply for different levels of membership in the community. These roles allow you to take on more responsibility within the community. Each role requires more time and commitment. The roles are:Anyone: regular contributors to the Kubernetes documentationMembers: can assign and triage issues and provide non-binding review on pull requestsReviewers: can lead reviews on documentation pull requests and can vouch for a change's qualityApprovers: can lead reviews on documentation and merge changesAnyoneAnyone with a GitHub account can contribute to Kubernetes. SIG Docs welcomes all new contributors!Anyone can:Open an issue in any Kubernetes repository, including kubernetes/websiteGive non-binding", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/participate/roles-and-responsibilities/", "id": "k8s_00057"}
{"instruction": "How do you define dependent environment variables in Kubernetes?", "response": "Define Dependent Environment VariablesThis page shows how to define dependent environment variables for a container in a Kubernetes Pod.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesDefine an environment dependent variable for a containerWhen you create a Pod, you can set dependent environment variables for the containers that run in the Pod. To set dependent environment variables, you can use $(VAR_NAME) in the value of env in the configuration file.In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines a dependent environment variable with common usage defined. Here is the configuration manifest for the Pod:pods/inject/dependent-envars.yaml apiVersion: v1 kind: Pod metadata: name: dependent-envars-demo spec: containers: - name: dependent-envars-demo args: - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done; command: - sh - -c image: busybox:1.28 env: - name: SERVICE_PORT value: \"80\" - name: SERVICE_IP value: \"172.17.0.1\" - name: UNCHANGED_REFERENCE value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\" - name: PROTOCOL value: \"https\" - name: SERVICE_ADDRESS value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\" - name: ESCAPED_REFERENCE value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\" Create a Pod based on that manifest:kubectl apply -f https://k8s.io/examples/pods/inject/dependent-envars.yaml pod/dependent-envars-demo created List the running Pods:kubectl get pods dependent-envars-demo NAME READY STATUS RESTARTS AGE dependent-envars-demo 1/1 Running 0 9s Check the logs for the container running in your Pod:kubectl logs pod/dependent-envars-demo UNCHANGED_REFERENCE=$(PROTOCOL)://172.17.0.1:80 SERVICE_ADDRESS=https://172.17.0.1:80 ESCAPED_REFERENCE=$(PROTOCOL)://172.17.0.1:80 As shown above, you have defined the correct dependency reference of SERVICE_ADDRESS, bad dependency reference of UNCHANGED_REFERENCE and skip dependent references of ESCAPED_REFERENCE.When an environment variable is already defined when being referenced, the reference can be correctly resolved, such as in the SERVICE_ADDRESS case.Note that order matters in the env list. An environment variable is not considered \"defined\" if it is specified further down the list. That is why UNCHANGED_REFERENCE fails to resolve $(PROTOCOL) in the example above.When the environment variable is undefined or only includes some variables, the undefined environment variable is treated as a normal string, such as UNCHANGED_REFERENCE. Note that incorrectly parsed environment variables, in general, will not block the container from starting.The $(VAR_NAME) syntax can be escaped with a double $, ie: $$(VAR_NAME). Escaped references are never expanded, regardless of whether the referenced variable is defined or not. This can be seen from the ESCAPED_REFERENCE case above.What's nextLearn more about environment variables.See EnvVarSource.", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058"}
{"instruction": "Write a yaml example for define dependent environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\nDefine Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_762"}
{"instruction": "Write a bash example for define dependent environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dependent-envars.yaml\n```\n\nDefine Dependent Environment Variables | List the running Pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_763"}
{"instruction": "Write a bash example for define dependent environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dependent-envars-demo\n```\n\nDefine Dependent Environment Variables | Check the logs for the container running in your Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_764"}
{"instruction": "Write a bash example for define dependent environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/dependent-envars-demo\n```\n\nDefine Dependent Environment Variables | As shown above, you have defined the correct dependency reference of SERVICE_ADDRESS, bad dependency reference of UNCHANGED_REFERENCE and skip dependent references of ESCAPED_REFERENCE.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_765"}
{"instruction": "Write a yaml example for define dependent environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\nDefine Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_766"}
{"instruction": "Write a yaml example for define dependent environment variables", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dependent-envars.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\nDefine Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_767"}
{"instruction": "Write a yaml example for define dependent environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\nDefine Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_768"}
{"instruction": "Write a bash example for define dependent environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dependent-envars.yaml\n```\n\nDefine Dependent Environment Variables | List the running Pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_769"}
{"instruction": "Write a bash example for define dependent environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dependent-envars-demo\n```\n\nDefine Dependent Environment Variables | Check the logs for the container running in your Pod:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_770"}
{"instruction": "Write a bash example for define dependent environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/dependent-envars-demo\n```\n\nDefine Dependent Environment Variables | As shown above, you have defined the correct dependency reference of SERVICE_ADDRESS, bad dependency reference of UNCHANGED_REFERENCE and skip dependent references of ESCAPED_REFERENCE.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/", "id": "k8s_00058_code_771"}
{"instruction": "Explain the Kubernetes concept: Dynamic Volume Provisioning", "response": "Dynamic Volume ProvisioningDynamic volume provisioning allows storage volumes to be created on-demand. Without dynamic provisioning, cluster administrators have to manually make calls to their cloud or storage provider to create new storage volumes, and then create PersistentVolume objects to represent them in Kubernetes. The dynamic provisioning feature eliminates the need for cluster administrators to pre-provision storage. Instead, it automatically provisions storage when users create PersistentVolumeClaim objects.BackgroundThe implementation of dynamic volume provisioning is based on the API object StorageClass from the API group storage.k8s.io. A cluster administrator can define as many StorageClass objects as needed, each specifying a volume plugin (aka provisioner) that provisions a volume and the set of parameters to pass to that provisioner when provisioning. A cluster administrator can define and expose multiple flavors of storage (from the same or different storage systems) within a cluster, each with a custom set of parameters. This design also ensures that end users don't have to worry about the complexity and nuances of how storage is provisioned, but still have the ability to select from multiple storage options.More information on storage classes can be found here.Enabling Dynamic ProvisioningTo enable dynamic provisioning, a cluster administrator needs to pre-create one or more StorageClass objects for users. StorageClass objects define which provisioner should be used and what parameters should be passed to that provisioner when dynamic provisioning is invoked. The name of a StorageClass object must be a valid DNS subdomain name.The following manifest creates a storage class \"slow\" which provisions standard disk-like persistent disks.apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: slow provisioner: kubernetes.io/gce-pd parameters: type: pd-standard The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast provisioner: kubernetes.io/gce-pd parameters: type: pd-ssd Using Dynamic ProvisioningUsers request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotation. However, this annotation is deprecated since v1.9. Users now can and should instead use the storageClassName field of the PersistentVolumeClaim object. The value of this field must match the name of a StorageClass configured by the administrator (see below).To select the \"fast\" storage class, for example, a user would create the following PersistentVolumeClaim:apiVersion: v1 kind: PersistentVolumeClaim metadata: name: claim1 spec: accessModes: - ReadWriteOnce storageClassName: fast resources: requests: storage: 30Gi This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.Defaulting BehaviorDynamic provisioning can be enabled on a cluster such that all claims are dynamically provisioned if no storage class is specified. A cluster administrator can enable this behavior by:Marking one StorageClass object as default;Making sure that the DefaultStorageClass admission controller is enabled on the API server.An administrator can mark a specific StorageClass as default by adding the storageclass.kubernetes.io/is-default-class annotation to it. When a default StorageClass exists in a cluster and a user creates a PersistentVolumeClaim with storageClassName unspecified, the DefaultStorageClass admission controller automatically adds the storageClassName field pointing to the default storage class.Note that if you set the storageclass.kubernetes.io/is-default-class annotation to true on more than one StorageClass in your cluster, and you then create a PersistentVolumeClaim with no storageClassName set, Kubernetes uses the most recently", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\nDynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_773"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\nDynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_774"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\nDynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_775"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\nDynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_776"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\nDynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_777"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\nDynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_778"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\nDynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_779"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\nDynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_780"}
{"instruction": "Write a yaml example for dynamic volume provisioning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\nDynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/", "id": "k8s_00059_code_781"}
{"instruction": "What is the reference documentation for server-side apply?", "response": "Server-Side ApplyFEATURE STATE: Kubernetes v1.22 [stable] (enabled by default: true)Kubernetes supports multiple appliers collaborating to manage the fields of a single object.Server-Side Apply provides an optional mechanism for your cluster's control plane to track changes to an object's fields. At the level of a specific resource, Server-Side Apply records and tracks information about control over the fields of that object.Server-Side Apply helps users and controllers manage their resources through declarative configuration. Clients can create and modify objects declaratively by submitting their fully specified intent.A fully specified intent is a partial object that only includes the fields and values for which the user has an opinion. That intent either creates a new object (using default values for unspecified fields), or is combined, by the API server, with the existing object.Comparison with Client-Side Apply explains how Server-Side Apply differs from the original, client-side kubectl apply implementation.Field managementThe Kubernetes API server tracks managed fields for all newly created objects.When trying to apply an object, fields that have a different value and are owned by another manager will result in a conflict. This is done in order to signal that the operation might undo another collaborator's changes. Writes to objects with managed fields can be forced, in which case the value of any conflicted field will be overridden, and the ownership will be transferred.Whenever a field's value does change, ownership moves from its current manager to the manager making the change.Apply checks if there are any other field managers that also own the field. If the field is not owned by any other field managers, that field is set to its default value (if there is one), or otherwise is deleted from the object. The same rule applies to fields that are lists, associative lists, or maps.For a user to manage a field, in the Server-Side Apply sense, means that the user relies on and expects the value of the field not to change. The user who last made an assertion about the value of a field will be recorded as the current field manager. This can be done by changing the field manager details explicitly using HTTP POST (create), PUT (update), or non-apply PATCH (patch). You can also declare and record a field manager by including a value for that field in a Server-Side Apply operation.A Server-Side Apply patch request requires the client to provide its identity as a field manager. When using Server-Side Apply, trying to change a field that is controlled by a different manager results in a rejected request unless the client forces an override. For details of overrides, see Conflicts.When two or more appliers set a field to the same value, they share ownership of that field. Any subsequent attempt to change the value of the shared field, by any of the appliers, results in a conflict. Shared field owners may give up ownership of a field by making a Server-Side Apply patch request that doesn't include that field.Field management details are stored in a managedFields field that is part of an object's metadata.If you remove a field from a manifest and apply that manifest, Server-Side Apply checks if there are any other field managers that also own the field. If the field is not owned by any other field managers, it is either deleted from the live object or reset to its default value, if it has one. The same rule applies to associative list or map items.Compared to the (legacy) kubectl.kubernetes.io/last-applied-configuration annotation managed by kubectl, Server-Side Apply uses a more declarative approach, that tracks a user's (or client's) field management, rather than a user's last applied state. As a side effect of using Server-Side Apply, information about which field manager manages each field in an object also becomes available.ExampleA simple example of an object created using Server-Side Apply could look like this:Note:kubectl ge", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply # note capitalization: \"Apply\" (or \"Update\")\n    apiVersion: v1\n    time: \"2010-10-10T0:00:00Z\"\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n      f:data:\n        f:key: {}\ndata:\n  key: some value\n```\n\nServer-Side Apply | That example ConfigMap object contains a single field management record in .metadata.managedFields. The field management record consists of basic information about the managing entity itself, plus det", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_783"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply\n    time: '2019-03-30T15:00:00.000Z'\n    apiVersion: v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n  - manager: kube-controller-manager\n    operation: Update\n    apiVersion: v1\n    time: '2019-03-30T16:00:00.000Z'\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:data:\n        f:key: {}\ndata:\n  key: new value\n```\n\nServer-Side Apply | In this example, a second operation was run as an update by the manager called kube-controller-manager. The update request succeeded and changed a value in the data field, which caused that field's ma", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_784"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: example.com/v1\nkind: Foo\nmetadata:\n  name: foo-sample\n  managedFields:\n  - manager: \"manager-one\"\n    operation: Apply\n    apiVersion: example.com/v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:spec:\n        f:data: {}\nspec:\n  data:\n    key1: val1\n    key2: val2\n```\n\nServer-Side Apply | Before spec.data gets changed from atomic to granular, manager-one owns the field spec.data, and all the fields within it (key1 and key2). When the CRD gets changed to make spec.data granular, manager", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_785"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_786"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/ssa/nginx-deployment.yaml --server-side\n```\n\nServer-Side Apply | Then later, automatic scaling is enabled for the Deployment; for example:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_787"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment nginx-deployment --cpu-percent=50 --min=1 --max=10\n```\n\nServer-Side Apply | Now, the user would like to remove replicas from their configuration, so they don't accidentally fight with the HorizontalPodAutoscaler (HPA) and its controller. However, there is a race: it might tak", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_788"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n# Save this file as 'nginx-deployment-replicas-only.yaml'.\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n```\n\nServer-Side Apply | The user applies that manifest using a private field manager name. In this example, the user picked handover-to-hpa:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_789"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginx-deployment-replicas-only.yaml \\\n  --server-side --field-manager=handover-to-hpa \\\n  --validate=false\n```\n\nServer-Side Apply | If the apply results in a conflict with the HPA controller, then do nothing. The conflict indicates the controller has claimed the field earlier in the process than it sometimes does.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_790"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_791"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side [--dry-run=server]\n```\n\nServer-Side Apply | By default, field management of the object transfers from client-side apply to kubectl server-side apply, without encountering conflicts.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_792"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\nServer-Side Apply | If you manage a resource with kubectl apply --server-side, you can downgrade to client-side apply directly with kubectl apply.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_793"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\nServer-Side Apply | The PATCH verb (for an object that supports Server-Side Apply) accepts the unofficial application/apply-patch+yaml content type. Users of Server-Side Apply can send partially specified objects as YAML", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_794"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nServer-Side Apply | A simple example of an object created using Server-Side Apply could look like this:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_795"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply # note capitalization: \"Apply\" (or \"Update\")\n    apiVersion: v1\n    time: \"2010-10-10T0:00:00Z\"\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n      f:data:\n        f:key: {}\ndata:\n  key: some value\n```\n\nServer-Side Apply | That example ConfigMap object contains a single field management record in .metadata.managedFields. The field management record consists of basic information about the managing entity itself, plus det", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_796"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"v1\",\n  \"kind\": \"ConfigMap\"\n}\n```\n\nServer-Side Apply | (this would make a no-change update, provided that it was sent as the body of a patch request to a valid v1/configmaps resource, and with the appropriate request Content-Type).", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_797"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply\n    time: '2019-03-30T15:00:00.000Z'\n    apiVersion: v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n  - manager: kube-controller-manager\n    operation: Update\n    apiVersion: v1\n    time: '2019-03-30T16:00:00.000Z'\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:data:\n        f:key: {}\ndata:\n  key: new value\n```\n\nServer-Side Apply | In this example, a second operation was run as an update by the manager called kube-controller-manager. The update request succeeded and changed a value in the data field, which caused that field's ma", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_798"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: example.com/v1\nkind: Foo\nmetadata:\n  name: foo-sample\n  managedFields:\n  - manager: \"manager-one\"\n    operation: Apply\n    apiVersion: example.com/v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:spec:\n        f:data: {}\nspec:\n  data:\n    key1: val1\n    key2: val2\n```\n\nServer-Side Apply | Before spec.data gets changed from atomic to granular, manager-one owns the field spec.data, and all the fields within it (key1 and key2). When the CRD gets changed to make spec.data granular, manager", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_799"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_800"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n# Save this file as 'nginx-deployment-replicas-only.yaml'.\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n```\n\nServer-Side Apply | The user applies that manifest using a private field manager name. In this example, the user picked handover-to-hpa:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_801"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_802"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side\n```\n\nServer-Side Apply | This behavior applies to server-side apply with the kubectl field manager. As an exception, you can opt-out of this behavior by specifying a different, non-default field manager, as seen in the follow", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_803"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side\n```\n\nServer-Side Apply | Downgrading works because kubectl Server-Side Apply keeps the last-applied-configuration annotation up-to-date if you use kubectl apply.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_804"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply # note capitalization: \"Apply\" (or \"Update\")\n    apiVersion: v1\n    time: \"2010-10-10T0:00:00Z\"\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n      f:data:\n        f:key: {}\ndata:\n  key: some value\n```\n\nServer-Side Apply | That example ConfigMap object contains a single field management record in .metadata.managedFields. The field management record consists of basic information about the managing entity itself, plus det", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_805"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply\n    time: '2019-03-30T15:00:00.000Z'\n    apiVersion: v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n  - manager: kube-controller-manager\n    operation: Update\n    apiVersion: v1\n    time: '2019-03-30T16:00:00.000Z'\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:data:\n        f:key: {}\ndata:\n  key: new value\n```\n\nServer-Side Apply | In this example, a second operation was run as an update by the manager called kube-controller-manager. The update request succeeded and changed a value in the data field, which caused that field's ma", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_806"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: example.com/v1\nkind: Foo\nmetadata:\n  name: foo-sample\n  managedFields:\n  - manager: \"manager-one\"\n    operation: Apply\n    apiVersion: example.com/v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:spec:\n        f:data: {}\nspec:\n  data:\n    key1: val1\n    key2: val2\n```\n\nServer-Side Apply | Before spec.data gets changed from atomic to granular, manager-one owns the field spec.data, and all the fields within it (key1 and key2). When the CRD gets changed to make spec.data granular, manager", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_807"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napplication/ssa/nginx-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_808"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_809"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/ssa/nginx-deployment.yaml --server-side\n```\n\nServer-Side Apply | Then later, automatic scaling is enabled for the Deployment; for example:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_810"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment nginx-deployment --cpu-percent=50 --min=1 --max=10\n```\n\nServer-Side Apply | Now, the user would like to remove replicas from their configuration, so they don't accidentally fight with the HorizontalPodAutoscaler (HPA) and its controller. However, there is a race: it might tak", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_811"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\n# Save this file as 'nginx-deployment-replicas-only.yaml'.\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n```\n\nServer-Side Apply | The user applies that manifest using a private field manager name. In this example, the user picked handover-to-hpa:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_812"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginx-deployment-replicas-only.yaml \\\n  --server-side --field-manager=handover-to-hpa \\\n  --validate=false\n```\n\nServer-Side Apply | If the apply results in a conflict with the HPA controller, then do nothing. The conflict indicates the controller has claimed the field earlier in the process than it sometimes does.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_813"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napplication/ssa/nginx-deployment-no-replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_814"}
{"instruction": "Write a yaml example for server-side apply", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nServer-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_815"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side [--dry-run=server]\n```\n\nServer-Side Apply | By default, field management of the object transfers from client-side apply to kubectl server-side apply, without encountering conflicts.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_816"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\nServer-Side Apply | If you manage a resource with kubectl apply --server-side, you can downgrade to client-side apply directly with kubectl apply.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_817"}
{"instruction": "Write a bash example for server-side apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\nServer-Side Apply | The PATCH verb (for an object that supports Server-Side Apply) accepts the unofficial application/apply-patch+yaml content type. Users of Server-Side Apply can send partially specified objects as YAML", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/server-side-apply/", "id": "k8s_00060_code_818"}
{"instruction": "Explain the Kubernetes concept: Volume Health Monitoring", "response": "Volume Health MonitoringFEATURE STATE: Kubernetes v1.21 [alpha]CSI volume health monitoring allows CSI Drivers to detect abnormal volume conditions from the underlying storage systems and report them as events on PVCs or Pods.Volume health monitoringKubernetes volume health monitoring is part of how Kubernetes implements the Container Storage Interface (CSI). Volume health monitoring feature is implemented in two components: an External Health Monitor controller, and the kubelet.If a CSI Driver supports Volume Health Monitoring feature from the controller side, an event will be reported on the related PersistentVolumeClaim (PVC) when an abnormal volume condition is detected on a CSI volume.The External Health Monitor controller also watches for node failure events. You can enable node failure monitoring by setting the enable-node-watcher flag to true. When the external health monitor detects a node failure event, the controller reports an Event will be reported on the PVC to indicate that pods using this PVC are on a failed node.If a CSI Driver supports Volume Health Monitoring feature from the node side, an Event will be reported on every Pod using the PVC when an abnormal volume condition is detected on a CSI volume. In addition, Volume Health information is exposed as Kubelet VolumeStats metrics. A new metric kubelet_volume_stats_health_status_abnormal is added. This metric includes two labels: namespace and persistentvolumeclaim. The count is either 1 or 0. 1 indicates the volume is unhealthy, 0 indicates volume is healthy. For more information, please check KEP.Note:You need to enable the CSIVolumeHealth feature gate to use this feature from the node side.What's nextSee the CSI driver documentation to find out which CSI drivers have implemented this feature.", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-health-monitoring/", "id": "k8s_00061"}
{"instruction": "How do you manage tls certificates in a cluster in Kubernetes?", "response": "Manage TLS Certificates in a ClusterKubernetes provides a certificates.k8s.io API, which lets you provision TLS certificates signed by a Certificate Authority (CA) that you control. These CA and certificates can be used by your workloads to establish trust.certificates.k8s.io API uses a protocol that is similar to the ACME draft.Note:Certificates created using the certificates.k8s.io API are signed by a dedicated CA. It is possible to configure your cluster to use the cluster root CA for this purpose, but you should never rely on this. Do not assume that these certificates will validate against the cluster root CA.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou need the cfssl tool. You can download cfssl from https://github.com/cloudflare/cfssl/releases.Some steps in this page use the jq tool. If you don't have jq, you can install it via your operating system's software sources, or fetch it from https://jqlang.github.io/jq/.Trusting TLS in a clusterTrusting the custom CA from an application running as a pod usually requires some extra application configuration. You will need to add the CA certificate bundle to the list of CA certificates that the TLS client or server trusts. For example, you would do this with a golang TLS config by parsing the certificate chain and adding the parsed certificates to the RootCAs field in the tls.Config struct.Note:Even though the custom CA certificate may be included in the filesystem (in the ConfigMap kube-root-ca.crt), you should not use that certificate authority for any purpose other than to verify internal Kubernetes endpoints. An example of an internal Kubernetes endpoint is the Service named kubernetes in the default namespace.If you want to use a custom certificate authority for your workloads, you should generate that CA separately, and distribute its CA certificate using a ConfigMap that your pods have access to read.Requesting a certificateThe following section demonstrates how to create a TLS certificate for a Kubernetes service accessed through DNS.Note:This tutorial uses CFSSL: Cloudflare's PKI and TLS toolkit click here to know more.Create a certificate signing requestGenerate a private key and certificate signing request (or CSR) by running the following command:cat <<EOF | cfssl genkey - | cfssljson -bare server { \"hosts\": [ \"my-svc.my-namespace.svc.cluster.local\", \"my-pod.my-namespace.pod.cluster.local\", \"192.0.2.24\", \"10.0.34.2\" ], \"CN\": \"my-pod.my-namespace.pod.cluster.local\", \"key\": { \"algo\": \"ecdsa\", \"size\": 256 } } EOF Where 192.0.2.24 is the service's cluster IP, my-svc.my-namespace.svc.cluster.local is the service's DNS name, 10.0.34.2 is the pod's IP and my-pod.my-namespace.pod.cluster.local is the pod's DNS name. You should see the output similar to:2022/02/01 11:45:32 [INFO] generate received request 2022/02/01 11:45:32 [INFO] received CSR 2022/02/01 11:45:32 [INFO] generating key: ecdsa-256 2022/02/01 11:45:32 [INFO] encoded CSR This command generates two files; it generates server.csr containing the PEM encoded PKCS#10 certification request, and server-key.pem containing the PEM encoded key to the certificate that is still to be created.Create a CertificateSigningRequest object to send to the Kubernetes APIGenerate a CSR manifest (in YAML), and send it to the API server. You can do that by running the following command:cat <<EOF | kubectl apply -f - apiVersion: certificates.k8s.io/v1 kind: CertificateSigningRequest metadata: name: my-svc.my-namespace spec: request: $(cat server.csr | base64 | tr -d '\\n') signerName: example.com/serving usages: - digital signature - key encipher", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062"}
{"instruction": "Write a yaml example for manage tls certificates in a cluster", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: my-svc.my-namespace\nspec:\n  request: $(cat server.csr | base64 | tr -d '\\n')\n  signerName: example.com/serving\n  usages:\n  - digital signature\n  - key encipherment\n  - server auth\nEOF\n```\n\nManage TLS Certificates in a Cluster | Notice that the server.csr file created in step 1 is base64 encoded and stashed in the .spec.request field. You are also requesting a certificate with the \"digital signature\", \"key encipherment\", and", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_821"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe csr my-svc.my-namespace\n```\n\nManage TLS Certificates in a Cluster | Approving the certificate signing request is either done by an automated approval process or on a one off basis by a cluster administrator. If you're authorized to approve a certificate request, you c", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_822"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve my-svc.my-namespace\n```\n\nManage TLS Certificates in a Cluster | You should now see the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_823"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.spec.request}' | \\\n  base64 --decode | \\\n  cfssl sign -ca ca.pem -ca-key ca-key.pem -config server-signing-config.json - | \\\n  cfssljson -bare ca-signed-server\n```\n\nManage TLS Certificates in a Cluster | You should see the output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_824"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o json | \\\n  jq '.status.certificate = \"'$(base64 ca-signed-server.pem | tr -d '\\n')'\"' | \\\n  kubectl replace --raw /apis/certificates.k8s.io/v1/certificatesigningrequests/my-svc.my-namespace/status -f -\n```\n\nManage TLS Certificates in a Cluster | Once the CSR is approved and the signed certificate is uploaded, run:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_825"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.status.certificate}' \\\n    | base64 --decode > server.crt\n```\n\nManage TLS Certificates in a Cluster | Now you can populate server.crt and server-key.pem in a Secret that you could later mount into a Pod (for example, to use with a webserver that serves HTTPS).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_826"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls server --cert server.crt --key server-key.pem\n```\n\nManage TLS Certificates in a Cluster | Finally, you can populate ca.pem into a ConfigMap and use it as the trust root to verify the serving certificate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_827"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap example-serving-ca --from-file ca.crt=ca.pem\n```\n\nManage TLS Certificates in a Cluster | A Kubernetes administrator (with appropriate permissions) can manually approve (or deny) CertificateSigningRequests by using the kubectl certificate approve and kubectl certificate deny commands. Howe", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_828"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\nManage TLS Certificates in a Cluster | The ability to approve CSRs decides who trusts whom within your environment. The ability to approve CSRs should not be granted broadly or lightly.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_829"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny\n```\n\nManage TLS Certificates in a Cluster | The ability to approve CSRs decides who trusts whom within your environment. The ability to approve CSRs should not be granted broadly or lightly.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_830"}
{"instruction": "Write a yaml example for manage tls certificates in a cluster", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: my-svc.my-namespace\nspec:\n  request: $(cat server.csr | base64 | tr -d '\\n')\n  signerName: example.com/serving\n  usages:\n  - digital signature\n  - key encipherment\n  - server auth\nEOF\n```\n\nManage TLS Certificates in a Cluster | Notice that the server.csr file created in step 1 is base64 encoded and stashed in the .spec.request field. You are also requesting a certificate with the \"digital signature\", \"key encipherment\", and", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_831"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe csr my-svc.my-namespace\n```\n\nManage TLS Certificates in a Cluster | Approving the certificate signing request is either done by an automated approval process or on a one off basis by a cluster administrator. If you're authorized to approve a certificate request, you c", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_832"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve my-svc.my-namespace\n```\n\nManage TLS Certificates in a Cluster | You should now see the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_833"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.spec.request}' | \\\n  base64 --decode | \\\n  cfssl sign -ca ca.pem -ca-key ca-key.pem -config server-signing-config.json - | \\\n  cfssljson -bare ca-signed-server\n```\n\nManage TLS Certificates in a Cluster | You should see the output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_834"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o json | \\\n  jq '.status.certificate = \"'$(base64 ca-signed-server.pem | tr -d '\\n')'\"' | \\\n  kubectl replace --raw /apis/certificates.k8s.io/v1/certificatesigningrequests/my-svc.my-namespace/status -f -\n```\n\nManage TLS Certificates in a Cluster | Once the CSR is approved and the signed certificate is uploaded, run:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_835"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.status.certificate}' \\\n    | base64 --decode > server.crt\n```\n\nManage TLS Certificates in a Cluster | Now you can populate server.crt and server-key.pem in a Secret that you could later mount into a Pod (for example, to use with a webserver that serves HTTPS).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_836"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls server --cert server.crt --key server-key.pem\n```\n\nManage TLS Certificates in a Cluster | Finally, you can populate ca.pem into a ConfigMap and use it as the trust root to verify the serving certificate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_837"}
{"instruction": "Write a bash example for manage tls certificates in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap example-serving-ca --from-file ca.crt=ca.pem\n```\n\nManage TLS Certificates in a Cluster | A Kubernetes administrator (with appropriate permissions) can manually approve (or deny) CertificateSigningRequests by using the kubectl certificate approve and kubectl certificate deny commands. Howe", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/tls/managing-tls-in-a-cluster/", "id": "k8s_00062_code_838"}
{"instruction": "What is the reference documentation for cronjob?", "response": "CronJobCronJob represents the configuration of a single cron job.apiVersion: batch/v1import \"k8s.io/api/batch/v1\"CronJobCronJob represents the configuration of a single cron job.apiVersion: batch/v1kind: CronJobmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (CronJobSpec)Specification of the desired behavior of a cron job, including the schedule. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (CronJobStatus)Current status of a cron job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusCronJobSpecCronJobSpec describes how the job execution will look like and when it will actually run.jobTemplate (JobTemplateSpec), requiredSpecifies the job that will be created when executing a CronJob.JobTemplateSpec describes the data a Job should have when created from a templatejobTemplate.metadata (ObjectMeta)Standard object's metadata of the jobs created from this template. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatajobTemplate.spec (JobSpec)Specification of the desired behavior of the job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusschedule (string), requiredThe schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.timeZone (string)The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the kube-controller-manager process. The set of valid time zone names and the time zone offset is loaded from the system-wide time zone database by the API server during CronJob validation and the controller manager during execution. If no system-wide time zone database can be found a bundled version of the database is used instead. If the time zone name becomes invalid during the lifetime of a CronJob or due to a change in host configuration, the controller will stop creating new new Jobs and will create a system event with the reason UnknownTimeZone. More information can be found in https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zonesconcurrencyPolicy (string)Specifies how to treat concurrent executions of a Job. Valid values are:\"Allow\" (default): allows CronJobs to run concurrently; - \"Forbid\": forbids concurrent runs, skipping", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/cron-job-v1/", "id": "k8s_00063"}
{"instruction": "What is the reference documentation for selfsubjectreview?", "response": "SelfSubjectReviewSelfSubjectReview contains the user information that the kube-apiserver has about the user making this request.apiVersion: authentication.k8s.io/v1import \"k8s.io/api/authentication/v1\"SelfSubjectReviewSelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase.apiVersion: authentication.k8s.io/v1kind: SelfSubjectReviewmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatastatus (SelfSubjectReviewStatus)Status is filled in by the server with the user attributes.SelfSubjectReviewStatusSelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user.userInfo (UserInfo)User attributes of the user making this request.UserInfo holds the information about the user needed to implement the user.Info interface.userInfo.extra (map[string][]string)Any additional information provided by the authenticator.userInfo.groups ([]string)Atomic: will be replaced during a mergeThe names of groups this user is a part of.userInfo.uid (string)A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.userInfo.username (string)The name that uniquely identifies this user among all active users.Operationscreate create a SelfSubjectReviewHTTP RequestPOST /apis/authentication.k8s.io/v1/selfsubjectreviewsParametersbody: SelfSubjectReview, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (SelfSubjectReview): OK201 (SelfSubjectReview): Created202 (SelfSubjectReview): Accepted401: UnauthorizedThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/self-subject-review-v1/", "id": "k8s_00064"}
{"instruction": "Write a yaml example for selfsubjectreview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\nSelfSubjectReview | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/self-subject-review-v1/", "id": "k8s_00064_code_841"}
{"instruction": "What is the reference documentation for feature gates (removed)?", "response": "Feature Gates (removed)This page contains list of feature gates that have been removed. The information on this page is for reference. A removed feature gate is different from a GA'ed or deprecated one in that a removed one is no longer recognized as a valid feature gate. However, a GA'ed or a deprecated feature gate is still recognized by the corresponding Kubernetes components although they are unable to cause any behavior differences in a cluster.For feature gates that are still recognized by the Kubernetes components, please refer to the Alpha/Beta feature gate table or the Graduated/Deprecated feature gate tableFeature gates that are removedIn the following table:The \"From\" column contains the Kubernetes release when a feature is introduced or its release stage is changed.The \"To\" column, if not empty, contains the last Kubernetes release in which you can still use a feature gate. If the feature stage is either \"Deprecated\" or \"GA\", the \"To\" column is the Kubernetes release when the feature is removed.Feature Gates RemovedFeatureDefaultStageFromToAcceleratorsfalseAlpha1.61.10Accelerators–Deprecated1.111.11AdmissionWebhookMatchConditionsfalseAlpha1.271.27AdmissionWebhookMatchConditionstrueBeta1.281.29AdmissionWebhookMatchConditionstrueGA1.301.32AdvancedAuditingfalseAlpha1.71.7AdvancedAuditingtrueBeta1.81.11AdvancedAuditingtrueGA1.121.27AffinityInAnnotationsfalseAlpha1.61.7AffinityInAnnotations–Deprecated1.81.8AggregatedDiscoveryEndpointfalseAlpha1.261.26AggregatedDiscoveryEndpointtrueBeta1.271.29AggregatedDiscoveryEndpointtrueGA1.301.32AllowExtTrafficLocalEndpointsfalseBeta1.41.6AllowExtTrafficLocalEndpointstrueGA1.71.9AllowInsecureBackendProxytrueBeta1.171.20AllowInsecureBackendProxytrueGA1.211.25APIListChunkingfalseAlpha1.81.8APIListChunkingtrueBeta1.91.28APIListChunkingtrueGA1.291.32APIPriorityAndFairnessfalseAlpha1.181.19APIPriorityAndFairnesstrueBeta1.201.28APIPriorityAndFairnesstrueGA1.291.30APISelfSubjectReviewfalseAlpha1.261.26APISelfSubjectReviewtrueBeta1.271.27APISelfSubjectReviewtrueGA1.281.29AppArmortrueBeta1.41.30AppArmortrueGA1.311.32AppArmorFieldstrueBeta1.301.30AppArmorFieldstrueGA1.311.32AttachVolumeLimitfalseAlpha1.111.11AttachVolumeLimittrueBeta1.121.16AttachVolumeLimittrueGA1.171.21BalanceAttachedNodeVolumesfalseAlpha1.111.21BalanceAttachedNodeVolumesfalseDeprecated1.221.22BlockVolumefalseAlpha1.91.12BlockVolumetrueBeta1.131.17BlockVolumetrueGA1.181.21BoundServiceAccountTokenVolumefalseAlpha1.131.20BoundServiceAccountTokenVolumetrueBeta1.211.21BoundServiceAccountTokenVolumetrueGA1.221.23CloudDualStackNodeIPsfalseAlpha1.271.28CloudDualStackNodeIPstrueBeta1.291.29CloudDualStackNodeIPstrueGA1.301.31ConfigurableFSGroupPolicyfalseAlpha1.181.19ConfigurableFSGroupPolicytrueBeta1.201.22ConfigurableFSGroupPolicytrueGA1.231.25ConsistentHTTPGetHandlerstrueGA1.251.30ControllerManagerLeaderMigrationfalseAlpha1.211.21ControllerManagerLeaderMigrationtrueBeta1.221.23ControllerManagerLeaderMigrationtrueGA1.241.26CPUManagerfalseAlpha1.81.9CPUManagertrueBeta1.101.25CPUManagertrueGA1.261.32CRIContainerLogRotationfalseAlpha1.101.10CRIContainerLogRotationtrueBeta1.111.20CRIContainerLogRotationtrueGA1.211.22CronJobControllerV2falseAlpha1.201.20CronJobControllerV2trueBeta1.211.21CronJobControllerV2trueGA1.221.23CronJobTimeZonefalseAlpha1.241.24CronJobTimeZonetrueBeta1.251.26CronJobTimeZonetrueGA1.271.28CSIBlockVolumefalseAlpha1.111.13CSIBlockVolumetrueBeta1.141.17CSIBlockVolumetrueGA1.181.21CSIDriverRegistryfalseAlpha1.121.13CSIDriverRegistrytrueBeta1.141.17CSIDriverRegistrytrueGA1.181.21CSIInlineVolumefalseAlpha1.151.15CSIInlineVolumetrueBeta1.161.24CSIInlineVolumetrueGA1.251.26CSIMigrationfalseAlpha1.141.16CSIMigrationtrueBeta1.171.24CSIMigrationtrueGA1.251.26CSIMigrationAWSfalseAlpha1.141.16CSIMigrationAWSfalseBeta1.171.22CSIMigrationAWStrueBeta1.231.24CSIMigrationAWStrueGA1.251.26CSIMigrationAWSCompletefalseAlpha1.171.20CSIMigrationAWSComplete–Deprecated1.211.21CSIMigrationAzureDiskfalseAlpha1.151.18CSIMigrationAzureDiskfa", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates-removed/", "id": "k8s_00065"}
{"instruction": "What is the reference documentation for kubectl completion?", "response": "kubectl completionSynopsisOutput shell completion code for the specified shell (bash, zsh, fish, or powershell). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .bash_profile.Detailed instructions on how to do this are available here: for macOS: https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/#enable-shell-autocompletion for linux: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#enable-shell-autocompletion for windows: https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/#enable-shell-autocompletion Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2.kubectl completion SHELL Examples # Installing bash completion on macOS using homebrew ## If running Bash 3.2 included with macOS brew install bash-completion ## or, if running Bash 4.1+ brew install bash-completion@2 ## If kubectl is installed via homebrew, this should start working immediately ## If you've installed via other means, you may need add the completion to your completion directory kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl # Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion code for bash into the current shell source <(kubectl completion bash) ## Write bash completion code to a file and source it from .bash_profile kubectl completion bash > ~/.kube/completion.bash.inc printf \" # kubectl shell completion source '$HOME/.kube/completion.bash.inc' \" >> $HOME/.bash_profile source $HOME/.bash_profile # Load the kubectl completion code for zsh[1] into the current shell source <(kubectl completion zsh) # Set the kubectl completion code for zsh[1] to autoload on startup kubectl completion zsh > \"${fpath[1]}/_kubectl\" # Load the kubectl completion code for fish[2] into the current shell kubectl completion fish | source # To load completions for each session, execute once: kubectl completion fish > ~/.config/fish/completions/kubectl.fish # Load the kubectl completion code for powershell into the current shell kubectl completion powershell | Out-String | Invoke-Expression # Set kubectl completion code for powershell to run on startup ## Save completion code to a script and execute in the profile kubectl completion powershell > $HOME\\.kube\\completion.ps1 Add-Content $PROFILE \"$HOME\\.kube\\completion.ps1\" ## Execute completion code in the profile Add-Content $PROFILE \"if (Get-Command kubectl -ErrorAction SilentlyContinue) { kubectl completion powershell | Out-String | Invoke-Expression }\" ## Add completion code directly to the $PROFILE script kubectl completion powershell >> $PROFILE Options-h, --helphelp for completionParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.-", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_completion/", "id": "k8s_00066"}
{"instruction": "Write a bash example for kubectl completion", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL\n```\n\nkubectl completion | help for completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_completion/", "id": "k8s_00066_code_844"}
{"instruction": "Write a bash example for kubectl completion", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL\n```\n\nkubectl completion | help for completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_completion/", "id": "k8s_00066_code_845"}
{"instruction": "Explain the Kubernetes concept: Pod Overhead", "response": "Pod OverheadFEATURE STATE: Kubernetes v1.24 [stable]When you run a Pod on a Node, the Pod itself takes an amount of system resources. These resources are additional to the resources needed to run the container(s) inside the Pod. In Kubernetes, Pod Overhead is a way to account for the resources consumed by the Pod infrastructure on top of the container requests & limits.In Kubernetes, the Pod's overhead is set at admission time according to the overhead associated with the Pod's RuntimeClass.A pod's overhead is considered in addition to the sum of container resource requests when scheduling a Pod. Similarly, the kubelet will include the Pod overhead when sizing the Pod cgroup, and when carrying out Pod eviction ranking.Configuring Pod overheadYou need to make sure a RuntimeClass is utilized which defines the overhead field.Usage exampleTo work with Pod overhead, you need a RuntimeClass that defines the overhead field. As an example, you could use the following RuntimeClass definition with a virtualization container runtime (in this example, Kata Containers combined with the Firecracker virtual machine monitor) that uses around 120MiB per Pod for the virtual machine and the guest OS:# You need to change this example to match the actual runtime name, and per-Pod # resource overhead, that the container runtime is adding in your cluster. apiVersion: node.k8s.io/v1 kind: RuntimeClass metadata: name: kata-fc handler: kata-fc overhead: podFixed: memory: \"120Mi\" cpu: \"250m\" Workloads which are created which specify the kata-fc RuntimeClass handler will take the memory and cpu overheads into account for resource quota calculations, node scheduling, as well as Pod cgroup sizing.Consider running the given example workload, test-pod:apiVersion: v1 kind: Pod metadata: name: test-pod spec: runtimeClassName: kata-fc containers: - name: busybox-ctr image: busybox:1.28 stdin: true tty: true resources: limits: cpu: 500m memory: 100Mi - name: nginx-ctr image: nginx resources: limits: cpu: 1500m memory: 100Mi Note:If only limits are specified in the pod definition, kubelet will deduce requests from those limits and set them to be the same as the defined limits.At admission time the RuntimeClass admission controller updates the workload's PodSpec to include the overhead as described in the RuntimeClass. If the PodSpec already has this field defined, the Pod will be rejected. In the given example, since only the RuntimeClass name is specified, the admission controller mutates the Pod to include an overhead.After the RuntimeClass admission controller has made modifications, you can check the updated Pod overhead value:kubectl get pod test-pod -o jsonpath='{.spec.overhead}' The output is:map[cpu:250m memory:120Mi] If a ResourceQuota is defined, the sum of container requests as well as the overhead field are counted.When the kube-scheduler is deciding which node should run a new Pod, the scheduler considers that Pod's overhead as well as the sum of container requests for that Pod. For this example, the scheduler adds the requests and the overhead, then looks for a node that has 2.25 CPU and 320 MiB of memory available.Once a Pod is scheduled to a node, the kubelet on that node creates a new cgroup for the Pod. It is within this pod that the underlying container runtime will create containers.If the resource has a limit defined for each container (Guaranteed QoS or Burstable QoS with limits defined), the kubelet will set an upper limit for the pod cgroup associated with that resource (cpu.cfs_quota_us for CPU and memory.limit_in_bytes memory). This upper limit is based on the sum of the container limits plus the overhead defined in the PodSpec.For CPU, if the Pod is Guaranteed or Burstable QoS, the kubelet will set cpu.shares based on the sum of container requests plus the overhead defined in the PodSpec.Looking at our example, verify the container requests for the workload:kubectl get pod test-pod -o jsonpath='{.spec.containers[*].resources.limits}' Th", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067"}
{"instruction": "Write a yaml example for pod overhead", "response": "Here's a yaml example:\n\n```yaml\n# You need to change this example to match the actual runtime name, and per-Pod\n# resource overhead, that the container runtime is adding in your cluster.\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: kata-fc\nhandler: kata-fc\noverhead:\n  podFixed:\n    memory: \"120Mi\"\n    cpu: \"250m\"\n```\n\nPod Overhead | Workloads which are created which specify the kata-fc RuntimeClass handler will take the memory and cpu overheads into account for resource quota calculations, node scheduling, as well as Pod cgroup s", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_847"}
{"instruction": "Write a yaml example for pod overhead", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  runtimeClassName: kata-fc\n  containers:\n  - name: busybox-ctr\n    image: busybox:1.28\n    stdin: true\n    tty: true\n    resources:\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  - name: nginx-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: 1500m\n        memory: 100Mi\n```\n\nPod Overhead | At admission time the RuntimeClass admission controller updates the workload's PodSpec to include the overhead as described in the RuntimeClass. If the PodSpec already has this field defined, the Pod", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_848"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.overhead}'\n```\n\nPod Overhead | The output is:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_849"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.containers[*].resources.limits}'\n```\n\nPod Overhead | The total container requests are 2000m CPU and 200MiB of memory:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_850"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl describe node | grep test-pod -B2\n```\n\nPod Overhead | The output shows requests for 2250m CPU, and for 320MiB of memory. The requests include Pod overhead:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_851"}
{"instruction": "Write a yaml example for pod overhead", "response": "Here's a yaml example:\n\n```yaml\n# You need to change this example to match the actual runtime name, and per-Pod\n# resource overhead, that the container runtime is adding in your cluster.\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: kata-fc\nhandler: kata-fc\noverhead:\n  podFixed:\n    memory: \"120Mi\"\n    cpu: \"250m\"\n```\n\nPod Overhead | Workloads which are created which specify the kata-fc RuntimeClass handler will take the memory and cpu overheads into account for resource quota calculations, node scheduling, as well as Pod cgroup s", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_852"}
{"instruction": "Write a yaml example for pod overhead", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  runtimeClassName: kata-fc\n  containers:\n  - name: busybox-ctr\n    image: busybox:1.28\n    stdin: true\n    tty: true\n    resources:\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  - name: nginx-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: 1500m\n        memory: 100Mi\n```\n\nPod Overhead | At admission time the RuntimeClass admission controller updates the workload's PodSpec to include the overhead as described in the RuntimeClass. If the PodSpec already has this field defined, the Pod", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_853"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.overhead}'\n```\n\nPod Overhead | The output is:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_854"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.containers[*].resources.limits}'\n```\n\nPod Overhead | The total container requests are 2000m CPU and 200MiB of memory:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_855"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl describe node | grep test-pod -B2\n```\n\nPod Overhead | The output shows requests for 2250m CPU, and for 320MiB of memory. The requests include Pod overhead:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_856"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\n# Run this on the node where the Pod is scheduled\nPOD_ID=\"$(sudo crictl pods --name test-pod -q)\"\n```\n\nPod Overhead | From this, you can determine the cgroup path for the Pod:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_857"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\n# Run this on the node where the Pod is scheduled\nsudo crictl inspectp -o=json $POD_ID | grep cgroupsPath\n```\n\nPod Overhead | The resulting cgroup path includes the Pod's pause container. The Pod level cgroup is one directory above.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_858"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\n# Run this on the node where the Pod is scheduled.\n# Also, change the name of the cgroup to match the cgroup allocated for your pod.\n cat /sys/fs/cgroup/memory/kubepods/podd7f4b509-cf94-4951-9417-d1087c92a5b2/memory.limit_in_bytes\n```\n\nPod Overhead | This is 320 MiB, as expected:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_859"}
{"instruction": "Write a yaml example for pod overhead", "response": "Here's a yaml example:\n\n```yaml\n# You need to change this example to match the actual runtime name, and per-Pod\n# resource overhead, that the container runtime is adding in your cluster.\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: kata-fc\nhandler: kata-fc\noverhead:\n  podFixed:\n    memory: \"120Mi\"\n    cpu: \"250m\"\n```\n\nPod Overhead | Workloads which are created which specify the kata-fc RuntimeClass handler will take the memory and cpu overheads into account for resource quota calculations, node scheduling, as well as Pod cgroup s", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_860"}
{"instruction": "Write a yaml example for pod overhead", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  runtimeClassName: kata-fc\n  containers:\n  - name: busybox-ctr\n    image: busybox:1.28\n    stdin: true\n    tty: true\n    resources:\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  - name: nginx-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: 1500m\n        memory: 100Mi\n```\n\nPod Overhead | At admission time the RuntimeClass admission controller updates the workload's PodSpec to include the overhead as described in the RuntimeClass. If the PodSpec already has this field defined, the Pod", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_861"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.overhead}'\n```\n\nPod Overhead | The output is:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_862"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.containers[*].resources.limits}'\n```\n\nPod Overhead | The total container requests are 2000m CPU and 200MiB of memory:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_863"}
{"instruction": "Write a bash example for pod overhead", "response": "Here's a bash example:\n\n```bash\nkubectl describe node | grep test-pod -B2\n```\n\nPod Overhead | The output shows requests for 2250m CPU, and for 320MiB of memory. The requests include Pod overhead:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/", "id": "k8s_00067_code_864"}
{"instruction": "Provide a tutorial on restrict a container's syscalls with seccomp", "response": "Restrict a Container's Syscalls with seccompFEATURE STATE: Kubernetes v1.19 [stable]Seccomp stands for secure computing mode and has been a feature of the Linux kernel since version 2.6.12. It can be used to sandbox the privileges of a process, restricting the calls it is able to make from userspace into the kernel. Kubernetes lets you automatically apply seccomp profiles loaded onto a node to your Pods and containers.Identifying the privileges required for your workloads can be difficult. In this tutorial, you will go through how to load seccomp profiles into a local Kubernetes cluster, how to apply them to a Pod, and how you can begin to craft profiles that give only the necessary privileges to your container processes.ObjectivesLearn how to load seccomp profiles on a nodeLearn how to apply a seccomp profile to a containerObserve auditing of syscalls made by a container processObserve behavior when a missing profile is specifiedObserve a violation of a seccomp profileLearn how to create fine-grained seccomp profilesLearn how to apply a container runtime default seccomp profileBefore you beginIn order to complete all steps in this tutorial, you must install kind and kubectl.The commands used in the tutorial assume that you are using Docker as your container runtime. (The cluster that kind creates may use a different container runtime internally). You could also use Podman but in that case, you would have to follow specific instructions in order to complete the tasks successfully.This tutorial shows some examples that are still beta (since v1.25) and others that use only generally available seccomp functionality. You should make sure that your cluster is configured correctly for the version you are using.The tutorial also uses the curl tool for downloading examples to your computer. You can adapt the steps to use a different tool if you prefer.Note:It is not possible to apply a seccomp profile to a container running with privileged: true set in the container's securityContext. Privileged containers always run as Unconfined.Download example seccomp profilesThe contents of these profiles will be explored later on, but for now go ahead and download them into a directory named profiles/ so that they can be loaded into the cluster.pods/security/seccomp/profiles/audit.json { \"defaultAction\": \"SCMP_ACT_LOG\" }pods/security/seccomp/profiles/violation.json { \"defaultAction\": \"SCMP_ACT_ERRNO\" }pods/security/seccomp/profiles/fine-grained.json { \"defaultAction\": \"SCMP_ACT_ERRNO\", \"architectures\": [ \"SCMP_ARCH_X86_64\", \"SCMP_ARCH_X86\", \"SCMP_ARCH_X32\" ], \"syscalls\": [ { \"names\": [ \"accept4\", \"epoll_wait\", \"pselect6\", \"futex\", \"madvise\", \"epoll_ctl\", \"getsockname\", \"setsockopt\", \"vfork\", \"mmap\", \"read\", \"write\", \"close\", \"arch_prctl\", \"sched_getaffinity\", \"munmap\", \"brk\", \"rt_sigaction\", \"rt_sigprocmask\", \"sigaltstack\", \"gettid\", \"clone\", \"bind\", \"socket\", \"openat\", \"readlinkat\", \"exit_group\", \"epoll_create1\", \"listen\", \"rt_sigreturn\", \"sched_yield\", \"clock_gettime\", \"connect\", \"dup2\", \"epoll_pwait\", \"execve\", \"exit\", \"fcntl\", \"getpid\", \"getuid\", \"ioctl\", \"mprotect\", \"nanosleep\", \"open\", \"poll\", \"recvfrom\", \"sendto\", \"set_tid_address\", \"setitimer\", \"writev\", \"fstatfs\", \"getdents64\", \"pipe2\", \"getrlimit\" ], \"action\": \"SCMP_ACT_ALLOW\" } ] }Run these commands:mkdir ./profiles curl -L -o profiles/audit.json https://k8s.io/examples/pods/security/seccomp/profiles/audit.json curl -L -o profiles/violation.json https://k8s.io/examples/pods/security/seccomp/profiles/violation.json curl -L -o profiles/fine-grained.json https://k8s.io/examples/pods/security/seccomp/profiles/fine-grained.json ls profiles You should see three profiles listed at the end of the final step:audit.json fine-grained.json violation.json Create a local Kubernetes cluster with kindFor simplicity, kind can be used to create a single node cluster with the seccomp profiles loaded. Kind runs Kubernetes in Docker, so each node of the cluster is a container. This allows for files to be ", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\nRestrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_866"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_867"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_868"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_869"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | To start off, apply the audit.json profile, which will log all syscalls of the process, to a new Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_870"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_871"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/audit-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | This profile does not restrict any syscalls, so the Pod should start successfully.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_872"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod audit-pod\n```\n\nRestrict a Container's Syscalls with seccomp | In order to be able to interact with this endpoint exposed by this container, create a NodePort Service that allows access to the endpoint from inside the kind control plane container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_873"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod audit-pod --type NodePort --port 5678\n```\n\nRestrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_874"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get service audit-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_875"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete service audit-pod --wait\nkubectl delete pod audit-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | For demonstration, apply a profile to the Pod that does not allow for any syscalls.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_876"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_877"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/violation-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod creates, but there is an issue. If you check the status of the Pod, you should see that it failed to start.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_878"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod violation-pod\n```\n\nRestrict a Container's Syscalls with seccomp | As seen in the previous example, the http-echo process requires quite a few syscalls. Here seccomp has been instructed to error on any syscall by setting \"defaultAction\": \"SCMP_ACT_ERRNO\". This is ext", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_879"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod violation-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | If you take a look at the fine-grained.json profile, you will notice some of the syscalls seen in syslog of the first example where the profile set \"defaultAction\": \"SCMP_ACT_LOG\". Now the profile is", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_880"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_881"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/fine-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_882"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod fine-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_883"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod fine-pod --type NodePort --port 5678\n```\n\nRestrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_884"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get service fine-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_885"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete service fine-pod --wait\nkubectl delete pod fine-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | To use seccomp profile defaulting, you must run the kubelet with the --seccomp-default command line flag enabled for each node where you want to use it.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_886"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n  - role: control-plane\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"        \n  - role: worker\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"\n```\n\nRestrict a Container's Syscalls with seccomp | If the cluster is ready, then running a pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_887"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl run --rm -it --restart=Never --image=alpine alpine -- sh\n```\n\nRestrict a Container's Syscalls with seccomp | Should now have the default seccomp profile attached. This can be verified by using docker exec to run crictl inspect for the container on the kind worker:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_888"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\ndocker exec -it kind-worker bash -c \\\n    'crictl inspect $(crictl ps --name=alpine -q) | jq .info.runtimeSpec.linux.seccomp'\n```\n\nRestrict a Container's Syscalls with seccomp | You can learn more about Linux seccomp:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_889"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\nRestrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_890"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_891"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_892"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_893"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_894"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n  - role: control-plane\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"        \n  - role: worker\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"\n```\n\nRestrict a Container's Syscalls with seccomp | If the cluster is ready, then running a pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_895"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/kind.yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\nRestrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_896"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\nRestrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_897"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/default-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_898"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_899"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_900"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_901"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | To start off, apply the audit.json profile, which will log all syscalls of the process, to a new Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_902"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/audit-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_903"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_904"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/audit-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | This profile does not restrict any syscalls, so the Pod should start successfully.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_905"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod audit-pod\n```\n\nRestrict a Container's Syscalls with seccomp | In order to be able to interact with this endpoint exposed by this container, create a NodePort Service that allows access to the endpoint from inside the kind control plane container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_906"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod audit-pod --type NodePort --port 5678\n```\n\nRestrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_907"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get service audit-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_908"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete service audit-pod --wait\nkubectl delete pod audit-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | For demonstration, apply a profile to the Pod that does not allow for any syscalls.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_909"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/violation-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_910"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_911"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/violation-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod creates, but there is an issue. If you check the status of the Pod, you should see that it failed to start.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_912"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod violation-pod\n```\n\nRestrict a Container's Syscalls with seccomp | As seen in the previous example, the http-echo process requires quite a few syscalls. Here seccomp has been instructed to error on any syscall by setting \"defaultAction\": \"SCMP_ACT_ERRNO\". This is ext", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_913"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod violation-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | If you take a look at the fine-grained.json profile, you will notice some of the syscalls seen in syslog of the first example where the profile set \"defaultAction\": \"SCMP_ACT_LOG\". Now the profile is", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_914"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/fine-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_915"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nRestrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_916"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/fine-pod.yaml\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_917"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get pod fine-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_918"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod fine-pod --type NodePort --port 5678\n```\n\nRestrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_919"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl get service fine-pod\n```\n\nRestrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_920"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl delete service fine-pod --wait\nkubectl delete pod fine-pod --wait --now\n```\n\nRestrict a Container's Syscalls with seccomp | To use seccomp profile defaulting, you must run the kubelet with the --seccomp-default command line flag enabled for each node where you want to use it.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_921"}
{"instruction": "Write a yaml example for restrict a container's syscalls with seccomp", "response": "Here's a yaml example:\n\n```yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n  - role: control-plane\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"        \n  - role: worker\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"\n```\n\nRestrict a Container's Syscalls with seccomp | If the cluster is ready, then running a pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_922"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\nkubectl run --rm -it --restart=Never --image=alpine alpine -- sh\n```\n\nRestrict a Container's Syscalls with seccomp | Should now have the default seccomp profile attached. This can be verified by using docker exec to run crictl inspect for the container on the kind worker:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_923"}
{"instruction": "Write a bash example for restrict a container's syscalls with seccomp", "response": "Here's a bash example:\n\n```bash\ndocker exec -it kind-worker bash -c \\\n    'crictl inspect $(crictl ps --name=alpine -q) | jq .info.runtimeSpec.linux.seccomp'\n```\n\nRestrict a Container's Syscalls with seccomp | You can learn more about Linux seccomp:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/seccomp/", "id": "k8s_00068_code_924"}
{"instruction": "How do you decrypt confidential data that is already encrypted at rest in Kubernetes?", "response": "Decrypt Confidential Data that is Already Encrypted at RestAll of the APIs in Kubernetes that let you write persistent API resource data support at-rest encryption. For example, you can enable at-rest encryption for Secrets. This at-rest encryption is additional to any system-level encryption for the etcd cluster or for the filesystem(s) on hosts where you are running the kube-apiserver.This page shows how to switch from encryption of API data at rest, so that API data are stored unencrypted. You might want to do this to improve performance; usually, though, if it was a good idea to encrypt some data, it's also a good idea to leave them encrypted.Note:This task covers encryption for resource data stored using the Kubernetes API. For example, you can encrypt Secret objects, including the key-value data they contain.If you wanted to manage encryption for data in filesystems that are mounted into containers, you instead need to either:use a storage integration that provides encrypted volumesencrypt the data within your own applicationBefore you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesThis task assumes that you are running the Kubernetes API server as a static pod on each control plane node.Your cluster's control plane must use etcd v3.x (major version 3, any minor version).To encrypt a custom resource, your cluster must be running Kubernetes v1.26 or newer.You should have some API data that are already encrypted.To check the version, enter kubectl version.Determine whether encryption at rest is already enabledBy default, the API server uses an identity provider that stores plain-text representations of resources. The default identity provider does not provide any confidentiality protection.The kube-apiserver process accepts an argument --encryption-provider-config that specifies a path to a configuration file. The contents of that file, if you specify one, control how Kubernetes API data is encrypted in etcd. If it is not specified, you do not have encryption at rest enabled.The format of that configuration file is YAML, representing a configuration API kind named EncryptionConfiguration. You can see an example configuration in Encryption at rest configuration.If --encryption-provider-config is set, check which resources (such as secrets) are configured for encryption, and what provider is used. Make sure that the preferred provider for that resource type is not identity; you only set identity (no encryption) as default when you want to disable encryption at rest. Verify that the first-listed provider for a resource is something other than identity, which means that any new information written to resources of that type will be encrypted as configured. If you do see identity as the first-listed provider for any resource, this means that those resources are being written out to etcd without encryption.Decrypt all dataThis example shows how to stop encrypting the Secret API at rest. If you are encrypting other API kinds, adjust the steps to match.Locate the encryption configuration fileFirst, find the API server configuration files. On each control plane node, static Pod manifest for the kube-apiserver specifies a command line argument, --encryption-provider-config. You are likely to find that this file is mounted into the static Pod using a hostPath volume mount. Once you locate the volume you can find the file on the node filesystem and inspect it.Configure the API server to decrypt objectsTo disable encryption at rest, place the identity provider as the first entry in your encryption configuration file.For example, if your existing EncryptionConfigu", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/decrypt-data/", "id": "k8s_00069"}
{"instruction": "Write a yaml example for decrypt confidential data that is already encrypted at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            # Do not use this (invalid) example key for encryption\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\nDecrypt Confidential Data that is Already Encrypted at Rest | then change it to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/decrypt-data/", "id": "k8s_00069_code_926"}
{"instruction": "Write a yaml example for decrypt confidential data that is already encrypted at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\nDecrypt Confidential Data that is Already Encrypted at Rest | and restart the kube-apiserver Pod on this node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/decrypt-data/", "id": "k8s_00069_code_927"}
{"instruction": "Write a yaml example for decrypt confidential data that is already encrypted at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            # Do not use this (invalid) example key for encryption\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\nDecrypt Confidential Data that is Already Encrypted at Rest | then change it to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/decrypt-data/", "id": "k8s_00069_code_928"}
{"instruction": "Write a yaml example for decrypt confidential data that is already encrypted at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\nDecrypt Confidential Data that is Already Encrypted at Rest | and restart the kube-apiserver Pod on this node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/decrypt-data/", "id": "k8s_00069_code_929"}
{"instruction": "Write a yaml example for decrypt confidential data that is already encrypted at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            # Do not use this (invalid) example key for encryption\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\nDecrypt Confidential Data that is Already Encrypted at Rest | then change it to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/decrypt-data/", "id": "k8s_00069_code_930"}
{"instruction": "Write a yaml example for decrypt confidential data that is already encrypted at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\nDecrypt Confidential Data that is Already Encrypted at Rest | and restart the kube-apiserver Pod on this node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/decrypt-data/", "id": "k8s_00069_code_931"}
{"instruction": "What is the reference documentation for kubelet configuration (v1)?", "response": "Kubelet Configuration (v1)Resource TypesCredentialProviderConfigCredentialProviderConfigCredentialProviderConfig is the configuration containing information about each exec credential provider. Kubelet reads this configuration from disk and enables each provider as specified by the CredentialProvider type.FieldDescriptionapiVersionstringkubelet.config.k8s.io/v1kindstringCredentialProviderConfigproviders [Required][]CredentialProviderproviders is a list of credential provider plugins that will be enabled by the kubelet. Multiple providers may match against a single image, in which case credentials from all providers will be returned to the kubelet. If multiple providers are called for a single image, the results are combined. If providers return overlapping auth keys, the value from the provider earlier in this list is attempted first.CredentialProviderAppears in:CredentialProviderConfigCredentialProvider represents an exec plugin to be invoked by the kubelet. The plugin is only invoked when an image being pulled matches the images handled by the plugin (see matchImages).FieldDescriptionname [Required]stringname is the required name of the credential provider. It must match the name of the provider executable as seen by the kubelet. The executable must be in the kubelet's bin directory (set by the --image-credential-provider-bin-dir flag). Required to be unique across all providers.matchImages [Required][]stringmatchImages is a required list of strings used to match against images in order to determine if this provider should be invoked. If one of the strings matches the requested image from the kubelet, the plugin will be invoked and given a chance to provide credentials. Images are expected to contain the registry domain and URL path.Each entry in matchImages is a pattern which can optionally contain a port and a path. Globs can be used in the domain, but not in the port or the path. Globs are supported as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'. Matching partial subdomains like 'app.k8s.io' is also supported. Each glob can only match a single subdomain segment, so *.io does not match *.k8s.io.A match exists between an image and a matchImage when all of the below are true:Both contain the same number of domain parts and each part matches.The URL path of an imageMatch must be a prefix of the target image URL path.If the imageMatch contains a port, then the port must match in the image as well.Example values of matchImages:123456789.dkr.ecr.us-east-1.amazonaws.com*.azurecr.iogcr.io*.*.registry.ioregistry.io:8080/pathdefaultCacheDuration [Required]meta/v1.DurationdefaultCacheDuration is the default duration the plugin will cache credentials in-memory if a cache duration is not provided in the plugin response. This field is required.apiVersion [Required]stringRequired input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse MUST use the same encoding version as the input. Current supported values are:credentialprovider.kubelet.k8s.io/v1args[]stringArguments to pass to the command when executing it.env[]ExecEnvVarEnv defines additional environment variables to expose to the process. These are unioned with the host's environment, as well as variables client-go uses to pass argument to the plugin.tokenAttributesServiceAccountTokenAttributestokenAttributes is the configuration for the service account token that will be passed to the plugin. The credential provider opts in to using service account tokens for image pull by setting this field. When this field is set, kubelet will generate a service account token bound to the pod for which the image is being pulled and pass to the plugin as part of CredentialProviderRequest along with other attributes required by the plugin.The service account metadata and token attributes will be used as a dimension to cache the credentials in kubelet. The cache key is generated by combining the service account metadata (namespa", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubelet-config.v1/", "id": "k8s_00070"}
{"instruction": "Explain the Kubernetes concept: Storage Capacity", "response": "Storage CapacityStorage capacity is limited and may vary depending on the node on which a pod runs: network-attached storage might not be accessible by all nodes, or storage is local to a node to begin with.FEATURE STATE: Kubernetes v1.24 [stable]This page describes how Kubernetes keeps track of storage capacity and how the scheduler uses that information to schedule Pods onto nodes that have access to enough storage capacity for the remaining missing volumes. Without storage capacity tracking, the scheduler may choose a node that doesn't have enough capacity to provision a volume and multiple scheduling retries will be needed.Before you beginKubernetes v1.34 includes cluster-level API support for storage capacity tracking. To use this you must also be using a CSI driver that supports capacity tracking. Consult the documentation for the CSI drivers that you use to find out whether this support is available and, if so, how to use it. If you are not running Kubernetes v1.34, check the documentation for that version of Kubernetes.APIThere are two API extensions for this feature:CSIStorageCapacity objects: these get produced by a CSI driver in the namespace where the driver is installed. Each object contains capacity information for one storage class and defines which nodes have access to that storage.The CSIDriverSpec.StorageCapacity field: when set to true, the Kubernetes scheduler will consider storage capacity for volumes that use the CSI driver.SchedulingStorage capacity information is used by the Kubernetes scheduler if:a Pod uses a volume that has not been created yet,that volume uses a StorageClass which references a CSI driver and uses WaitForFirstConsumer volume binding mode, andthe CSIDriver object for the driver has StorageCapacity set to true.In that case, the scheduler only considers nodes for the Pod which have enough storage available to them. This check is very simplistic and only compares the size of the volume against the capacity listed in CSIStorageCapacity objects with a topology that includes the node.For volumes with Immediate volume binding mode, the storage driver decides where to create the volume, independently of Pods that will use the volume. The scheduler then schedules Pods onto nodes where the volume is available after the volume has been created.For CSI ephemeral volumes, scheduling always happens without considering storage capacity. This is based on the assumption that this volume type is only used by special CSI drivers which are local to a node and do not need significant resources there.ReschedulingWhen a node has been selected for a Pod with WaitForFirstConsumer volumes, that decision is still tentative. The next step is that the CSI storage driver gets asked to create the volume with a hint that the volume is supposed to be available on the selected node.Because Kubernetes might have chosen a node based on out-dated capacity information, it is possible that the volume cannot really be created. The node selection is then reset and the Kubernetes scheduler tries again to find a node for the Pod.LimitationsStorage capacity tracking increases the chance that scheduling works on the first try, but cannot guarantee this because the scheduler has to decide based on potentially out-dated information. Usually, the same retry mechanism as for scheduling without any storage capacity information handles scheduling failures.One situation where scheduling can fail permanently is when a Pod uses multiple volumes: one volume might have been created already in a topology segment which then does not have enough capacity left for another volume. Manual intervention is necessary to recover from this, for example by increasing capacity or deleting the volume that was already created.What's nextFor more information on the design, see the Storage Capacity Constraints for Pod Scheduling KEP.", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-capacity/", "id": "k8s_00071"}
{"instruction": "How do you using sysctls in a kubernetes cluster in Kubernetes?", "response": "Using sysctls in a Kubernetes ClusterFEATURE STATE: Kubernetes v1.21 [stable]This document describes how to configure and use kernel parameters within a Kubernetes cluster using the sysctl interface.Note:Starting from Kubernetes version 1.23, the kubelet supports the use of either / or . as separators for sysctl names. Starting from Kubernetes version 1.25, setting Sysctls for a Pod supports setting sysctls with slashes. For example, you can represent the same sysctl name as kernel.shm_rmid_forced using a period as the separator, or as kernel/shm_rmid_forced using a slash as a separator. For more sysctl parameter conversion method details, please refer to the page sysctl.d(5) from the Linux man-pages project.Before you beginNote:sysctl is a Linux-specific command-line tool used to configure various kernel parameters and it is not available on non-Linux operating systems.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesFor some steps, you also need to be able to reconfigure the command line options for the kubelets running on your cluster.Listing all Sysctl ParametersIn Linux, the sysctl interface allows an administrator to modify kernel parameters at runtime. Parameters are available via the /proc/sys/ virtual process file system. The parameters cover various subsystems such as:kernel (common prefix: kernel.)networking (common prefix: net.)virtual memory (common prefix: vm.)MDADM (common prefix: dev.)More subsystems are described in Kernel docs.To get a list of all parameters, you can runsudo sysctl -a Safe and Unsafe SysctlsKubernetes classes sysctls as either safe or unsafe. In addition to proper namespacing, a safe sysctl must be properly isolated between pods on the same node. This means that setting a safe sysctl for one podmust not have any influence on any other pod on the nodemust not allow to harm the node's healthmust not allow to gain CPU or memory resources outside of the resource limits of a pod.By far, most of the namespaced sysctls are not necessarily considered safe. The following sysctls are supported in the safe set:kernel.shm_rmid_forced;net.ipv4.ip_local_port_range;net.ipv4.tcp_syncookies;net.ipv4.ping_group_range (since Kubernetes 1.18);net.ipv4.ip_unprivileged_port_start (since Kubernetes 1.22);net.ipv4.ip_local_reserved_ports (since Kubernetes 1.27, needs kernel 3.16+);net.ipv4.tcp_keepalive_time (since Kubernetes 1.29, needs kernel 4.5+);net.ipv4.tcp_fin_timeout (since Kubernetes 1.29, needs kernel 4.6+);net.ipv4.tcp_keepalive_intvl (since Kubernetes 1.29, needs kernel 4.5+);net.ipv4.tcp_keepalive_probes (since Kubernetes 1.29, needs kernel 4.5+).net.ipv4.tcp_rmem (since Kubernetes 1.32, needs kernel 4.15+).net.ipv4.tcp_wmem (since Kubernetes 1.32, needs kernel 4.15+).Note:There are some exceptions to the set of safe sysctls:The net.* sysctls are not allowed with host networking enabled.The net.ipv4.tcp_syncookies sysctl is not namespaced on Linux kernel version 4.5 or lower.This list will be extended in future Kubernetes versions when the kubelet supports better isolation mechanisms.Enabling Unsafe SysctlsAll safe sysctls are enabled by default.All unsafe sysctls are disabled by default and must be allowed manually by the cluster admin on a per-node basis. Pods with disabled unsafe sysctls will be scheduled, but will fail to launch.With the warning above in mind, the cluster admin can allow certain unsafe sysctls for very special situations such as high-performance or real-time application tuning. Unsafe sysctls are enabled on a node-by-node basis with a flag of the kubelet; for example:kubelet --allowed-unsafe-sysctls \\ 'kernel.msg*,n", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/", "id": "k8s_00072"}
{"instruction": "Write a yaml example for using sysctls in a kubernetes cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sysctl-example\nspec:\n  securityContext:\n    sysctls:\n    - name: kernel.shm_rmid_forced\n      value: \"0\"\n    - name: net.core.somaxconn\n      value: \"1024\"\n    - name: kernel.msgmax\n      value: \"65536\"\n  ...\n```\n\nUsing sysctls in a Kubernetes Cluster | It is good practice to consider nodes with special sysctl settings as tainted within a cluster, and only schedule pods onto them which need those sysctl settings. It is suggested to use the Kubernetes", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/", "id": "k8s_00072_code_935"}
{"instruction": "Write a yaml example for using sysctls in a kubernetes cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sysctl-example\nspec:\n  securityContext:\n    sysctls:\n    - name: kernel.shm_rmid_forced\n      value: \"0\"\n    - name: net.core.somaxconn\n      value: \"1024\"\n    - name: kernel.msgmax\n      value: \"65536\"\n  ...\n```\n\nUsing sysctls in a Kubernetes Cluster | It is good practice to consider nodes with special sysctl settings as tainted within a cluster, and only schedule pods onto them which need those sysctl settings. It is suggested to use the Kubernetes", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/", "id": "k8s_00072_code_936"}
{"instruction": "Write a yaml example for using sysctls in a kubernetes cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sysctl-example\nspec:\n  securityContext:\n    sysctls:\n    - name: kernel.shm_rmid_forced\n      value: \"0\"\n    - name: net.core.somaxconn\n      value: \"1024\"\n    - name: kernel.msgmax\n      value: \"65536\"\n  ...\n```\n\nUsing sysctls in a Kubernetes Cluster | It is good practice to consider nodes with special sysctl settings as tainted within a cluster, and only schedule pods onto them which need those sysctl settings. It is suggested to use the Kubernetes", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/", "id": "k8s_00072_code_937"}
{"instruction": "How do you determine the reason for pod failure in Kubernetes?", "response": "Determine the Reason for Pod FailureThis page shows how to write and read a Container termination message.Termination messages provide a way for containers to write information about fatal events to a location where it can be easily retrieved and surfaced by tools like dashboards and monitoring software. In most cases, information that you put in a termination message should also be written to the general Kubernetes logs.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesWriting and reading a termination messageIn this exercise, you create a Pod that runs one container. The manifest for that Pod specifies a command that runs when the container starts:debug/termination.yaml apiVersion: v1 kind: Pod metadata: name: termination-demo spec: containers: - name: termination-demo-container image: debian command: [\"/bin/sh\"] args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"] Create a Pod based on the YAML configuration file:kubectl apply -f https://k8s.io/examples/debug/termination.yaml In the YAML file, in the command and args fields, you can see that the container sleeps for 10 seconds and then writes \"Sleep expired\" to the /dev/termination-log file. After the container writes the \"Sleep expired\" message, it terminates.Display information about the Pod:kubectl get pod termination-demo Repeat the preceding command until the Pod is no longer running.Display detailed information about the Pod:kubectl get pod termination-demo --output=yaml The output includes the \"Sleep expired\" message:apiVersion: v1 kind: Pod ... lastState: terminated: containerID: ... exitCode: 0 finishedAt: ... message: | Sleep expired ... Use a Go template to filter the output so that it includes only the termination message:kubectl get pod termination-demo -o go-template=\"{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}\" If you are running a multi-container Pod, you can use a Go template to include the container's name. By doing so, you can discover which of the containers is failing:kubectl get pod multi-container-pod -o go-template='{{range .status.containerStatuses}}{{printf \"%s:\\n%s\\n\\n\" .name .lastState.terminated.message}}{{end}}' Customizing the termination messageKubernetes retrieves termination messages from the termination message file specified in the terminationMessagePath field of a Container, which has a default value of /dev/termination-log. By customizing this field, you can tell Kubernetes to use a different file. Kubernetes use the contents from the specified file to populate the Container's status message on both success and failure.The termination message is intended to be brief final status, such as an assertion failure message. The kubelet truncates messages that are longer than 4096 bytes.The total message length across all containers is limited to 12KiB, divided equally among each container. For example, if there are 12 containers (initContainers or containers), each has 1024 bytes of available termination message space.The default termination message path is /dev/termination-log. You cannot set the termination message path after a Pod is launched.In the following example, the container writes termination messages to /tmp/my-log for Kubernetes to retrieve:apiVersion: v1 kind: Pod metadata: name: msg-path-demo spec: containers: - name: msg-path-demo-container image: debian terminationMessagePath: \"/tmp/my-log\" Moreover, users can set the terminationMessagePolicy field of a Container for further customization. This field defaults to \"File\" which means the termination messages are retrieved only from the termination me", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\nDetermine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_939"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/termination.yaml\n```\n\nDetermine the Reason for Pod Failure | In the YAML file, in the command and args fields, you can see that the container sleeps for 10 seconds and then writes \"Sleep expired\" to the /dev/termination-log file. After the container writes the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_940"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo\n```\n\nDetermine the Reason for Pod Failure | Repeat the preceding command until the Pod is no longer running.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_941"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo --output=yaml\n```\n\nDetermine the Reason for Pod Failure | The output includes the \"Sleep expired\" message:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_942"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\n...\n    lastState:\n      terminated:\n        containerID: ...\n        exitCode: 0\n        finishedAt: ...\n        message: |\n          Sleep expired          \n        ...\n```\n\nDetermine the Reason for Pod Failure | Use a Go template to filter the output so that it includes only the termination message:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_943"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo -o go-template=\"{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}\"\n```\n\nDetermine the Reason for Pod Failure | If you are running a multi-container Pod, you can use a Go template to include the container's name. By doing so, you can discover which of the containers is failing:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_944"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod multi-container-pod -o go-template='{{range .status.containerStatuses}}{{printf \"%s:\\n%s\\n\\n\" .name .lastState.terminated.message}}{{end}}'\n```\n\nDetermine the Reason for Pod Failure | Kubernetes retrieves termination messages from the termination message file specified in the terminationMessagePath field of a Container, which has a default value of /dev/termination-log. By customiz", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_945"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: msg-path-demo\nspec:\n  containers:\n  - name: msg-path-demo-container\n    image: debian\n    terminationMessagePath: \"/tmp/my-log\"\n```\n\nDetermine the Reason for Pod Failure | Moreover, users can set the terminationMessagePolicy field of a Container for further customization. This field defaults to \"File\" which means the termination messages are retrieved only from the term", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_946"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\nDetermine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_947"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\n...\n    lastState:\n      terminated:\n        containerID: ...\n        exitCode: 0\n        finishedAt: ...\n        message: |\n          Sleep expired          \n        ...\n```\n\nDetermine the Reason for Pod Failure | Use a Go template to filter the output so that it includes only the termination message:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_948"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: msg-path-demo\nspec:\n  containers:\n  - name: msg-path-demo-container\n    image: debian\n    terminationMessagePath: \"/tmp/my-log\"\n```\n\nDetermine the Reason for Pod Failure | Moreover, users can set the terminationMessagePolicy field of a Container for further customization. This field defaults to \"File\" which means the termination messages are retrieved only from the term", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_949"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\ndebug/termination.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\nDetermine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_950"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\nDetermine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_951"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/termination.yaml\n```\n\nDetermine the Reason for Pod Failure | In the YAML file, in the command and args fields, you can see that the container sleeps for 10 seconds and then writes \"Sleep expired\" to the /dev/termination-log file. After the container writes the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_952"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo\n```\n\nDetermine the Reason for Pod Failure | Repeat the preceding command until the Pod is no longer running.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_953"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo --output=yaml\n```\n\nDetermine the Reason for Pod Failure | The output includes the \"Sleep expired\" message:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_954"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\n...\n    lastState:\n      terminated:\n        containerID: ...\n        exitCode: 0\n        finishedAt: ...\n        message: |\n          Sleep expired          \n        ...\n```\n\nDetermine the Reason for Pod Failure | Use a Go template to filter the output so that it includes only the termination message:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_955"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo -o go-template=\"{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}\"\n```\n\nDetermine the Reason for Pod Failure | If you are running a multi-container Pod, you can use a Go template to include the container's name. By doing so, you can discover which of the containers is failing:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_956"}
{"instruction": "Write a bash example for determine the reason for pod failure", "response": "Here's a bash example:\n\n```bash\nkubectl get pod multi-container-pod -o go-template='{{range .status.containerStatuses}}{{printf \"%s:\\n%s\\n\\n\" .name .lastState.terminated.message}}{{end}}'\n```\n\nDetermine the Reason for Pod Failure | Kubernetes retrieves termination messages from the termination message file specified in the terminationMessagePath field of a Container, which has a default value of /dev/termination-log. By customiz", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_957"}
{"instruction": "Write a yaml example for determine the reason for pod failure", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: msg-path-demo\nspec:\n  containers:\n  - name: msg-path-demo-container\n    image: debian\n    terminationMessagePath: \"/tmp/my-log\"\n```\n\nDetermine the Reason for Pod Failure | Moreover, users can set the terminationMessagePolicy field of a Container for further customization. This field defaults to \"File\" which means the termination messages are retrieved only from the term", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/", "id": "k8s_00073_code_958"}
{"instruction": "How do you changing the container runtime on a node from docker engine to containerd in Kubernetes?", "response": "Changing the Container Runtime on a Node from Docker Engine to containerdThis task outlines the steps needed to update your container runtime to containerd from Docker. It is applicable for cluster operators running Kubernetes 1.23 or earlier. This also covers an example scenario for migrating from dockershim to containerd. Alternative container runtimes can be picked from this page.Before you beginNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Install containerd. For more information see containerd's installation documentation and for specific prerequisite follow the containerd guide.Drain the nodekubectl drain <node-to-drain> --ignore-daemonsets Replace <node-to-drain> with the name of your node you are draining.Stop the Docker daemonsystemctl stop kubelet systemctl disable docker.service --now Install ContainerdFollow the guide for detailed steps to install containerd.Install the containerd.io package from the official Docker repositories. Instructions for setting up the Docker repository for your respective Linux distribution and installing the containerd.io package can be found at Getting started with containerd.Configure containerd:sudo mkdir -p /etc/containerd containerd config default | sudo tee /etc/containerd/config.toml Restart containerd:sudo systemctl restart containerd Start a Powershell session, set $Version to the desired version (ex: $Version=\"1.4.3\"), and then run the following commands:Download containerd:curl.exe -L https://github.com/containerd/containerd/releases/download/v$Version/containerd-$Version-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz tar.exe xvf .\\containerd-windows-amd64.tar.gz Extract and configure:Copy-Item -Path \".\\bin\\\" -Destination \"$Env:ProgramFiles\\containerd\" -Recurse -Force cd $Env:ProgramFiles\\containerd\\ .\\containerd.exe config default | Out-File config.toml -Encoding ascii # Review the configuration. Depending on setup you may want to adjust: # - the sandbox_image (Kubernetes pause image) # - cni bin_dir and conf_dir locations Get-Content config.toml # (Optional - but highly recommended) Exclude containerd from Windows Defender Scans Add-MpPreference -ExclusionProcess \"$Env:ProgramFiles\\containerd\\containerd.exe\" Start containerd:.\\containerd.exe --register-service Start-Service containerd Configure the kubelet to use containerd as its container runtimeEdit the file /var/lib/kubelet/kubeadm-flags.env and add the containerd runtime to the flags; --container-runtime-endpoint=unix:///run/containerd/containerd.sock.Users using kubeadm should be aware that the kubeadm tool stores the host's CRI socket in the/var/lib/kubelet/instance-config.yaml file on each node. You can create this /var/lib/kubelet/instance-config.yaml file on the node.The /var/lib/kubelet/instance-config.yaml file allows setting the containerRuntimeEndpoint parameter.You can set this parameter's value to the path of your chosen CRI socket (for example unix:///run/containerd/containerd.sock).Restart the kubeletsystemctl start kubelet Verify that the node is healthyRun kubectl get nodes -o wide and containerd appears as the runtime for the node we just changed.Remove Docker EngineNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.If the node appears healthy, remove Docker.sudo yum remove docker-ce docker-ce-cli sudo apt-get purge docker-ce docker-ce-cli sudo dnf remove docker-ce docker-ce-cli sudo apt-get purge docker-ce docker-ce-cli The preceding commands don't remove images, containers, volumes, or customized", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/", "id": "k8s_00074"}
{"instruction": "Write a bash example for changing the container runtime on a node from docker engine to containerd", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node-to-drain> --ignore-daemonsets\n```\n\nChanging the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-drain> with the name of your node you are draining.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/", "id": "k8s_00074_code_960"}
{"instruction": "Write a bash example for changing the container runtime on a node from docker engine to containerd", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-to-uncordon>\n```\n\nChanging the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-uncordon> with the name of your node you previously drained.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/", "id": "k8s_00074_code_961"}
{"instruction": "Write a bash example for changing the container runtime on a node from docker engine to containerd", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o wide\n```\n\nChanging the Container Runtime on a Node from Docker Engine to containerd | If the node appears healthy, remove Docker.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/", "id": "k8s_00074_code_962"}
{"instruction": "Write a bash example for changing the container runtime on a node from docker engine to containerd", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node-to-drain> --ignore-daemonsets\n```\n\nChanging the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-drain> with the name of your node you are draining.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/", "id": "k8s_00074_code_963"}
{"instruction": "Write a bash example for changing the container runtime on a node from docker engine to containerd", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-to-uncordon>\n```\n\nChanging the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-uncordon> with the name of your node you previously drained.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/", "id": "k8s_00074_code_964"}
{"instruction": "What is the reference documentation for local files and paths used by the kubelet?", "response": "Local Files And Paths Used By The KubeletThe kubelet is mostly a stateless process running on a Kubernetes node. This document outlines files that kubelet reads and writes.Note:This document is for informational purpose and not describing any guaranteed behaviors or APIs. It lists resources used by the kubelet, which is an implementation detail and a subject to change at any release.The kubelet typically uses the control plane as the source of truth on what needs to run on the Node, and the container runtime to retrieve the current state of containers. So long as you provide a kubeconfig (API client configuration) to the kubelet, the kubelet does connect to your control plane; otherwise the node operates in standalone mode.On Linux nodes, the kubelet also relies on reading cgroups and various system files to collect metrics.On Windows nodes, the kubelet collects metrics via a different mechanism that does not rely on paths.There are also a few other files that are used by the kubelet as well, as kubelet communicates using local Unix-domain sockets. Some are sockets that the kubelet listens on, and for other sockets the kubelet discovers them and then connects as a client.Note:This page lists paths as Linux paths, which map to the Windows paths by adding a root disk C:\\ in place of / (unless specified otherwise). For example, /var/lib/kubelet/device-plugins maps to C:\\var\\lib\\kubelet\\device-plugins.ConfigurationKubelet configuration filesThe path to the kubelet configuration file can be configured using the command line argument --config. The kubelet also supports drop-in configuration files to enhance configuration.CertificatesCertificates and private keys are typically located at /var/lib/kubelet/pki, but can be configured using the --cert-dir kubelet command line argument. Names of certificate files are also configurable.ManifestsManifests for static pods are typically located in /etc/kubernetes/manifests. Location can be configured using the staticPodPath kubelet configuration option.Systemd unit settingsWhen kubelet is running as a systemd unit, some kubelet configuration may be declared in systemd unit settings file. Typically it includes:command line arguments to run kubeletenvironment variables, used by kubelet or configuring golang runtimeStateCheckpoint files for resource managersAll resource managers keep the mapping of Pods to allocated resources in state files. State files are located in the kubelet's base directory, also termed the root directory (but not the same as /, the node root directory). You can configure the base directory for the kubelet using the kubelet command line argument --root-dir.Names of files:memory_manager_state for the Memory Managercpu_manager_state for the CPU Managerdra_manager_state for DRACheckpoint file for device managerDevice manager creates checkpoints in the same directory with socket files: /var/lib/kubelet/device-plugins/. The name of a checkpoint file is kubelet_internal_checkpoint for Device ManagerPod resource checkpointsFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: true)If a node has enabled the InPlacePodVerticalScalingfeature gate, the kubelet stores a local record of allocated and actuated Pod resources. See Resize CPU and Memory Resources assigned to Containers for more details on how these records are used.Names of files:allocated_pods_state records the resources allocated to each pod running on the nodeactuated_pods_state records the resources that have been accepted by the runtime for each pod pod running on the nodeThe files are located within the kubelet base directory (/var/lib/kubelet by default on Linux; configurable using --root-dir).Container runtimeKubelet communicates with the container runtime using socket configured via the configuration parameters:containerRuntimeEndpoint for runtime operationsimageServiceEndpoint for image management operationsThe actual values of those endpoints depend on the container runtime being used.Device pluginsThe kub", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-files/", "id": "k8s_00075"}
{"instruction": "What is the reference documentation for introduction to kubectl?", "response": "Introduction to kubectlkubectl is the Kubernetes cli version of a swiss army knife, and can do many things.While this Book is focused on using kubectl to declaratively manage applications in Kubernetes, it also covers other kubectl functions.Command FamiliesMost kubectl commands typically fall into one of a few categories:TypeUsed ForDescriptionDeclarative Resource ManagementDeployment and operations (e.g. GitOps)Declaratively manage Kubernetes workloads using resource configurationImperative Resource ManagementDevelopment OnlyRun commands to manage Kubernetes workloads using Command Line arguments and flagsPrinting Workload StateDebuggingPrint information about workloadsInteracting with ContainersDebuggingExec, attach, cp, logsCluster ManagementCluster operationsDrain and cordon NodesDeclarative Application ManagementThe preferred approach for managing resources is through declarative files called resource configuration used with the kubectl Apply command. This command reads a local (or remote) file structure and modifies cluster state to reflect the declared intent.ApplyApply is the preferred mechanism for managing resources in a Kubernetes cluster.Printing State about WorkloadsUsers will need to view workload state.Printing summarize state and information about resourcesPrinting complete state and information about resourcesPrinting specific fields from resourcesQuery resources matching labelsDebugging Workloadskubectl supports debugging by providing commands for:Printing Container logsPrinting cluster eventsExec or attaching to a ContainerCopying files from Containers in the cluster to a user's filesystemCluster ManagementOn occasion, users may need to perform operations to the Nodes of cluster. kubectl supports commands to drain workloads from a Node so that it can be decommissioned or debugged.PorcelainUsers may find using resource configuration overly verbose for development and prefer to work with the cluster imperatively with a shell-like workflow. kubectl offers porcelain commands for generating and modifying resources.Generating + creating resources such as Deployments, StatefulSets, Services, ConfigMaps, etc.Setting fields on resourcesEditing (live) resources in a text editorPorcelain for Dev OnlyPorcelain commands are time saving for experimenting with workloads in a dev cluster, but shouldn't be used for production.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/introduction/", "id": "k8s_00076"}
{"instruction": "How do you using a kms provider for data encryption in Kubernetes?", "response": "Using a KMS provider for data encryptionThis page shows how to configure a Key Management Service (KMS) provider and plugin to enable secret data encryption. In Kubernetes 1.34 there are two versions of KMS at-rest encryption. You should use KMS v2 if feasible because KMS v1 is deprecated (since Kubernetes v1.28) and disabled by default (since Kubernetes v1.29). KMS v2 offers significantly better performance characteristics than KMS v1.Caution:This documentation is for the generally available implementation of KMS v2 (and for the deprecated version 1 implementation). If you are using any control plane components older than Kubernetes v1.29, please check the equivalent page in the documentation for the version of Kubernetes that your cluster is running. Earlier releases of Kubernetes had different behavior that may be relevant for information security.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesThe version of Kubernetes that you need depends on which KMS API version you have selected. Kubernetes recommends using KMS v2.If you selected KMS API v1 to support clusters prior to version v1.27 or if you have a legacy KMS plugin that only supports KMS v1, any supported Kubernetes version will work. This API is deprecated as of Kubernetes v1.28. Kubernetes does not recommend the use of this API.To check the version, enter kubectl version.KMS v1FEATURE STATE: Kubernetes v1.28 [deprecated]Kubernetes version 1.10.0 or later is requiredFor version 1.29 and later, the v1 implementation of KMS is disabled by default. To enable the feature, set --feature-gates=KMSv1=true to configure a KMS v1 provider.Your cluster must use etcd v3 or laterKMS v2FEATURE STATE: Kubernetes v1.29 [stable]Your cluster must use etcd v3 or laterKMS encryption and per-object encryption keysThe KMS encryption provider uses an envelope encryption scheme to encrypt data in etcd. The data is encrypted using a data encryption key (DEK). The DEKs are encrypted with a key encryption key (KEK) that is stored and managed in a remote KMS.If you use the (deprecated) v1 implementation of KMS, a new DEK is generated for each encryption.With KMS v2, a new DEK is generated per encryption: the API server uses a key derivation function to generate single use data encryption keys from a secret seed combined with some random data. The seed is rotated whenever the KEK is rotated (see the Understanding key_id and Key Rotation section below for more details).The KMS provider uses gRPC to communicate with a specific KMS plugin over a UNIX domain socket. The KMS plugin, which is implemented as a gRPC server and deployed on the same host(s) as the Kubernetes control plane, is responsible for all communication with the remote KMS.Configuring the KMS providerTo configure a KMS provider on the API server, include a provider of type kms in the providers array in the encryption configuration file and set the following properties:KMS v1apiVersion: API Version for KMS provider. Leave this value empty or set it to v1.name: Display name of the KMS plugin. Cannot be changed once set.endpoint: Listen address of the gRPC server (KMS plugin). The endpoint is a UNIX domain socket.cachesize: Number of data encryption keys (DEKs) to be cached in the clear. When cached, DEKs can be used without another call to the KMS; whereas DEKs that are not cached require a call to the KMS to unwrap.timeout: How long should kube-apiserver wait for kms-plugin to respond before returning an error (default is 3 seconds).KMS v2apiVersion: API Version for KMS provider. Set this to v2.name: Display name of the KMS plugin. Cannot be changed", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          cachesize: 100\n          timeout: 3s\n      - kms:\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          cachesize: 100\n          timeout: 3s\n```\n\nUsing a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_968"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          timeout: 3s\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          timeout: 3s\n```\n\nUsing a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_969"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\nUsing a KMS provider for data encryption | Using the etcdctl command line, read that secret out of etcd:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_970"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret secret1 -n default\n```\n\nUsing a KMS provider for data encryption | The Secret should contain mykey: mydata", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_971"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\nUsing a KMS provider for data encryption | To switch from a local encryption provider to the kms provider and re-encrypt all of the secrets:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_972"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - kms:\n          apiVersion: v2\n          name : myKmsPlugin\n          endpoint: unix:///tmp/socketfile.sock\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n```\n\nUsing a KMS provider for data encryption | Restart all kube-apiserver processes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_973"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\nUsing a KMS provider for data encryption | If you no longer want to use encryption for data persisted in the Kubernetes API, read decrypt data that are already stored at rest.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_974"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          cachesize: 100\n          timeout: 3s\n      - kms:\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          cachesize: 100\n          timeout: 3s\n```\n\nUsing a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_975"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          timeout: 3s\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          timeout: 3s\n```\n\nUsing a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_976"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - kms:\n          apiVersion: v2\n          name : myKmsPlugin\n          endpoint: unix:///tmp/socketfile.sock\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n```\n\nUsing a KMS provider for data encryption | Restart all kube-apiserver processes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_977"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          cachesize: 100\n          timeout: 3s\n      - kms:\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          cachesize: 100\n          timeout: 3s\n```\n\nUsing a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_978"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          timeout: 3s\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          timeout: 3s\n```\n\nUsing a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_979"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\nUsing a KMS provider for data encryption | Using the etcdctl command line, read that secret out of etcd:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_980"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret secret1 -n default\n```\n\nUsing a KMS provider for data encryption | The Secret should contain mykey: mydata", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_981"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\nUsing a KMS provider for data encryption | To switch from a local encryption provider to the kms provider and re-encrypt all of the secrets:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_982"}
{"instruction": "Write a yaml example for using a kms provider for data encryption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - kms:\n          apiVersion: v2\n          name : myKmsPlugin\n          endpoint: unix:///tmp/socketfile.sock\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n```\n\nUsing a KMS provider for data encryption | Restart all kube-apiserver processes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_983"}
{"instruction": "Write a bash example for using a kms provider for data encryption", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\nUsing a KMS provider for data encryption | If you no longer want to use encryption for data persisted in the Kubernetes API, read decrypt data that are already stored at rest.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/", "id": "k8s_00077_code_984"}
{"instruction": "What is the reference documentation for kubectl drain?", "response": "kubectl drainSynopsisDrain node in preparation for maintenance.The given node will be marked unschedulable to prevent new pods from arriving. 'drain' evicts the pods if the API server supports https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ eviction https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ . Otherwise, it will use normal DELETE to delete the pods. The 'drain' evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are daemon set-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any daemon set-managed pods, because those pods would be immediately replaced by the daemon set controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by a replication controller, replica set, daemon set, stateful set, or job, then drain will not delete any pods unless you use --force. --force will also allow deletion to proceed if the managing resource of one or more pods is missing.'drain' waits for graceful termination. You should not operate on the machine until the command completes.When you are ready to put the node back into service, use kubectl uncordon, which will make the node schedulable again.https://kubernetes.io/images/docs/kubectl_drain.svg Workflowhttps://kubernetes.io/images/docs/kubectl_drain.svgkubectl drain NODE Examples # Drain node \"foo\", even if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set on it kubectl drain foo --force # As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set, and use a grace period of 15 minutes kubectl drain foo --grace-period=900 Options--chunk-size int Default: 500Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future.--delete-emptydir-dataContinue even if there are pods using emptyDir (local data that will be deleted when the node is drained).--disable-evictionForce drain to use delete, even if eviction is supported. This will bypass checking PodDisruptionBudgets, use with caution.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--forceContinue even if there are pods that do not declare a controller.--grace-period int Default: -1Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used.-h, --helphelp for drain--ignore-daemonsetsIgnore DaemonSet-managed pods.--pod-selector stringLabel selector to filter pods on the node-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--skip-wait-for-delete-timeout intIf pod DeletionTimestamp older than N seconds, skip waiting for the pod. Seconds must be greater than 0 to skip.--timeout durationThe length of time to wait before giving up, zero means infiniteParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_drain/", "id": "k8s_00078"}
{"instruction": "Provide a tutorial on example: deploying wordpress and mysql with persistent volumes", "response": "Example: Deploying WordPress and MySQL with Persistent VolumesThis tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.A PersistentVolume (PV) is a piece of storage in the cluster that has been manually provisioned by an administrator, or dynamically provisioned by Kubernetes using a StorageClass. A PersistentVolumeClaim (PVC) is a request for storage by a user that can be fulfilled by a PV. PersistentVolumes and PersistentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods.Warning:This deployment is not suitable for production use cases, as it uses single instance WordPress and MySQL Pods. Consider using WordPress Helm Chart to deploy WordPress in production.Note:The files provided in this tutorial are using GA Deployment APIs and are specific to kubernetes version 1.9 and later. If you wish to use this tutorial with an earlier version of Kubernetes, please update the API version appropriately, or reference earlier versions of this tutorial.ObjectivesCreate PersistentVolumeClaims and PersistentVolumesCreate a kustomization.yaml witha Secret generatorMySQL resource configsWordPress resource configsApply the kustomization directory by kubectl apply -k ./Clean upBefore you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.The example shown on this page works with kubectl 1.27 and above.Download the following configuration files:mysql-deployment.yamlwordpress-deployment.yamlCreate PersistentVolumeClaims and PersistentVolumesMySQL and Wordpress each require a PersistentVolume to store data. Their PersistentVolumeClaims will be created at the deployment step.Many cluster environments have a default StorageClass installed. When a StorageClass is not specified in the PersistentVolumeClaim, the cluster's default StorageClass is used instead.When a PersistentVolumeClaim is created, a PersistentVolume is dynamically provisioned based on the StorageClass configuration.Warning:In local clusters, the default StorageClass uses the hostPath provisioner. hostPath volumes are only suitable for development and testing. With hostPath volumes, your data lives in /tmp on the node the Pod is scheduled onto and does not move between nodes. If a Pod dies and gets scheduled to another node in the cluster, or the node is rebooted, the data is lost.Note:If you are bringing up a cluster that needs to use the hostPath provisioner, the --enable-hostpath-provisioner flag must be set in the controller-manager component.Note:If you have a Kubernetes cluster running on Google Kubernetes Engine, please follow this guide.Create a kustomization.yamlAdd a Secret generatorA Secret is an object that stores a piece of sensitive data like a password or key. Since 1.14, kubectl supports the management of Kubernetes objects using a kustomization file. You can create a Secret by generators in kustomization.yaml.Add a Secret generator in kustomization.yaml from the following command. You will need to replace YOUR_PASSWORD with the password you want to use.cat <<EOF >./kustomization.yaml secretGenerator: - name: mysql-pass literals: - password=YOUR_PASSWORD EOF Add resource configs for MySQL and WordPressThe following manifest describes a single-instance MySQL Deployment. The MySQL container mounts the PersistentVolume at /var/lib/mysql. The MYSQL_ROOT_PASSWORD environment variable sets the database password from the Secret.application/wordpress/mysql-deployment.yaml apiVers", "category": "tutorials", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_987"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_988"}
{"instruction": "Write a bash example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl get services wordpress\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | The response should be like this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_989"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_990"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_991"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napplication/wordpress/mysql-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_992"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_993"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napplication/wordpress/wordpress-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_994"}
{"instruction": "Write a yaml example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_995"}
{"instruction": "Write a bash example for example: deploying wordpress and mysql with persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl get services wordpress\n```\n\nExample: Deploying WordPress and MySQL with Persistent Volumes | The response should be like this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/", "id": "k8s_00079_code_996"}
{"instruction": "What is the reference documentation for kubectl create token?", "response": "kubectl create tokenSynopsisRequest a service account token.kubectl create token SERVICE_ACCOUNT_NAME Examples # Request a token to authenticate to the kube-apiserver as the service account \"myapp\" in the current namespace kubectl create token myapp # Request a token for a service account in a custom namespace kubectl create token myapp --namespace myns # Request a token with a custom expiration kubectl create token myapp --duration 10m # Request a token with a custom audience kubectl create token myapp --audience https://example.com # Request a token bound to an instance of a Secret object kubectl create token myapp --bound-object-kind Secret --bound-object-name mysecret # Request a token bound to an instance of a Secret object with a specific UID kubectl create token myapp --bound-object-kind Secret --bound-object-name mysecret --bound-object-uid 0d4691ed-659b-4935-a832-355f77ee47cc Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--audience stringsAudience of the requested token. If unset, defaults to requesting a token for use with the Kubernetes API server. May be repeated to request a token valid for multiple audiences.--bound-object-kind stringKind of an object to bind the token to. Supported kinds are Node, Pod, Secret. If set, --bound-object-name must be provided.--bound-object-name stringName of an object to bind the token to. The token will expire when the object is deleted. Requires --bound-object-kind.--bound-object-uid stringUID of an object to bind the token to. Requires --bound-object-kind and --bound-object-name. If unset, the UID of the existing object is used.--duration durationRequested lifetime of the issued token. If not set or if set to 0, the lifetime will be determined by the server automatically. The server may return a token with a longer or shorter lifetime.-h, --helphelp for token-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to writ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_token/", "id": "k8s_00080"}
{"instruction": "Write a bash example for kubectl create token", "response": "Here's a bash example:\n\n```bash\nkubectl create token SERVICE_ACCOUNT_NAME\n```\n\nkubectl create token | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_token/", "id": "k8s_00080_code_998"}
{"instruction": "Write a bash example for kubectl create token", "response": "Here's a bash example:\n\n```bash\nkubectl create token SERVICE_ACCOUNT_NAME\n```\n\nkubectl create token | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_token/", "id": "k8s_00080_code_999"}
{"instruction": "What is the reference documentation for kubectl patch?", "response": "kubectl patchSynopsisUpdate fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.JSON and YAML formats are accepted.Note: Strategic merge patch is not supported for custom resources.kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE] Examples # Partially update a node using a strategic merge patch, specifying the patch as JSON kubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}' # Partially update a node using a strategic merge patch, specifying the patch as YAML kubectl patch node k8s-node-1 -p $'spec:\\n unschedulable: true' # Partially update a node identified by the type and name specified in \"node.json\" using strategic merge patch kubectl patch -f node.json -p '{\"spec\":{\"unschedulable\":true}}' # Update a container's image; spec.containers[*].name is required because it's a merge key kubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}' # Update a container's image using a JSON patch with positional arrays kubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]' # Update a deployment's replicas through the 'scale' subresource using a merge patch kubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":2}}' Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-patch\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update-h, --helphelp for patch-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--localIf true, patch will operate on the content of the file, not the server-side resource.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-p, --patch stringThe patch to be applied to the resource JSON file.--patch-file stringA file containing a patch to be applied to the resource.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--subresource stringIf specified, patch will operate on the subresource of the requested object.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--type string Default: \"strategic\"The type of patch being provided; one of [json merge strategic]Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's cert", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_patch/", "id": "k8s_00081"}
{"instruction": "Write a bash example for kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]\n```\n\nkubectl patch | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_patch/", "id": "k8s_00081_code_1001"}
{"instruction": "Write a bash example for kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]\n```\n\nkubectl patch | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_patch/", "id": "k8s_00081_code_1002"}
{"instruction": "How do you monitor node health in Kubernetes?", "response": "Monitor Node HealthNode Problem Detector is a daemon for monitoring and reporting about a node's health. You can run Node Problem Detector as a DaemonSet or as a standalone daemon. Node Problem Detector collects information about node problems from various daemons and reports these conditions to the API server as Node Conditions or as Events.To learn how to install and use Node Problem Detector, see Node Problem Detector project documentation.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesLimitationsNode Problem Detector uses the kernel log format for reporting kernel issues. To learn how to extend the kernel log format, see Add support for another log format.Enabling Node Problem DetectorSome cloud providers enable Node Problem Detector as an Addon. You can also enable Node Problem Detector with kubectl or by creating an Addon DaemonSet.Using kubectl to enable Node Problem Detectorkubectl provides the most flexible management of Node Problem Detector. You can overwrite the default configuration to fit it into your environment or to detect customized node problems. For example:Create a Node Problem Detector configuration similar to node-problem-detector.yaml:debug/node-problem-detector.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: node-problem-detector-v0.1 namespace: kube-system labels: k8s-app: node-problem-detector version: v0.1 kubernetes.io/cluster-service: \"true\" spec: selector: matchLabels: k8s-app: node-problem-detector version: v0.1 kubernetes.io/cluster-service: \"true\" template: metadata: labels: k8s-app: node-problem-detector version: v0.1 kubernetes.io/cluster-service: \"true\" spec: hostNetwork: true containers: - name: node-problem-detector image: registry.k8s.io/node-problem-detector:v0.1 securityContext: privileged: true resources: limits: cpu: \"200m\" memory: \"100Mi\" requests: cpu: \"20m\" memory: \"20Mi\" volumeMounts: - name: log mountPath: /log readOnly: true volumes: - name: log hostPath: path: /var/log/Note:You should verify that the system log directory is right for your operating system distribution.Start node problem detector with kubectl:kubectl apply -f https://k8s.io/examples/debug/node-problem-detector.yaml Using an Addon pod to enable Node Problem DetectorIf you are using a custom cluster bootstrap solution and don't need to overwrite the default configuration, you can leverage the Addon pod to further automate the deployment.Create node-problem-detector.yaml, and save the configuration in the Addon pod's directory /etc/kubernetes/addons/node-problem-detector on a control plane node.Overwrite the configurationThe default configuration is embedded when building the Docker image of Node Problem Detector.However, you can use a ConfigMap to overwrite the configuration:Change the configuration files in config/Create the ConfigMap node-problem-detector-config:kubectl create configmap node-problem-detector-config --from-file=config/ Change the node-problem-detector.yaml to use the ConfigMap:debug/node-problem-detector-configmap.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: node-problem-detector-v0.1 namespace: kube-system labels: k8s-app: node-problem-detector version: v0.1 kubernetes.io/cluster-service: \"true\" spec: selector: matchLabels: k8s-app: node-problem-detector version: v0.1 kubernetes.io/cluster-service: \"true\" template: metadata: labels: k8s-app: node-problem-detector version: v0.1 kubernetes.io/cluster-service: \"true\" spec: hostNetwork: true containers: - name: node-problem-detector image: registry.k8s.io/node-problem-detector:v0.1 securityContext: privileged: true resources: limits: cpu: \"200", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\nMonitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1004"}
{"instruction": "Write a bash example for monitor node health", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/node-problem-detector.yaml\n```\n\nMonitor Node Health | If you are using a custom cluster bootstrap solution and don't need to overwrite the default configuration, you can leverage the Addon pod to further automate the deployment.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1005"}
{"instruction": "Write a bash example for monitor node health", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap node-problem-detector-config --from-file=config/\n```\n\nMonitor Node Health | Change the node-problem-detector.yaml to use the ConfigMap:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1006"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\nMonitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1007"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\nMonitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1008"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\nMonitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1009"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\ndebug/node-problem-detector.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\nMonitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1010"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\nMonitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1011"}
{"instruction": "Write a bash example for monitor node health", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/node-problem-detector.yaml\n```\n\nMonitor Node Health | If you are using a custom cluster bootstrap solution and don't need to overwrite the default configuration, you can leverage the Addon pod to further automate the deployment.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1012"}
{"instruction": "Write a bash example for monitor node health", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap node-problem-detector-config --from-file=config/\n```\n\nMonitor Node Health | Change the node-problem-detector.yaml to use the ConfigMap:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1013"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\ndebug/node-problem-detector-configmap.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\nMonitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1014"}
{"instruction": "Write a yaml example for monitor node health", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\nMonitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/", "id": "k8s_00082_code_1015"}
{"instruction": "Explain the Kubernetes concept: Persistent Volumes", "response": "Persistent VolumesThis document describes persistent volumes in Kubernetes. Familiarity with volumes, StorageClasses and VolumeAttributesClasses is suggested.IntroductionManaging storage is a distinct problem from managing compute instances. The PersistentVolume subsystem provides an API for users and administrators that abstracts details of how storage is provided from how it is consumed. To do this, we introduce two new API resources: PersistentVolume and PersistentVolumeClaim.A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes. It is a resource in the cluster just like a node is a cluster resource. PVs are volume plugins like Volumes, but have a lifecycle independent of any individual Pod that uses the PV. This API object captures the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.A PersistentVolumeClaim (PVC) is a request for storage by a user. It is similar to a Pod. Pods consume node resources and PVCs consume PV resources. Pods can request specific levels of resources (CPU and Memory). Claims can request specific size and access modes (e.g., they can be mounted ReadWriteOnce, ReadOnlyMany, ReadWriteMany, or ReadWriteOncePod, see AccessModes).While PersistentVolumeClaims allow a user to consume abstract storage resources, it is common that users need PersistentVolumes with varying properties, such as performance, for different problems. Cluster administrators need to be able to offer a variety of PersistentVolumes that differ in more ways than size and access modes, without exposing users to the details of how those volumes are implemented. For these needs, there is the StorageClass resource.See the detailed walkthrough with working examples.Lifecycle of a volume and claimPVs are resources in the cluster. PVCs are requests for those resources and also act as claim checks to the resource. The interaction between PVs and PVCs follows this lifecycle:ProvisioningThere are two ways PVs may be provisioned: statically or dynamically.StaticA cluster administrator creates a number of PVs. They carry the details of the real storage, which is available for use by cluster users. They exist in the Kubernetes API and are available for consumption.DynamicWhen none of the static PVs the administrator created match a user's PersistentVolumeClaim, the cluster may try to dynamically provision a volume specially for the PVC. This provisioning is based on StorageClasses: the PVC must request a storage class and the administrator must have created and configured that class for dynamic provisioning to occur. Claims that request the class \"\" effectively disable dynamic provisioning for themselves.To enable dynamic storage provisioning based on storage class, the cluster administrator needs to enable the DefaultStorageClass admission controller on the API server. This can be done, for example, by ensuring that DefaultStorageClass is among the comma-delimited, ordered list of values for the --enable-admission-plugins flag of the API server component. For more information on API server command-line flags, check kube-apiserver documentation.BindingA user creates, or in the case of dynamic provisioning, has already created, a PersistentVolumeClaim with a specific amount of storage requested and with certain access modes. A control loop in the control plane watches for new PVCs, finds a matching PV (if possible), and binds them together. If a PV was dynamically provisioned for a new PVC, the loop will always bind that PV to the PVC. Otherwise, the user will always get at least what they asked for, but the volume may be in excess of what was requested. Once bound, PersistentVolumeClaim binds are exclusive, regardless of how they were bound. A PVC to PV binding is a one-to-one mapping, using a ClaimRef which is a bi-directional binding between the PersistentVolume and the PersistentVolume", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083"}
{"instruction": "Write a bash example for persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc hostpath\nName:          hostpath\nNamespace:     default\nStorageClass:  example-hostpath\nStatus:        Terminating\nVolume:\nLabels:        <none>\nAnnotations:   volume.beta.kubernetes.io/storage-class=example-hostpath\n               volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath\nFinalizers:    [kubernetes.io/pvc-protection]\n...\n```\n\nPersistent Volumes | You can see that a PV is protected when the PV's status is Terminating and the Finalizers list includes kubernetes.io/pv-protection too:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1017"}
{"instruction": "Write a bash example for persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv task-pv-volume\nName:            task-pv-volume\nLabels:          type=local\nAnnotations:     <none>\nFinalizers:      [kubernetes.io/pv-protection]\nStorageClass:    standard\nStatus:          Terminating\nClaim:\nReclaim Policy:  Delete\nAccess Modes:    RWO\nCapacity:        1Gi\nMessage:\nSource:\n    Type:          HostPath (bare host directory volume)\n    Path:          /tmp/data\n    HostPathType:\nEvents:            <none>\n```\n\nPersistent Volumes | When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource. The reclaim policy for a PersistentVolume tells the cluster what to do with", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1018"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\nPersistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1019"}
{"instruction": "Write a bash example for persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nName:            pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nLabels:          <none>\nAnnotations:     kubernetes.io/createdby: vsphere-volume-dynamic-provisioner\n                 pv.kubernetes.io/bound-by-controller: yes\n                 pv.kubernetes.io/provisioned-by: kubernetes.io/vsphere-volume\nFinalizers:      [kubernetes.io/pv-protection kubernetes.io/pv-controller]\nStorageClass:    vcp-sc\nStatus:          Bound\nClaim:           default/vcp-pvc-1\nReclaim Policy:  Delete\nAccess Modes:    RWO\nVolumeMode:      Filesystem\nCapacity:        1Gi\nNode Affinity:   <none>\nMessage:\nSource:\n    Type:               vSphereVolume (a Persistent Disk resource in vSphere)\n    VolumePath:         [vsanDatastore] d49c4a62-166f-ce12-c464-020077ba5d46/kubernetes-dynamic-pvc-74a498d6-3929-47e8-8c02-078c1ece4d78.vmdk\n    FSType:             ext4\n    StoragePolicyName:  vSAN Default Storage Policy\nEvents:                 <none>\n```\n\nPersistent Volumes | The finalizer external-provisioner.volume.kubernetes.io/finalizer is added for CSI volumes. The following is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1020"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\nPersistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1021"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\nPersistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1022"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\nPersistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1023"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\nPersistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1024"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\nPersistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1025"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\nPersistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1026"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1027"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1028"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1029"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1030"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1031"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1032"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\nPersistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1033"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\nPersistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1034"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\nPersistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1035"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\nPersistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1036"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\nPersistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1037"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\nPersistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1038"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\nPersistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1039"}
{"instruction": "Write a bash example for persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl describe persistentvolume <name>\n```\n\nPersistent Volumes | The .status field for a PersistentVolume can include an alpha lastPhaseTransitionTime field. This field records the timestamp of when the volume last transitioned its phase. For newly created volumes", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1040"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\nPersistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1041"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\nPersistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1042"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1043"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1044"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1045"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1046"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1047"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1048"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\nPersistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1049"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\nPersistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1050"}
{"instruction": "Write a bash example for persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc hostpath\nName:          hostpath\nNamespace:     default\nStorageClass:  example-hostpath\nStatus:        Terminating\nVolume:\nLabels:        <none>\nAnnotations:   volume.beta.kubernetes.io/storage-class=example-hostpath\n               volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath\nFinalizers:    [kubernetes.io/pvc-protection]\n...\n```\n\nPersistent Volumes | You can see that a PV is protected when the PV's status is Terminating and the Finalizers list includes kubernetes.io/pv-protection too:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1051"}
{"instruction": "Write a bash example for persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv task-pv-volume\nName:            task-pv-volume\nLabels:          type=local\nAnnotations:     <none>\nFinalizers:      [kubernetes.io/pv-protection]\nStorageClass:    standard\nStatus:          Terminating\nClaim:\nReclaim Policy:  Delete\nAccess Modes:    RWO\nCapacity:        1Gi\nMessage:\nSource:\n    Type:          HostPath (bare host directory volume)\n    Path:          /tmp/data\n    HostPathType:\nEvents:            <none>\n```\n\nPersistent Volumes | When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource. The reclaim policy for a PersistentVolume tells the cluster what to do with", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1052"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\nPersistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1053"}
{"instruction": "Write a bash example for persistent volumes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nName:            pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nLabels:          <none>\nAnnotations:     kubernetes.io/createdby: vsphere-volume-dynamic-provisioner\n                 pv.kubernetes.io/bound-by-controller: yes\n                 pv.kubernetes.io/provisioned-by: kubernetes.io/vsphere-volume\nFinalizers:      [kubernetes.io/pv-protection kubernetes.io/pv-controller]\nStorageClass:    vcp-sc\nStatus:          Bound\nClaim:           default/vcp-pvc-1\nReclaim Policy:  Delete\nAccess Modes:    RWO\nVolumeMode:      Filesystem\nCapacity:        1Gi\nNode Affinity:   <none>\nMessage:\nSource:\n    Type:               vSphereVolume (a Persistent Disk resource in vSphere)\n    VolumePath:         [vsanDatastore] d49c4a62-166f-ce12-c464-020077ba5d46/kubernetes-dynamic-pvc-74a498d6-3929-47e8-8c02-078c1ece4d78.vmdk\n    FSType:             ext4\n    StoragePolicyName:  vSAN Default Storage Policy\nEvents:                 <none>\n```\n\nPersistent Volumes | The finalizer external-provisioner.volume.kubernetes.io/finalizer is added for CSI volumes. The following is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1054"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\nPersistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1055"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\nPersistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1056"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\nPersistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1057"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\nPersistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1058"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\nPersistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1059"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\nPersistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1060"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1061"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1062"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\nPersistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1063"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1064"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1065"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\nPersistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1066"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\nPersistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1067"}
{"instruction": "Write a yaml example for persistent volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\nPersistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/persistent-volumes/", "id": "k8s_00083_code_1068"}
{"instruction": "What is the reference documentation for image policy api (v1alpha1)?", "response": "Image Policy API (v1alpha1)Resource TypesImageReviewImageReviewImageReview checks if the set of images in a pod are allowed.FieldDescriptionapiVersionstringimagepolicy.k8s.io/v1alpha1kindstringImageReviewmetadatameta/v1.ObjectMetaStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataRefer to the Kubernetes API documentation for the fields of the metadata field.spec [Required]ImageReviewSpecSpec holds information about the pod being evaluatedstatusImageReviewStatusStatus is filled in by the backend and indicates whether the pod should be allowed.ImageReviewContainerSpecAppears in:ImageReviewSpecImageReviewContainerSpec is a description of a container within the pod creation request.FieldDescriptionimagestringThis can be in the form image:tag or image@SHA:012345679abcdef.ImageReviewSpecAppears in:ImageReviewImageReviewSpec is a description of the pod creation request.FieldDescriptioncontainers[]ImageReviewContainerSpecContainers is a list of a subset of the information in each container of the Pod being created.annotationsmap[string]stringAnnotations is a list of key-value pairs extracted from the Pod's annotations. It only includes keys which match the pattern *.image-policy.k8s.io/*. It is up to each webhook backend to determine how to interpret these annotations, if at all.namespacestringNamespace is the namespace the pod is being created in.ImageReviewStatusAppears in:ImageReviewImageReviewStatus is the result of the review for the pod creation request.FieldDescriptionallowed [Required]boolAllowed indicates that all images were allowed to be run.reasonstringReason should be empty unless Allowed is false in which case it may contain a short description of what is wrong. Kubernetes may truncate excessively long errors when displaying to the user.auditAnnotationsmap[string]stringAuditAnnotations will be added to the attributes object of the admission controller request using 'AddAnnotation'. The keys should be prefix-less (i.e., the admission controller will add an appropriate prefix).This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/imagepolicy.v1alpha1/", "id": "k8s_00084"}
{"instruction": "Explain the Kubernetes concept: Workload Management", "response": "Workload ManagementKubernetes provides several built-in APIs for declarative management of your workloads and the components of those workloads.Ultimately, your applications run as containers inside Pods; however, managing individual Pods would be a lot of effort. For example, if a Pod fails, you probably want to run a new Pod to replace it. Kubernetes can do that for you.You use the Kubernetes API to create a workload object that represents a higher abstraction level than a Pod, and then the Kubernetes control plane automatically manages Pod objects on your behalf, based on the specification for the workload object you defined.The built-in APIs for managing workloads are:Deployment (and, indirectly, ReplicaSet), the most common way to run an application on your cluster. Deployment is a good fit for managing a stateless application workload on your cluster, where any Pod in the Deployment is interchangeable and can be replaced if needed. (Deployments are a replacement for the legacy ReplicationController API).A StatefulSet lets you manage one or more Pods – all running the same application code – where the Pods rely on having a distinct identity. This is different from a Deployment where the Pods are expected to be interchangeable. The most common use for a StatefulSet is to be able to make a link between its Pods and their persistent storage. For example, you can run a StatefulSet that associates each Pod with a PersistentVolume. If one of the Pods in the StatefulSet fails, Kubernetes makes a replacement Pod that is connected to the same PersistentVolume.A DaemonSet defines Pods that provide facilities that are local to a specific node; for example, a driver that lets containers on that node access a storage system. You use a DaemonSet when the driver, or other node-level service, has to run on the node where it's useful. Each Pod in a DaemonSet performs a role similar to a system daemon on a classic Unix / POSIX server. A DaemonSet might be fundamental to the operation of your cluster, such as a plugin to let that node access cluster networking, it might help you to manage the node, or it could provide less essential facilities that enhance the container platform you are running. You can run DaemonSets (and their pods) across every node in your cluster, or across just a subset (for example, only install the GPU accelerator driver on nodes that have a GPU installed).You can use a Job and / or a CronJob to define tasks that run to completion and then stop. A Job represents a one-off task, whereas each CronJob repeats according to a schedule.Other topics in this section:Automatic Cleanup for Finished JobsReplicationController", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/", "id": "k8s_00085"}
{"instruction": "Explain the Kubernetes concept: Organizing Cluster Access Using kubeconfig Files", "response": "Organizing Cluster Access Using kubeconfig FilesUse kubeconfig files to organize information about clusters, users, namespaces, and authentication mechanisms. The kubectl command-line tool uses kubeconfig files to find the information it needs to choose a cluster and communicate with the API server of a cluster.Note:A file that is used to configure access to clusters is called a kubeconfig file. This is a generic way of referring to configuration files. It does not mean that there is a file named kubeconfig.Warning:Only use kubeconfig files from trusted sources. Using a specially-crafted kubeconfig file could result in malicious code execution or file exposure. If you must use an untrusted kubeconfig file, inspect it carefully first, much as you would a shell script.By default, kubectl looks for a file named config in the $HOME/.kube directory. You can specify other kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.For step-by-step instructions on creating and specifying kubeconfig files, see Configure Access to Multiple Clusters.Supporting multiple clusters, users, and authentication mechanismsSuppose you have several clusters, and your users and components authenticate in a variety of ways. For example:A running kubelet might authenticate using certificates.A user might authenticate using tokens.Administrators might have sets of certificates that they provide to individual users.With kubeconfig files, you can organize your clusters, users, and namespaces. You can also define contexts to quickly and easily switch between clusters and namespaces.ContextA context element in a kubeconfig file is used to group access parameters under a convenient name. Each context has three parameters: cluster, namespace, and user. By default, the kubectl command-line tool uses parameters from the current context to communicate with the cluster.To choose the current context:kubectl config use-context The KUBECONFIG environment variableThe KUBECONFIG environment variable holds a list of kubeconfig files. For Linux and Mac, the list is colon-delimited. For Windows, the list is semicolon-delimited. The KUBECONFIG environment variable is not required. If the KUBECONFIG environment variable doesn't exist, kubectl uses the default kubeconfig file, $HOME/.kube/config.If the KUBECONFIG environment variable does exist, kubectl uses an effective configuration that is the result of merging the files listed in the KUBECONFIG environment variable.Merging kubeconfig filesTo see your configuration, enter this command:kubectl config view As described previously, the output might be from a single kubeconfig file, or it might be the result of merging several kubeconfig files.Here are the rules that kubectl uses when it merges kubeconfig files:If the --kubeconfig flag is set, use only the specified file. Do not merge. Only one instance of this flag is allowed.Otherwise, if the KUBECONFIG environment variable is set, use it as a list of files that should be merged. Merge the files listed in the KUBECONFIG environment variable according to these rules:Ignore empty filenames.Produce errors for files with content that cannot be deserialized.The first file to set a particular value or map key wins.Never change the value or map key. Example: Preserve the context of the first file to set current-context. Example: If two files specify a red-user, use only values from the first file's red-user. Even if the second file has non-conflicting entries under red-user, discard them.For an example of setting the KUBECONFIG environment variable, see Setting the KUBECONFIG environment variable.Otherwise, use the default kubeconfig file, $HOME/.kube/config, with no merging.Determine the context to use based on the first hit in this chain:Use the --context command-line flag if it exists.Use the current-context from the merged kubeconfig files.An empty context is allowed at this point.Determine the cluster and user. At this point, there ", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/", "id": "k8s_00086"}
{"instruction": "Write a bash example for organizing cluster access using kubeconfig files", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\nOrganizing Cluster Access Using kubeconfig Files | The KUBECONFIG environment variable holds a list of kubeconfig files. For Linux and Mac, the list is colon-delimited. For Windows, the list is semicolon-delimited. The KUBECONFIG environment variable", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/", "id": "k8s_00086_code_1072"}
{"instruction": "Write a yaml example for organizing cluster access using kubeconfig files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\nOrganizing Cluster Access Using kubeconfig Files |", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/", "id": "k8s_00086_code_1073"}
{"instruction": "Write a bash example for organizing cluster access using kubeconfig files", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\nOrganizing Cluster Access Using kubeconfig Files | The KUBECONFIG environment variable holds a list of kubeconfig files. For Linux and Mac, the list is colon-delimited. For Windows, the list is semicolon-delimited. The KUBECONFIG environment variable", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/", "id": "k8s_00086_code_1074"}
{"instruction": "Write a yaml example for organizing cluster access using kubeconfig files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\nOrganizing Cluster Access Using kubeconfig Files |", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/", "id": "k8s_00086_code_1075"}
{"instruction": "Write a yaml example for organizing cluster access using kubeconfig files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\nOrganizing Cluster Access Using kubeconfig Files |", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/", "id": "k8s_00086_code_1076"}
{"instruction": "Explain the Kubernetes concept: Resource Management for Windows nodes", "response": "Resource Management for Windows nodesThis page outlines the differences in how resources are managed between Linux and Windows.On Linux nodes, cgroups are used as a pod boundary for resource control. Containers are created within that boundary for network, process and file system isolation. The Linux cgroup APIs can be used to gather CPU, I/O, and memory use statistics.In contrast, Windows uses a job object per container with a system namespace filter to contain all processes in a container and provide logical isolation from the host. (Job objects are a Windows process isolation mechanism and are different from what Kubernetes refers to as a Job).There is no way to run a Windows container without the namespace filtering in place. This means that system privileges cannot be asserted in the context of the host, and thus privileged containers are not available on Windows. Containers cannot assume an identity from the host because the Security Account Manager (SAM) is separate.Memory managementWindows does not have an out-of-memory process killer as Linux does. Windows always treats all user-mode memory allocations as virtual, and pagefiles are mandatory.Windows nodes do not overcommit memory for processes. The net effect is that Windows won't reach out of memory conditions the same way Linux does, and processes page to disk instead of being subject to out of memory (OOM) termination. If memory is over-provisioned and all physical memory is exhausted, then paging can slow down performance.CPU managementWindows can limit the amount of CPU time allocated for different processes but cannot guarantee a minimum amount of CPU time.On Windows, the kubelet supports a command-line flag to set the scheduling priority of the kubelet process: --windows-priorityclass. This flag allows the kubelet process to get more CPU time slices when compared to other processes running on the Windows host. More information on the allowable values and their meaning is available at Windows Priority Classes. To ensure that running Pods do not starve the kubelet of CPU cycles, set this flag to ABOVE_NORMAL_PRIORITY_CLASS or above.Resource reservationTo account for memory and CPU used by the operating system, the container runtime, and by Kubernetes host processes such as the kubelet, you can (and should) reserve memory and CPU resources with the --kube-reserved and/or --system-reserved kubelet flags. On Windows these values are only used to calculate the node's allocatable resources.Caution:As you deploy workloads, set resource memory and CPU limits on containers. This also subtracts from NodeAllocatable and helps the cluster-wide scheduler in determining which pods to place on which nodes.Scheduling pods without limits may over-provision the Windows nodes and in extreme cases can cause the nodes to become unhealthy.On Windows, a good practice is to reserve at least 2GiB of memory.To determine how much CPU to reserve, identify the maximum pod density for each node and monitor the CPU usage of the system services running there, then choose a value that meets your workload needs.", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/windows-resource-management/", "id": "k8s_00087"}
{"instruction": "How do you tools for monitoring resources in Kubernetes?", "response": "Tools for Monitoring ResourcesTo scale an application and provide a reliable service, you need to understand how the application behaves when it is deployed. You can examine application performance in a Kubernetes cluster by examining the containers, pods, services, and the characteristics of the overall cluster. Kubernetes provides detailed information about an application's resource usage at each of these levels. This information allows you to evaluate your application's performance and where bottlenecks can be removed to improve overall performance.In Kubernetes, application monitoring does not depend on a single monitoring solution. On new clusters, you can use resource metrics or full metrics pipelines to collect monitoring statistics.Resource metrics pipelineThe resource metrics pipeline provides a limited set of metrics related to cluster components such as the Horizontal Pod Autoscaler controller, as well as the kubectl top utility. These metrics are collected by the lightweight, short-term, in-memory metrics-server and are exposed via the metrics.k8s.io API.metrics-server discovers all nodes on the cluster and queries each node's kubelet for CPU and memory usage. The kubelet acts as a bridge between the Kubernetes master and the nodes, managing the pods and containers running on a machine. The kubelet translates each pod into its constituent containers and fetches individual container usage statistics from the container runtime through the container runtime interface. If you use a container runtime that uses Linux cgroups and namespaces to implement containers, and the container runtime does not publish usage statistics, then the kubelet can look up those statistics directly (using code from cAdvisor). No matter how those statistics arrive, the kubelet then exposes the aggregated pod resource usage statistics through the metrics-server Resource Metrics API. This API is served at /metrics/resource/v1beta1 on the kubelet's authenticated and read-only ports.Full metrics pipelineA full metrics pipeline gives you access to richer metrics. Kubernetes can respond to these metrics by automatically scaling or adapting the cluster based on its current state, using mechanisms such as the Horizontal Pod Autoscaler. The monitoring pipeline fetches metrics from the kubelet and then exposes them to Kubernetes via an adapter by implementing either the custom.metrics.k8s.io or external.metrics.k8s.io API.Kubernetes is designed to work with OpenMetrics, which is one of the CNCF Observability and Analysis - Monitoring Projects, built upon and carefully extending Prometheus exposition format in almost 100% backwards-compatible ways.If you glance over at the CNCF Landscape, you can see a number of monitoring projects that can work with Kubernetes by scraping metric data and using that to help you observe your cluster. It is up to you to select the tool or tools that suit your needs. The CNCF landscape for observability and analytics includes a mix of open-source software, paid-for software-as-a-service, and other commercial products.When you design and implement a full metrics pipeline you can make that monitoring data available back to Kubernetes. For example, a HorizontalPodAutoscaler can use the processed metrics to work out how many Pods to run for a component of your workload.Integration of a full metrics pipeline into your Kubernetes implementation is outside the scope of Kubernetes documentation because of the very wide scope of possible solutions.The choice of monitoring platform depends heavily on your needs, budget, and technical resources. Kubernetes does not recommend any specific metrics pipeline; many options are available. Your monitoring system should be capable of handling the OpenMetrics metrics transmission standard and needs to be chosen to best fit into your overall design and deployment of your infrastructure platform.What's nextLearn about additional debugging tools, including:LoggingGetting into containers via exec", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-usage-monitoring/", "id": "k8s_00088"}
{"instruction": "Explain the Kubernetes concept: Garbage Collection", "response": "Garbage CollectionGarbage collection is a collective term for the various mechanisms Kubernetes uses to clean up cluster resources. This allows the clean up of resources like the following:Terminated podsCompleted JobsObjects without owner referencesUnused containers and container imagesDynamically provisioned PersistentVolumes with a StorageClass reclaim policy of DeleteStale or expired CertificateSigningRequests (CSRs)Nodes deleted in the following scenarios:On a cloud when the cluster uses a cloud controller managerOn-premises when the cluster uses an addon similar to a cloud controller managerNode Lease objectsOwners and dependentsMany objects in Kubernetes link to each other through owner references. Owner references tell the control plane which objects are dependent on others. Kubernetes uses owner references to give the control plane, and other API clients, the opportunity to clean up related resources before deleting an object. In most cases, Kubernetes manages owner references automatically.Ownership is different from the labels and selectors mechanism that some resources also use. For example, consider a Service that creates EndpointSlice objects. The Service uses labels to allow the control plane to determine which EndpointSlice objects are used for that Service. In addition to the labels, each EndpointSlice that is managed on behalf of a Service has an owner reference. Owner references help different parts of Kubernetes avoid interfering with objects they don’t control.Note:Cross-namespace owner references are disallowed by design. Namespaced dependents can specify cluster-scoped or namespaced owners. A namespaced owner must exist in the same namespace as the dependent. If it does not, the owner reference is treated as absent, and the dependent is subject to deletion once all owners are verified absent.Cluster-scoped dependents can only specify cluster-scoped owners. In v1.20+, if a cluster-scoped dependent specifies a namespaced kind as an owner, it is treated as having an unresolvable owner reference, and is not able to be garbage collected.In v1.20+, if the garbage collector detects an invalid cross-namespace ownerReference, or a cluster-scoped dependent with an ownerReference referencing a namespaced kind, a warning Event with a reason of OwnerRefInvalidNamespace and an involvedObject of the invalid dependent is reported. You can check for that kind of Event by running kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace.Cascading deletionKubernetes checks for and deletes objects that no longer have owner references, like the pods left behind when you delete a ReplicaSet. When you delete an object, you can control whether Kubernetes deletes the object's dependents automatically, in a process called cascading deletion. There are two types of cascading deletion, as follows:Foreground cascading deletionBackground cascading deletionYou can also control how and when garbage collection deletes resources that have owner references using Kubernetes finalizers.Foreground cascading deletionIn foreground cascading deletion, the owner object you're deleting first enters a deletion in progress state. In this state, the following happens to the owner object:The Kubernetes API server sets the object's metadata.deletionTimestamp field to the time the object was marked for deletion.The Kubernetes API server also sets the metadata.finalizers field to foregroundDeletion.The object remains visible through the Kubernetes API until the deletion process is complete.After the owner object enters the deletion in progress state, the controller deletes dependents it knows about. After deleting all the dependent objects it knows about, the controller deletes the owner object. At this point, the object is no longer visible in the Kubernetes API.During foreground cascading deletion, the only dependents that block owner deletion are those that have the ownerReference.blockOwnerDeletion=true field and are in the garbage coll", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/garbage-collection/", "id": "k8s_00089"}
{"instruction": "Write a bash example for garbage collection", "response": "Here's a bash example:\n\n```bash\nkubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace\n```\n\nGarbage Collection | Kubernetes checks for and deletes objects that no longer have owner references, like the pods left behind when you delete a ReplicaSet. When you delete an object, you can control whether Kubernetes de", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/garbage-collection/", "id": "k8s_00089_code_1080"}
{"instruction": "How do you parallel processing using expansions in Kubernetes?", "response": "Parallel Processing using ExpansionsThis task demonstrates running multiple Jobs based on a common template. You can use this approach to process batches of work in parallel.For this example there are only three items: apple, banana, and cherry. The sample Jobs process each item by printing a string then pausing.See using Jobs in real workloads to learn about how this pattern fits more realistic use cases.Before you beginYou should be familiar with the basic, non-parallel, use of Job.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesFor basic templating you need the command-line utility sed.To follow the advanced templating example, you need a working installation of Python, and the Jinja2 template library for Python.Once you have Python set up, you can install Jinja2 by running:pip install --user jinja2 Create Jobs based on a templateFirst, download the following template of a Job to a file called job-tmpl.yaml. Here's what you'll download:application/job/job-tmpl.yaml apiVersion: batch/v1 kind: Job metadata: name: process-item-$ITEM labels: jobgroup: jobexample spec: template: metadata: name: jobexample labels: jobgroup: jobexample spec: containers: - name: c image: busybox:1.28 command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"] restartPolicy: Never # Use curl to download job-tmpl.yaml curl -L -s -O https://k8s.io/examples/application/job/job-tmpl.yaml The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. The $ITEM syntax is not meaningful to Kubernetes.Create manifests from the templateThe following shell snippet uses sed to replace the string $ITEM with the loop variable, writing into a temporary directory named jobs. Run this now:# Expand the template into multiple files, one for each item to be processed. mkdir ./jobs for i in apple banana cherry do cat job-tmpl.yaml | sed \"s/\\$ITEM/$i/\" > ./jobs/job-$i.yaml done Check if it worked:ls jobs/ The output is similar to this:job-apple.yaml job-banana.yaml job-cherry.yaml You could use any type of template language (for example: Jinja2; ERB), or write a program to generate the Job manifests.Create Jobs from the manifestsNext, create all the Jobs with one kubectl command:kubectl create -f ./jobs The output is similar to this:job.batch/process-item-apple created job.batch/process-item-banana created job.batch/process-item-cherry created Now, check on the jobs:kubectl get jobs -l jobgroup=jobexample The output is similar to this:NAME COMPLETIONS DURATION AGE process-item-apple 1/1 14s 22s process-item-banana 1/1 12s 21s process-item-cherry 1/1 12s 20s Using the -l option to kubectl selects only the Jobs that are part of this group of jobs (there might be other unrelated jobs in the system).You can check on the Pods as well using the same label selector:kubectl get pods -l jobgroup=jobexample The output is similar to:NAME READY STATUS RESTARTS AGE process-item-apple-kixwv 0/1 Completed 0 4m process-item-banana-wrsf7 0/1 Completed 0 4m process-item-cherry-dnfu9 0/1 Completed 0 4m We can use this single command to check on the output of all jobs at once:kubectl logs -f -l jobgroup=jobexample The output should be:Processing item apple Processing item banana Processing item cherry Clean up# Remove the Jobs you created # Your cluster automatically cleans up their Pods kubectl delete job -l jobgroup=jobexample Use advanced template parametersIn the first example, each instance of the template had one parameter, and that parameter was also used in the Job's name. Howe", "category": "tasks", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090"}
{"instruction": "Write a yaml example for parallel processing using expansions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\nParallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1082"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./jobs\n```\n\nParallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1083"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l jobgroup=jobexample\n```\n\nParallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1084"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l jobgroup=jobexample\n```\n\nParallel Processing using Expansions | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1085"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l jobgroup=jobexample\n```\n\nParallel Processing using Expansions | The output should be:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1086"}
{"instruction": "Write a yaml example for parallel processing using expansions", "response": "Here's a yaml example:\n\n```yaml\n{% set params = [{ \"name\": \"apple\", \"url\": \"http://dbpedia.org/resource/Apple\", },\n                  { \"name\": \"banana\", \"url\": \"http://dbpedia.org/resource/Banana\", },\n                  { \"name\": \"cherry\", \"url\": \"http://dbpedia.org/resource/Cherry\" }]\n%}\n{% for p in params %}\n{% set name = p[\"name\"] %}\n{% set url = p[\"url\"] %}\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: jobexample-{{ name }}\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing URL {{ url }} && sleep 5\"]\n      restartPolicy: Never\n{% endfor %}\n```\n\nParallel Processing using Expansions | The above template defines two parameters for each Job object using a list of python dicts (lines 1-4). A for loop emits one Job manifest for each set of parameters (remaining lines).", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1087"}
{"instruction": "Write a yaml example for parallel processing using expansions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\nParallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1088"}
{"instruction": "Write a yaml example for parallel processing using expansions", "response": "Here's a yaml example:\n\n```yaml\napplication/job/job-tmpl.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\nParallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1089"}
{"instruction": "Write a yaml example for parallel processing using expansions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\nParallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1090"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./jobs\n```\n\nParallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1091"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l jobgroup=jobexample\n```\n\nParallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1092"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l jobgroup=jobexample\n```\n\nParallel Processing using Expansions | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1093"}
{"instruction": "Write a bash example for parallel processing using expansions", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l jobgroup=jobexample\n```\n\nParallel Processing using Expansions | The output should be:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/parallel-processing-expansion/", "id": "k8s_00090_code_1094"}
{"instruction": "How do you configure multiple schedulers in Kubernetes?", "response": "Configure Multiple SchedulersKubernetes ships with a default scheduler that is described here. If the default scheduler does not suit your needs you can implement your own scheduler. Moreover, you can even run multiple schedulers simultaneously alongside the default scheduler and instruct Kubernetes what scheduler to use for each of your pods. Let's learn how to run multiple schedulers in Kubernetes with an example.A detailed description of how to implement a scheduler is outside the scope of this document. Please refer to the kube-scheduler implementation in pkg/scheduler in the Kubernetes source directory for a canonical example.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Package the schedulerPackage your scheduler binary into a container image. For the purposes of this example, you can use the default scheduler (kube-scheduler) as your second scheduler. Clone the Kubernetes source code from GitHub and build the source.git clone https://github.com/kubernetes/kubernetes.git cd kubernetes make Create a container image containing the kube-scheduler binary. Here is the Dockerfile to build the image:FROM busybox ADD ./_output/local/bin/linux/amd64/kube-scheduler /usr/local/bin/kube-scheduler Save the file as Dockerfile, build the image and push it to a registry. This example pushes the image to Google Container Registry (GCR). For more details, please read the GCR documentation. Alternatively you can also use the docker hub. For more details refer to the docker hub documentation.docker build -t gcr.io/my-gcp-project/my-kube-scheduler:1.0 . # The image name and the repository gcloud docker -- push gcr.io/my-gcp-project/my-kube-scheduler:1.0 # used in here is just an example Define a Kubernetes Deployment for the schedulerNow that you have your scheduler in a container image, create a pod configuration for it and run it in your Kubernetes cluster. But instead of creating a pod directly in the cluster, you can use a Deployment for this example. A Deployment manages a Replica Set which in turn manages the pods, thereby making the scheduler resilient to failures. Here is the deployment config. Save it as my-scheduler.yaml:admin/sched/my-scheduler.yaml apiVersion: v1 kind: ServiceAccount metadata: name: my-scheduler namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: my-scheduler-as-kube-scheduler subjects: - kind: ServiceAccount name: my-scheduler namespace: kube-system roleRef: kind: ClusterRole name: system:kube-scheduler apiGroup: rbac.authorization.k8s.io --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: my-scheduler-as-volume-scheduler subjects: - kind: ServiceAccount name: my-scheduler namespace: kube-system roleRef: kind: ClusterRole name: system:volume-scheduler apiGroup: rbac.authorization.k8s.io --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: my-scheduler-extension-apiserver-authentication-reader namespace: kube-system roleRef: kind: Role name: extension-apiserver-authentication-reader apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount name: my-scheduler namespace: kube-system --- apiVersion: v1 kind: ConfigMap metadata: name: my-scheduler-config namespace: kube-system data: my-scheduler-config.yaml: | apiVersion: kubescheduler.config.k8s.io/v1 kind: KubeSchedulerConfiguration profiles: - schedulerName: my-scheduler leaderElection: leaderElect: false --- apiVersion: apps/v1 kind: Deployment metadata: labels: component: scheduler tier: control-plane name: ", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\ndocker build -t gcr.io/my-gcp-project/my-kube-scheduler:1.0 .     # The image name and the repository\ngcloud docker -- push gcr.io/my-gcp-project/my-kube-scheduler:1.0 # used in here is just an example\n```\n\nConfigure Multiple Schedulers | Now that you have your scheduler in a container image, create a pod configuration for it and run it in your Kubernetes cluster. But instead of creating a pod directly in the cluster, you can use a Dep", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1096"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\nConfigure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1097"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f my-scheduler.yaml\n```\n\nConfigure Multiple Schedulers | Verify that the scheduler pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1098"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\nConfigure Multiple Schedulers | You should see a \"Running\" my-scheduler pod, in addition to the default kube-scheduler pod in this list.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1099"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:kube-scheduler\n```\n\nConfigure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1100"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\nConfigure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1101"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1102"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod1.yaml\n```\n\nConfigure Multiple Schedulers | Pod spec with default-scheduler", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1103"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1104"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod2.yaml\n```\n\nConfigure Multiple Schedulers | Pod spec with my-scheduler", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1105"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1106"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod3.yaml\n```\n\nConfigure Multiple Schedulers | Verify that all three pods are running.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1107"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\nConfigure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1108"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\nConfigure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1109"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1110"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1111"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1112"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\ndocker build -t gcr.io/my-gcp-project/my-kube-scheduler:1.0 .     # The image name and the repository\ngcloud docker -- push gcr.io/my-gcp-project/my-kube-scheduler:1.0 # used in here is just an example\n```\n\nConfigure Multiple Schedulers | Now that you have your scheduler in a container image, create a pod configuration for it and run it in your Kubernetes cluster. But instead of creating a pod directly in the cluster, you can use a Dep", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1113"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/my-scheduler.yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\nConfigure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1114"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\nConfigure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1115"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f my-scheduler.yaml\n```\n\nConfigure Multiple Schedulers | Verify that the scheduler pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1116"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\nConfigure Multiple Schedulers | You should see a \"Running\" my-scheduler pod, in addition to the default kube-scheduler pod in this list.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1117"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:kube-scheduler\n```\n\nConfigure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1118"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\nConfigure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1119"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\nConfigure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1120"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/pod1.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1121"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1122"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod1.yaml\n```\n\nConfigure Multiple Schedulers | Pod spec with default-scheduler", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1123"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/pod2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1124"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1125"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod2.yaml\n```\n\nConfigure Multiple Schedulers | Pod spec with my-scheduler", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1126"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/pod3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1127"}
{"instruction": "Write a yaml example for configure multiple schedulers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\nConfigure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1128"}
{"instruction": "Write a bash example for configure multiple schedulers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod3.yaml\n```\n\nConfigure Multiple Schedulers | Verify that all three pods are running.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/", "id": "k8s_00091_code_1129"}
{"instruction": "How do you operating etcd clusters for kubernetes in Kubernetes?", "response": "Operating etcd clusters for Kubernetesetcd is a consistent and highly-available key value store used as Kubernetes' backing store for all cluster data.If your Kubernetes cluster uses etcd as its backing store, make sure you have a back up plan for the data.You can find in-depth information about etcd in the official documentation.Before you beginBefore you follow steps in this page to deploy, manage, back up or restore etcd, you need to understand the typical expectations for operating an etcd cluster. Refer to the etcd documentation for more context.Key details include:The minimum recommended etcd versions to run in production are 3.4.22+ and 3.5.6+.etcd is a leader-based distributed system. Ensure that the leader periodically send heartbeats on time to all followers to keep the cluster stable.You should run etcd as a cluster with an odd number of members.Aim to ensure that no resource starvation occurs.Performance and stability of the cluster is sensitive to network and disk I/O. Any resource starvation can lead to heartbeat timeout, causing instability of the cluster. An unstable etcd indicates that no leader is elected. Under such circumstances, a cluster cannot make any changes to its current state, which implies no new pods can be scheduled.Resource requirements for etcdOperating etcd with limited resources is suitable only for testing purposes. For deploying in production, advanced hardware configuration is required. Before deploying etcd in production, see resource requirement reference.Keeping etcd clusters stable is critical to the stability of Kubernetes clusters. Therefore, run etcd clusters on dedicated machines or isolated environments for guaranteed resource requirements.ToolsDepending on which specific outcome you're working on, you will need the etcdctl tool or the etcdutl tool (you may need both).Understanding etcdctl and etcdutletcdctl and etcdutl are command-line tools used to interact with etcd clusters, but they serve different purposes:etcdctl: This is the primary command-line client for interacting with etcd over a network. It is used for day-to-day operations such as managing keys and values, administering the cluster, checking health, and more.etcdutl: This is an administration utility designed to operate directly on etcd data files, including migrating data between etcd versions, defragmenting the database, restoring snapshots, and validating data consistency. For network operations, etcdctl should be used.For more information on etcdutl, you can refer to the etcd recovery documentation.Starting etcd clustersThis section covers starting a single-node and multi-node etcd cluster.This guide assumes that etcd is already installed.Single-node etcd clusterUse a single-node etcd cluster only for testing purposes.Run the following:etcd --listen-client-urls=http://$PRIVATE_IP:2379 \\ --advertise-client-urls=http://$PRIVATE_IP:2379 Start the Kubernetes API server with the flag --etcd-servers=$PRIVATE_IP:2379.Make sure PRIVATE_IP is set to your etcd client IP.Multi-node etcd clusterFor durability and high availability, run etcd as a multi-node cluster in production and back it up periodically. A five-member cluster is recommended in production. For more information, see FAQ documentation.As you're using Kubernetes, you have the option to run etcd as a container inside one or more Pods. The kubeadm tool sets up etcd static pods by default, or you can deploy a separate cluster and instruct kubeadm to use that etcd cluster as the control plane's backing store.You configure an etcd cluster either by static member information or by dynamic discovery. For more information on clustering, see etcd clustering documentation.For an example, consider a five-member etcd cluster running with the following client URLs: http://$IP1:2379, http://$IP2:2379, http://$IP3:2379, http://$IP4:2379, and http://$IP5:2379. To start a Kubernetes API server:Run the following:etcd --listen-client-urls=http://$IP1:2379,http://$IP2:2379,http:", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/", "id": "k8s_00092"}
{"instruction": "Write a bash example for operating etcd clusters for kubernetes", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system delete pod <name-of-etcd-pod>\n```\n\nOperating etcd clusters for Kubernetes | For more information and examples on restoring a cluster from a snapshot file, see etcd disaster recovery documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/", "id": "k8s_00092_code_1131"}
{"instruction": "What is the reference documentation for kubectl label?", "response": "kubectl labelSynopsisUpdate the labels on a resource.A label key and value must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters each.Optionally, the key can begin with a DNS subdomain prefix and a single '/', like example.com/my-app.If --overwrite is true, then existing labels can be overwritten, otherwise attempting to overwrite a label will result in an error.If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version] Examples # Update pod 'foo' with the label 'unhealthy' and the value 'true' kubectl label pods foo unhealthy=true # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value kubectl label --overwrite pods foo status=unhealthy # Update all pods in the namespace kubectl label pods --all status=unhealthy # Update a pod identified by the type and name in \"pod.json\" kubectl label -f pod.json status=unhealthy # Update pod 'foo' only if the resource is unchanged from version 1 kubectl label pods foo status=unhealthy --resource-version=1 # Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag kubectl label pods foo bar- Options--allSelect all resources, in the namespace of the specified resource types-A, --all-namespacesIf true, check the specified action in all namespaces.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-label\"Name of the manager used to track field ownership.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update the labels-h, --helphelp for label-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--listIf true, display the labels for a given resource.--localIf true, label will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--overwriteIf true, allow labels to be overwritten, otherwise reject label updates that overwrite existing labels.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--resource-version stringIf non-empty, the labels update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multip", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_label/", "id": "k8s_00093"}
{"instruction": "Write a bash example for kubectl label", "response": "Here's a bash example:\n\n```bash\nkubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\nkubectl label | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_label/", "id": "k8s_00093_code_1133"}
{"instruction": "Write a bash example for kubectl label", "response": "Here's a bash example:\n\n```bash\nkubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\nkubectl label | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_label/", "id": "k8s_00093_code_1134"}
{"instruction": "How do you set up ingress on minikube with the nginx ingress controller in Kubernetes?", "response": "Set up Ingress on Minikube with the NGINX Ingress ControllerAn Ingress is an API object that defines rules which allow external access to services in a cluster. An Ingress controller fulfills the rules set in the Ingress.This page shows you how to set up a simple Ingress which routes requests to Service 'web' or 'web2' depending on the HTTP URI.Before you beginThis tutorial assumes that you are using minikube to run a local Kubernetes cluster. Visit Install tools to learn how to install minikube.Note:This tutorial uses a container that requires the AMD64 architecture. If you are using minikube on a computer with a different CPU architecture, you could try using minikube with a driver that can emulate AMD64. For example, the Docker Desktop driver can do this.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.19.To check the version, enter kubectl version.If you are using an older Kubernetes version, switch to the documentation for that version.Create a minikube clusterIf you haven't already set up a cluster locally, run minikube start to create a cluster.Enable the Ingress controllerTo enable the NGINX Ingress controller, run the following command:minikube addons enable ingress Verify that the NGINX Ingress controller is runningkubectl get pods -n ingress-nginx Note:It can take up to a minute before you see these pods running OK.The output is similar to:NAME READY STATUS RESTARTS AGE ingress-nginx-admission-create-g9g49 0/1 Completed 0 11m ingress-nginx-admission-patch-rqp78 0/1 Completed 1 11m ingress-nginx-controller-59b45fb494-26npt 1/1 Running 0 11m Deploy a hello, world appCreate a Deployment using the following command:kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0 The output should be:deployment.apps/web created Verify that the Deployment is in a Ready state:kubectl get deployment web The output should be similar to:NAME READY UP-TO-DATE AVAILABLE AGE web 1/1 1 1 53s Expose the Deployment:kubectl expose deployment web --type=NodePort --port=8080 The output should be:service/web exposed Verify the Service is created and is available on a node port:kubectl get service web The output is similar to:NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE web NodePort 10.104.133.249 <none> 8080:31637/TCP 12m Visit the Service via NodePort, using the minikube service command. Follow the instructions for your platform:minikube service web --url The output is similar to:http://172.17.0.15:31637 Invoke the URL obtained in the output of the previous step:curl http://172.17.0.15:31637 # The command must be run in a separate terminal. minikube service web --url The output is similar to:http://127.0.0.1:62445 ! Because you are using a Docker driver on darwin, the terminal needs to be open to run it. From a different terminal, invoke the URL obtained in the output of the previous step:curl http://127.0.0.1:62445 The output is similar to:Hello, world! Version: 1.0.0 Hostname: web-55b8c6998d-8k564 You can now access the sample application via the Minikube IP address and NodePort. The next step lets you access the application using the Ingress resource.Create an IngressThe following manifest defines an Ingress that sends traffic to your Service via hello-world.example.Create example-ingress.yaml from the following file:service/networking/example-ingress.yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-ingress spec: ingressClassName: nginx rules: - host: hello-world.example http: paths: - path: / pathType: Prefix backend: service: name: web port: number: 8080Create the Ingres", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n ingress-nginx\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1136"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1137"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1138"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web --type=NodePort --port=8080\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1139"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get service web\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1140"}
{"instruction": "Write a yaml example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1141"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1142"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1143"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web2\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1144"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web2 --port=8080 --type=NodePort\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1145"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-ingress.yaml\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | You should see:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1146"}
{"instruction": "Write a yaml example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1147"}
{"instruction": "Write a yaml example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a yaml example:\n\n```yaml\n- path: /v2\n  pathType: Prefix\n  backend:\n    service:\n      name: web2\n      port:\n        number: 8080\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | Apply the changes:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1148"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n ingress-nginx\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1149"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1150"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1151"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web --type=NodePort --port=8080\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1152"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get service web\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1153"}
{"instruction": "Write a yaml example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/example-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1154"}
{"instruction": "Write a yaml example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1155"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1156"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1157"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web2\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1158"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web2 --port=8080 --type=NodePort\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1159"}
{"instruction": "Write a bash example for set up ingress on minikube with the nginx ingress controller", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-ingress.yaml\n```\n\nSet up Ingress on Minikube with the NGINX Ingress Controller | You should see:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/", "id": "k8s_00094_code_1160"}
{"instruction": "What is the reference documentation for kuberc (v1alpha1)?", "response": "kuberc (v1alpha1)Resource TypesPreferencePreferencePreference stores elements of KubeRC configuration fileFieldDescriptionapiVersionstringkubectl.config.k8s.io/v1alpha1kindstringPreferenceoverrides [Required][]CommandOverrideoverrides allows changing default flag values of commands. This is especially useful, when user doesn't want to explicitly set flags each time.aliases [Required][]AliasOverridealiases allows defining command aliases for existing kubectl commands, with optional default flag values. If the alias name collides with a built-in command, built-in command always takes precedence. Flag overrides defined in the overrides section do NOT apply to aliases for the same command. kubectl [ALIAS NAME] [USER_FLAGS] [USER_EXPLICIT_ARGS] expands to kubectl [COMMAND] # built-in command alias points to [KUBERC_PREPEND_ARGS] [USER_FLAGS] [KUBERC_FLAGS] # rest of the flags that are not passed by user in [USER_FLAGS] [USER_EXPLICIT_ARGS] [KUBERC_APPEND_ARGS] e.g.name: runx command: run flags:name: image default: nginx appendArgs:custom-arg1 For example, if user invokes \"kubectl runx test-pod\" command, this will be expanded to \"kubectl run --image=nginx test-pod -- custom-arg1\"name: getn command: get flags:name: output default: wide prependArgs:node \"kubectl getn control-plane-1\" expands to \"kubectl get node control-plane-1 --output=wide\" \"kubectl getn control-plane-1 --output=json\" expands to \"kubectl get node --output=json control-plane-1\"AliasOverrideAppears in:PreferenceAliasOverride stores the alias definitions.FieldDescriptionname [Required]stringName is the name of alias that can only include alphabetical characters If the alias name conflicts with the built-in command, built-in command will be used.command [Required]stringCommand is the single or set of commands to execute, such as \"set env\" or \"create\"prependArgs [Required][]stringPrependArgs stores the arguments such as resource names, etc. These arguments are inserted after the alias name.appendArgs [Required][]stringAppendArgs stores the arguments such as resource names, etc. These arguments are appended to the USER_ARGS.flags [Required][]CommandOverrideFlagFlag is allocated to store the flag definitions of alias. Flag only modifies the default value of the flag and if user explicitly passes a value, explicit one is used.CommandOverrideAppears in:PreferenceCommandOverride stores the commands and their associated flag's default values.FieldDescriptioncommand [Required]stringCommand refers to a command whose flag's default value is changed.flags [Required][]CommandOverrideFlagFlags is a list of flags storing different default values.CommandOverrideFlagAppears in:AliasOverrideCommandOverrideCommandOverrideFlag stores the name and the specified default value of the flag.FieldDescriptionname [Required]stringFlag name (long form, without dashes).default [Required]stringIn a string format of a default value. It will be parsed by kubectl to the compatible value of the flag.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kuberc.v1alpha1/", "id": "k8s_00095"}
{"instruction": "Write a bash example for kuberc (v1alpha1)", "response": "Here's a bash example:\n\n```bash\nkubectl.config.k8s.io/v1alpha1\n```\n\nkuberc (v1alpha1) | overrides allows changing default flag values of commands. This is especially useful, when user doesn't want to explicitly set flags each time.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kuberc.v1alpha1/", "id": "k8s_00095_code_1162"}
{"instruction": "How do you using nodelocal dnscache in kubernetes clusters in Kubernetes?", "response": "Using NodeLocal DNSCache in Kubernetes ClustersFEATURE STATE: Kubernetes v1.18 [stable]This page provides an overview of NodeLocal DNSCache feature in Kubernetes.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.IntroductionNodeLocal DNSCache improves Cluster DNS performance by running a DNS caching agent on cluster nodes as a DaemonSet. In today's architecture, Pods in 'ClusterFirst' DNS mode reach out to a kube-dns serviceIP for DNS queries. This is translated to a kube-dns/CoreDNS endpoint via iptables rules added by kube-proxy. With this new architecture, Pods will reach out to the DNS caching agent running on the same node, thereby avoiding iptables DNAT rules and connection tracking. The local caching agent will query kube-dns service for cache misses of cluster hostnames (\"cluster.local\" suffix by default).MotivationWith the current DNS architecture, it is possible that Pods with the highest DNS QPS have to reach out to a different node, if there is no local kube-dns/CoreDNS instance. Having a local cache will help improve the latency in such scenarios.Skipping iptables DNAT and connection tracking will help reduce conntrack races and avoid UDP DNS entries filling up conntrack table.Connections from the local caching agent to kube-dns service can be upgraded to TCP. TCP conntrack entries will be removed on connection close in contrast with UDP entries that have to timeout (default nf_conntrack_udp_timeout is 30 seconds)Upgrading DNS queries from UDP to TCP would reduce tail latency attributed to dropped UDP packets and DNS timeouts usually up to 30s (3 retries + 10s timeout). Since the nodelocal cache listens for UDP DNS queries, applications don't need to be changed.Metrics & visibility into DNS requests at a node level.Negative caching can be re-enabled, thereby reducing the number of queries for the kube-dns service.Architecture DiagramThis is the path followed by DNS Queries after NodeLocal DNSCache is enabled:Nodelocal DNSCache flowThis image shows how NodeLocal DNSCache handles DNS queries.ConfigurationNote:The local listen IP address for NodeLocal DNSCache can be any address that can be guaranteed to not collide with any existing IP in your cluster. It's recommended to use an address with a local scope, for example, from the 'link-local' range '169.254.0.0/16' for IPv4 or from the 'Unique Local Address' range in IPv6 'fd00::/8'.This feature can be enabled using the following steps:Prepare a manifest similar to the sample nodelocaldns.yaml and save it as nodelocaldns.yaml.If using IPv6, the CoreDNS configuration file needs to enclose all the IPv6 addresses into square brackets if used in 'IP:Port' format. If you are using the sample manifest from the previous point, this will require you to modify the configuration line L70 like this: \"health [__PILLAR__LOCAL__DNS__]:8080\"Substitute the variables in the manifest with the right values:kubedns=`kubectl get svc kube-dns -n kube-system -o jsonpath={.spec.clusterIP}` domain=<cluster-domain> localdns=<node-local-address> <cluster-domain> is \"cluster.local\" by default. <node-local-address> is the local listen IP address chosen for NodeLocal DNSCache.If kube-proxy is running in IPTABLES mode:sed -i \"s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/__PILLAR__DNS__SERVER__/$kubedns/g\" nodelocaldns.yaml __PILLAR__CLUSTER__DNS__ and __PILLAR__UPSTREAM__SERVERS__ will be populated by the node-local-dns pods. In this mode, the node-local-dns pods listen on both the kube-dns service IP as well as <node-local-address>, so pods ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/", "id": "k8s_00096"}
{"instruction": "Write a bash example for using nodelocal dnscache in kubernetes clusters", "response": "Here's a bash example:\n\n```bash\nsed -i \"s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/__PILLAR__DNS__SERVER__/$kubedns/g\" nodelocaldns.yaml\n```\n\nUsing NodeLocal DNSCache in Kubernetes Clusters | __PILLAR__CLUSTER__DNS__ and __PILLAR__UPSTREAM__SERVERS__ will be populated by the node-local-dns pods. In this mode, the node-local-dns pods listen on both the kube-dns service IP as well as <node-l", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/", "id": "k8s_00096_code_1164"}
{"instruction": "Write a bash example for using nodelocal dnscache in kubernetes clusters", "response": "Here's a bash example:\n\n```bash\nsed -i \"s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/,__PILLAR__DNS__SERVER__//g; s/__PILLAR__CLUSTER__DNS__/$kubedns/g\" nodelocaldns.yaml\n```\n\nUsing NodeLocal DNSCache in Kubernetes Clusters | In this mode, the node-local-dns pods listen only on <node-local-address>. The node-local-dns interface cannot bind the kube-dns cluster IP since the interface used for IPVS loadbalancing already uses", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/", "id": "k8s_00096_code_1165"}
{"instruction": "Write a bash example for using nodelocal dnscache in kubernetes clusters", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nodelocaldns.yaml\n```\n\nUsing NodeLocal DNSCache in Kubernetes Clusters | If using kube-proxy in IPVS mode, --cluster-dns flag to kubelet needs to be modified to use <node-local-address> that NodeLocal DNSCache is listening on. Otherwise, there is no need to modify the valu", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/", "id": "k8s_00096_code_1166"}
{"instruction": "Write a bash example for using nodelocal dnscache in kubernetes clusters", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <manifest>\n```\n\nUsing NodeLocal DNSCache in Kubernetes Clusters | StubDomains and upstream servers specified in the kube-dns ConfigMap in the kube-system namespace are automatically picked up by node-local-dns pods. The ConfigMap contents need to follow the format s", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/", "id": "k8s_00096_code_1167"}
{"instruction": "What is the reference documentation for scheduler configuration?", "response": "Scheduler ConfigurationFEATURE STATE: Kubernetes v1.25 [stable]You can customize the behavior of the kube-scheduler by writing a configuration file and passing its path as a command line argument.A scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing one or more of these extension points.You can specify scheduling profiles by running kube-scheduler --config <filename>, using the KubeSchedulerConfiguration v1 struct.A minimal configuration looks as follows:apiVersion: kubescheduler.config.k8s.io/v1 kind: KubeSchedulerConfiguration clientConnection: kubeconfig: /etc/srv/kubernetes/kube-scheduler/kubeconfig Note:KubeSchedulerConfiguration v1beta3 is deprecated in v1.26 and is removed in v1.29. Please migrate KubeSchedulerConfiguration to v1.ProfilesA scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing one or more of these extension points.You can configure a single instance of kube-scheduler to run multiple profiles.Extension pointsScheduling happens in a series of stages that are exposed through the following extension points:queueSort: These plugins provide an ordering function that is used to sort pending Pods in the scheduling queue. Exactly one queue sort plugin may be enabled at a time.preFilter: These plugins are used to pre-process or check information about a Pod or the cluster before filtering. They can mark a pod as unschedulable.filter: These plugins are the equivalent of Predicates in a scheduling Policy and are used to filter out nodes that can not run the Pod. Filters are called in the configured order. A pod is marked as unschedulable if no nodes pass all the filters.postFilter: These plugins are called in their configured order when no feasible nodes were found for the pod. If any postFilter plugin marks the Pod schedulable, the remaining plugins are not called.preScore: This is an informational extension point that can be used for doing pre-scoring work.score: These plugins provide a score to each node that has passed the filtering phase. The scheduler will then select the node with the highest weighted scores sum.reserve: This is an informational extension point that notifies plugins when resources have been reserved for a given Pod. Plugins also implement an Unreserve call that gets called in the case of failure during or after Reserve.permit: These plugins can prevent or delay the binding of a Pod.preBind: These plugins perform any work required before a Pod is bound.bind: The plugins bind a Pod to a Node. bind plugins are called in order and once one has done the binding, the remaining plugins are skipped. At least one bind plugin is required.postBind: This is an informational extension point that is called after a Pod has been bound.multiPoint: This is a config-only field that allows plugins to be enabled or disabled for all of their applicable extension points simultaneously.For each extension point, you could disable specific default plugins or enable your own. For example:apiVersion: kubescheduler.config.k8s.io/v1 kind: KubeSchedulerConfiguration profiles: - plugins: score: disabled: - name: PodTopologySpread enabled: - name: MyCustomPluginA weight: 2 - name: MyCustomPluginB weight: 1 You can use * as name in the disabled array to disable all default plugins for that extension point. This can also be used to rearrange plugins order, if desired.Scheduling pluginsThe following plugins, enabled by default, implement one or more of these extension points:ImageLocality: Favors nodes that already have the container images that the Pod runs. Extension points: score.TaintToleration: Implements taints and tolerations. Implements extension points: filter, preScore, score.NodeName: Checks if a Pod spec node name matches the cur", "category": "reference", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nclientConnection:\n  kubeconfig: /etc/srv/kubernetes/kube-scheduler/kubeconfig\n```\n\nScheduler Configuration | A scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1169"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - plugins:\n      score:\n        disabled:\n        - name: PodTopologySpread\n        enabled:\n        - name: MyCustomPluginA\n          weight: 2\n        - name: MyCustomPluginB\n          weight: 1\n```\n\nScheduler Configuration | You can use * as name in the disabled array to disable all default plugins for that extension point. This can also be used to rearrange plugins order, if desired.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1170"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: no-scoring-scheduler\n    plugins:\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\nScheduler Configuration | Pods that want to be scheduled according to a specific profile can include the corresponding scheduler name in its .spec.schedulerName.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1171"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: MyPlugin\n```\n\nScheduler Configuration | This would equate to manually enabling MyPlugin for all of its extension points, like so:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1172"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      preScore:\n        enabled:\n        - name: MyPlugin\n      score:\n        enabled:\n        - name: MyPlugin\n      preFilter:\n        enabled:\n        - name: MyPlugin\n      filter:\n        enabled:\n        - name: MyPlugin\n```\n\nScheduler Configuration | One benefit of using multiPoint here is that if MyPlugin implements another extension point in the future, the multiPoint config will automatically enable it for the new extension.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1173"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'MyPlugin'\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\nScheduler Configuration | Starting from kubescheduler.config.k8s.io/v1beta3, all default plugins are enabled internally through MultiPoint. However, individual extension points are still available to allow flexible reconfigura", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1174"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      score:\n        enabled:\n        - name: 'DefaultScore2'\n          weight: 5\n```\n\nScheduler Configuration | In this example, it's unnecessary to specify the plugins in MultiPoint explicitly because they are default plugins. And the only plugin specified in Score is DefaultScore2. This is because plugins set", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1175"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'CustomQueueSort'\n        - name: 'CustomPlugin1'\n          weight: 3\n        - name: 'CustomPlugin2'\n        disabled:\n        - name: 'DefaultQueueSort'\n      filter:\n        disabled:\n        - name: 'DefaultPlugin1'\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n```\n\nScheduler Configuration | Note that there is no error for re-declaring a MultiPoint plugin in a specific extension point. The re-declaration is ignored (and logged), as specific extension points take precedence.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1176"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n\n      # Disable the default QueueSort plugin\n      queueSort:\n        enabled:\n        - name: 'CustomQueueSort'\n        disabled:\n        - name: 'DefaultQueueSort'\n\n      # Enable custom Filter plugins\n      filter:\n        enabled:\n        - name: 'CustomPlugin1'\n        - name: 'CustomPlugin2'\n        - name: 'DefaultPlugin2'\n        disabled:\n        - name: 'DefaultPlugin1'\n\n      # Enable and reorder custom score plugins\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n          weight: 1\n        - name: 'DefaultPlugin1'\n          weight: 3\n```\n\nScheduler Configuration | While this is a complicated example, it demonstrates the flexibility of MultiPoint config as well as its seamless integration with the existing methods for configuring extension points.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1177"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\nScheduler Configuration | The scheduler plugin NodeLabel is deprecated; instead, use the NodeAffinity plugin (enabled by default) to achieve similar behavior.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1178"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nclientConnection:\n  kubeconfig: /etc/srv/kubernetes/kube-scheduler/kubeconfig\n```\n\nScheduler Configuration | A scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1179"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - plugins:\n      score:\n        disabled:\n        - name: PodTopologySpread\n        enabled:\n        - name: MyCustomPluginA\n          weight: 2\n        - name: MyCustomPluginB\n          weight: 1\n```\n\nScheduler Configuration | You can use * as name in the disabled array to disable all default plugins for that extension point. This can also be used to rearrange plugins order, if desired.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1180"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: no-scoring-scheduler\n    plugins:\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\nScheduler Configuration | Pods that want to be scheduled according to a specific profile can include the corresponding scheduler name in its .spec.schedulerName.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1181"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: MyPlugin\n```\n\nScheduler Configuration | This would equate to manually enabling MyPlugin for all of its extension points, like so:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1182"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      preScore:\n        enabled:\n        - name: MyPlugin\n      score:\n        enabled:\n        - name: MyPlugin\n      preFilter:\n        enabled:\n        - name: MyPlugin\n      filter:\n        enabled:\n        - name: MyPlugin\n```\n\nScheduler Configuration | One benefit of using multiPoint here is that if MyPlugin implements another extension point in the future, the multiPoint config will automatically enable it for the new extension.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1183"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'MyPlugin'\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\nScheduler Configuration | Starting from kubescheduler.config.k8s.io/v1beta3, all default plugins are enabled internally through MultiPoint. However, individual extension points are still available to allow flexible reconfigura", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1184"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      score:\n        enabled:\n        - name: 'DefaultScore2'\n          weight: 5\n```\n\nScheduler Configuration | In this example, it's unnecessary to specify the plugins in MultiPoint explicitly because they are default plugins. And the only plugin specified in Score is DefaultScore2. This is because plugins set", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1185"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'CustomQueueSort'\n        - name: 'CustomPlugin1'\n          weight: 3\n        - name: 'CustomPlugin2'\n        disabled:\n        - name: 'DefaultQueueSort'\n      filter:\n        disabled:\n        - name: 'DefaultPlugin1'\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n```\n\nScheduler Configuration | Note that there is no error for re-declaring a MultiPoint plugin in a specific extension point. The re-declaration is ignored (and logged), as specific extension points take precedence.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1186"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n\n      # Disable the default QueueSort plugin\n      queueSort:\n        enabled:\n        - name: 'CustomQueueSort'\n        disabled:\n        - name: 'DefaultQueueSort'\n\n      # Enable custom Filter plugins\n      filter:\n        enabled:\n        - name: 'CustomPlugin1'\n        - name: 'CustomPlugin2'\n        - name: 'DefaultPlugin2'\n        disabled:\n        - name: 'DefaultPlugin1'\n\n      # Enable and reorder custom score plugins\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n          weight: 1\n        - name: 'DefaultPlugin1'\n          weight: 3\n```\n\nScheduler Configuration | While this is a complicated example, it demonstrates the flexibility of MultiPoint config as well as its seamless integration with the existing methods for configuring extension points.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1187"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\nScheduler Configuration | The scheduler plugin NodeLabel is deprecated; instead, use the NodeAffinity plugin (enabled by default) to achieve similar behavior.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1188"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nclientConnection:\n  kubeconfig: /etc/srv/kubernetes/kube-scheduler/kubeconfig\n```\n\nScheduler Configuration | A scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1189"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - plugins:\n      score:\n        disabled:\n        - name: PodTopologySpread\n        enabled:\n        - name: MyCustomPluginA\n          weight: 2\n        - name: MyCustomPluginB\n          weight: 1\n```\n\nScheduler Configuration | You can use * as name in the disabled array to disable all default plugins for that extension point. This can also be used to rearrange plugins order, if desired.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1190"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: no-scoring-scheduler\n    plugins:\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\nScheduler Configuration | Pods that want to be scheduled according to a specific profile can include the corresponding scheduler name in its .spec.schedulerName.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1191"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: MyPlugin\n```\n\nScheduler Configuration | This would equate to manually enabling MyPlugin for all of its extension points, like so:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1192"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      preScore:\n        enabled:\n        - name: MyPlugin\n      score:\n        enabled:\n        - name: MyPlugin\n      preFilter:\n        enabled:\n        - name: MyPlugin\n      filter:\n        enabled:\n        - name: MyPlugin\n```\n\nScheduler Configuration | One benefit of using multiPoint here is that if MyPlugin implements another extension point in the future, the multiPoint config will automatically enable it for the new extension.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1193"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'MyPlugin'\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\nScheduler Configuration | Starting from kubescheduler.config.k8s.io/v1beta3, all default plugins are enabled internally through MultiPoint. However, individual extension points are still available to allow flexible reconfigura", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1194"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      score:\n        enabled:\n        - name: 'DefaultScore2'\n          weight: 5\n```\n\nScheduler Configuration | In this example, it's unnecessary to specify the plugins in MultiPoint explicitly because they are default plugins. And the only plugin specified in Score is DefaultScore2. This is because plugins set", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1195"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'CustomQueueSort'\n        - name: 'CustomPlugin1'\n          weight: 3\n        - name: 'CustomPlugin2'\n        disabled:\n        - name: 'DefaultQueueSort'\n      filter:\n        disabled:\n        - name: 'DefaultPlugin1'\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n```\n\nScheduler Configuration | Note that there is no error for re-declaring a MultiPoint plugin in a specific extension point. The re-declaration is ignored (and logged), as specific extension points take precedence.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1196"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n\n      # Disable the default QueueSort plugin\n      queueSort:\n        enabled:\n        - name: 'CustomQueueSort'\n        disabled:\n        - name: 'DefaultQueueSort'\n\n      # Enable custom Filter plugins\n      filter:\n        enabled:\n        - name: 'CustomPlugin1'\n        - name: 'CustomPlugin2'\n        - name: 'DefaultPlugin2'\n        disabled:\n        - name: 'DefaultPlugin1'\n\n      # Enable and reorder custom score plugins\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n          weight: 1\n        - name: 'DefaultPlugin1'\n          weight: 3\n```\n\nScheduler Configuration | While this is a complicated example, it demonstrates the flexibility of MultiPoint config as well as its seamless integration with the existing methods for configuring extension points.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1197"}
{"instruction": "Write a yaml example for scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\nScheduler Configuration | The scheduler plugin NodeLabel is deprecated; instead, use the NodeAffinity plugin (enabled by default) to achieve similar behavior.", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/scheduling/config/", "id": "k8s_00097_code_1198"}
{"instruction": "Provide a tutorial on connecting applications with services", "response": "Connecting Applications with ServicesThe Kubernetes model for connecting containersNow that you have a continuously running, replicated application you can expose it on a network.Kubernetes assumes that pods can communicate with other pods, regardless of which host they land on. Kubernetes gives every pod its own cluster-private IP address, so you do not need to explicitly create links between pods or map container ports to host ports. This means that containers within a Pod can all reach each other's ports on localhost, and all pods in a cluster can see each other without NAT. The rest of this document elaborates on how you can run reliable services on such a networking model.This tutorial uses a simple nginx web server to demonstrate the concept.Exposing pods to the clusterWe did this in a previous example, but let's do it once again and focus on the networking perspective. Create an nginx Pod, and note that it has a container port specification:service/networking/run-my-nginx.yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx spec: selector: matchLabels: run: my-nginx replicas: 2 template: metadata: labels: run: my-nginx spec: containers: - name: my-nginx image: nginx ports: - containerPort: 80 This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:kubectl apply -f ./run-my-nginx.yaml kubectl get pods -l run=my-nginx -o wide NAME READY STATUS RESTARTS AGE IP NODE my-nginx-3800858182-jr4a2 1/1 Running 0 13s 10.244.3.4 kubernetes-minion-905m my-nginx-3800858182-kna2y 1/1 Running 0 13s 10.244.2.5 kubernetes-minion-ljyd Check your pods' IPs:kubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs POD_IP [map[ip:10.244.3.4]] [map[ip:10.244.2.5]] You should be able to ssh into any node in your cluster and use a tool such as curl to make queries against both IPs. Note that the containers are not using port 80 on the node, nor are there any special NAT rules to route traffic to the pod. This means you can run multiple nginx pods on the same node all using the same containerPort, and access them from any other pod or node in your cluster using the assigned IP address for the pod. If you want to arrange for a specific port on the host Node to be forwarded to backing Pods, you can - but the networking model should mean that you do not need to do so.You can read more about the Kubernetes Networking Model if you're curious.Creating a ServiceSo we have pods running nginx in a flat, cluster wide, address space. In theory, you could talk to these pods directly, but what happens when a node dies? The pods die with it, and the ReplicaSet inside the Deployment will create new ones, with different IPs. This is the problem a Service solves.A Kubernetes Service is an abstraction which defines a logical set of Pods running somewhere in your cluster, that all provide the same functionality. When created, each Service is assigned a unique IP address (also called clusterIP). This address is tied to the lifespan of the Service, and will not change while the Service is alive. Pods can be configured to talk to the Service, and know that communication to the Service will be automatically load-balanced out to some pod that is a member of the Service.You can create a Service for your 2 nginx replicas with kubectl expose:kubectl expose deployment/my-nginx service/my-nginx exposed This is equivalent to kubectl apply -f in the following yaml:service/networking/nginx-svc.yaml apiVersion: v1 kind: Service metadata: name: my-nginx labels: run: my-nginx spec: ports: - port: 80 protocol: TCP selector: run: my-nginx This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts traffic on, port: is the abstracted Service port, which can be any port other pods use to access the Service). View Service API object to see the list of supported fields in service defi", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nConnecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1200"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./run-my-nginx.yaml\nkubectl get pods -l run=my-nginx -o wide\n```\n\nConnecting Applications with Services | Check your pods' IPs:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1201"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.4]]\n    [map[ip:10.244.2.5]]\n```\n\nConnecting Applications with Services | You should be able to ssh into any node in your cluster and use a tool such as curl to make queries against both IPs. Note that the containers are not using port 80 on the node, nor are there any spec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1202"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/my-nginx\n```\n\nConnecting Applications with Services | This is equivalent to kubectl apply -f in the following yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1203"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\nConnecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1204"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx\n```\n\nConnecting Applications with Services | As mentioned previously, a Service is backed by a group of Pods. These Pods are exposed through EndpointSlices. The Service's selector will be evaluated continuously and the results will be POSTed to", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1205"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc my-nginx\n```\n\nConnecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1206"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=my-nginx\n```\n\nConnecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1207"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-jr4a2 -- printenv | grep SERVICE\n```\n\nConnecting Applications with Services | Note there's no mention of your Service. This is because you created the replicas before the Service. Another disadvantage of doing this is that the scheduler might put both Pods on the same machine,", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1208"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment my-nginx --replicas=0; kubectl scale deployment my-nginx --replicas=2;\n\nkubectl get pods -l run=my-nginx -o wide\n```\n\nConnecting Applications with Services | You may notice that the pods have different names, since they are killed and recreated.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1209"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-e9ihh -- printenv | grep SERVICE\n```\n\nConnecting Applications with Services | Kubernetes offers a DNS cluster addon Service that automatically assigns dns names to other Services. You can check if it's running on your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1210"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get services kube-dns --namespace=kube-system\n```\n\nConnecting Applications with Services | The rest of this section will assume you have a Service with a long lived IP (my-nginx), and a DNS server that has assigned a name to that IP. Here we use the CoreDNS cluster addon (application name k", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1211"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl run curl --image=radial/busyboxplus:curl -i --tty --rm\n```\n\nConnecting Applications with Services | Then, hit enter and run nslookup my-nginx:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1212"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap nginxconfigmap --from-file=default.conf\n```\n\nConnecting Applications with Services | You can find an example for default.conf in the Kubernetes examples project repo.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1213"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps\n```\n\nConnecting Applications with Services | You can view the details of the nginxconfigmap ConfigMap using the following command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1214"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap  nginxconfigmap\n```\n\nConnecting Applications with Services | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1215"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"v1\"\nkind: \"Secret\"\nmetadata:\n  name: \"nginxsecret\"\n  namespace: \"default\"\ntype: kubernetes.io/tls\ndata:\n # NOTE: Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\nConnecting Applications with Services | Now create the secrets using the file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1216"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginxsecrets.yaml\nkubectl get secrets\n```\n\nConnecting Applications with Services | Now modify your nginx replicas to start an https server using the certificate in the secret, and the Service, to expose both ports (80 and 443):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1217"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\nConnecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1218"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments,svc my-nginx; kubectl create -f ./nginx-secure-app.yaml\n```\n\nConnecting Applications with Services | At this point you can reach the nginx server from any node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1219"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.5]]\n```\n\nConnecting Applications with Services | Note how we supplied the -k parameter to curl in the last step, this is because we don't know anything about the pods running nginx at certificate generation time, so we have to tell curl to ignore th", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1220"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1221"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./curlpod.yaml\nkubectl get pods -l app=curlpod\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1222"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl exec curl-deployment-1515033274-1410r -- curl https://my-nginx --cacert /etc/nginx/ssl/tls.crt\n...\n<title>Welcome to nginx!</title>\n...\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1223"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx -o yaml | grep nodePort -C 5\n  uid: 07191fb3-f61a-11e5-8ae5-42010af00002\nspec:\n  clusterIP: 10.0.162.149\n  ports:\n  - name: http\n    nodePort: 31704\n    port: 8080\n    protocol: TCP\n    targetPort: 80\n  - name: https\n    nodePort: 32453\n    port: 443\n    protocol: TCP\n    targetPort: 443\n  selector:\n    run: my-nginx\n```\n\nConnecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1224"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o yaml | grep ExternalIP -C 1\n    - address: 104.197.41.11\n      type: ExternalIP\n    allocatable:\n--\n    - address: 23.251.152.56\n      type: ExternalIP\n    allocatable:\n...\n\n$ curl https://<EXTERNAL-IP>:<NODE-PORT> -k\n...\n<h1>Welcome to nginx!</h1>\n```\n\nConnecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1225"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc my-nginx\nkubectl get svc my-nginx\n```\n\nConnecting Applications with Services | The IP address in the EXTERNAL-IP column is the one that is available on the public internet. The CLUSTER-IP is only available inside your cluster/private cloud network.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1226"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl describe service my-nginx\n...\nLoadBalancer Ingress:   a320587ffd19711e5a37606cf4a74574-1142138393.us-east-1.elb.amazonaws.com\n...\n```\n\nConnecting Applications with Services |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1227"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nConnecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1228"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\nConnecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1229"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"v1\"\nkind: \"Secret\"\nmetadata:\n  name: \"nginxsecret\"\n  namespace: \"default\"\ntype: kubernetes.io/tls\ndata:\n # NOTE: Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\nConnecting Applications with Services | Now create the secrets using the file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1230"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\nConnecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1231"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1232"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl describe service my-nginx\n```\n\nConnecting Applications with Services |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1233"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/run-my-nginx.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nConnecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1234"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nConnecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1235"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./run-my-nginx.yaml\nkubectl get pods -l run=my-nginx -o wide\n```\n\nConnecting Applications with Services | Check your pods' IPs:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1236"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.4]]\n    [map[ip:10.244.2.5]]\n```\n\nConnecting Applications with Services | You should be able to ssh into any node in your cluster and use a tool such as curl to make queries against both IPs. Note that the containers are not using port 80 on the node, nor are there any spec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1237"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/my-nginx\n```\n\nConnecting Applications with Services | This is equivalent to kubectl apply -f in the following yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1238"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/nginx-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\nConnecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1239"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\nConnecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1240"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx\n```\n\nConnecting Applications with Services | As mentioned previously, a Service is backed by a group of Pods. These Pods are exposed through EndpointSlices. The Service's selector will be evaluated continuously and the results will be POSTed to", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1241"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc my-nginx\n```\n\nConnecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1242"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=my-nginx\n```\n\nConnecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1243"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-jr4a2 -- printenv | grep SERVICE\n```\n\nConnecting Applications with Services | Note there's no mention of your Service. This is because you created the replicas before the Service. Another disadvantage of doing this is that the scheduler might put both Pods on the same machine,", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1244"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment my-nginx --replicas=0; kubectl scale deployment my-nginx --replicas=2;\n\nkubectl get pods -l run=my-nginx -o wide\n```\n\nConnecting Applications with Services | You may notice that the pods have different names, since they are killed and recreated.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1245"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-e9ihh -- printenv | grep SERVICE\n```\n\nConnecting Applications with Services | Kubernetes offers a DNS cluster addon Service that automatically assigns dns names to other Services. You can check if it's running on your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1246"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get services kube-dns --namespace=kube-system\n```\n\nConnecting Applications with Services | The rest of this section will assume you have a Service with a long lived IP (my-nginx), and a DNS server that has assigned a name to that IP. Here we use the CoreDNS cluster addon (application name k", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1247"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl run curl --image=radial/busyboxplus:curl -i --tty --rm\n```\n\nConnecting Applications with Services | Then, hit enter and run nslookup my-nginx:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1248"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap nginxconfigmap --from-file=default.conf\n```\n\nConnecting Applications with Services | You can find an example for default.conf in the Kubernetes examples project repo.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1249"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps\n```\n\nConnecting Applications with Services | You can view the details of the nginxconfigmap ConfigMap using the following command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1250"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap  nginxconfigmap\n```\n\nConnecting Applications with Services | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1251"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"v1\"\nkind: \"Secret\"\nmetadata:\n  name: \"nginxsecret\"\n  namespace: \"default\"\ntype: kubernetes.io/tls\ndata:\n # NOTE: Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\nConnecting Applications with Services | Now create the secrets using the file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1252"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginxsecrets.yaml\nkubectl get secrets\n```\n\nConnecting Applications with Services | Now modify your nginx replicas to start an https server using the certificate in the secret, and the Service, to expose both ports (80 and 443):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1253"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/nginx-secure-app.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\nConnecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1254"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\nConnecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1255"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments,svc my-nginx; kubectl create -f ./nginx-secure-app.yaml\n```\n\nConnecting Applications with Services | At this point you can reach the nginx server from any node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1256"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.5]]\n```\n\nConnecting Applications with Services | Note how we supplied the -k parameter to curl in the last step, this is because we don't know anything about the pods running nginx at certificate generation time, so we have to tell curl to ignore th", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1257"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/curlpod.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1258"}
{"instruction": "Write a yaml example for connecting applications with services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1259"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./curlpod.yaml\nkubectl get pods -l app=curlpod\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1260"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl exec curl-deployment-1515033274-1410r -- curl https://my-nginx --cacert /etc/nginx/ssl/tls.crt\n...\n<title>Welcome to nginx!</title>\n...\n```\n\nConnecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1261"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx -o yaml | grep nodePort -C 5\n  uid: 07191fb3-f61a-11e5-8ae5-42010af00002\nspec:\n  clusterIP: 10.0.162.149\n  ports:\n  - name: http\n    nodePort: 31704\n    port: 8080\n    protocol: TCP\n    targetPort: 80\n  - name: https\n    nodePort: 32453\n    port: 443\n    protocol: TCP\n    targetPort: 443\n  selector:\n    run: my-nginx\n```\n\nConnecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1262"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o yaml | grep ExternalIP -C 1\n    - address: 104.197.41.11\n      type: ExternalIP\n    allocatable:\n--\n    - address: 23.251.152.56\n      type: ExternalIP\n    allocatable:\n...\n\n$ curl https://<EXTERNAL-IP>:<NODE-PORT> -k\n...\n<h1>Welcome to nginx!</h1>\n```\n\nConnecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1263"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc my-nginx\nkubectl get svc my-nginx\n```\n\nConnecting Applications with Services | The IP address in the EXTERNAL-IP column is the one that is available on the public internet. The CLUSTER-IP is only available inside your cluster/private cloud network.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1264"}
{"instruction": "Write a bash example for connecting applications with services", "response": "Here's a bash example:\n\n```bash\nkubectl describe service my-nginx\n...\nLoadBalancer Ingress:   a320587ffd19711e5a37606cf4a74574-1142138393.us-east-1.elb.amazonaws.com\n...\n```\n\nConnecting Applications with Services |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/connect-applications-service/", "id": "k8s_00098_code_1265"}
{"instruction": "How do you use antrea for networkpolicy in Kubernetes?", "response": "Use Antrea for NetworkPolicyThis page shows how to install and use Antrea CNI plugin on Kubernetes. For background on Project Antrea, read the Introduction to Antrea.Before you beginYou need to have a Kubernetes cluster. Follow the kubeadm getting started guide to bootstrap one.Deploying Antrea with kubeadmFollow Getting Started guide to deploy Antrea for kubeadm.What's nextOnce your cluster is running, you can follow the Declare Network Policy to try out Kubernetes NetworkPolicy.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/antrea-network-policy/", "id": "k8s_00099"}
{"instruction": "What is the reference documentation for typedlocalobjectreference?", "response": "TypedLocalObjectReferenceTypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.import \"k8s.io/api/core/v1\"TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.kind (string), requiredKind is the type of resource being referencedname (string), requiredName is the name of resource being referencedapiGroup (string)APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/typed-local-object-reference/", "id": "k8s_00100"}
{"instruction": "How do you extend kubernetes in Kubernetes?", "response": "Extend KubernetesUnderstand advanced ways to adapt your Kubernetes cluster to the needs of your work environment.Configure the Aggregation LayerUse Custom ResourcesSet up an Extension API ServerConfigure Multiple SchedulersUse an HTTP Proxy to Access the Kubernetes APIUse a SOCKS5 Proxy to Access the Kubernetes APISet up Konnectivity service", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/", "id": "k8s_00101"}
{"instruction": "What is the reference documentation for client authentication (v1beta1)?", "response": "Client Authentication (v1beta1)Resource TypesExecCredentialExecCredentialExecCredential is used by exec-based plugins to communicate credentials to HTTP transports.FieldDescriptionapiVersionstringclient.authentication.k8s.io/v1beta1kindstringExecCredentialspec [Required]ExecCredentialSpecSpec holds information passed to the plugin by the transport.statusExecCredentialStatusStatus is filled in by the plugin and holds the credentials that the transport should use to contact the API.ClusterAppears in:ExecCredentialSpecCluster contains information to allow an exec plugin to communicate with the kubernetes cluster being authenticated to.To ensure that this struct contains everything someone would need to communicate with a kubernetes cluster (just like they would via a kubeconfig), the fields should shadow \"k8s.io/client-go/tools/clientcmd/api/v1\".Cluster, with the exception of CertificateAuthority, since CA data will always be passed to the plugin as bytes.FieldDescriptionserver [Required]stringServer is the address of the kubernetes cluster (https://hostname:port).tls-server-namestringTLSServerName is passed to the server for SNI and is used in the client to check server certificates against. If ServerName is empty, the hostname used to contact the server is used.insecure-skip-tls-verifyboolInsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure.certificate-authority-data[]byteCAData contains PEM-encoded certificate authority certificates. If empty, system roots should be used.proxy-urlstringProxyURL is the URL to the proxy to be used for all requests to this cluster.disable-compressionboolDisableCompression allows client to opt-out of response compression for all requests to the server. This is useful to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296.configk8s.io/apimachinery/pkg/runtime.RawExtensionConfig holds additional config data that is specific to the exec plugin with regards to the cluster being authenticated to.This data is sourced from the clientcmd Cluster object's extensions[client.authentication.k8s.io/exec] field:clusters:name: my-cluster cluster: ... extensions:name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config extension: audience: 06e3fbd18de8 # arbitrary configIn some environments, the user config may be exactly the same across many clusters (i.e. call this exec plugin) minus some details that are specific to each cluster such as the audience. This field allows the per cluster config to be directly specified with the cluster info. Using this field to store secret data is not recommended as one of the prime benefits of exec plugins is that no secrets need to be stored directly in the kubeconfig.ExecCredentialSpecAppears in:ExecCredentialExecCredentialSpec holds request and runtime specific information provided by the transport.FieldDescriptionclusterClusterCluster contains information to allow an exec plugin to communicate with the kubernetes cluster being authenticated to. Note that Cluster is non-nil only when provideClusterInfo is set to true in the exec provider config (i.e., ExecConfig.ProvideClusterInfo).interactive [Required]boolInteractive declares whether stdin has been passed to this exec plugin.ExecCredentialStatusAppears in:ExecCredentialExecCredentialStatus holds credentials for the transport to use.Token and ClientKeyData are sensitive fields. This data should only be transmitted in-memory between client and exec plugin process. Exec plugin itself should at least be protected via file permissions.FieldDescriptionexpirationTimestampmeta/v1.TimeExpirationTimestamp indicates a time when the provided credentials expire.token [Required]stringToken is a bearer token used by the client for request authentication.clientCertificate", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/client-authentication.v1beta1/", "id": "k8s_00102"}
{"instruction": "What is the reference documentation for kubectl config delete-context?", "response": "kubectl config delete-contextSynopsisDelete the specified context from the kubeconfig.kubectl config delete-context NAME Examples # Delete the context for the minikube cluster kubectl config delete-context minikube Options-h, --helphelp for delete-contextParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-context/", "id": "k8s_00103"}
{"instruction": "Write a bash example for kubectl config delete-context", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context NAME\n```\n\nkubectl config delete-context | help for delete-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-context/", "id": "k8s_00103_code_1271"}
{"instruction": "Write a bash example for kubectl config delete-context", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context NAME\n```\n\nkubectl config delete-context | help for delete-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-context/", "id": "k8s_00103_code_1272"}
{"instruction": "Explain the Kubernetes concept: Leases", "response": "LeasesDistributed systems often have a need for leases, which provide a mechanism to lock shared resources and coordinate activity between members of a set. In Kubernetes, the lease concept is represented by Lease objects in the coordination.k8s.io API Group, which are used for system-critical capabilities such as node heartbeats and component-level leader election.Node heartbeatsKubernetes uses the Lease API to communicate kubelet node heartbeats to the Kubernetes API server. For every Node , there is a Lease object with a matching name in the kube-node-lease namespace. Under the hood, every kubelet heartbeat is an update request to this Lease object, updating the spec.renewTime field for the Lease. The Kubernetes control plane uses the time stamp of this field to determine the availability of this Node.See Node Lease objects for more details.Leader electionKubernetes also uses Leases to ensure only one instance of a component is running at any given time. This is used by control plane components like kube-controller-manager and kube-scheduler in HA configurations, where only one instance of the component should be actively running while the other instances are on stand-by.Read coordinated leader election to learn about how Kubernetes builds on the Lease API to select which component instance acts as leader.API server identityFEATURE STATE: Kubernetes v1.26 [beta] (enabled by default: true)Starting in Kubernetes v1.26, each kube-apiserver uses the Lease API to publish its identity to the rest of the system. While not particularly useful on its own, this provides a mechanism for clients to discover how many instances of kube-apiserver are operating the Kubernetes control plane. Existence of kube-apiserver leases enables future capabilities that may require coordination between each kube-apiserver.You can inspect Leases owned by each kube-apiserver by checking for lease objects in the kube-system namespace with the name apiserver-<sha256-hash>. Alternatively you can use the label selector apiserver.kubernetes.io/identity=kube-apiserver:kubectl -n kube-system get lease -l apiserver.kubernetes.io/identity=kube-apiserver NAME HOLDER AGE apiserver-07a5ea9b9b072c4a5f3d1c3702 apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05 5m33s apiserver-7be9e061c59d368b3ddaf1376e apiserver-7be9e061c59d368b3ddaf1376e_84f2a85d-37c1-4b14-b6b9-603e62e4896f 4m23s apiserver-1dfef752bcb36637d2763d1868 apiserver-1dfef752bcb36637d2763d1868_c5ffa286-8a9a-45d4-91e7-61118ed58d2e 4m43s The SHA256 hash used in the lease name is based on the OS hostname as seen by that API server. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instances of kube-apiserver that use the same hostname will take over existing Leases using a new holder identity, as opposed to instantiating new Lease objects. You can check the hostname used by kube-apiserver by checking the value of the kubernetes.io/hostname label:kubectl -n kube-system get lease apiserver-07a5ea9b9b072c4a5f3d1c3702 -o yaml apiVersion: coordination.k8s.io/v1 kind: Lease metadata: creationTimestamp: \"2023-07-02T13:16:48Z\" labels: apiserver.kubernetes.io/identity: kube-apiserver kubernetes.io/hostname: master-1 name: apiserver-07a5ea9b9b072c4a5f3d1c3702 namespace: kube-system resourceVersion: \"334899\" uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1 spec: holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05 leaseDurationSeconds: 3600 renewTime: \"2023-07-04T21:58:48.065888Z\" Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.You can disable API server identity leases by disabling the APIServerIdentity feature gate.WorkloadsYour own workload can define its own use of Leases. For example, you might run a custom controller where a primary or leader member performs operations that its peers do not. You define a Lease so that the controller replicas can selec", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104"}
{"instruction": "Write a bash example for leases", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease -l apiserver.kubernetes.io/identity=kube-apiserver\n```\n\nLeases | The SHA256 hash used in the lease name is based on the OS hostname as seen by that API server. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instanc", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104_code_1274"}
{"instruction": "Write a bash example for leases", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease apiserver-07a5ea9b9b072c4a5f3d1c3702 -o yaml\n```\n\nLeases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104_code_1275"}
{"instruction": "Write a yaml example for leases", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\nLeases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104_code_1276"}
{"instruction": "Write a yaml example for leases", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\nLeases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104_code_1277"}
{"instruction": "Write a bash example for leases", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease -l apiserver.kubernetes.io/identity=kube-apiserver\n```\n\nLeases | The SHA256 hash used in the lease name is based on the OS hostname as seen by that API server. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instanc", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104_code_1278"}
{"instruction": "Write a bash example for leases", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease apiserver-07a5ea9b9b072c4a5f3d1c3702 -o yaml\n```\n\nLeases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104_code_1279"}
{"instruction": "Write a yaml example for leases", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\nLeases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/leases/", "id": "k8s_00104_code_1280"}
{"instruction": "Explain helping as a blog writing buddy in Kubernetes", "response": "Helping as a blog writing buddyThere are two official Kubernetes blogs, and the CNCF has its own blog where you can cover Kubernetes too. Read contributing to Kubernetes blogs to learn about these two blogs.When people contribute to either blog as an author, the Kubernetes project pairs up authors as writing buddies. This page explains how to fulfil the buddy role.You should make sure that you have at least read an outline of article submission before you read on within this page.Buddy responsibilitiesAs a writing buddy, you:help the blog team get articles ready to merge and to publishsupport your buddy to produce content that is good to mergeprovide a review on the article that your buddy has writtenWhen the team pairs you up with another author, the idea is that you both support each other by reviewing the other author's draft article. Most people reading articles on the Kubernetes blog are not experts; the content should try to make sense for that audience, or at least to support non-expert readers appropriately.The blog team are also there to help you both along the journey from draft to publication. They will either be directly able to approve your article for publication, or can arrange for the approval to happen.Supporting the blog teamYour main responsibility here is to communicate about your capacity, availability and progress in a reasonable timeline. If many weeks go by and your buddy hasn't heard from you, it makes the overall work take more time.Supporting your buddyThere are two parts to the process(This is the recommended option)The blog team recommend that the main author for the article sets up collaborative editing using either a Google Doc or HackMD (their choice). The main author then shares that document with the following people:Any co-authorsYou (their writing buddy)Ideally, with a nominated person from the blog team.As a writing buddy, you then read the draft text and either directly make suggestions or provide", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/blog/writing-buddy/", "id": "k8s_00105"}
{"instruction": "What is the reference documentation for mutating admission policy?", "response": "Mutating Admission PolicyFEATURE STATE: Kubernetes v1.34 [beta]This page provides an overview of MutatingAdmissionPolicies. MutatingAdmissionPolicies allow you change what happens when someone writes a change to the Kubernetes API. If you want to use declarative policies just to prevent a particular kind of change to resources (for example: protecting platform namespaces from deletion), ValidatingAdmissionPolicy is a simpler and more effective alternative.To use the feature, enable the MutatingAdmissionPolicy feature gate (which is off by default) and set --runtime-config=admissionregistration.k8s.io/v1beta1=true on the kube-apiserver.What are MutatingAdmissionPolicies?Mutating admission policies offer a declarative, in-process alternative to mutating admission webhooks.Mutating admission policies use the Common Expression Language (CEL) to declare mutations to resources. Mutations can be defined either with an apply configuration that is merged using the server side apply merge strategy, or a JSON patch.Mutating admission policies are highly configurable, enabling policy authors to define policies that can be parameterized and scoped to resources as needed by cluster administrators.What resources make a policyA policy is generally made up of three resources:The MutatingAdmissionPolicy describes the abstract logic of a policy (think: \"this policy sets a particular label to a particular value\").A parameter resource provides information to a MutatingAdmissionPolicy to make it a concrete statement (think \"set the owner label to something like company.example.com\"). Parameter resources refer to Kubernetes resources, available in the Kubernetes API. They can be built-in types or extensions, such as a CustomResourceDefinition (CRD). For example, you can use a ConfigMap as a parameter.A MutatingAdmissionPolicyBinding links the above (MutatingAdmissionPolicy and parameter) resources together and provides scoping. If you only want to set an owner label for Pods, and not other API kinds, the binding is where you specify this mutation.At least a MutatingAdmissionPolicy and a corresponding MutatingAdmissionPolicyBinding must be defined for a policy to have an effect.If a MutatingAdmissionPolicy does not need to be configured via parameters, simply leave spec.paramKind in MutatingAdmissionPolicy not specified.Getting Started with MutatingAdmissionPoliciesMutating admission policy is part of the cluster control-plane. You should write and deploy them with great caution. The following describes how to quickly experiment with Mutating admission policy.Create a MutatingAdmissionPolicyThe following is an example of a MutatingAdmissionPolicy. This policy mutates newly created Pods to have a sidecar container if it does not exist.mutatingadmissionpolicy/applyconfiguration-example.yaml apiVersion: admissionregistration.k8s.io/v1beta1 kind: MutatingAdmissionPolicy metadata: name: \"sidecar-policy.example.com\" spec: paramKind: kind: Sidecar apiVersion: mutations.example.com/v1 matchConstraints: resourceRules: - apiGroups: [\"\"] apiVersions: [\"v1\"] operations: [\"CREATE\"] resources: [\"pods\"] matchConditions: - name: does-not-already-have-sidecar expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\" failurePolicy: Fail reinvocationPolicy: IfNeeded mutations: - patchType: \"ApplyConfiguration\" applyConfiguration: expression: > Object{ spec: Object.spec{ initContainers: [ Object.spec.initContainers{ name: \"mesh-proxy\", image: \"mesh/proxy:v1.0.0\", args: [\"proxy\", \"sidecar\"], restartPolicy: \"Always\" } ] } } The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty list of mutations. After evaluating all the expressions, the API server applies those changes to the resource that is passing through admission.To configure a mutating admission policy for use in a cluster, a binding is required. The", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\nMutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1283"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp\n  namespace: default\nspec:\n  ...\n  initContainers:\n  - name: mesh-proxy\n    image: mesh/proxy:v1.0.0\n    args: [\"proxy\", \"sidecar\"]\n    restartPolicy: Always\n  - name: myapp-initializer\n    image: example/initializer:v1.0.0\n  ...\n```\n\nMutating Admission Policy | Parameter resources allow a policy configuration to be separate from its definition. A policy can define paramKind, which outlines GVK of the parameter resource, and then a policy binding ties a polic", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1284"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\nMutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1285"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\nMutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1286"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp\n  namespace: default\nspec:\n  ...\n  initContainers:\n  - name: mesh-proxy\n    image: mesh/proxy:v1.0.0\n    args: [\"proxy\", \"sidecar\"]\n    restartPolicy: Always\n  - name: myapp-initializer\n    image: example/initializer:v1.0.0\n  ...\n```\n\nMutating Admission Policy | Parameter resources allow a policy configuration to be separate from its definition. A policy can define paramKind, which outlines GVK of the parameter resource, and then a policy binding ties a polic", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1287"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\nMutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1288"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\nmutatingadmissionpolicy/applyconfiguration-example.yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\nMutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1289"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\nMutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1290"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp\n  namespace: default\nspec:\n  ...\n  initContainers:\n  - name: mesh-proxy\n    image: mesh/proxy:v1.0.0\n    args: [\"proxy\", \"sidecar\"]\n    restartPolicy: Always\n  - name: myapp-initializer\n    image: example/initializer:v1.0.0\n  ...\n```\n\nMutating Admission Policy | Parameter resources allow a policy configuration to be separate from its definition. A policy can define paramKind, which outlines GVK of the parameter resource, and then a policy binding ties a polic", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1291"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\nmutatingadmissionpolicy/json-patch-example.yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\nMutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1292"}
{"instruction": "Write a yaml example for mutating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\nMutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/", "id": "k8s_00106_code_1293"}
{"instruction": "Explain reviewing pull requests in Kubernetes", "response": "Reviewing pull requestsAnyone can review a documentation pull request. Visit the pull requests section in the Kubernetes website repository to see open pull requests.Reviewing documentation pull requests is a great way to introduce yourself to the Kubernetes community. It helps you learn the code base and build trust with other contributors.Before reviewing, it's a good idea to:Read the content guide and style guide so you can leave informed comments.Understand the different roles and responsibilities in the Kubernetes documentation community.Before you beginBefore you start a review:Read the CNCF Code of Conduct and ensure that you abide by it at all times.Be polite, considerate, and helpful.Comment on positive aspects of PRs as well as changes.Be empathetic and mindful of how your review may be received.Assume good intent and ask clarifying questions.Experienced contributors, consider pairing with new contributors whose work requires extensive changes.Review processIn general, review pull requests for content and style in English. Figure 1 outlines the steps for the review process. The details for each step follow.flowchart LR subgraph fourth[Start review] direction TB S[ ] -.- M[add comments] --> N[review changes] N --> O[new contributors shouldchoose Comment] end subgraph third[Select PR] direction TB T[ ] -.- J[read descriptionand comments]--> K[preview changes inNetlify preview build] end A[Review open PR list]--> B[Filter open PRsby label] B --> third --> fourth classDef grey fill:#dddddd,stroke:#ffffff,stroke-width:px,color:#000000, font-size:15px; classDef white fill:#ffffff,stroke:#000,stroke-width:px,color:#000,font-weight:bold classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000 class A,B,J,K,M,N,O grey class S,T spacewhite class third,fourth whiteJavaScript must be enabled to view this contentFigure 1. Review process steps.Go to https://github.com/kubernetes/website/pulls. You see a list of every open pull request against the Kubernetes website and docs.Filter the open PRs using one or all of the following labels:cncf-cla: yes (Recommended): PRs submitted by contributors who have not signed the CLA cannot be merged. See Sign the CLA for more information.language/en (Recommended): Filters for english language PRs only.size/<size>: filters for PRs of a certain size. If you're new, start with smaller PRs.Additionally, ensure the PR isn't marked as a work in progress. PRs using the work in progress label are not ready for review yet.Once you've selected a PR to review, understand the change by:Reading the PR description to understand the changes made, and read any linked issuesReading any comments by other reviewersClicking the Files changed tab to see the files and lines changedPreviewing the changes in the Netlify preview build by scrolling to the PR's build check section at the bottom of the Conversation tab. Here's a screenshot (this shows GitHub's desktop site; if you're reviewing on a tablet or smartphone device, the GitHub web UI is slightly different):To open the preview, click on the Details link of the deploy/netlify line in the list of checks.Go to the Files changed tab to start your review.Click on the + symbol beside the line you want to comment on.Fill in any comments you have about the line and click either Add single comment (if you have only one comment to make) or Start a review (if you have multiple comments to make).When finished, click Review changes at the top of the page. Here, you can add a summary of your review (and leave some positive comments for the contributor!). Please always use the \"Comment\"Avoid clicking the \"Request changes\" button when finishing your review. If you want to block a PR from being merged before some further changes are made, you can leave a \"/hold\" comment. Mention why you are setting a hold, and optionally specify the conditions under which the hold can be removed by you or other reviewers.Avoid clicking the \"Approve\" button when finishing your rev", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/review/reviewing-prs/", "id": "k8s_00107"}
{"instruction": "Explain the Kubernetes concept: Resource Quotas", "response": "Resource QuotasWhen several users or teams share a cluster with a fixed number of nodes, there is a concern that one team could use more than its fair share of resources.Resource quotas are a tool for administrators to address this concern.A resource quota, defined by a ResourceQuota object, provides constraints that limit aggregate resource consumption per namespace. A ResourceQuota can also limit the quantity of objects that can be created in a namespace by API kind, as well as the total amount of infrastructure resources that may be consumed by API objects found in that namespace.Caution:Neither contention nor changes to quota will affect already created resources.How Kubernetes ResourceQuotas workResourceQuotas work like this:Different teams work in different namespaces. This separation can be enforced with RBAC or any other authorization mechanism.A cluster administrator creates at least one ResourceQuota for each namespace.To make sure the enforcement stays enforced, the cluster administrator should also restrict access to delete or update that ResourceQuota; for example, by defining a ValidatingAdmissionPolicy.Users create resources (pods, services, etc.) in the namespace, and the quota system tracks usage to ensure it does not exceed hard resource limits defined in a ResourceQuota.You can apply a scope to a ResourceQuota to limit where it applies,If creating or updating a resource violates a quota constraint, the control plane rejects that request with HTTP status code 403 Forbidden. The error includes a message explaining the constraint that would have been violated.If quotas are enabled in a namespace for resource such as cpu and memory, users must specify requests or limits for those values when they define a Pod; otherwise, the quota system may reject pod creation.The resource quota walkthrough shows an example of how to avoid this problem.Note:You can define a LimitRange to force defaults on pods that make no compute resource requirements (so that users don't have to remember to do that).You often do not create Pods directly; for example, you more usually create a workload management object such as a Deployment. If you create a Deployment that tries to use more resources than are available, the creation of the Deployment (or other workload management object) succeeds, but the Deployment may not be able to get all of the Pods it manages to exist. In that case you can check the status of the Deployment, for example with kubectl describe, to see what has happened.For cpu and memory resources, ResourceQuotas enforce that every (new) pod in that namespace sets a limit for that resource. If you enforce a resource quota in a namespace for either cpu or memory, you and other clients, must specify either requests or limits for that resource, for every new Pod you submit. If you don't, the control plane may reject admission for that Pod.For other resources: ResourceQuota works and will ignore pods in the namespace without setting a limit or request for that resource. It means that you can create a new pod without limit/request for ephemeral storage if the resource quota limits the ephemeral storage of this namespace.You can use a LimitRange to automatically set a default request for these resources.The name of a ResourceQuota object must be a valid DNS subdomain name.Examples of policies that could be created using namespaces and quotas are:In a cluster with a capacity of 32 GiB RAM, and 16 cores, let team A use 20 GiB and 10 cores, let B use 10GiB and 4 cores, and hold 2GiB and 2 cores in reserve for future allocation.Limit the \"testing\" namespace to using 1 core and 1GiB RAM. Let the \"production\" namespace use any amount.In the case where the total capacity of the cluster is less than the sum of the quotas of the namespaces, there may be contention for resources. This is handled on a first-come-first-served basis.Enabling Resource QuotaResourceQuota support is enabled by default for many Kubernetes distributions. It is en", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1296"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota.yaml\n```\n\nResource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1297"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1298"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1299"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./high-priority-pod.yaml\n```\n\nResource Quotas | Verify that \"Used\" stats for \"high\" priority quota, pods-high, has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1300"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Operators can use CrossNamespacePodAffinity quota scope to limit which namespaces are allowed to have pods with affinity terms that cross namespaces. Specifically, it controls which pods are allowed t", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1301"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\nResource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1302"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\nResource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1303"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1304"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota-vac.yaml\n```\n\nResource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1305"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1306"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1307"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./gold-vac-pvc.yaml\n```\n\nResource Quotas | Verify that \"Used\" stats for \"gold\" volume attributes class quota, pvcs-gold has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1308"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Once the PVC is bound, it is allowed to modify the desired volume attributes class. Let's change it to \"silver\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1309"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"silver\"}}'\n```\n\nResource Quotas | Verify that \"Used\" stats for \"silver\" volume attributes class quota, pvcs-silver has changed, pvcs-copper is unchanged, and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1310"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Let's change it to \"copper\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1311"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"copper\"}}'\n```\n\nResource Quotas | Verify that \"Used\" stats for \"copper\" volume attributes class quota, pvcs-copper has changed, pvcs-silver and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1312"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Print the manifest of the PVC using the following command:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1313"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc gold-vac-pvc -o yaml\n```\n\nResource Quotas | It might show the following output:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1314"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\nResource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1315"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | When allocating compute resources, each container may specify a request and a limit value for either CPU or memory. The quota can be configured to quota either value.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1316"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1317"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > compute-resources.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: compute-resources\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: \"1Gi\"\n    limits.cpu: \"2\"\n    limits.memory: \"2Gi\"\n    requests.nvidia.com/gpu: 4\nEOF\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1318"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./compute-resources.yaml --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1319"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > object-counts.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-counts\nspec:\n  hard:\n    configmaps: \"10\"\n    persistentvolumeclaims: \"4\"\n    pods: \"4\"\n    replicationcontrollers: \"20\"\n    secrets: \"10\"\n    services: \"10\"\n    services.loadbalancers: \"2\"\nEOF\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1320"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./object-counts.yaml --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1321"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl get quota --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1322"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota compute-resources --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1323"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota object-counts --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1324"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1325"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create quota test --hard=count/deployments.apps=2,count/replicasets.apps=4,count/pods=3,count/secrets=4 --namespace=myspace\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1326"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx --namespace=myspace --replicas=2\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1327"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota --namespace=myspace\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1328"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\nResource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1329"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\nResource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1330"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/policy/priority-class-resourcequota.yaml -n kube-system\n```\n\nResource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1331"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\nscopeSelector:\n    matchExpressions:\n      - scopeName: PriorityClass\n        operator: In\n        values:\n          - middle\n```\n\nResource Quotas | If the operator is Exists or DoesNotExist, the values field must NOT be specified.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1332"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1333"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1334"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1335"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\nResource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1336"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\nResource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1337"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1338"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1339"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1340"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\nResource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1341"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\nResource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1342"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\nResource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1343"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\npolicy/quota.yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1344"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1345"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota.yaml\n```\n\nResource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1346"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1347"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\npolicy/high-priority-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1348"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1349"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./high-priority-pod.yaml\n```\n\nResource Quotas | Verify that \"Used\" stats for \"high\" priority quota, pods-high, has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1350"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Operators can use CrossNamespacePodAffinity quota scope to limit which namespaces are allowed to have pods with affinity terms that cross namespaces. Specifically, it controls which pods are allowed t", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1351"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\nResource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1352"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\nResource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1353"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\npolicy/quota-vac.yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1354"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\nResource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1355"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota-vac.yaml\n```\n\nResource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1356"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1357"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\npolicy/gold-vac-pvc.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1358"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\nResource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1359"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./gold-vac-pvc.yaml\n```\n\nResource Quotas | Verify that \"Used\" stats for \"gold\" volume attributes class quota, pvcs-gold has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1360"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Once the PVC is bound, it is allowed to modify the desired volume attributes class. Let's change it to \"silver\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1361"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"silver\"}}'\n```\n\nResource Quotas | Verify that \"Used\" stats for \"silver\" volume attributes class quota, pvcs-silver has changed, pvcs-copper is unchanged, and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1362"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Let's change it to \"copper\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1363"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"copper\"}}'\n```\n\nResource Quotas | Verify that \"Used\" stats for \"copper\" volume attributes class quota, pvcs-copper has changed, pvcs-silver and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1364"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | Print the manifest of the PVC using the following command:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1365"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc gold-vac-pvc -o yaml\n```\n\nResource Quotas | It might show the following output:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1366"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\nResource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1367"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\nResource Quotas | When allocating compute resources, each container may specify a request and a limit value for either CPU or memory. The quota can be configured to quota either value.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1368"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1369"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > compute-resources.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: compute-resources\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: \"1Gi\"\n    limits.cpu: \"2\"\n    limits.memory: \"2Gi\"\n    requests.nvidia.com/gpu: 4\nEOF\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1370"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./compute-resources.yaml --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1371"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > object-counts.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-counts\nspec:\n  hard:\n    configmaps: \"10\"\n    persistentvolumeclaims: \"4\"\n    pods: \"4\"\n    replicationcontrollers: \"20\"\n    secrets: \"10\"\n    services: \"10\"\n    services.loadbalancers: \"2\"\nEOF\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1372"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./object-counts.yaml --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1373"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl get quota --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1374"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota compute-resources --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1375"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota object-counts --namespace=myspace\n```\n\nResource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1376"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1377"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create quota test --hard=count/deployments.apps=2,count/replicasets.apps=4,count/pods=3,count/secrets=4 --namespace=myspace\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1378"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx --namespace=myspace --replicas=2\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1379"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota --namespace=myspace\n```\n\nResource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1380"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\nResource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1381"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\npolicy/priority-class-resourcequota.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\nResource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1382"}
{"instruction": "Write a yaml example for resource quotas", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\nResource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1383"}
{"instruction": "Write a bash example for resource quotas", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/policy/priority-class-resourcequota.yaml -n kube-system\n```\n\nResource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/resource-quotas/", "id": "k8s_00108_code_1384"}
{"instruction": "Provide a tutorial on configuring swap memory on kubernetes nodes", "response": "Configuring swap memory on Kubernetes nodesThis page provides an example of how to provision and configure swap memory on a Kubernetes node using kubeadm.ObjectivesProvision swap memory on a Kubernetes node using kubeadm.Learn to configure both encrypted and unencrypted swap.Learn to enable swap on boot.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.33.To check the version, enter kubectl version.You need at least one worker node in your cluster which needs to run a Linux operating system. It is required for this demo that the kubeadm tool be installed, following the steps outlined in the kubeadm installation guide.On each worker node where you will configure swap use, you need:fallocatemkswapswaponFor encrypted swap space (recommended), you also need:cryptsetupInstall a swap-enabled cluster with kubeadmCreate a swap file and turn swap onIf swap is not enabled, there's a need to provision swap on the node. The following sections demonstrate creating 4GiB of swap, both in the encrypted and unencrypted case.An encrypted swap file can be set up as follows. Bear in mind that this example uses the cryptsetup binary (which is available on most Linux distributions).# Allocate storage and restrict access fallocate --length 4GiB /swapfile chmod 600 /swapfile # Create an encrypted device backed by the allocated storage cryptsetup --type plain --cipher aes-xts-plain64 --key-size 256 -d /dev/urandom open /swapfile cryptswap # Format the swap space mkswap /dev/mapper/cryptswap # Activate the swap space for paging swapon /dev/mapper/cryptswap An unencrypted swap file can be set up as follows.# Allocate storage and restrict access fallocate --length 4GiB /swapfile chmod 600 /swapfile # Format the swap space mkswap /swapfile # Activate the swap space for paging swapon /swapfile Verify that swap is enabledSwap can be verified to be enabled with both swapon -s command or the free command.Using swapon -s:Filename Type Size Used Priority /dev/dm-0 partition 4194300 0 -2 Using free -h: total used free shared buff/cache available Mem: 3.8Gi 1.3Gi 249Mi 25Mi 2.5Gi 2.5Gi Swap: 4.0Gi 0B 4.0Gi Enable swap on bootAfter setting up swap, to start the swap file at boot time, you typically either set up a systemd unit to activate (encrypted) swap, or you add a line similar to /swapfile swap swap defaults 0 0 into /etc/fstab.Using systemd for swap activation allows the system to delay kubelet start until swap is available, if that is something you want to ensure. In a similar way, using systemd allows your server to leave swap active until kubelet (and, typically, your container runtime) have shut down.Set up kubelet configurationAfter enabling swap on the node, kubelet needs to be configured to use it. You need to select a swap behavior for this node. You'll configure LimitedSwap behavior for this tutorial.Find and edit the kubelet configuration file, and:set failSwapOn to falseset memorySwap.swapBehavior to LimitedSwap # this fragment goes into the kubelet's configuration file failSwapOn: false memorySwap: swapBehavior: LimitedSwap In order for these configurations to take effect, kubelet needs to be restarted. Typically you do that by running:systemctl restart kubelet.service You should find that the kubelet is now healthy, and that you can run Pods that use swap memory as needed.", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/provision-swap-memory/", "id": "k8s_00109"}
{"instruction": "Write a bash example for configuring swap memory on kubernetes nodes", "response": "Here's a bash example:\n\n```bash\n# Allocate storage and restrict access\nfallocate --length 4GiB /swapfile\nchmod 600 /swapfile\n\n# Create an encrypted device backed by the allocated storage\ncryptsetup --type plain --cipher aes-xts-plain64 --key-size 256 -d /dev/urandom open /swapfile cryptswap\n\n# Format the swap space\nmkswap /dev/mapper/cryptswap\n\n# Activate the swap space for paging\nswapon /dev/mapper/cryptswap\n```\n\nConfiguring swap memory on Kubernetes nodes | An unencrypted swap file can be set up as follows.# Allocate storage and restrict access fallocate --length 4GiB /swapfile chmod 600 /swapfile # Format the swap space mkswap /swapfile # Activate the", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/provision-swap-memory/", "id": "k8s_00109_code_1386"}
{"instruction": "Write a bash example for configuring swap memory on kubernetes nodes", "response": "Here's a bash example:\n\n```bash\n# Allocate storage and restrict access\nfallocate --length 4GiB /swapfile\nchmod 600 /swapfile\n\n# Format the swap space\nmkswap /swapfile\n\n# Activate the swap space for paging\nswapon /swapfile\n```\n\nConfiguring swap memory on Kubernetes nodes | Swap can be verified to be enabled with both swapon -s command or the free command.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/provision-swap-memory/", "id": "k8s_00109_code_1387"}
{"instruction": "Write a yaml example for configuring swap memory on kubernetes nodes", "response": "Here's a yaml example:\n\n```yaml\n# this fragment goes into the kubelet's configuration file\n failSwapOn: false\n memorySwap:\n     swapBehavior: LimitedSwap\n```\n\nConfiguring swap memory on Kubernetes nodes | In order for these configurations to take effect, kubelet needs to be restarted. Typically you do that by running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/provision-swap-memory/", "id": "k8s_00109_code_1388"}
{"instruction": "How do you changing the kubernetes package repository in Kubernetes?", "response": "Changing The Kubernetes Package RepositoryThis page explains how to enable a package repository for the desired Kubernetes minor release upon upgrading a cluster. This is only needed for users of the community-owned package repositories hosted at pkgs.k8s.io. Unlike the legacy package repositories, the community-owned package repositories are structured in a way that there's a dedicated package repository for each Kubernetes minor version.Note:This guide only covers a part of the Kubernetes upgrade process. Please see the upgrade guide for more information about upgrading Kubernetes clusters.Note:This step is only needed upon upgrading a cluster to another minor release. If you're upgrading to another patch release within the same minor release (e.g. v1.34.5 to v1.34.7), you don't need to follow this guide. However, if you're still using the legacy package repositories, you'll need to migrate to the new community-owned package repositories before upgrading (see the next section for more details on how to do this).Before you beginThis document assumes that you're already using the community-owned package repositories (pkgs.k8s.io). If that's not the case, it's strongly recommended to migrate to the community-owned package repositories as described in the official announcement.Note: The legacy package repositories (apt.kubernetes.io and yum.kubernetes.io) have been deprecated and frozen starting from September 13, 2023. Using the new package repositories hosted at pkgs.k8s.io is strongly recommended and required in order to install Kubernetes versions released after September 13, 2023. The deprecated legacy repositories, and their contents, might be removed at any time in the future and without a further notice period. The new package repositories provide downloads for Kubernetes versions starting with v1.24.0.Verifying if the Kubernetes package repositories are usedIf you're unsure whether you're using the community-owned package repositories or the legacy package repositories, take the following steps to verify:Print the contents of the file that defines the Kubernetes apt repository:# On your system, this configuration file could have a different name pager /etc/apt/sources.list.d/kubernetes.list If you see a line similar to:deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ / You're using the Kubernetes package repositories and this guide applies to you. Otherwise, it's strongly recommended to migrate to the Kubernetes package repositories as described in the official announcement.Print the contents of the file that defines the Kubernetes yum repository:# On your system, this configuration file could have a different name cat /etc/yum.repos.d/kubernetes.repo If you see a baseurl similar to the baseurl in the output below:[kubernetes] name=Kubernetes baseurl=https://pkgs.k8s.io/core:/stable:/v1.33/rpm/ enabled=1 gpgcheck=1 gpgkey=https://pkgs.k8s.io/core:/stable:/v1.33/rpm/repodata/repomd.xml.key exclude=kubelet kubeadm kubectl You're using the Kubernetes package repositories and this guide applies to you. Otherwise, it's strongly recommended to migrate to the Kubernetes package repositories as described in the official announcement.Print the contents of the file that defines the Kubernetes zypper repository:# On your system, this configuration file could have a different name cat /etc/zypp/repos.d/kubernetes.repo If you see a baseurl similar to the baseurl in the output below:[kubernetes] name=Kubernetes baseurl=https://pkgs.k8s.io/core:/stable:/v1.33/rpm/ enabled=1 gpgcheck=1 gpgkey=https://pkgs.k8s.io/core:/stable:/v1.33/rpm/repodata/repomd.xml.key exclude=kubelet kubeadm kubectl You're using the Kubernetes package repositories and this guide applies to you. Otherwise, it's strongly recommended to migrate to the Kubernetes package repositories as described in the official announcement.Note:The URL used for the Kubernetes package repositories is not limited to pkgs.k8s.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/change-package-repository/", "id": "k8s_00110"}
{"instruction": "How do you resource metrics pipeline in Kubernetes?", "response": "Resource metrics pipelineFor Kubernetes, the Metrics API offers a basic set of metrics to support automatic scaling and similar use cases. This API makes information available about resource usage for node and pod, including metrics for CPU and memory. If you deploy the Metrics API into your cluster, clients of the Kubernetes API can then query for this information, and you can use Kubernetes' access control mechanisms to manage permissions to do so.The HorizontalPodAutoscaler (HPA) and VerticalPodAutoscaler (VPA) use data from the metrics API to adjust workload replicas and resources to meet customer demand.You can also view the resource metrics using the kubectl top command.Note:The Metrics API, and the metrics pipeline that it enables, only offers the minimum CPU and memory metrics to enable automatic scaling using HPA and / or VPA. If you would like to provide a more complete set of metrics, you can complement the simpler Metrics API by deploying a second metrics pipeline that uses the Custom Metrics API.Figure 1 illustrates the architecture of the resource metrics pipeline.flowchart RL subgraph cluster[Cluster] direction RL S[] A[Metrics-Server] subgraph B[Nodes] direction TB D[cAdvisor] --> C[kubelet] E[Containerruntime] --> D E1[Containerruntime] --> D P[pod data] -.- C end L[APIserver] W[HPA] C ---->|node levelresource metrics| A -->|metricsAPI| L --> W end L ---> K[kubectltop] classDef box fill:#fff,stroke:#000,stroke-width:1px,color:#000; class W,B,P,K,cluster,D,E,E1 box classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000 class S spacewhite classDef k8s fill:#326ce5,stroke:#fff,stroke-width:1px,color:#fff; class A,L,C k8sJavaScript must be enabled to view this contentFigure 1. Resource Metrics PipelineThe architecture components, from right to left in the figure, consist of the following:cAdvisor: Daemon for collecting, aggregating and exposing container metrics included in Kubelet.kubelet: Node agent for managing container resources. Resource metrics are accessible using the /metrics/resource and /stats kubelet API endpoints.node level resource metrics: API provided by the kubelet for discovering and retrieving per-node summarized stats available through the /metrics/resource endpoint.metrics-server: Cluster addon component that collects and aggregates resource metrics pulled from each kubelet. The API server serves Metrics API for use by HPA, VPA, and by the kubectl top command. Metrics Server is a reference implementation of the Metrics API.Metrics API: Kubernetes API supporting access to CPU and memory used for workload autoscaling. To make this work in your cluster, you need an API extension server that provides the Metrics API.Note:cAdvisor supports reading metrics from cgroups, which works with typical container runtimes on Linux. If you use a container runtime that uses another resource isolation mechanism, for example virtualization, then that container runtime must support CRI Container Metrics in order for metrics to be available to the kubelet.Metrics APIFEATURE STATE: Kubernetes 1.8 [beta]The metrics-server implements the Metrics API. This API allows you to access CPU and memory usage for the nodes and pods in your cluster. Its primary role is to feed resource usage metrics to K8s autoscaler components.Here is an example of the Metrics API request for a minikube node piped through jq for easier reading:kubectl get --raw \"/apis/metrics.k8s.io/v1beta1/nodes/minikube\" | jq '.' Here is the same API call using curl:curl http://localhost:8080/apis/metrics.k8s.io/v1beta1/nodes/minikube Sample response:{ \"kind\": \"NodeMetrics\", \"apiVersion\": \"metrics.k8s.io/v1beta1\", \"metadata\": { \"name\": \"minikube\", \"selfLink\": \"/apis/metrics.k8s.io/v1beta1/nodes/minikube\", \"creationTimestamp\": \"2022-01-27T18:48:43Z\" }, \"timestamp\": \"2022-01-27T18:48:33Z\", \"window\": \"30s\", \"usage\": { \"cpu\": \"487558164n\", \"memory\": \"732212Ki\" } } Here is an example of the Metrics API request for a kube-scheduler-minikube pod ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/", "id": "k8s_00111"}
{"instruction": "Write a bash example for resource metrics pipeline", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/nodes/minikube\" | jq '.'\n```\n\nResource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/", "id": "k8s_00111_code_1391"}
{"instruction": "Write a bash example for resource metrics pipeline", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/namespaces/kube-system/pods/kube-scheduler-minikube\" | jq '.'\n```\n\nResource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/", "id": "k8s_00111_code_1392"}
{"instruction": "Write a bash example for resource metrics pipeline", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/nodes/minikube\" | jq '.'\n```\n\nResource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/", "id": "k8s_00111_code_1393"}
{"instruction": "Write a bash example for resource metrics pipeline", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/namespaces/kube-system/pods/kube-scheduler-minikube\" | jq '.'\n```\n\nResource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/", "id": "k8s_00111_code_1394"}
{"instruction": "What is the reference documentation for kubectl create service loadbalancer?", "response": "kubectl create service loadbalancerSynopsisCreate a LoadBalancer service with the specified name.kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none] Examples # Create a new LoadBalancer service named my-lbs kubectl create service loadbalancer my-lbs --tcp=5678:8080 Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for loadbalancer-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--tcp stringsPort pairs can be specified as '<port>:<targetPort>'.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a correspond", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_loadbalancer/", "id": "k8s_00112"}
{"instruction": "Write a bash example for kubectl create service loadbalancer", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\nkubectl create service loadbalancer | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_loadbalancer/", "id": "k8s_00112_code_1396"}
{"instruction": "Write a bash example for kubectl create service loadbalancer", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\nkubectl create service loadbalancer | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_loadbalancer/", "id": "k8s_00112_code_1397"}
{"instruction": "Explain the Kubernetes concept: Compatibility Version For Kubernetes Control Plane Components", "response": "Compatibility Version For Kubernetes Control Plane ComponentsSince release v1.32, we introduced configurable version compatibility and emulation options to Kubernetes control plane components to make upgrades safer by providing more control and increasing the granularity of steps available to cluster administrators.Emulated VersionThe emulation option is set by the --emulated-version flag of control plane components. It allows the component to emulate the behavior (APIs, features, ...) of an earlier version of Kubernetes.When used, the capabilities available will match the emulated version:Any capabilities present in the binary version that were introduced after the emulation version will be unavailable.Any capabilities removed after the emulation version will be available.This enables a binary from a particular Kubernetes release to emulate the behavior of a previous version with sufficient fidelity that interoperability with other system components can be defined in terms of the emulated version.The --emulated-version must be <= binaryVersion. See the help message of the --emulated-version flag for supported range of emulated versions.", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/compatibility-version/", "id": "k8s_00113"}
{"instruction": "How do you configure pod initialization in Kubernetes?", "response": "Configure Pod InitializationThis page shows how to use an Init Container to initialize a Pod before an application Container runs.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Create a Pod that has an Init ContainerIn this exercise you create a Pod that has one application Container and one Init Container. The init container runs to completion before the application container starts.Here is the configuration file for the Pod:pods/init-containers.yaml apiVersion: v1 kind: Pod metadata: name: init-demo spec: containers: - name: nginx image: nginx ports: - containerPort: 80 volumeMounts: - name: workdir mountPath: /usr/share/nginx/html # These containers are run during pod initialization initContainers: - name: install image: busybox:1.28 command: - wget - \"-O\" - \"/work-dir/index.html\" - http://info.cern.ch volumeMounts: - name: workdir mountPath: \"/work-dir\" dnsPolicy: Default volumes: - name: workdir emptyDir: {} In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.The init container mounts the shared Volume at /work-dir, and the application container mounts the shared Volume at /usr/share/nginx/html. The init container runs the following command and then terminates:wget -O /work-dir/index.html http://info.cern.ch Notice that the init container writes the index.html file in the root directory of the nginx server.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/init-containers.yaml Verify that the nginx container is running:kubectl get pod init-demo The output shows that the nginx container is running:NAME READY STATUS RESTARTS AGE init-demo 1/1 Running 0 1m Get a shell into the nginx container running in the init-demo Pod:kubectl exec -it init-demo -- /bin/bash In your shell, send a GET request to the nginx server:root@nginx:~# apt-get update root@nginx:~# apt-get install curl root@nginx:~# curl localhost The output shows that nginx is serving the web page that was written by the init container:<html><head></head><body><header> <title>http://info.cern.ch</title> </header> <h1>http://info.cern.ch - home of the first website</h1> ... <li><a href=\"http://info.cern.ch/hypertext/WWW/TheProject.html\">Browse the first website</a></li> ... What's nextLearn more about communicating between Containers running in the same Pod.Learn more about Init Containers.Learn more about Volumes.Learn more about Debugging Init Containers", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114"}
{"instruction": "Write a yaml example for configure pod initialization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\nConfigure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1400"}
{"instruction": "Write a bash example for configure pod initialization", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/init-containers.yaml\n```\n\nConfigure Pod Initialization | Verify that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1401"}
{"instruction": "Write a bash example for configure pod initialization", "response": "Here's a bash example:\n\n```bash\nkubectl get pod init-demo\n```\n\nConfigure Pod Initialization | The output shows that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1402"}
{"instruction": "Write a bash example for configure pod initialization", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it init-demo -- /bin/bash\n```\n\nConfigure Pod Initialization | In your shell, send a GET request to the nginx server:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1403"}
{"instruction": "Write a yaml example for configure pod initialization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\nConfigure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1404"}
{"instruction": "Write a yaml example for configure pod initialization", "response": "Here's a yaml example:\n\n```yaml\npods/init-containers.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\nConfigure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1405"}
{"instruction": "Write a yaml example for configure pod initialization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\nConfigure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1406"}
{"instruction": "Write a bash example for configure pod initialization", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/init-containers.yaml\n```\n\nConfigure Pod Initialization | Verify that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1407"}
{"instruction": "Write a bash example for configure pod initialization", "response": "Here's a bash example:\n\n```bash\nkubectl get pod init-demo\n```\n\nConfigure Pod Initialization | The output shows that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1408"}
{"instruction": "Write a bash example for configure pod initialization", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it init-demo -- /bin/bash\n```\n\nConfigure Pod Initialization | In your shell, send a GET request to the nginx server:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/", "id": "k8s_00114_code_1409"}
{"instruction": "How do you enforce pod security standards by configuring the built-in admission controller in Kubernetes?", "response": "Enforce Pod Security Standards by Configuring the Built-in Admission ControllerKubernetes provides a built-in admission controller to enforce the Pod Security Standards. You can configure this admission controller to set cluster-wide defaults and exemptions.Before you beginFollowing an alpha release in Kubernetes v1.22, Pod Security Admission became available by default in Kubernetes v1.23, as a beta. From version 1.25 onwards, Pod Security Admission is generally available.To check the version, enter kubectl version.If you are not running Kubernetes 1.34, you can switch to viewing this page in the documentation for the Kubernetes version that you are running.Configure the Admission ControllerNote:pod-security.admission.config.k8s.io/v1 configuration requires v1.25+. For v1.23 and v1.24, use v1beta1. For v1.22, use v1alpha1.apiVersion: apiserver.config.k8s.io/v1 kind: AdmissionConfiguration plugins: - name: PodSecurity configuration: apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note kind: PodSecurityConfiguration # Defaults applied when a mode label is not set. # # Level label values must be one of: # - \"privileged\" (default) # - \"baseline\" # - \"restricted\" # # Version label values must be one of: # - \"latest\" (default) # - specific version like \"v1.34\" defaults: enforce: \"privileged\" enforce-version: \"latest\" audit: \"privileged\" audit-version: \"latest\" warn: \"privileged\" warn-version: \"latest\" exemptions: # Array of authenticated usernames to exempt. usernames: [] # Array of runtime class names to exempt. runtimeClasses: [] # Array of namespaces to exempt. namespaces: [] Note:The above manifest needs to be specified via the --admission-control-config-file to kube-apiserver.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/", "id": "k8s_00115"}
{"instruction": "Write a yaml example for enforce pod security standards by configuring the built-in admission controller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\nEnforce Pod Security Standards by Configuring the Built-in Admission Controller |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/", "id": "k8s_00115_code_1411"}
{"instruction": "Write a yaml example for enforce pod security standards by configuring the built-in admission controller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\nEnforce Pod Security Standards by Configuring the Built-in Admission Controller |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/", "id": "k8s_00115_code_1412"}
{"instruction": "Write a yaml example for enforce pod security standards by configuring the built-in admission controller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\nEnforce Pod Security Standards by Configuring the Built-in Admission Controller |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/", "id": "k8s_00115_code_1413"}
{"instruction": "What is the reference documentation for resourceclaimtemplate?", "response": "ResourceClaimTemplateResourceClaimTemplate is used to produce ResourceClaim objects.apiVersion: resource.k8s.io/v1import \"k8s.io/api/resource/v1\"ResourceClaimTemplateResourceClaimTemplate is used to produce ResourceClaim objects.This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.apiVersion: resource.k8s.io/v1kind: ResourceClaimTemplatemetadata (ObjectMeta)Standard object metadataspec (ResourceClaimTemplateSpec), requiredDescribes the ResourceClaim that is to be generated.This field is immutable. A ResourceClaim will get created by the control plane for a Pod when needed and then not get updated anymore.ResourceClaimTemplateSpecResourceClaimTemplateSpec contains the metadata and fields for a ResourceClaim.spec (ResourceClaimSpec), requiredSpec for the ResourceClaim. The entire content is copied unchanged into the ResourceClaim that gets created from this template. The same fields as in a ResourceClaim are also valid here.metadata (ObjectMeta)ObjectMeta may contain labels and annotations that will be copied into the ResourceClaim when creating it. No other fields are allowed and will be rejected during validation.ResourceClaimTemplateListResourceClaimTemplateList is a collection of claim templates.apiVersion: resource.k8s.io/v1kind: ResourceClaimTemplateListmetadata (ListMeta)Standard list metadataitems ([]ResourceClaimTemplate), requiredItems is the list of resource claim templates.Operationsget read the specified ResourceClaimTemplateHTTP RequestGET /apis/resource.k8s.io/v1/namespaces/{namespace}/resourceclaimtemplates/{name}Parametersname (in path): string, requiredname of the ResourceClaimTemplatenamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (ResourceClaimTemplate): OK401: Unauthorizedlist list or watch objects of kind ResourceClaimTemplateHTTP RequestGET /apis/resource.k8s.io/v1/namespaces/{namespace}/resourceclaimtemplatesParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ResourceClaimTemplateList): OK401: Unauthorizedlist list or watch objects of kind ResourceClaimTemplateHTTP RequestGET /apis/resource.k8s.io/v1/resourceclaimtemplatesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ResourceClaimTemplateList): OK401: Unauthorizedcreate create a ResourceClaimTemplateHTTP RequestPOST /apis/resource.k8s.io/v1/namespaces/{namespace}/resourceclaimtemplatesParametersnamespace (in path): string, requirednamespacebody: ResourceClaimTemplate, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (ResourceClaimTemplate): OK201 (ResourceClaimTemplate): Created202 (ResourceClaimTemplate): Accepted401: Unauthorizedupdate replace the specified ResourceClaimTemplateHTTP RequestPUT /apis/resource.k8s.io/v1/namespaces/{namespace}/resourceclaimtemplates/{name}Parametersname (in path): string, requiredname of the ResourceClaimTemplatenamespace (in path): string, requirednamespacebody: ResourceClaimTemplat", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/resource-claim-template-v1/", "id": "k8s_00116"}
{"instruction": "Write a yaml example for resourceclaimtemplate", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\nResourceClaimTemplate | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/resource-claim-template-v1/", "id": "k8s_00116_code_1415"}
{"instruction": "Explain the Kubernetes concept: Projected Volumes", "response": "Projected VolumesThis document describes projected volumes in Kubernetes. Familiarity with volumes is suggested.IntroductionA projected volume maps several existing volume sources into the same directory.Currently, the following types of volume sources can be projected:secretdownwardAPIconfigMapserviceAccountTokenclusterTrustBundlepodCertificateAll sources are required to be in the same namespace as the Pod. For more details, see the all-in-one volume design document.Example configuration with a secret, a downwardAPI, and a configMappods/storage/projected-secret-downwardapi-configmap.yaml apiVersion: v1 kind: Pod metadata: name: volume-test spec: containers: - name: container-test image: busybox:1.28 command: [\"sleep\", \"3600\"] volumeMounts: - name: all-in-one mountPath: \"/projected-volume\" readOnly: true volumes: - name: all-in-one projected: sources: - secret: name: mysecret items: - key: username path: my-group/my-username - downwardAPI: items: - path: \"labels\" fieldRef: fieldPath: metadata.labels - path: \"cpu_limit\" resourceFieldRef: containerName: container-test resource: limits.cpu - configMap: name: myconfigmap items: - key: config path: my-group/my-config Example configuration: secrets with a non-default permission mode setpods/storage/projected-secrets-nondefault-permission-mode.yaml apiVersion: v1 kind: Pod metadata: name: volume-test spec: containers: - name: container-test image: busybox:1.28 command: [\"sleep\", \"3600\"] volumeMounts: - name: all-in-one mountPath: \"/projected-volume\" readOnly: true volumes: - name: all-in-one projected: sources: - secret: name: mysecret items: - key: username path: my-group/my-username - secret: name: mysecret2 items: - key: password path: my-group/my-password mode: 511 Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:For secrets, the secretName field has been changed to name to be consistent with ConfigMap naming.The defaultMode can only be specified at the projected level and not for each volume source. However, as illustrated above, you can explicitly set the mode for each individual projection.serviceAccountToken projected volumesYou can inject the token for the current service account into a Pod at a specified path. For example:pods/storage/projected-service-account-token.yaml apiVersion: v1 kind: Pod metadata: name: sa-token-test spec: containers: - name: container-test image: busybox:1.28 command: [\"sleep\", \"3600\"] volumeMounts: - name: token-vol mountPath: \"/service-account\" readOnly: true serviceAccountName: default volumes: - name: token-vol projected: sources: - serviceAccountToken: audience: api expirationSeconds: 3600 path: token The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of the pod's ServiceAccount. The audience field contains the intended audience of the token. A recipient of the token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. This field is optional and it defaults to the identifier of the API server.The expirationSeconds is the expected duration of validity of the service account token. It defaults to 1 hour and must be at least 10 minutes (600 seconds). An administrator can also limit its maximum value by specifying the --service-account-max-token-expiration option for the API server. The path field specifies a relative path to the mount point of the projected volume.Note:A container using a projected volume source as a subPath volume mount will not receive updates for those volume sources.clusterTrustBundle projected volumesFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: false)Note:To use this feature in Kubernetes 1.34, you must enable support for ClusterTrustBundle objects with the ClusterTrustBundle feature gate and --runtime-config=certificates.k8s.io/v", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1417"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1418"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\nProjected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1419"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\nProjected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1420"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\nProjected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1421"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1422"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1423"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\nProjected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1424"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\nProjected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1425"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\nProjected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1426"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-secret-downwardapi-configmap.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1427"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1428"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-secrets-nondefault-permission-mode.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1429"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\nProjected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1430"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-service-account-token.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\nProjected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1431"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\nProjected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1432"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-clustertrustbundle.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\nProjected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1433"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\nProjected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1434"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-podcertificate.yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\nProjected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1435"}
{"instruction": "Write a yaml example for projected volumes", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\nProjected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/projected-volumes/", "id": "k8s_00117_code_1436"}
{"instruction": "How do you assign pods to nodes using node affinity in Kubernetes?", "response": "Assign Pods to Nodes using Node AffinityThis page shows how to assign a Kubernetes Pod to a particular node using Node Affinity in a Kubernetes cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.10.To check the version, enter kubectl version.Add a label to a nodeList the nodes in your cluster, along with their labels:kubectl get nodes --show-labels The output is similar to this:NAME STATUS ROLES AGE VERSION LABELS worker0 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker0 worker1 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker1 worker2 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker2 Choose one of your nodes, and add a label to it:kubectl label nodes <your-node-name> disktype=ssd where <your-node-name> is the name of your chosen node.Verify that your chosen node has a disktype=ssd label:kubectl get nodes --show-labels The output is similar to this:NAME STATUS ROLES AGE VERSION LABELS worker0 Ready <none> 1d v1.13.0 ...,disktype=ssd,kubernetes.io/hostname=worker0 worker1 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker1 worker2 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker2 In the preceding output, you can see that the worker0 node has a disktype=ssd label.Schedule a Pod using required node affinityThis manifest describes a Pod that has a requiredDuringSchedulingIgnoredDuringExecution node affinity,disktype: ssd. This means that the pod will get scheduled only on a node that has a disktype=ssd label.pods/pod-nginx-required-affinity.yaml apiVersion: v1 kind: Pod metadata: name: nginx spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: disktype operator: In values: - ssd containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent Apply the manifest to create a Pod that is scheduled onto your chosen node:kubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml Verify that the pod is running on your chosen node:kubectl get pods --output=wide The output is similar to this:NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 Schedule a Pod using preferred node affinityThis manifest describes a Pod that has a preferredDuringSchedulingIgnoredDuringExecution node affinity,disktype: ssd. This means that the pod will prefer a node that has a disktype=ssd label.pods/pod-nginx-preferred-affinity.yaml apiVersion: v1 kind: Pod metadata: name: nginx spec: affinity: nodeAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 1 preference: matchExpressions: - key: disktype operator: In values: - ssd containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent Apply the manifest to create a Pod that is scheduled onto your chosen node:kubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml Verify that the pod is running on your chosen node:kubectl get pods --output=wide The output is similar to this:NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 What's nextLearn more about Node Affinity.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1438"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\nAssign Pods to Nodes using Node Affinity | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1439"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1440"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1441"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml\n```\n\nAssign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1442"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1443"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1444"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml\n```\n\nAssign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1445"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1446"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1447"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1448"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1449"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\nAssign Pods to Nodes using Node Affinity | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1450"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1451"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-required-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1452"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1453"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml\n```\n\nAssign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1454"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1455"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-preferred-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1456"}
{"instruction": "Write a yaml example for assign pods to nodes using node affinity", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1457"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml\n```\n\nAssign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1458"}
{"instruction": "Write a bash example for assign pods to nodes using node affinity", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAssign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/", "id": "k8s_00118_code_1459"}
{"instruction": "Provide a tutorial on restrict a container's access to resources with apparmor", "response": "Restrict a Container's Access to Resources with AppArmorFEATURE STATE: Kubernetes v1.31 [stable] (enabled by default: true)This page shows you how to load AppArmor profiles on your nodes and enforce those profiles in Pods. To learn more about how Kubernetes can confine Pods using AppArmor, see Linux kernel security constraints for Pods and containers.ObjectivesSee an example of how to load a profile on a NodeLearn how to enforce the profile on a PodLearn how to check that the profile is loadedSee what happens when a profile is violatedSee what happens when a profile cannot be loadedBefore you beginAppArmor is an optional kernel module and Kubernetes feature, so verify it is supported on your Nodes before proceeding:AppArmor kernel module is enabled -- For the Linux kernel to enforce an AppArmor profile, the AppArmor kernel module must be installed and enabled. Several distributions enable the module by default, such as Ubuntu and SUSE, and many others provide optional support. To check whether the module is enabled, check the /sys/module/apparmor/parameters/enabled file:cat /sys/module/apparmor/parameters/enabled Y The kubelet verifies that AppArmor is enabled on the host before admitting a pod with AppArmor explicitly configured.Container runtime supports AppArmor -- All common Kubernetes-supported container runtimes should support AppArmor, including containerd and CRI-O. Please refer to the corresponding runtime documentation and verify that the cluster fulfills the requirements to use AppArmor.Profile is loaded -- AppArmor is applied to a Pod by specifying an AppArmor profile that each container should be run with. If any of the specified profiles are not loaded in the kernel, the kubelet will reject the Pod. You can view which profiles are loaded on a node by checking the /sys/kernel/security/apparmor/profiles file. For example:ssh gke-test-default-pool-239f5d02-gyn2 \"sudo cat /sys/kernel/security/apparmor/profiles | sort\" apparmor-test-deny-write (enforce) apparmor-test-audit-write (enforce) docker-default (enforce) k8s-nginx (enforce) For more details on loading profiles on nodes, see Setting up nodes with profiles.Securing a PodNote:Prior to Kubernetes v1.30, AppArmor was specified through annotations. Use the documentation version selector to view the documentation with this deprecated API.AppArmor profiles can be specified at the pod level or container level. The container AppArmor profile takes precedence over the pod profile.securityContext: appArmorProfile: type: <profile_type> Where <profile_type> is one of:RuntimeDefault to use the runtime's default profileLocalhost to use a profile loaded on the host (see below)Unconfined to run without AppArmorSee Specifying AppArmor Confinement for full details on the AppArmor profile API.To verify that the profile was applied, you can check that the container's root process is running with the correct profile by examining its proc attr:kubectl exec <pod_name> -- cat /proc/1/attr/current The output should look something like this:cri-containerd.apparmor.d (enforce) ExampleThis example assumes you have already set up a cluster with AppArmor support.First, load the profile you want to use onto your Nodes. This profile blocks all file write operations:#include <tunables/global> profile k8s-apparmor-example-deny-write flags=(attach_disconnected) { #include <abstractions/base> file, # Deny all file writes. deny /** w, } The profile needs to be loaded onto all nodes, since you don't know where the pod will be scheduled. For this example you can use SSH to install the profiles, but other approaches are discussed in Setting up nodes with profiles.# This example assumes that node names match host names, and are reachable via SSH. NODES=($( kubectl get node -o jsonpath='{.items[*].status.addresses[?(.type == \"Hostname\")].address}' )) for NODE in ${NODES[*]}; do ssh $NODE 'sudo apparmor_parser -q <<EOF #include <tunables/global> profile k8s-apparmor-example-deny-write flags=(attach_disc", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod_name> -- cat /proc/1/attr/current\n```\n\nRestrict a Container's Access to Resources with AppArmor | The output should look something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1461"}
{"instruction": "Write a yaml example for restrict a container's access to resources with apparmor", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\nRestrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1462"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl create -f hello-apparmor.yaml\n```\n\nRestrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1463"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- cat /proc/1/attr/current\n```\n\nRestrict a Container's Access to Resources with AppArmor | The output should be:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1464"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- touch /tmp/test\n```\n\nRestrict a Container's Access to Resources with AppArmor | To wrap up, see what happens if you try to specify a profile that hasn't been loaded:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1465"}
{"instruction": "Write a yaml example for restrict a container's access to resources with apparmor", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f /dev/stdin <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor-2\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-allow-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\nEOF\n```\n\nRestrict a Container's Access to Resources with AppArmor | Although the Pod was created successfully, further examination will show that it is stuck in pending:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1466"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod hello-apparmor-2\n```\n\nRestrict a Container's Access to Resources with AppArmor | An Event provides the error message with the reason, the specific wording is runtime-dependent:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1467"}
{"instruction": "Write a yaml example for restrict a container's access to resources with apparmor", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  appArmorProfile:\n    type: <profile_type>\n```\n\nRestrict a Container's Access to Resources with AppArmor | Where <profile_type> is one of:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1468"}
{"instruction": "Write a yaml example for restrict a container's access to resources with apparmor", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\nRestrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1469"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod_name> -- cat /proc/1/attr/current\n```\n\nRestrict a Container's Access to Resources with AppArmor | The output should look something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1470"}
{"instruction": "Write a yaml example for restrict a container's access to resources with apparmor", "response": "Here's a yaml example:\n\n```yaml\npods/security/hello-apparmor.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\nRestrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1471"}
{"instruction": "Write a yaml example for restrict a container's access to resources with apparmor", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\nRestrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1472"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl create -f hello-apparmor.yaml\n```\n\nRestrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1473"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- cat /proc/1/attr/current\n```\n\nRestrict a Container's Access to Resources with AppArmor | The output should be:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1474"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- touch /tmp/test\n```\n\nRestrict a Container's Access to Resources with AppArmor | To wrap up, see what happens if you try to specify a profile that hasn't been loaded:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1475"}
{"instruction": "Write a yaml example for restrict a container's access to resources with apparmor", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f /dev/stdin <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor-2\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-allow-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\nEOF\n```\n\nRestrict a Container's Access to Resources with AppArmor | Although the Pod was created successfully, further examination will show that it is stuck in pending:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1476"}
{"instruction": "Write a bash example for restrict a container's access to resources with apparmor", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod hello-apparmor-2\n```\n\nRestrict a Container's Access to Resources with AppArmor | An Event provides the error message with the reason, the specific wording is runtime-dependent:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/apparmor/", "id": "k8s_00119_code_1477"}
{"instruction": "Explain the Kubernetes concept: Storage", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.StorageWays to provide both long-term and temporary storage to Pods in your cluster.1: Volumes2: Persistent Volumes3: Projected Volumes4: Ephemeral Volumes5: Storage Classes6: Volume Attributes Classes7: Dynamic Volume Provisioning8: Volume Snapshots9: Volume Snapshot Classes10: CSI Volume Cloning11: Storage Capacity12: Node-specific Volume Limits13: Volume Health Monitoring14: Windows Storage1 - VolumesKubernetes volumes provide a way for containers in a pod to access and share data via the filesystem. There are different kinds of volume that you can use for different purposes, such as:populating a configuration file based on a ConfigMap or a Secretproviding some temporary scratch space for a podsharing a filesystem between two different containers in the same podsharing a filesystem between two different pods (even if those Pods run on different nodes)durably storing data so that it stays available even if the Pod restarts or is replacedpassing configuration information to an app running in a container, based on details of the Pod the container is in (for example: telling a sidecar container what namespace the Pod is running in)providing read-only access to data in a different container imageData sharing can be between different local processes within a container, or between different containers, or between Pods.Why volumes are importantData persistence: On-disk files in a container are ephemeral, which presents some problems for non-trivial applications when running in containers. One problem occurs when a container crashes or is stopped, the container state is not saved so all of the files that were created or modified during the lifetime of the container are lost. After a crash, kubelet restarts the container with a clean state.Shared storage: Another problem occurs when multiple containers are running in a Pod and need to share files. It can be challenging to set up and access a shared filesystem across all of the containers.The Kubernetes volume abstraction can help you to solve both of these problems.Before you learn about volumes, PersistentVolumes and PersistentVolumeClaims, you should read up about Pods and make sure that you understand how Kubernetes uses Pods to run containers.How volumes workKubernetes supports many types of volumes. A Pod can use any number of volume types simultaneously. Ephemeral volume types have a lifetime linked to a specific Pod, but persistent volumes exist beyond the lifetime of any individual pod. When a pod ceases to exist, Kubernetes destroys ephemeral volumes; however, Kubernetes does not destroy persistent volumes. For any kind of volume in a given pod, data is preserved across container restarts.At its core, a volume is a directory, possibly with some data in it, which is accessible to the containers in a pod. How that directory comes to be, the medium that backs it, and the contents of it are determined by the particular volume type used.To use a volume, specify the volumes to provide for the Pod in .spec.volumes and declare where to mount those volumes into containers in .spec.containers[*].volumeMounts.When a pod is launched, a process in the container sees a filesystem view composed from the initial contents of the container image, plus volumes (if defined) mounted inside the container. The process sees a root filesystem that initially matches the contents of the container image. Any writes to within that filesystem hierarchy, if allowed, affect what that process views when it performs a subsequent filesystem access. Volumes are mounted at specified paths within the container filesystem. For each container defined within a Pod, you must independently specify where to mount each volume that the container uses.Volumes cannot mount within other volumes (but see Using subPath for a related mechanism). Also, a volume cannot contain a hard link to anything in a different", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\n1 - Volumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1479"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\n1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1480"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\n1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1481"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\n1 - Volumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1482"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\n1 - Volumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1483"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\n1 - Volumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1484"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\n1 - Volumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1485"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1486"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\n1 - Volumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1487"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\n1 - Volumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1488"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\n1 - Volumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1489"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\n1 - Volumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1490"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\n1 - Volumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1491"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1492"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc hostpath\nName:          hostpath\nNamespace:     default\nStorageClass:  example-hostpath\nStatus:        Terminating\nVolume:\nLabels:        <none>\nAnnotations:   volume.beta.kubernetes.io/storage-class=example-hostpath\n               volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath\nFinalizers:    [kubernetes.io/pvc-protection]\n...\n```\n\n2 - Persistent Volumes | You can see that a PV is protected when the PV's status is Terminating and the Finalizers list includes kubernetes.io/pv-protection too:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1493"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv task-pv-volume\nName:            task-pv-volume\nLabels:          type=local\nAnnotations:     <none>\nFinalizers:      [kubernetes.io/pv-protection]\nStorageClass:    standard\nStatus:          Terminating\nClaim:\nReclaim Policy:  Delete\nAccess Modes:    RWO\nCapacity:        1Gi\nMessage:\nSource:\n    Type:          HostPath (bare host directory volume)\n    Path:          /tmp/data\n    HostPathType:\nEvents:            <none>\n```\n\n2 - Persistent Volumes | When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource. The reclaim policy for a PersistentVolume tells the cluster what to do with", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1494"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\n2 - Persistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1495"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nName:            pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nLabels:          <none>\nAnnotations:     kubernetes.io/createdby: vsphere-volume-dynamic-provisioner\n                 pv.kubernetes.io/bound-by-controller: yes\n                 pv.kubernetes.io/provisioned-by: kubernetes.io/vsphere-volume\nFinalizers:      [kubernetes.io/pv-protection kubernetes.io/pv-controller]\nStorageClass:    vcp-sc\nStatus:          Bound\nClaim:           default/vcp-pvc-1\nReclaim Policy:  Delete\nAccess Modes:    RWO\nVolumeMode:      Filesystem\nCapacity:        1Gi\nNode Affinity:   <none>\nMessage:\nSource:\n    Type:               vSphereVolume (a Persistent Disk resource in vSphere)\n    VolumePath:         [vsanDatastore] d49c4a62-166f-ce12-c464-020077ba5d46/kubernetes-dynamic-pvc-74a498d6-3929-47e8-8c02-078c1ece4d78.vmdk\n    FSType:             ext4\n    StoragePolicyName:  vSAN Default Storage Policy\nEvents:                 <none>\n```\n\n2 - Persistent Volumes | The finalizer external-provisioner.volume.kubernetes.io/finalizer is added for CSI volumes. The following is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1496"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\n2 - Persistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1497"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\n2 - Persistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1498"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n2 - Persistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1499"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\n2 - Persistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1500"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\n2 - Persistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1501"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\n2 - Persistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1502"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1503"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1504"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1505"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1506"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1507"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1508"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\n2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1509"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\n2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1510"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1511"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1512"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1513"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1514"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1515"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\n4 - Ephemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1516"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\n4 - Ephemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1517"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1518"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1519"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1520"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1521"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1522"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1523"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\n5 - Storage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1524"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\n5 - Storage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1525"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1526"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\n5 - Storage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1527"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1528"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1529"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1530"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\n6 - Volume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1531"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\n6 - Volume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1532"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\n6 - Volume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1533"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\n6 - Volume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1534"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\n7 - Dynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1535"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\n7 - Dynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1536"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\n7 - Dynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1537"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\n8 - Volume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1538"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\n8 - Volume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1539"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\n8 - Volume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1540"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n8 - Volume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1541"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n8 - Volume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1542"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n9 - Volume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1543"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n9 - Volume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1544"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\n10 - CSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1545"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\n12 - Node-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1546"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\n1 - Volumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1547"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\n1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1548"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\n1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1549"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\n1 - Volumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1550"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\n1 - Volumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1551"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\n1 - Volumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1552"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\n1 - Volumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1553"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1554"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\n1 - Volumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1555"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\n1 - Volumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1556"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\n1 - Volumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1557"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\n1 - Volumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1558"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\n1 - Volumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1559"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1560"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\n2 - Persistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1561"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\n2 - Persistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1562"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\n2 - Persistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1563"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n2 - Persistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1564"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\n2 - Persistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1565"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl describe persistentvolume <name>\n```\n\n2 - Persistent Volumes | The .status field for a PersistentVolume can include an alpha lastPhaseTransitionTime field. This field records the timestamp of when the volume last transitioned its phase. For newly created volumes", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1566"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\n2 - Persistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1567"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\n2 - Persistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1568"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1569"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1570"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1571"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1572"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1573"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1574"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\n2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1575"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\n2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1576"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1577"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1578"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1579"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1580"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1581"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\n4 - Ephemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1582"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\n4 - Ephemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1583"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1584"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1585"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1586"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1587"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1588"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1589"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\n5 - Storage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1590"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\n5 - Storage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1591"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1592"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1593"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1594"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1595"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\n6 - Volume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1596"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\n6 - Volume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1597"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\n6 - Volume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1598"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\n6 - Volume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1599"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\n7 - Dynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1600"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\n7 - Dynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1601"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\n7 - Dynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1602"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\n8 - Volume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1603"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\n8 - Volume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1604"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\n8 - Volume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1605"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n8 - Volume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1606"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl get crd volumesnapshotcontent -o yaml\n```\n\n8 - Volume Snapshots | If you want to allow users to create a PersistentVolumeClaim from an existing VolumeSnapshot, but with a different volume mode than the source, the annotation snapshot.storage.kubernetes.io/allow-volu", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1607"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n8 - Volume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1608"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n9 - Volume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1609"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n9 - Volume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1610"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\n10 - CSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1611"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\n12 - Node-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1612"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\n1 - Volumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1613"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\n1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1614"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\n1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1615"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\n1 - Volumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1616"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\n1 - Volumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1617"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\n1 - Volumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1618"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\n1 - Volumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1619"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1620"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1621"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\n1 - Volumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1622"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\n1 - Volumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1623"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\n1 - Volumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1624"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\n1 - Volumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1625"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\n1 - Volumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1626"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/rro.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1627"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1628"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc hostpath\nName:          hostpath\nNamespace:     default\nStorageClass:  example-hostpath\nStatus:        Terminating\nVolume:\nLabels:        <none>\nAnnotations:   volume.beta.kubernetes.io/storage-class=example-hostpath\n               volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath\nFinalizers:    [kubernetes.io/pvc-protection]\n...\n```\n\n2 - Persistent Volumes | You can see that a PV is protected when the PV's status is Terminating and the Finalizers list includes kubernetes.io/pv-protection too:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1629"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv task-pv-volume\nName:            task-pv-volume\nLabels:          type=local\nAnnotations:     <none>\nFinalizers:      [kubernetes.io/pv-protection]\nStorageClass:    standard\nStatus:          Terminating\nClaim:\nReclaim Policy:  Delete\nAccess Modes:    RWO\nCapacity:        1Gi\nMessage:\nSource:\n    Type:          HostPath (bare host directory volume)\n    Path:          /tmp/data\n    HostPathType:\nEvents:            <none>\n```\n\n2 - Persistent Volumes | When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource. The reclaim policy for a PersistentVolume tells the cluster what to do with", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1630"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\n2 - Persistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1631"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nName:            pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nLabels:          <none>\nAnnotations:     kubernetes.io/createdby: vsphere-volume-dynamic-provisioner\n                 pv.kubernetes.io/bound-by-controller: yes\n                 pv.kubernetes.io/provisioned-by: kubernetes.io/vsphere-volume\nFinalizers:      [kubernetes.io/pv-protection kubernetes.io/pv-controller]\nStorageClass:    vcp-sc\nStatus:          Bound\nClaim:           default/vcp-pvc-1\nReclaim Policy:  Delete\nAccess Modes:    RWO\nVolumeMode:      Filesystem\nCapacity:        1Gi\nNode Affinity:   <none>\nMessage:\nSource:\n    Type:               vSphereVolume (a Persistent Disk resource in vSphere)\n    VolumePath:         [vsanDatastore] d49c4a62-166f-ce12-c464-020077ba5d46/kubernetes-dynamic-pvc-74a498d6-3929-47e8-8c02-078c1ece4d78.vmdk\n    FSType:             ext4\n    StoragePolicyName:  vSAN Default Storage Policy\nEvents:                 <none>\n```\n\n2 - Persistent Volumes | The finalizer external-provisioner.volume.kubernetes.io/finalizer is added for CSI volumes. The following is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1632"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\n2 - Persistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1633"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\n2 - Persistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1634"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n2 - Persistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1635"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\n2 - Persistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1636"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\n2 - Persistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1637"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\n2 - Persistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1638"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1639"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1640"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\n2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1641"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1642"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1643"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n2 - Persistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1644"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\n2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1645"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\n2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1646"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-secret-downwardapi-configmap.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1647"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1648"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-secrets-nondefault-permission-mode.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1649"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1650"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-service-account-token.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1651"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1652"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-clustertrustbundle.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1653"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1654"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-podcertificate.yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1655"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1656"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\n4 - Ephemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1657"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\n4 - Ephemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1658"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass-low-latency.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1659"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1660"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/pod-volume-binding.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1661"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1662"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-topology.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1663"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1664"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-ebs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1665"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1666"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-efs.yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1667"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1668"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-nfs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1669"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1670"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\n5 - Storage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1671"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\n5 - Storage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1672"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-ceph-rbd.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1673"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1674"}
{"instruction": "Write a bash example for storage", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\n5 - Storage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1675"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-azure-file.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1676"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1677"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-portworx-volume.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1678"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1679"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-local.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1680"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1681"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\n6 - Volume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1682"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\n6 - Volume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1683"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\n6 - Volume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1684"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\n6 - Volume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1685"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\n7 - Dynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1686"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\n7 - Dynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1687"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\n7 - Dynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1688"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\n8 - Volume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1689"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\n8 - Volume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1690"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\n8 - Volume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1691"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n8 - Volume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1692"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n8 - Volume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1693"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n9 - Volume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1694"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n9 - Volume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1695"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\n10 - CSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1696"}
{"instruction": "Write a yaml example for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\n12 - Node-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/_print/", "id": "k8s_00120_code_1697"}
{"instruction": "How do you access services running on clusters in Kubernetes?", "response": "Access Services Running on ClustersThis page shows how to connect to services running on the Kubernetes cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Accessing services running on the clusterIn Kubernetes, nodes, pods and services all have their own IPs. In many cases, the node IPs, pod IPs, and some service IPs on a cluster will not be routable, so they will not be reachable from a machine outside the cluster, such as your desktop machine.Ways to connectYou have several options for connecting to nodes, pods and services from outside the cluster:Access services through public IPs.Use a service with type NodePort or LoadBalancer to make the service reachable outside the cluster. See the services and kubectl expose documentation.Depending on your cluster environment, this may only expose the service to your corporate network, or it may expose it to the internet. Think about whether the service being exposed is secure. Does it do its own authentication?Place pods behind services. To access one specific pod from a set of replicas, such as for debugging, place a unique label on the pod and create a new service which selects this label.In most cases, it should not be necessary for application developer to directly access nodes via their nodeIPs.Access services, nodes, or pods using the Proxy Verb.Does apiserver authentication and authorization prior to accessing the remote service. Use this if the services are not secure enough to expose to the internet, or to gain access to ports on the node IP, or for debugging.Proxies may cause problems for some web applications.Only works for HTTP/HTTPS.Described here.Access from a node or pod in the cluster.Run a pod, and then connect to a shell in it using kubectl exec. Connect to other nodes, pods, and services from that shell.Some clusters may allow you to ssh to a node in the cluster. From there you may be able to access cluster services. This is a non-standard method, and will work on some clusters but not others. Browsers and other tools may or may not be installed. Cluster DNS may not work.Discovering builtin servicesTypically, there are several services which are started on a cluster by kube-system. Get a list of these with the kubectl cluster-info command:kubectl cluster-info The output is similar to this:Kubernetes master is running at https://192.0.2.1 elasticsearch-logging is running at https://192.0.2.1/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy kibana-logging is running at https://192.0.2.1/api/v1/namespaces/kube-system/services/kibana-logging/proxy kube-dns is running at https://192.0.2.1/api/v1/namespaces/kube-system/services/kube-dns/proxy grafana is running at https://192.0.2.1/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy heapster is running at https://192.0.2.1/api/v1/namespaces/kube-system/services/monitoring-heapster/proxy This shows the proxy-verb URL for accessing each service. For example, this cluster has cluster-level logging enabled (using Elasticsearch), which can be reached at https://192.0.2.1/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/ if suitable credentials are passed, or through a kubectl proxy at, for example: http://localhost:8080/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/.Note:See Access Clusters Using the Kubernetes API for how to pass credentials or use kubectl proxy.Manually constructing apiserver proxy URLsAs mentioned above, you use the kubectl cluster-info command to retrieve the service's proxy URL. To create proxy URLs that", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster-services/", "id": "k8s_00121"}
{"instruction": "What is the reference documentation for kubectl cluster-info?", "response": "kubectl cluster-infoSynopsisDisplay addresses of the control plane and services with label kubernetes.io/cluster-service=true. To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.kubectl cluster-info [flags] Examples # Print the address of the control plane and cluster services kubectl cluster-info Options-h, --helphelp for cluster-infoParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerkubectl cluster-info dump - Dump relevant information for debugging and diagnosisThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cluster-info/", "id": "k8s_00122"}
{"instruction": "Write a bash example for kubectl cluster-info", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\nkubectl cluster-info | help for cluster-info", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cluster-info/", "id": "k8s_00122_code_1700"}
{"instruction": "Write a bash example for kubectl cluster-info", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\nkubectl cluster-info | help for cluster-info", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cluster-info/", "id": "k8s_00122_code_1701"}
{"instruction": "Explain documentation content guide in Kubernetes", "response": "Documentation Content GuideThis page contains guidelines for Kubernetes documentation.If you have questions about what's allowed, join the #sig-docs channel in Kubernetes Slack and ask!You can register for Kubernetes Slack at https://slack.k8s.io/.For information on creating new content for the Kubernetes docs, follow the style guide.OverviewSource for the Kubernetes website, including the docs, resides in the kubernetes/website repository.Located in the kubernetes/website/content/<language_code>/docs folder, the majority of Kubernetes documentation is specific to the Kubernetes project.What's allowedKubernetes docs allow content for third-party projects only when:Content documents software in the Kubernetes projectContent documents software that's out of project but necessary for Kubernetes to functionContent is canonical on kubernetes.io, or links to canonical content elsewhereThird party contentKubernetes documentation includes applied examples of projects in the Kubernetes project—projects that live in the kubernetes and kubernetes-sigs GitHub organizations.Links to active content in the Kubernetes project are always allowed.Kubernetes requires some third party content to function. Examples include container runtimes (containerd, CRI-O, Docker), networking policy (CNI plugins), Ingress controllers, and logging.Docs can link to third-party open source software (OSS) outside the Kubernetes project only if it's necessary for Kubernetes to function.Dual sourced contentWherever possible, Kubernetes docs link to canonical sources instead of hosting dual-sourced content.Dual-sourced content requires double the effort (or more!) to maintain and grows stale more quickly.Note:If you're a maintainer for a Kubernetes project and need help hosting your own docs, ask for help in #sig-docs on Kubernetes Slack.More informationIf you have questions about allowed content, join the Kubernetes Slack #sig-docs channel and ask!What's nextRead the Style guide.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/content-guide/", "id": "k8s_00123"}
{"instruction": "Explain the Kubernetes concept: Topology Aware Routing", "response": "Topology Aware RoutingTopology Aware Routing provides a mechanism to help keep network traffic within the zone where it originated. Preferring same-zone traffic between Pods in your cluster can help with reliability, performance (network latency and throughput), or cost.FEATURE STATE: Kubernetes v1.23 [beta]Note:Prior to Kubernetes 1.27, this feature was known as Topology Aware Hints.Topology Aware Routing adjusts routing behavior to prefer keeping traffic in the zone it originated from. In some cases this can help reduce costs or improve network performance.MotivationKubernetes clusters are increasingly deployed in multi-zone environments. Topology Aware Routing provides a mechanism to help keep traffic within the zone it originated from. When calculating the endpoints for a Service, the EndpointSlice controller considers the topology (region and zone) of each endpoint and populates the hints field to allocate it to a zone. Cluster components such as kube-proxy can then consume those hints, and use them to influence how the traffic is routed (favoring topologically closer endpoints).Enabling Topology Aware RoutingNote:Prior to Kubernetes 1.27, this behavior was controlled using the service.kubernetes.io/topology-aware-hints annotation.You can enable Topology Aware Routing for a Service by setting the service.kubernetes.io/topology-mode annotation to Auto. When there are enough endpoints available in each zone, Topology Hints will be populated on EndpointSlices to allocate individual endpoints to specific zones, resulting in traffic being routed closer to where it originated from.When it works bestThis feature works best when:1. Incoming traffic is evenly distributedIf a large proportion of traffic is originating from a single zone, that traffic could overload the subset of endpoints that have been allocated to that zone. This feature is not recommended when incoming traffic is expected to originate from a single zone.2. The Service has 3 or more endpoints per zoneIn a three zone cluster, this means 9 or more endpoints. If there are fewer than 3 endpoints per zone, there is a high (≈50%) probability that the EndpointSlice controller will not be able to allocate endpoints evenly and instead will fall back to the default cluster-wide routing approach.How It WorksThe \"Auto\" heuristic attempts to proportionally allocate a number of endpoints to each zone. Note that this heuristic works best for Services that have a significant number of endpoints.EndpointSlice controllerThe EndpointSlice controller is responsible for setting hints on EndpointSlices when this heuristic is enabled. The controller allocates a proportional amount of endpoints to each zone. This proportion is based on the allocatable CPU cores for nodes running in that zone. For example, if one zone had 2 CPU cores and another zone only had 1 CPU core, the controller would allocate twice as many endpoints to the zone with 2 CPU cores.The following example shows what an EndpointSlice looks like when hints have been populated:apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: example-hints labels: kubernetes.io/service-name: example-svc addressType: IPv4 ports: - name: http protocol: TCP port: 80 endpoints: - addresses: - \"10.1.2.3\" conditions: ready: true hostname: pod-1 zone: zone-a hints: forZones: - name: \"zone-a\" kube-proxyThe kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints in the same zone. Sometimes the controller allocates endpoints from a different zone to ensure more even distribution of endpoints between zones. This would result in some traffic being routed to other zones.SafeguardsThe Kubernetes control plane and the kube-proxy on each node apply some safeguard rules before using Topology Aware Hints. If these don't check out, the kube-proxy selects endpoints from anywhere in your cluster, regardl", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/topology-aware-routing/", "id": "k8s_00124"}
{"instruction": "Write a yaml example for topology aware routing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\nTopology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/topology-aware-routing/", "id": "k8s_00124_code_1704"}
{"instruction": "Write a yaml example for topology aware routing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\nTopology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/topology-aware-routing/", "id": "k8s_00124_code_1705"}
{"instruction": "Write a yaml example for topology aware routing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\nTopology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/topology-aware-routing/", "id": "k8s_00124_code_1706"}
{"instruction": "How do you manage kubernetes objects in Kubernetes?", "response": "Manage Kubernetes ObjectsDeclarative and imperative paradigms for interacting with the Kubernetes API.Declarative Management of Kubernetes Objects Using Configuration FilesDeclarative Management of Kubernetes Objects Using KustomizeManaging Kubernetes Objects Using Imperative CommandsImperative Management of Kubernetes Objects Using Configuration FilesUpdate API Objects in Place Using kubectl patchUse kubectl patch to update Kubernetes API objects in place. Do a strategic merge patch or a JSON merge patch.Migrate Kubernetes Objects Using Storage Version Migration", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/", "id": "k8s_00125"}
{"instruction": "How do you extend kubectl with plugins in Kubernetes?", "response": "Extend kubectl with pluginsExtend kubectl by creating and installing kubectl plugins.This guide demonstrates how to install and write extensions for kubectl. By thinking of core kubectl commands as essential building blocks for interacting with a Kubernetes cluster, a cluster administrator can think of plugins as a means of utilizing these building blocks to create more complex behavior. Plugins extend kubectl with new sub-commands, allowing for new and custom features not included in the main distribution of kubectl.Before you beginYou need to have a working kubectl binary installed.Installing kubectl pluginsA plugin is a standalone executable file, whose name begins with kubectl-. To install a plugin, move its executable file to anywhere on your PATH.You can also discover and install kubectl plugins available in the open source using Krew. Krew is a plugin manager maintained by the Kubernetes SIG CLI community.Caution:Kubectl plugins available via the Krew plugin index are not audited for security. You should install and run third-party plugins at your own risk, since they are arbitrary programs running on your machine.Discovering pluginskubectl provides a command kubectl plugin list that searches your PATH for valid plugin executables. Executing this command causes a traversal of all files in your PATH. Any files that are executable, and begin with kubectl- will show up in the order in which they are present in your PATH in this command's output. A warning will be included for any files beginning with kubectl- that are not executable. A warning will also be included for any valid plugin files that overlap each other's name.You can use Krew to discover and install kubectl plugins from a community-curated plugin index.Create pluginskubectl allows plugins to add custom create commands of the shape kubectl create something by providing a kubectl-create-something binary in the PATH.LimitationsIt is currently not possible to create plugins that overwrite existing kubectl commands or extend commands other than create. For example, creating a plugin kubectl-version will cause that plugin to never be executed, as the existing kubectl version command will always take precedence over it. Due to this limitation, it is also not possible to use plugins to add new subcommands to existing kubectl commands. For example, adding a subcommand kubectl attach vm by naming your plugin kubectl-attach-vm will cause that plugin to be ignored.kubectl plugin list shows warnings for any valid plugins that attempt to do this.Writing kubectl pluginsYou can write a plugin in any programming language or script that allows you to write command-line commands.There is no plugin installation or pre-loading required. Plugin executables receive the inherited environment from the kubectl binary. A plugin determines which command path it wishes to implement based on its name. For example, a plugin named kubectl-foo provides a command kubectl foo. You must install the plugin executable somewhere in your PATH.Example plugin#!/bin/bash # optional argument handling if [[ \"$1\" == \"version\" ]] then echo \"1.0.0\" exit 0 fi # optional argument handling if [[ \"$1\" == \"config\" ]] then echo \"$KUBECONFIG\" exit 0 fi echo \"I am a plugin named kubectl-foo\" Using a pluginTo use a plugin, make the plugin executable:sudo chmod +x ./kubectl-foo and place it anywhere in your PATH:sudo mv ./kubectl-foo /usr/local/bin You may now invoke your plugin as a kubectl command:kubectl foo I am a plugin named kubectl-foo All args and flags are passed as-is to the executable:kubectl foo version 1.0.0 All environment variables are also passed as-is to the executable:export KUBECONFIG=~/.kube/config kubectl foo config /home/<user>/.kube/config KUBECONFIG=/etc/kube/config kubectl foo config /etc/kube/config Additionally, the first argument that is passed to a plugin will always be the full path to the location where it was invoked ($0 would equal /usr/local/bin/kubectl-foo in the example above).Nami", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz buz\n```\n\nExtend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1709"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl-parent\nkubectl-parent-subcommand\nkubectl-parent-subcommand-subsubcommand\n```\n\nExtend kubectl with plugins | You can use the aforementioned kubectl plugin list command to ensure that your plugin is visible by kubectl, and verify that there are no warnings preventing it from being called as a kubectl command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1710"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl create something\n```\n\nExtend kubectl with plugins | It is currently not possible to create plugins that overwrite existing kubectl commands or extend commands other than create. For example, creating a plugin kubectl-version will cause that plugin to n", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1711"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl-create-something\n```\n\nExtend kubectl with plugins | It is currently not possible to create plugins that overwrite existing kubectl commands or extend commands other than create. For example, creating a plugin kubectl-version will cause that plugin to n", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1712"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\n# optional argument handling\nif [[ \"$1\" == \"version\" ]]\nthen\n    echo \"1.0.0\"\n    exit 0\nfi\n\n# optional argument handling\nif [[ \"$1\" == \"config\" ]]\nthen\n    echo \"$KUBECONFIG\"\n    exit 0\nfi\n\necho \"I am a plugin named kubectl-foo\"\n```\n\nExtend kubectl with plugins | To use a plugin, make the plugin executable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1713"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nexport KUBECONFIG=~/.kube/config\nkubectl foo config\n```\n\nExtend kubectl with plugins | Additionally, the first argument that is passed to a plugin will always be the full path to the location where it was invoked ($0 would equal /usr/local/bin/kubectl-foo in the example above).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1714"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz arg1 --flag=value arg2\n```\n\nExtend kubectl with plugins | Example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1715"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl-foo-bar-baz-arg1\n```\n\nExtend kubectl with plugins | Example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1716"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\n# create a plugin\necho -e '#!/bin/bash\\n\\necho \"My first command-line argument was $1\"' > kubectl-foo-bar-baz\nsudo chmod +x ./kubectl-foo-bar-baz\n\n# \"install\" your plugin by moving it to a directory in your $PATH\nsudo mv ./kubectl-foo-bar-baz /usr/local/bin\n\n# check that kubectl recognizes your plugin\nkubectl plugin list\n```\n\nExtend kubectl with plugins | As you can see, your plugin was found based on the kubectl command specified by a user, and all extra arguments and flags were passed as-is to the plugin executable once it was found.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1717"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\n# create a plugin containing an underscore in its filename\necho -e '#!/bin/bash\\n\\necho \"I am a plugin with a dash in my name\"' > ./kubectl-foo_bar\nsudo chmod +x ./kubectl-foo_bar\n\n# move the plugin into your $PATH\nsudo mv ./kubectl-foo_bar /usr/local/bin\n\n# You can now invoke your plugin via kubectl:\nkubectl foo-bar\n```\n\nExtend kubectl with plugins | Note that the introduction of underscores to a plugin filename does not prevent you from having commands such as kubectl foo_bar. The command from the above example, can be invoked using either a dash", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1718"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\n# You can invoke your custom command with a dash\nkubectl foo-bar\n```\n\nExtend kubectl with plugins | It is possible to have multiple plugins with the same filename in different locations throughout your PATH. For example, given a PATH with the following value: PATH=/usr/local/bin/plugins:/usr/local/b", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1719"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\n# You can also invoke your custom command with an underscore\nkubectl foo_bar\n```\n\nExtend kubectl with plugins | It is possible to have multiple plugins with the same filename in different locations throughout your PATH. For example, given a PATH with the following value: PATH=/usr/local/bin/plugins:/usr/local/b", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1720"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nPATH=/usr/local/bin/plugins:/usr/local/bin/moreplugins kubectl plugin list\n```\n\nExtend kubectl with plugins | In the above scenario, the warning under /usr/local/bin/moreplugins/kubectl-foo tells you that this plugin will never be executed. Instead, the executable that appears first in your PATH, /usr/local/b", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1721"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\n# for a given kubectl command, the plugin with the longest possible filename will always be preferred\nkubectl foo bar baz\n```\n\nExtend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1722"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz buz\n```\n\nExtend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1723"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nls ./plugin_command_tree\n```\n\nExtend kubectl with plugins | You can use the aforementioned kubectl plugin list command to ensure that your plugin is visible by kubectl, and verify that there are no warnings preventing it from being called as a kubectl command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1724"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl-parent\nkubectl-parent-subcommand\nkubectl-parent-subcommand-subsubcommand\n```\n\nExtend kubectl with plugins | You can use the aforementioned kubectl plugin list command to ensure that your plugin is visible by kubectl, and verify that there are no warnings preventing it from being called as a kubectl command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1725"}
{"instruction": "Write a bash example for extend kubectl with plugins", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz buz\n```\n\nExtend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/", "id": "k8s_00126_code_1726"}
{"instruction": "Explain the Kubernetes concept: Good practices for Kubernetes Secrets", "response": "Good practices for Kubernetes SecretsPrinciples and practices for good Secret management for cluster administrators and application developers.In Kubernetes, a Secret is an object that stores sensitive information, such as passwords, OAuth tokens, and SSH keys.Secrets give you more control over how sensitive information is used and reduces the risk of accidental exposure. Secret values are encoded as base64 strings and are stored unencrypted by default, but can be configured to be encrypted at rest.A Pod can reference the Secret in a variety of ways, such as in a volume mount or as an environment variable. Secrets are designed for confidential data and ConfigMaps are designed for non-confidential data.The following good practices are intended for both cluster administrators and application developers. Use these guidelines to improve the security of your sensitive information in Secret objects, as well as to more effectively manage your Secrets.Cluster administratorsThis section provides good practices that cluster administrators can use to improve the security of confidential information in the cluster.Configure encryption at restBy default, Secret objects are stored unencrypted in etcd. You should configure encryption of your Secret data in etcd. For instructions, refer to Encrypt Secret Data at Rest.Configure least-privilege access to SecretsWhen planning your access control mechanism, such as Kubernetes Role-based Access Control (RBAC), consider the following guidelines for access to Secret objects. You should also follow the other guidelines in RBAC good practices.Components: Restrict watch or list access to only the most privileged, system-level components. Only grant get access for Secrets if the component's normal behavior requires it.Humans: Restrict get, watch, or list access to Secrets. Only allow cluster administrators to access etcd. This includes read-only access. For more complex access control, such as restricting access to Secrets with specific annotations, consider using third-party authorization mechanisms.Caution:Granting list access to Secrets implicitly lets the subject fetch the contents of the Secrets.A user who can create a Pod that uses a Secret can also see the value of that Secret. Even if cluster policies do not allow a user to read the Secret directly, the same user could have access to run a Pod that then exposes the Secret. You can detect or limit the impact caused by Secret data being exposed, either intentionally or unintentionally, by a user with this access. Some recommendations include:Use short-lived SecretsImplement audit rules that alert on specific events, such as concurrent reading of multiple Secrets by a single userRestrict Access for SecretsUse separate namespaces to isolate access to mounted secrets.Improve etcd management policiesConsider wiping or shredding the durable storage used by etcd once it is no longer in use.If there are multiple etcd instances, configure encrypted SSL/TLS communication between the instances to protect the Secret data in transit.Configure access to external SecretsNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.You can use third-party Secrets store providers to keep your confidential data outside your cluster and then configure Pods to access that information. The Kubernetes Secrets Store CSI Driver is a DaemonSet that lets the kubelet retrieve Secrets from external stores, and mount the Secrets as a volume into specific Pods that you authorize to access the data.For a list of supported providers, refer to Providers for the Secret Store CSI Driver.Good practices for using swap memoryFor best practices for setting swap memory for Linux nodes, please refer to swap memory management.DevelopersThis section pro", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/security/secrets-good-practices/", "id": "k8s_00127"}
{"instruction": "How do you migrate kubernetes objects using storage version migration in Kubernetes?", "response": "Migrate Kubernetes Objects Using Storage Version MigrationFEATURE STATE: Kubernetes v1.30 [alpha] (enabled by default: false)Kubernetes relies on API data being actively re-written, to support some maintenance activities related to at rest storage. Two prominent examples are the versioned schema of stored resources (that is, the preferred storage schema changing from v1 to v2 for a given resource) and encryption at rest (that is, rewriting stale data based on a change in how the data should be encrypted).Before you beginInstall kubectl.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.30.To check the version, enter kubectl version.Ensure that your cluster has the StorageVersionMigrator and InformerResourceVersion feature gates enabled. You will need control plane administrator access to make that change.Enable storage version migration REST api by setting runtime config storagemigration.k8s.io/v1alpha1 to true for the API server. For more information on how to do that, read enable or disable a Kubernetes API.Re-encrypt Kubernetes secrets using storage version migrationTo begin with, configure KMS provider to encrypt data at rest in etcd using following encryption configuration.kind: EncryptionConfiguration apiVersion: apiserver.config.k8s.io/v1 resources: - resources: - secrets providers: - aescbc: keys: - name: key1 secret: c2VjcmV0IGlzIHNlY3VyZQ== Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.Create a Secret using kubectl.kubectl create secret generic my-secret --from-literal=key1=supersecret Verify the serialized data for that Secret object is prefixed with k8s:enc:aescbc:v1:key1.Update the encryption configuration file as follows to rotate the encryption key.kind: EncryptionConfiguration apiVersion: apiserver.config.k8s.io/v1 resources: - resources: - secrets providers: - aescbc: keys: - name: key2 secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/ - aescbc: keys: - name: key1 secret: c2VjcmV0IGlzIHNlY3VyZQ== To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.Create a StorageVersionMigration manifest named migrate-secret.yaml as follows:kind: StorageVersionMigration apiVersion: storagemigration.k8s.io/v1alpha1 metadata: name: secrets-migration spec: resource: group: \"\" version: v1 resource: secrets Create the object using kubectl as follows:kubectl apply -f migrate-secret.yaml Monitor migration of Secrets by checking the .status of the StorageVersionMigration. A successful migration should have its Succeeded condition set to true. Get the StorageVersionMigration object as follows:kubectl get storageversionmigration.storagemigration.k8s.io/secrets-migration -o yaml The output is similar to:kind: StorageVersionMigration apiVersion: storagemigration.k8s.io/v1alpha1 metadata: name: secrets-migration uid: 628f6922-a9cb-4514-b076-12d3c178967c resourceVersion: \"90\" creationTimestamp: \"2024-03-12T20:29:45Z\" spec: resource: group: \"\" version: v1 resource: secrets status: conditions: - type: Running status: \"False\" lastUpdateTime: \"2024-03-12T20:29:46Z\" reason: StorageVersionMigrationInProgress - type: Succeeded status: \"True\" lastUpdateTime: \"2024-03-12T20:29:46Z\" reason: StorageVersionMigrationSucceeded resourceVersion: \"84\" Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.Update the preferred storage schema of a CRDConsider a scenario where a CustomResourceDefinition (CRD) is created to serve custom resources (CRs) and is set as the pre", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1729"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify the serialized data for that Secret object is prefixed with k8s:enc:aescbc:v1:key1.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1730"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1731"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1732"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-secret.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Monitor migration of Secrets by checking the .status of the StorageVersionMigration. A successful migration should have its Succeeded condition set to true. Get the StorageVersionMigration object as f", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1733"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/secrets-migration -o yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1734"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1735"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1736"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create a manifest for an example testcrd. Name the manifest cr1.yaml and use these contents:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1737"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1738"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr1.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v1 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1739"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1740"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR resource file with name cr2.yaml as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1741"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1742"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr2.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1743"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1744"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-crd.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Monitor migration of secrets using status. Successful migration should have Succeeded condition set to \"True\" in the status field. Get the migration resource as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1745"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/crdsvm -o yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1746"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1747"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1748"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1749"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1750"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1751"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1752"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1753"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1754"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1755"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1756"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1757"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1758"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify the serialized data for that Secret object is prefixed with k8s:enc:aescbc:v1:key1.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1759"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1760"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1761"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-secret.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Monitor migration of Secrets by checking the .status of the StorageVersionMigration. A successful migration should have its Succeeded condition set to true. Get the StorageVersionMigration object as f", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1762"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/secrets-migration -o yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1763"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1764"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1765"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create a manifest for an example testcrd. Name the manifest cr1.yaml and use these contents:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1766"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1767"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr1.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v1 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1768"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1769"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR resource file with name cr2.yaml as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1770"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1771"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr2.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1772"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1773"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-crd.yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Monitor migration of secrets using status. Successful migration should have Succeeded condition set to \"True\" in the status field. Get the migration resource as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1774"}
{"instruction": "Write a bash example for migrate kubernetes objects using storage version migration", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/crdsvm -o yaml\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1775"}
{"instruction": "Write a yaml example for migrate kubernetes objects using storage version migration", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\nMigrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/storage-version-migration/", "id": "k8s_00128_code_1776"}
{"instruction": "How do you coarse parallel processing using a work queue in Kubernetes?", "response": "Coarse Parallel Processing Using a Work QueueIn this example, you will run a Kubernetes Job with multiple parallel worker processes.In this example, as each pod is created, it picks up one unit of work from a task queue, completes it, deletes it from the queue, and exits.Here is an overview of the steps in this example:Start a message queue service. In this example, you use RabbitMQ, but you could use another one. In practice you would set up a message queue service once and reuse it for many jobs.Create a queue, and fill it with messages. Each message represents one task to be done. In this example, a message is an integer that we will do a lengthy computation on.Start a Job that works on tasks from the queue. The Job starts several pods. Each pod takes one task from the message queue, processes it, and exits.Before you beginYou should already be familiar with the basic, non-parallel, use of Job.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou will need a container image registry where you can upload images to run in your cluster.This task example also assumes that you have Docker installed locally.Starting a message queue serviceThis example uses RabbitMQ, however, you can adapt the example to use another AMQP-type message service.In practice you could set up a message queue service once in a cluster and reuse it for many jobs, as well as for long-running services.Start RabbitMQ as follows:# make a Service for the StatefulSet to use kubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-service.yaml service \"rabbitmq-service\" created kubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-statefulset.yaml statefulset \"rabbitmq\" created Testing the message queue serviceNow, we can experiment with accessing the message queue. We will create a temporary interactive pod, install some tools on it, and experiment with queues.First create a temporary interactive Pod.# Create a temporary interactive container kubectl run -i --tty temp --image ubuntu:22.04 Waiting for pod default/temp-loe07 to be running, status is Pending, pod ready: false ... [ previous line repeats several times .. hit return when it stops ] ... Note that your pod name and command prompt will be different.", "category": "tasks", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-statefulset.yaml\n```\n\nCoarse Parallel Processing Using a Work Queue | Now, we can experiment with accessing the message queue. We will create a temporary interactive pod, install some tools on it, and experiment with queues.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1778"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-1 .\n```\n\nCoarse Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1779"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-1 <username>/job-wq-1\ndocker push <username>/job-wq-1\n```\n\nCoarse Parallel Processing Using a Work Queue | If you are using an alternative container image registry, tag the image and push it there instead.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1780"}
{"instruction": "Write a yaml example for coarse parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\nCoarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1781"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-1\n```\n\nCoarse Parallel Processing Using a Work Queue | All the pods for that Job succeeded! You're done.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1782"}
{"instruction": "Write a yaml example for coarse parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\nCoarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1783"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-statefulset.yaml\n```\n\nCoarse Parallel Processing Using a Work Queue | Now, we can experiment with accessing the message queue. We will create a temporary interactive pod, install some tools on it, and experiment with queues.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1784"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-1 .\n```\n\nCoarse Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1785"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-1 <username>/job-wq-1\ndocker push <username>/job-wq-1\n```\n\nCoarse Parallel Processing Using a Work Queue | If you are using an alternative container image registry, tag the image and push it there instead.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1786"}
{"instruction": "Write a yaml example for coarse parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napplication/job/rabbitmq/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\nCoarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1787"}
{"instruction": "Write a yaml example for coarse parallel processing using a work queue", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\nCoarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1788"}
{"instruction": "Write a bash example for coarse parallel processing using a work queue", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-1\n```\n\nCoarse Parallel Processing Using a Work Queue | All the pods for that Job succeeded! You're done.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/coarse-parallel-processing-work-queue/", "id": "k8s_00129_code_1789"}
{"instruction": "What is the reference documentation for lease?", "response": "LeaseLease defines a lease concept.apiVersion: coordination.k8s.io/v1import \"k8s.io/api/coordination/v1\"LeaseLease defines a lease concept.apiVersion: coordination.k8s.io/v1kind: Leasemetadata (ObjectMeta)More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (LeaseSpec)spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusLeaseSpecLeaseSpec is a specification of a Lease.acquireTime (MicroTime)acquireTime is a time when the current lease was acquired.MicroTime is version of Time with microsecond level precision.holderIdentity (string)holderIdentity contains the identity of the holder of a current lease. If Coordinated Leader Election is used, the holder identity must be equal to the elected LeaseCandidate.metadata.name field.leaseDurationSeconds (int32)leaseDurationSeconds is a duration that candidates for a lease need to wait to force acquire it. This is measured against the time of last observed renewTime.leaseTransitions (int32)leaseTransitions is the number of transitions of a lease between holders.preferredHolder (string)PreferredHolder signals to a lease holder that the lease has a more optimal holder and should be given up. This field can only be set if Strategy is also set.renewTime (MicroTime)renewTime is a time when the current holder of a lease has last updated the lease.MicroTime is version of Time with microsecond level precision.strategy (string)Strategy indicates the strategy for picking the leader for coordinated leader election. If the field is not specified, there is no active coordination for this lease. (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled.LeaseListLeaseList is a list of Lease objects.apiVersion: coordination.k8s.io/v1kind: LeaseListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]Lease), requireditems is a list of schema objects.Operationsget read the specified LeaseHTTP RequestGET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}Parametersname (in path): string, requiredname of the Leasenamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (Lease): OK401: Unauthorizedlist list or watch objects of kind LeaseHTTP RequestGET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leasesParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (LeaseList): OK401: Unauthorizedlist list or watch objects of kind LeaseHTTP RequestGET /apis/coordination.k8s.io/v1/leasesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (LeaseList): OK401: Unauthorizedcreate create a LeaseHTTP RequestPOST /apis/coordination.k8s.io/v1/namespaces/{namespace}/leasesParametersnamespace (in path): string, requirednamespacebody: Lease, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfi", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/lease-v1/", "id": "k8s_00130"}
{"instruction": "Write a yaml example for lease", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\n```\n\nLease | import \"k8s.io/api/coordination/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/lease-v1/", "id": "k8s_00130_code_1791"}
{"instruction": "What is the reference documentation for other tools?", "response": "Other ToolsKubernetes contains several tools to help you work with the Kubernetes system.crictlcrictl is a command-line interface for inspecting and debugging CRI-compatible container runtimes.DashboardDashboard, the web-based user interface of Kubernetes, allows you to deploy containerized applications to a Kubernetes cluster, troubleshoot them, and manage the cluster and its resources itself.Helm🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationHelm is a tool for managing packages of pre-configured Kubernetes resources. These packages are known as Helm charts.Use Helm to:Find and use popular software packaged as Kubernetes chartsShare your own applications as Kubernetes chartsCreate reproducible builds of your Kubernetes applicationsIntelligently manage your Kubernetes manifest filesManage releases of Helm packagesKomposeKompose is a tool to help Docker Compose users move to Kubernetes.Use Kompose to:Translate a Docker Compose file into Kubernetes objectsGo from local Docker development to managing your application via KubernetesConvert v1 or v2 Docker Compose yaml files or Distributed Application BundlesKuiKui is a GUI tool that takes your normal kubectl command line requests and responds with graphics.Kui takes the normal kubectl command line requests and responds with graphics. Instead of ASCII tables, Kui provides a GUI rendering with tables that you can sort.Kui lets you:Directly click on long, auto-generated resource names instead of copying and pastingType in kubectl commands and see them execute, even sometimes faster than kubectl itselfQuery a Job and see its execution rendered as a waterfall diagramClick through resources in your cluster using a tabbed UIMinikubeminikube is a tool that runs a single-node Kubernetes cluster locally on your workstation for development and testing purposes.Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/tools/", "id": "k8s_00131"}
{"instruction": "What is the reference documentation for kubeadm init phase?", "response": "kubeadm init phasekubeadm init phase enables you to invoke atomic steps of the bootstrap process. Hence, you can let kubeadm do some of the work and you can fill in the gaps if you wish to apply customization.kubeadm init phase is consistent with the kubeadm init workflow, and behind the scene both use the same code.kubeadm init phase preflightUsing this command you can execute preflight checks on a control-plane node.SynopsisRun pre-flight checks for kubeadm init.kubeadm init phase preflight [flags] Examples # Run pre-flight checks for kubeadm init using a config file. kubeadm init phase preflight --config kubeadm-config.yaml Options--config stringPath to a kubeadm configuration file.--cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.--dry-runDon't apply any changes; just output what would be done.-h, --helphelp for preflight--ignore-preflight-errors stringsA list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.--image-repository string Default: \"registry.k8s.io\"Choose a container registry to pull control plane images fromOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm init phase kubelet-startThis phase will write the kubelet configuration file and environment file and then start the kubelet.Write kubelet settings and (re)start the kubeletSynopsisWrite a file with KubeletConfiguration and an environment file with node specific kubelet settings, and then (re)start kubelet.kubeadm init phase kubelet-start [flags] Examples # Writes a dynamic environment file with kubelet flags from a InitConfiguration file. kubeadm init phase kubelet-start --config config.yaml Options--config stringPath to a kubeadm configuration file.--cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.--dry-runDon't apply any changes; just output what would be done.-h, --helphelp for kubelet-start--image-repository string Default: \"registry.k8s.io\"Choose a container registry to pull control plane images from--node-name stringSpecify the node name.--patches stringPath to a directory that contains files named \"target[suffix][+patchtype].extension\". For example, \"kube-apiserver0+merge.yaml\" or just \"etcd.json\". \"target\" can be one of \"kube-apiserver\", \"kube-controller-manager\", \"kube-scheduler\", \"etcd\", \"kubeletconfiguration\", \"corednsdeployment\". \"patchtype\" can be one of \"strategic\", \"merge\" or \"json\" and they match the patch formats supported by kubectl. The default \"patchtype\" is \"strategic\". \"extension\" must be either \"json\" or \"yaml\". \"suffix\" is an optional string that can be used to determine which patches are applied first alpha-numerically.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm init phase certsCan be used to create all required certificates by kubeadm.SynopsisCertificate generationkubeadm init phase certs [flags] Options-h, --helphelp for certsOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisGenerate all certificateskubeadm init phase certs all [flags] Options--apiserver-advertise-address stringThe IP address the API Server will advertise it's listening on. If not set the default network interface will be used.--apiserver-cert-extra-sans stringsOptional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names.--cert-dir string Default: \"/etc/kubernetes/pki\"Th", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/", "id": "k8s_00132"}
{"instruction": "How do you configure a kubelet image credential provider in Kubernetes?", "response": "Configure a kubelet image credential providerFEATURE STATE: Kubernetes v1.26 [stable]Starting from Kubernetes v1.20, the kubelet can dynamically retrieve credentials for a container image registry using exec plugins. The kubelet and the exec plugin communicate through stdio (stdin, stdout, and stderr) using Kubernetes versioned APIs. These plugins allow the kubelet to request credentials for a container registry dynamically as opposed to storing static credentials on disk. For example, the plugin may talk to a local metadata server to retrieve short-lived credentials for an image that is being pulled by the kubelet.You may be interested in using this capability if any of the below are true:API calls to a cloud provider service are required to retrieve authentication information for a registry.Credentials have short expiration times and requesting new credentials frequently is required.Storing registry credentials on disk or in imagePullSecrets is not acceptable.This guide demonstrates how to configure the kubelet's image credential provider plugin mechanism.Service Account Token for Image PullsFEATURE STATE: Kubernetes v1.34 [beta] (enabled by default: true)Starting from Kubernetes v1.33, the kubelet can be configured to send a service account token bound to the pod for which the image pull is being performed to the credential provider plugin.This allows the plugin to exchange the token for credentials to access the image registry.To enable this feature, the KubeletServiceAccountTokenForCredentialProviders feature gate must be enabled on the kubelet, and the tokenAttributes field must be set in the CredentialProviderConfig file for the plugin.The tokenAttributes field contains information about the service account token that will be passed to the plugin, including the intended audience for the token and whether the plugin requires the pod to have a service account.Using service account token credentials can enable the following use-cases:Avoid needing a kubelet/node-based identity to pull images from a registry.Allow workloads to pull images based on their own runtime identity without long-lived/persisted secrets.Before you beginYou need a Kubernetes cluster with nodes that support kubelet credential provider plugins. This support is available in Kubernetes 1.34; Kubernetes v1.24 and v1.25 included this as a beta feature, enabled by default.If you are configuring a credential provider plugin that requires the service account token, you need a Kubernetes cluster with nodes running Kubernetes v1.33 or later and the KubeletServiceAccountTokenForCredentialProviders feature gate enabled on the kubelet.A working implementation of a credential provider exec plugin. You can build your own plugin or use one provided by cloud providers.Your Kubernetes server must be at or later than version v1.26.To check the version, enter kubectl version.Installing Plugins on NodesA credential provider plugin is an executable binary that will be run by the kubelet. Ensure that the plugin binary exists on every node in your cluster and stored in a known directory. The directory will be required later when configuring kubelet flags.Configuring the KubeletIn order to use this feature, the kubelet expects two flags to be set:--image-credential-provider-config - the path to the credential provider plugin config file.--image-credential-provider-bin-dir - the path to the directory where credential provider plugin binaries are located.Configure a kubelet credential providerThe configuration file passed into --image-credential-provider-config is read by the kubelet to determine which exec plugins should be invoked for which container images. Here's an example configuration file you may end up using if you are using the ECR-based plugin:apiVersion: kubelet.config.k8s.io/v1 kind: CredentialProviderConfig # providers is a list of credential provider helper plugins that will be enabled by the kubelet. # Multiple providers may match against a single image, in which", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-credential-provider/", "id": "k8s_00133"}
{"instruction": "Write a yaml example for configure a kubelet image credential provider", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1\nkind: CredentialProviderConfig\n# providers is a list of credential provider helper plugins that will be enabled by the kubelet.\n# Multiple providers may match against a single image, in which case credentials\n# from all providers will be returned to the kubelet. If multiple providers are called\n# for a single image, the results are combined. If providers return overlapping\n# auth keys, the value from the provider earlier in this list is used.\nproviders:\n  # name is the required name of the credential provider. It must match the name of the\n  # provider executable as seen by the kubelet. The executable must be in the kubelet's\n  # bin directory (set by the --image-credential-provider-bin-dir flag).\n  - name: ecr-credential-provider\n    # matchImages is a required list of strings used to match against images in order to\n    # determine if this provider should be invoked. If one of the strings matches the\n    # requested image from the kubelet, the plugin will be invoked and given a chance\n    # to provide credentials. Images are expected to contain the registry domain\n    # and URL path.\n    #\n    # Each entry in matchImages is a pattern which can optionally contain a port and a path.\n    # Globs can be used in the domain, but not in the port or the path. Globs are supported\n    # as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'.\n    # Matching partial subdomains like 'app*.k8s.io' is also supported. Each glob can only match\n    # a single subdomain segment, so `*.io` does **not** match `*.k8s.io`.\n    #\n    # A match exists between an image and a matchImage when all of the below are true:\n    # - Both contain the same number of domain parts and each part matches.\n    # - The URL path of an matchImages must be a prefix of the target image URL path.\n    # - If the matchImages contains a port, then the port must match in the image as well.\n    #\n    # Example values of matchImages:\n    # - 123456789.dkr.ecr.us-east-1.amazonaws.com\n    # - *.azurecr.io\n    # - gcr.io\n    # - *.*.registry.io\n    # - registry.io:8080/path\n    matchImages:\n      - \"*.dkr.ecr.*.amazonaws.com\"\n      - \"*.dkr.ecr.*.amazonaws.com.cn\"\n      - \"*.dkr.ecr-fips.*.amazonaws.com\"\n      - \"*.dkr.ecr.us-iso-east-1.c2s.ic.gov\"\n      - \"*.dkr.ecr.us-isob-east-1.sc2s.sgov.gov\"\n    # defaultCacheDuration is the default duration the plugin will cache credentials in-memory\n    # if a cache duration is not provided in the plugin response. This field is required.\n    defaultCacheDuration: \"12h\"\n    # Required input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse\n    # MUST use the same encoding version as the input. Current supported values are:\n    # - credentialprovider.kubelet.k8s.io/v1\n    apiVersion: credentialprovider.kubelet.k8s.io/v1\n    # Arguments to pass to the command when executing it.\n    # +optional\n    # args:\n    #   - --example-argument\n    # Env defines additional environment variables to expose to the process. These\n    # are unioned with the host's environment, as well as variables client-go uses\n    # to pass argument to the plugin.\n    # +optional\n    env:\n      - name: AWS_PROFILE\n        value: example_profile\n\n    # tokenAttributes is the configuration for the service account token that will be passed to the plugin.\n    # The credential provider opts in to using service account tokens for image pull by setting this field.\n    # if this field is set without the `KubeletServiceAccountTokenForCredentialProviders` feature gate enabled, \n    # kubelet will fail to start with invalid configuration error.\n    # +optional\n    tokenAttributes:\n      # serviceAccountTokenAudience is the intended audience for the projected service account token.\n      # +required\n      serviceAccountTokenAudience: \"<audience for the token>\"\n      # cacheType indicates the type of cache key use for caching the credentials returned by the plugin\n      # when the service account token is used.\n      # The most conservative option is to set this to \"Token\", which means the kubelet will cache\n      # returned credentials on a per-token basis. This should be set if the returned credential's\n      # lifetime is limited to the service account token's lifetime.\n      # If the plugin's credential retrieval logic depends only on the service account and not on\n      # pod-specific claims, then the plugin can set this to \"ServiceAccount\". In this case, the\n      # kubelet will cache returned credentials on a per-serviceaccount basis. Use this when the\n      # returned credential is valid for all pods using the same service account.\n      # +required\n      cacheType: \"<Token or ServiceAccount>\"\n      # requireServiceAccount indicates whether the plugin requires the pod to have a service account.\n      # If set to true, kubelet will only invoke the plugin if the pod has a service account.\n      # If set to false, kubelet will invoke the plugin even if the pod does not have a service account\n      # and will not include a token in the CredentialProviderRequest. This is useful for plugins\n      # that are used to pull images for pods without service accounts (e.g., static pods).\n      # +required\n      requireServiceAccount: true\n      # requiredServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are required to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. If any of the keys defined in this list\n      # are not present in the service account, kubelet will not invoke the plugin and will return an error.\n      # This field is optional and may be empty. Plugins may use this field to extract additional information\n      # required to fetch credentials or allow workloads to opt in to using service account tokens for image pull.\n      # If non-empty, requireServiceAccount must be set to true.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # optionalServiceAccountAnnotationKeys list.\n      # +optional\n      requiredServiceAccountAnnotationKeys:\n      - \"example.com/required-annotation-key-1\"\n      - \"example.com/required-annotation-key-2\"\n      # optionalServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are optional to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. The plugin is responsible for validating the\n      # existence of annotations and their values. This field is optional and may be empty.\n      # Plugins may use this field to extract additional information required to fetch credentials.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # requiredServiceAccountAnnotationKeys list.\n      # +optional\n      optionalServiceAccountAnnotationKeys:\n      - \"example.com/optional-annotation-key-1\"\n      - \"example.com/optional-annotation-key-2\"\n```\n\nConfigure a kubelet image credential provider | The providers field is a list of enabled plugins used by the kubelet. Each entry has a few required fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-credential-provider/", "id": "k8s_00133_code_1795"}
{"instruction": "Write a yaml example for configure a kubelet image credential provider", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1\nkind: CredentialProviderConfig\n# providers is a list of credential provider helper plugins that will be enabled by the kubelet.\n# Multiple providers may match against a single image, in which case credentials\n# from all providers will be returned to the kubelet. If multiple providers are called\n# for a single image, the results are combined. If providers return overlapping\n# auth keys, the value from the provider earlier in this list is used.\nproviders:\n  # name is the required name of the credential provider. It must match the name of the\n  # provider executable as seen by the kubelet. The executable must be in the kubelet's\n  # bin directory (set by the --image-credential-provider-bin-dir flag).\n  - name: ecr-credential-provider\n    # matchImages is a required list of strings used to match against images in order to\n    # determine if this provider should be invoked. If one of the strings matches the\n    # requested image from the kubelet, the plugin will be invoked and given a chance\n    # to provide credentials. Images are expected to contain the registry domain\n    # and URL path.\n    #\n    # Each entry in matchImages is a pattern which can optionally contain a port and a path.\n    # Globs can be used in the domain, but not in the port or the path. Globs are supported\n    # as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'.\n    # Matching partial subdomains like 'app*.k8s.io' is also supported. Each glob can only match\n    # a single subdomain segment, so `*.io` does **not** match `*.k8s.io`.\n    #\n    # A match exists between an image and a matchImage when all of the below are true:\n    # - Both contain the same number of domain parts and each part matches.\n    # - The URL path of an matchImages must be a prefix of the target image URL path.\n    # - If the matchImages contains a port, then the port must match in the image as well.\n    #\n    # Example values of matchImages:\n    # - 123456789.dkr.ecr.us-east-1.amazonaws.com\n    # - *.azurecr.io\n    # - gcr.io\n    # - *.*.registry.io\n    # - registry.io:8080/path\n    matchImages:\n      - \"*.dkr.ecr.*.amazonaws.com\"\n      - \"*.dkr.ecr.*.amazonaws.com.cn\"\n      - \"*.dkr.ecr-fips.*.amazonaws.com\"\n      - \"*.dkr.ecr.us-iso-east-1.c2s.ic.gov\"\n      - \"*.dkr.ecr.us-isob-east-1.sc2s.sgov.gov\"\n    # defaultCacheDuration is the default duration the plugin will cache credentials in-memory\n    # if a cache duration is not provided in the plugin response. This field is required.\n    defaultCacheDuration: \"12h\"\n    # Required input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse\n    # MUST use the same encoding version as the input. Current supported values are:\n    # - credentialprovider.kubelet.k8s.io/v1\n    apiVersion: credentialprovider.kubelet.k8s.io/v1\n    # Arguments to pass to the command when executing it.\n    # +optional\n    # args:\n    #   - --example-argument\n    # Env defines additional environment variables to expose to the process. These\n    # are unioned with the host's environment, as well as variables client-go uses\n    # to pass argument to the plugin.\n    # +optional\n    env:\n      - name: AWS_PROFILE\n        value: example_profile\n\n    # tokenAttributes is the configuration for the service account token that will be passed to the plugin.\n    # The credential provider opts in to using service account tokens for image pull by setting this field.\n    # if this field is set without the `KubeletServiceAccountTokenForCredentialProviders` feature gate enabled, \n    # kubelet will fail to start with invalid configuration error.\n    # +optional\n    tokenAttributes:\n      # serviceAccountTokenAudience is the intended audience for the projected service account token.\n      # +required\n      serviceAccountTokenAudience: \"<audience for the token>\"\n      # cacheType indicates the type of cache key use for caching the credentials returned by the plugin\n      # when the service account token is used.\n      # The most conservative option is to set this to \"Token\", which means the kubelet will cache\n      # returned credentials on a per-token basis. This should be set if the returned credential's\n      # lifetime is limited to the service account token's lifetime.\n      # If the plugin's credential retrieval logic depends only on the service account and not on\n      # pod-specific claims, then the plugin can set this to \"ServiceAccount\". In this case, the\n      # kubelet will cache returned credentials on a per-serviceaccount basis. Use this when the\n      # returned credential is valid for all pods using the same service account.\n      # +required\n      cacheType: \"<Token or ServiceAccount>\"\n      # requireServiceAccount indicates whether the plugin requires the pod to have a service account.\n      # If set to true, kubelet will only invoke the plugin if the pod has a service account.\n      # If set to false, kubelet will invoke the plugin even if the pod does not have a service account\n      # and will not include a token in the CredentialProviderRequest. This is useful for plugins\n      # that are used to pull images for pods without service accounts (e.g., static pods).\n      # +required\n      requireServiceAccount: true\n      # requiredServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are required to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. If any of the keys defined in this list\n      # are not present in the service account, kubelet will not invoke the plugin and will return an error.\n      # This field is optional and may be empty. Plugins may use this field to extract additional information\n      # required to fetch credentials or allow workloads to opt in to using service account tokens for image pull.\n      # If non-empty, requireServiceAccount must be set to true.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # optionalServiceAccountAnnotationKeys list.\n      # +optional\n      requiredServiceAccountAnnotationKeys:\n      - \"example.com/required-annotation-key-1\"\n      - \"example.com/required-annotation-key-2\"\n      # optionalServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are optional to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. The plugin is responsible for validating the\n      # existence of annotations and their values. This field is optional and may be empty.\n      # Plugins may use this field to extract additional information required to fetch credentials.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # requiredServiceAccountAnnotationKeys list.\n      # +optional\n      optionalServiceAccountAnnotationKeys:\n      - \"example.com/optional-annotation-key-1\"\n      - \"example.com/optional-annotation-key-2\"\n```\n\nConfigure a kubelet image credential provider | The providers field is a list of enabled plugins used by the kubelet. Each entry has a few required fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-credential-provider/", "id": "k8s_00133_code_1796"}
{"instruction": "Write a yaml example for configure a kubelet image credential provider", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1\nkind: CredentialProviderConfig\n# providers is a list of credential provider helper plugins that will be enabled by the kubelet.\n# Multiple providers may match against a single image, in which case credentials\n# from all providers will be returned to the kubelet. If multiple providers are called\n# for a single image, the results are combined. If providers return overlapping\n# auth keys, the value from the provider earlier in this list is used.\nproviders:\n  # name is the required name of the credential provider. It must match the name of the\n  # provider executable as seen by the kubelet. The executable must be in the kubelet's\n  # bin directory (set by the --image-credential-provider-bin-dir flag).\n  - name: ecr-credential-provider\n    # matchImages is a required list of strings used to match against images in order to\n    # determine if this provider should be invoked. If one of the strings matches the\n    # requested image from the kubelet, the plugin will be invoked and given a chance\n    # to provide credentials. Images are expected to contain the registry domain\n    # and URL path.\n    #\n    # Each entry in matchImages is a pattern which can optionally contain a port and a path.\n    # Globs can be used in the domain, but not in the port or the path. Globs are supported\n    # as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'.\n    # Matching partial subdomains like 'app*.k8s.io' is also supported. Each glob can only match\n    # a single subdomain segment, so `*.io` does **not** match `*.k8s.io`.\n    #\n    # A match exists between an image and a matchImage when all of the below are true:\n    # - Both contain the same number of domain parts and each part matches.\n    # - The URL path of an matchImages must be a prefix of the target image URL path.\n    # - If the matchImages contains a port, then the port must match in the image as well.\n    #\n    # Example values of matchImages:\n    # - 123456789.dkr.ecr.us-east-1.amazonaws.com\n    # - *.azurecr.io\n    # - gcr.io\n    # - *.*.registry.io\n    # - registry.io:8080/path\n    matchImages:\n      - \"*.dkr.ecr.*.amazonaws.com\"\n      - \"*.dkr.ecr.*.amazonaws.com.cn\"\n      - \"*.dkr.ecr-fips.*.amazonaws.com\"\n      - \"*.dkr.ecr.us-iso-east-1.c2s.ic.gov\"\n      - \"*.dkr.ecr.us-isob-east-1.sc2s.sgov.gov\"\n    # defaultCacheDuration is the default duration the plugin will cache credentials in-memory\n    # if a cache duration is not provided in the plugin response. This field is required.\n    defaultCacheDuration: \"12h\"\n    # Required input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse\n    # MUST use the same encoding version as the input. Current supported values are:\n    # - credentialprovider.kubelet.k8s.io/v1\n    apiVersion: credentialprovider.kubelet.k8s.io/v1\n    # Arguments to pass to the command when executing it.\n    # +optional\n    # args:\n    #   - --example-argument\n    # Env defines additional environment variables to expose to the process. These\n    # are unioned with the host's environment, as well as variables client-go uses\n    # to pass argument to the plugin.\n    # +optional\n    env:\n      - name: AWS_PROFILE\n        value: example_profile\n\n    # tokenAttributes is the configuration for the service account token that will be passed to the plugin.\n    # The credential provider opts in to using service account tokens for image pull by setting this field.\n    # if this field is set without the `KubeletServiceAccountTokenForCredentialProviders` feature gate enabled, \n    # kubelet will fail to start with invalid configuration error.\n    # +optional\n    tokenAttributes:\n      # serviceAccountTokenAudience is the intended audience for the projected service account token.\n      # +required\n      serviceAccountTokenAudience: \"<audience for the token>\"\n      # cacheType indicates the type of cache key use for caching the credentials returned by the plugin\n      # when the service account token is used.\n      # The most conservative option is to set this to \"Token\", which means the kubelet will cache\n      # returned credentials on a per-token basis. This should be set if the returned credential's\n      # lifetime is limited to the service account token's lifetime.\n      # If the plugin's credential retrieval logic depends only on the service account and not on\n      # pod-specific claims, then the plugin can set this to \"ServiceAccount\". In this case, the\n      # kubelet will cache returned credentials on a per-serviceaccount basis. Use this when the\n      # returned credential is valid for all pods using the same service account.\n      # +required\n      cacheType: \"<Token or ServiceAccount>\"\n      # requireServiceAccount indicates whether the plugin requires the pod to have a service account.\n      # If set to true, kubelet will only invoke the plugin if the pod has a service account.\n      # If set to false, kubelet will invoke the plugin even if the pod does not have a service account\n      # and will not include a token in the CredentialProviderRequest. This is useful for plugins\n      # that are used to pull images for pods without service accounts (e.g., static pods).\n      # +required\n      requireServiceAccount: true\n      # requiredServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are required to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. If any of the keys defined in this list\n      # are not present in the service account, kubelet will not invoke the plugin and will return an error.\n      # This field is optional and may be empty. Plugins may use this field to extract additional information\n      # required to fetch credentials or allow workloads to opt in to using service account tokens for image pull.\n      # If non-empty, requireServiceAccount must be set to true.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # optionalServiceAccountAnnotationKeys list.\n      # +optional\n      requiredServiceAccountAnnotationKeys:\n      - \"example.com/required-annotation-key-1\"\n      - \"example.com/required-annotation-key-2\"\n      # optionalServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are optional to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. The plugin is responsible for validating the\n      # existence of annotations and their values. This field is optional and may be empty.\n      # Plugins may use this field to extract additional information required to fetch credentials.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # requiredServiceAccountAnnotationKeys list.\n      # +optional\n      optionalServiceAccountAnnotationKeys:\n      - \"example.com/optional-annotation-key-1\"\n      - \"example.com/optional-annotation-key-2\"\n```\n\nConfigure a kubelet image credential provider | The providers field is a list of enabled plugins used by the kubelet. Each entry has a few required fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-credential-provider/", "id": "k8s_00133_code_1797"}
{"instruction": "How do you troubleshooting kubectl in Kubernetes?", "response": "Troubleshooting kubectlThis documentation is about investigating and diagnosing kubectl related issues. If you encounter issues accessing kubectl or connecting to your cluster, this document outlines various common scenarios and potential solutions to help identify and address the likely cause.Before you beginYou need to have a Kubernetes cluster.You also need to have kubectl installed - see install toolsVerify kubectl setupMake sure you have installed and configured kubectl correctly on your local machine. Check the kubectl version to ensure it is up-to-date and compatible with your cluster.Check kubectl version:kubectl version You'll see a similar output:Client Version: version.Info{Major:\"1\", Minor:\"27\", GitVersion:\"v1.27.4\",GitCommit:\"fa3d7990104d7c1f16943a67f11b154b71f6a132\", GitTreeState:\"clean\",BuildDate:\"2023-07-19T12:20:54Z\", GoVersion:\"go1.20.6\", Compiler:\"gc\", Platform:\"linux/amd64\"} Kustomize Version: v5.0.1 Server Version: version.Info{Major:\"1\", Minor:\"27\", GitVersion:\"v1.27.3\",GitCommit:\"25b4e43193bcda6c7328a6d147b1fb73a33f1598\", GitTreeState:\"clean\",BuildDate:\"2023-06-14T09:47:40Z\", GoVersion:\"go1.20.5\", Compiler:\"gc\", Platform:\"linux/amd64\"} If you see Unable to connect to the server: dial tcp <server-ip>:8443: i/o timeout, instead of Server Version, you need to troubleshoot kubectl connectivity with your cluster.Make sure you have installed the kubectl by following the official documentation for installing kubectl, and you have properly configured the $PATH environment variable.Check kubeconfigThe kubectl requires a kubeconfig file to connect to a Kubernetes cluster. The kubeconfig file is usually located under the ~/.kube/config directory. Make sure that you have a valid kubeconfig file. If you don't have a kubeconfig file, you can obtain it from your Kubernetes administrator, or you can copy it from your Kubernetes control plane's /etc/kubernetes/admin.conf directory. If you have deployed your Kubernetes cluster on a cloud platform and lost your kubeconfig file, you can re-generate it using your cloud provider's tools. Refer the cloud provider's documentation for re-generating a kubeconfig file.Check if the $KUBECONFIG environment variable is configured correctly. You can set $KUBECONFIGenvironment variable or use the --kubeconfig parameter with the kubectl to specify the directory of a kubeconfig file.Check VPN connectivityIf you are using a Virtual Private Network (VPN) to access your Kubernetes cluster, make sure that your VPN connection is active and stable. Sometimes, VPN disconnections can lead to connection issues with the cluster. Reconnect to the VPN and try accessing the cluster again.Authentication and authorizationIf you are using the token based authentication and the kubectl is returning an error regarding the authentication token or authentication server address, validate the Kubernetes authentication token and the authentication server address are configured properly.If kubectl is returning an error regarding the authorization, make sure that you are using the valid user credentials. And you have the permission to access the resource that you have requested.Verify contextsKubernetes supports multiple clusters and contexts. Ensure that you are using the correct context to interact with your cluster.List available contexts:kubectl config get-contexts Switch to the appropriate context:kubectl config use-context <context-name> API server and load balancerThe kube-apiserver server is the central component of a Kubernetes cluster. If the API server or the load balancer that runs in front of your API servers is not reachable or not responding, you won't be able to interact with the cluster.Check the if the API server's host is reachable by using ping command. Check cluster's network connectivity and firewall. If your are using a cloud provider for deploying the cluster, check your cloud provider's health check status for the cluster's API server.Verify the status of the load balancer (if used) to e", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nTroubleshooting kubectl | Switch to the appropriate context:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1799"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context <context-name>\n```\n\nTroubleshooting kubectl | The kube-apiserver server is the central component of a Kubernetes cluster. If the API server or the load balancer that runs in front of your API servers is not reachable or not responding, you won't", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1800"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.clusters[0].cluster.certificate-authority-data}' | base64 -d | openssl x509 -noout -dates\n```\n\nTroubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1801"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.users[0].user.client-certificate-data}'| base64 -d | openssl x509 -noout -dates\n```\n\nTroubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1802"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nTroubleshooting kubectl | Switch to the appropriate context:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1803"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context <context-name>\n```\n\nTroubleshooting kubectl | The kube-apiserver server is the central component of a Kubernetes cluster. If the API server or the load balancer that runs in front of your API servers is not reachable or not responding, you won't", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1804"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.clusters[0].cluster.certificate-authority-data}' | base64 -d | openssl x509 -noout -dates\n```\n\nTroubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1805"}
{"instruction": "Write a bash example for troubleshooting kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.users[0].user.client-certificate-data}'| base64 -d | openssl x509 -noout -dates\n```\n\nTroubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/troubleshoot-kubectl/", "id": "k8s_00134_code_1806"}
{"instruction": "Provide a tutorial on tutorials", "response": "This section of the Kubernetes documentation contains tutorials. A tutorial shows how to accomplish a goal that is larger than a single task. Typically a tutorial has several sections, each of which has a sequence of steps. Before walking through each tutorial, you may want to bookmark the Standardized Glossary page for later references.BasicsKubernetes Basics is an in-depth interactive tutorial that helps you understand the Kubernetes system and try out some basic Kubernetes features.Introduction to Kubernetes (edX)Hello MinikubeConfigurationConfiguring Redis Using a ConfigMapAuthoring PodsAdopting Sidecar ContainersStateless ApplicationsExposing an External IP Address to Access an Application in a ClusterExample: Deploying PHP Guestbook application with RedisStateful ApplicationsStatefulSet BasicsExample: WordPress and MySQL with Persistent VolumesExample: Deploying Cassandra with Stateful SetsRunning ZooKeeper, A CP Distributed SystemServicesConnecting Applications with ServicesUsing Source IPSecurityApply Pod Security Standards at Cluster levelApply Pod Security Standards at Namespace levelRestrict a Container's Access to Resources with AppArmorSeccompCluster ManagementConfiguring Swap Memory on Kubernetes NodesRunning Kubelet in Standalone ModeInstall Drivers and Allocate Devices with DRAWhat's nextIf you would like to write a tutorial, see Content Page Types for information about the tutorial page type.", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/", "id": "k8s_00135"}
{"instruction": "Explain creating highly available clusters with kubeadm in Kubernetes", "response": "Creating Highly Available Clusters with kubeadmThis page explains two different approaches to setting up a highly available Kubernetes cluster using kubeadm:With stacked control plane nodes. This approach requires less infrastructure. The etcd members and control plane nodes are co-located.With an external etcd cluster. This approach requires more infrastructure. The control plane nodes and etcd members are separated.Before proceeding, you should carefully consider which approach best meets the needs of your applications and environment. Options for Highly Available topology outlines the advantages and disadvantages of each.If you encounter issues with setting up the HA cluster, please report these in the kubeadm issue tracker.See also the upgrade documentation.Caution:This page does not address running your cluster on a cloud provider. In a cloud environment, neither approach documented here works with Service objects of type LoadBalancer, or with dynamic PersistentVolumes.Before you beginThe prerequisites depend on which topology you have selected for your cluster's control plane:You need:Three or more machines that meet kubeadm's minimum requirements for the control-plane nodes. Having an odd number of control plane nodes can help with leader selection in the case of machine or zone failure.including a container runtime, already set up and workingThree or more machines that meet kubeadm's minimum requirements for the workersincluding a container runtime, already set up and workingFull network connectivity between all machines in the cluster (public or private network)Superuser privileges on all machines using sudoYou can use a different tool; this guide uses sudo in the examples.SSH access from one device to all nodes in the systemkubeadm and kubelet already installed on all machines.See Stacked etcd topology for context.You need:Three or more machines that meet kubeadm's minimum requirements for the control-plane nodes. Having an odd number of control plane nodes can help with leader selection in the case of machine or zone failure.including a container runtime, already set up and workingThree or more machines that meet kubeadm's minimum requirements for the workersincluding a container runtime, already set up and workingFull network connectivity between all machines in the cluster (public or private network)Superuser privileges on all machines using sudoYou can use a different tool; this guide uses sudo in the examples.SSH access from one device to all nodes in the systemkubeadm and kubelet already installed on all machines.And you also need:Three or more additional machines, that will become etcd cluster members. Having an odd number of members in the etcd cluster is a requirement for achieving optimal voting quorum.These machines again need to have kubeadm and kubelet installed.These machines also require a container runtime, that is already set up and working.See External etcd topology for context.Container imagesEach host should have access read and fetch images from the Kubernetes container image registry, registry.k8s.io. If you want to deploy a highly-available cluster where the hosts do not have access to pull images, this is possible. You must ensure by some other means that the correct container images are already available on the relevant hosts.Command line interfaceTo manage Kubernetes once your cluster is set up, you should install kubectl on your PC. It is also useful to install the kubectl tool on each control plane node, as this can be helpful for troubleshooting.First steps for both methodsCreate load balancer for kube-apiserverNote:There are many configurations for load balancers. The following example is only one option. Your cluster requirements may need a different configuration.Create a kube-apiserver load balancer with a name that resolves to DNS.In a cloud environment you should place your control plane nodes behind a TCP forwarding load balancer. This load balancer distributes traffic to all healt", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/", "id": "k8s_00136"}
{"instruction": "Write a bash example for creating highly available clusters with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -n kube-system -w\n```\n\nCreating Highly Available Clusters with kubeadm | For each additional control plane node you should:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/", "id": "k8s_00136_code_1809"}
{"instruction": "Write a yaml example for creating highly available clusters with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: stable\ncontrolPlaneEndpoint: \"LOAD_BALANCER_DNS:LOAD_BALANCER_PORT\" # change this (see below)\netcd:\n  external:\n    endpoints:\n      - https://ETCD_0_IP:2379 # change ETCD_0_IP appropriately\n      - https://ETCD_1_IP:2379 # change ETCD_1_IP appropriately\n      - https://ETCD_2_IP:2379 # change ETCD_2_IP appropriately\n    caFile: /etc/kubernetes/pki/etcd/ca.crt\n    certFile: /etc/kubernetes/pki/apiserver-etcd-client.crt\n    keyFile: /etc/kubernetes/pki/apiserver-etcd-client.key\n```\n\nCreating Highly Available Clusters with kubeadm | Replace the following variables in the config template with the appropriate values for your cluster:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/", "id": "k8s_00136_code_1810"}
{"instruction": "Write a bash example for creating highly available clusters with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system rollout restart deployment coredns\n```\n\nCreating Highly Available Clusters with kubeadm | Setting up a cluster with external etcd nodes is similar to the procedure used for stacked etcd with the exception that you should setup etcd first, and you should pass the etcd information in the kub", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/", "id": "k8s_00136_code_1811"}
{"instruction": "Write a yaml example for creating highly available clusters with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: stable\ncontrolPlaneEndpoint: \"LOAD_BALANCER_DNS:LOAD_BALANCER_PORT\" # change this (see below)\netcd:\n  external:\n    endpoints:\n      - https://ETCD_0_IP:2379 # change ETCD_0_IP appropriately\n      - https://ETCD_1_IP:2379 # change ETCD_1_IP appropriately\n      - https://ETCD_2_IP:2379 # change ETCD_2_IP appropriately\n    caFile: /etc/kubernetes/pki/etcd/ca.crt\n    certFile: /etc/kubernetes/pki/apiserver-etcd-client.crt\n    keyFile: /etc/kubernetes/pki/apiserver-etcd-client.key\n```\n\nCreating Highly Available Clusters with kubeadm | Replace the following variables in the config template with the appropriate values for your cluster:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/", "id": "k8s_00136_code_1812"}
{"instruction": "Write a bash example for creating highly available clusters with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -n kube-system -w\n```\n\nCreating Highly Available Clusters with kubeadm | For each additional control plane node you should:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/", "id": "k8s_00136_code_1813"}
{"instruction": "Write a yaml example for creating highly available clusters with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nkubernetesVersion: stable\ncontrolPlaneEndpoint: \"LOAD_BALANCER_DNS:LOAD_BALANCER_PORT\" # change this (see below)\netcd:\n  external:\n    endpoints:\n      - https://ETCD_0_IP:2379 # change ETCD_0_IP appropriately\n      - https://ETCD_1_IP:2379 # change ETCD_1_IP appropriately\n      - https://ETCD_2_IP:2379 # change ETCD_2_IP appropriately\n    caFile: /etc/kubernetes/pki/etcd/ca.crt\n    certFile: /etc/kubernetes/pki/apiserver-etcd-client.crt\n    keyFile: /etc/kubernetes/pki/apiserver-etcd-client.key\n```\n\nCreating Highly Available Clusters with kubeadm | Replace the following variables in the config template with the appropriate values for your cluster:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/", "id": "k8s_00136_code_1814"}
{"instruction": "How do you configure liveness, readiness and startup probes in Kubernetes?", "response": "Configure Liveness, Readiness and Startup ProbesThis page shows how to configure liveness, readiness and startup probes for containers.For more information about probes, see Liveness, Readiness and Startup ProbesThe kubelet uses liveness probes to know when to restart a container. For example, liveness probes could catch a deadlock, where an application is running, but unable to make progress. Restarting a container in such a state can help to make the application more available despite bugs.A common pattern for liveness probes is to use the same low-cost HTTP endpoint as for readiness probes, but with a higher failureThreshold. This ensures that the pod is observed as not-ready for some period of time before it is hard killed.The kubelet uses readiness probes to know when a container is ready to start accepting traffic. One use of this signal is to control which Pods are used as backends for Services. A Pod is considered ready when its Ready condition is true. When a Pod is not ready, it is removed from Service load balancers. A Pod's Ready condition is false when its Node's Ready condition is not true, when one of the Pod's readinessGates is false, or when at least one of its containers is not ready.The kubelet uses startup probes to know when a container application has started. If such a probe is configured, liveness and readiness probes do not start until it succeeds, making sure those probes don't interfere with the application startup. This can be used to adopt liveness checks on slow starting containers, avoiding them getting killed by the kubelet before they are up and running.Caution:Liveness probes can be a powerful way to recover from application failures, but they should be used with caution. Liveness probes must be configured carefully to ensure that they truly indicate unrecoverable application failure, for example a deadlock.Note:Incorrect implementation of liveness probes can lead to cascading failures. This results in restarting of container under high load; failed client requests as your application became less scalable; and increased workload on remaining pods due to some failed pods. Understand the difference between readiness and liveness probes and when to apply them for your app.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesDefine a liveness commandMany applications running for long periods of time eventually transition to broken states, and cannot recover except by being restarted. Kubernetes provides liveness probes to detect and remedy such situations.In this exercise, you create a Pod that runs a container based on the registry.k8s.io/busybox:1.27.2 image. Here is the configuration file for the Pod:pods/probe/exec-liveness.yaml apiVersion: v1 kind: Pod metadata: labels: test: liveness name: liveness-exec spec: containers: - name: liveness image: registry.k8s.io/busybox:1.27.2 args: - /bin/sh - -c - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600 livenessProbe: exec: command: - cat - /tmp/healthy initialDelaySeconds: 5 periodSeconds: 5 In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds field tells the kubelet that it should wait 5 seconds before performing the first probe. To perform a probe, the kubelet executes the command cat /tmp/healthy in the target container. If the command succeeds, it returns 0, and the kubelet considers the container to be alive and healthy. If the command returns a non-zero value, the kubelet kills the container and restarts it.W", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1816"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | Within 30 seconds, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1817"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\nConfigure Liveness, Readiness and Startup Probes | The output indicates that no liveness probes have failed yet:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1818"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\nConfigure Liveness, Readiness and Startup Probes | At the bottom of the output, there are messages indicating that the liveness probes have failed, and the failed containers have been killed and recreated.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1819"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl get pod liveness-exec\n```\n\nConfigure Liveness, Readiness and Startup Probes | The output shows that RESTARTS has been incremented. Note that the RESTARTS counter increments as soon as a failed container comes back to the running state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1820"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1821"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/http-liveness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | After 10 seconds, view Pod events to verify that liveness probes have failed and the container has been restarted:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1822"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-http\n```\n\nConfigure Liveness, Readiness and Startup Probes | In releases after v1.13, local HTTP proxy environment variable settings do not affect the HTTP liveness probe.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1823"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1824"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that liveness probes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1825"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod goproxy\n```\n\nConfigure Liveness, Readiness and Startup Probes | If your application implements the gRPC Health Checking Protocol, this example shows how to configure Kubernetes to use it for application liveness checks. Similarly you can configure readiness and st", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1826"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1827"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/grpc-liveness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that the liveness check has not failed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1828"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod etcd-with-grpc\n```\n\nConfigure Liveness, Readiness and Startup Probes | When using a gRPC probe, there are some technical details to be aware of:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1829"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1830"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1831"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1832"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1833"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\nports:\n- name: liveness-port\n  containerPort: 8080\n\nlivenessProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n```\n\nConfigure Liveness, Readiness and Startup Probes | Sometimes, you have to deal with applications that require additional startup time on their first initialization. In such cases, it can be tricky to set up liveness probe parameters without compromisi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1834"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\nports:\n- name: liveness-port\n  containerPort: 8080\n\nlivenessProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n  failureThreshold: 1\n  periodSeconds: 10\n\nstartupProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n  failureThreshold: 30\n  periodSeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | Thanks to the startup probe, the application will have a maximum of 5 minutes (30 * 10 = 300s) to finish its startup. Once the startup probe has succeeded once, the liveness probe takes over to provid", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1835"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\nreadinessProbe:\n  exec:\n    command:\n    - cat\n    - /tmp/healthy\n  initialDelaySeconds: 5\n  periodSeconds: 5\n```\n\nConfigure Liveness, Readiness and Startup Probes | Configuration for HTTP and TCP readiness probes also remains identical to liveness probes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1836"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n  httpGet:\n    httpHeaders:\n      - name: Accept\n        value: application/json\n\nstartupProbe:\n  httpGet:\n    httpHeaders:\n      - name: User-Agent\n        value: MyUserAgent\n```\n\nConfigure Liveness, Readiness and Startup Probes | You can also remove these two headers by defining them with an empty value.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1837"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n  httpGet:\n    httpHeaders:\n      - name: Accept\n        value: \"\"\n\nstartupProbe:\n  httpGet:\n    httpHeaders:\n      - name: User-Agent\n        value: \"\"\n```\n\nConfigure Liveness, Readiness and Startup Probes | When the kubelet probes a Pod using HTTP, it only follows redirects if the redirect is to the same host. If the kubelet receives 11 or more redirects during probing, the probe is considered successful", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1838"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  terminationGracePeriodSeconds: 3600  # pod-level\n  containers:\n  - name: test\n    image: ...\n\n    ports:\n    - name: liveness-port\n      containerPort: 8080\n\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: liveness-port\n      failureThreshold: 1\n      periodSeconds: 60\n      # Override pod-level terminationGracePeriodSeconds #\n      terminationGracePeriodSeconds: 60\n```\n\nConfigure Liveness, Readiness and Startup Probes | Probe-level terminationGracePeriodSeconds cannot be set for readiness probes. It will be rejected by the API server.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1839"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\npods/probe/exec-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1840"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1841"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | Within 30 seconds, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1842"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\nConfigure Liveness, Readiness and Startup Probes | The output indicates that no liveness probes have failed yet:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1843"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\nConfigure Liveness, Readiness and Startup Probes | At the bottom of the output, there are messages indicating that the liveness probes have failed, and the failed containers have been killed and recreated.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1844"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl get pod liveness-exec\n```\n\nConfigure Liveness, Readiness and Startup Probes | The output shows that RESTARTS has been incremented. Note that the RESTARTS counter increments as soon as a failed container comes back to the running state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1845"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\npods/probe/http-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1846"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\nConfigure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1847"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/http-liveness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | After 10 seconds, view Pod events to verify that liveness probes have failed and the container has been restarted:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1848"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-http\n```\n\nConfigure Liveness, Readiness and Startup Probes | In releases after v1.13, local HTTP proxy environment variable settings do not affect the HTTP liveness probe.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1849"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\npods/probe/tcp-liveness-readiness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1850"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1851"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that liveness probes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1852"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod goproxy\n```\n\nConfigure Liveness, Readiness and Startup Probes | If your application implements the gRPC Health Checking Protocol, this example shows how to configure Kubernetes to use it for application liveness checks. Similarly you can configure readiness and st", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1853"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\npods/probe/grpc-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1854"}
{"instruction": "Write a yaml example for configure liveness, readiness and startup probes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\nConfigure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1855"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/grpc-liveness.yaml\n```\n\nConfigure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that the liveness check has not failed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1856"}
{"instruction": "Write a bash example for configure liveness, readiness and startup probes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod etcd-with-grpc\n```\n\nConfigure Liveness, Readiness and Startup Probes | When using a gRPC probe, there are some technical details to be aware of:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", "id": "k8s_00137_code_1857"}
{"instruction": "Explain the Kubernetes concept: Limit Ranges", "response": "Limit RangesBy default, containers run with unbounded compute resources on a Kubernetes cluster. Using Kubernetes resource quotas, administrators (also termed cluster operators) can restrict consumption and creation of cluster resources (such as CPU time, memory, and persistent storage) within a specified namespace. Within a namespace, a Pod can consume as much CPU and memory as is allowed by the ResourceQuotas that apply to that namespace. As a cluster operator, or as a namespace-level administrator, you might also be concerned about making sure that a single object cannot monopolize all available resources within a namespace.A LimitRange is a policy to constrain the resource allocations (limits and requests) that you can specify for each applicable object kind (such as Pod or PersistentVolumeClaim) in a namespace.A LimitRange provides constraints that can:Enforce minimum and maximum compute resources usage per Pod or Container in a namespace.Enforce minimum and maximum storage request per PersistentVolumeClaim in a namespace.Enforce a ratio between request and limit for a resource in a namespace.Set default request/limit for compute resources in a namespace and automatically inject them to Containers at runtime.Kubernetes constrains resource allocations to Pods in a particular namespace whenever there is at least one LimitRange object in that namespace.The name of a LimitRange object must be a valid DNS subdomain name.Constraints on resource limits and requestsThe administrator creates a LimitRange in a namespace.Users create (or try to create) objects in that namespace, such as Pods or PersistentVolumeClaims.First, the LimitRange admission controller applies default request and limit values for all Pods (and their containers) that do not set compute resource requirements.Second, the LimitRange tracks usage to ensure it does not exceed resource minimum, maximum and ratio defined in any LimitRange present in the namespace.If you attempt to create or update an object (Pod or PersistentVolumeClaim) that violates a LimitRange constraint, your request to the API server will fail with anHTTP status code 403 Forbidden and a message explaining the constraint that has been violated.If you add a LimitRange in a namespace that applies to compute-related resources such as cpu and memory, you must specify requests or limits for those values. Otherwise, the system may reject Pod creation.LimitRange validations occur only at Pod admission stage, not on running Pods. If you add or modify a LimitRange, the Pods that already exist in that namespace continue unchanged.If two or more LimitRange objects exist in the namespace, it is not deterministic which default value will be applied.LimitRange and admission checks for PodsA LimitRange does not check the consistency of the default values it applies. This means that a default value for the limit that is set by LimitRange may be less than the request value specified for the container in the spec that a client submits to the API server. If that happens, the final Pod will not be schedulable.For example, you define a LimitRange with below manifest:Note:The following examples operate within the default namespace of your cluster, as the namespace parameter is undefined and the LimitRange scope is limited to the namespace level. This implies that any references or operations within these examples will interact with elements within the default namespace of your cluster. You can override the operating namespace by configuring namespace in the metadata.namespace field.concepts/policy/limit-range/problematic-limit-range.yaml apiVersion: v1 kind: LimitRange metadata: name: cpu-resource-constraint spec: limits: - default: # this section defines default limits cpu: 500m defaultRequest: # this section defines default requests cpu: 500m max: # max and min define the limit range cpu: \"1\" min: cpu: 100m type: Container along with a Pod that declares a CPU resource request of 700m, but not a limit:concepts/polic", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\nLimit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1859"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\nLimit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1860"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\nLimit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1861"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\nLimit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1862"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\nLimit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1863"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\nLimit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1864"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/problematic-limit-range.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\nLimit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1865"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\nLimit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1866"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/example-conflict-with-limitrange-cpu.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\nLimit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1867"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\nLimit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1868"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/example-no-conflict-with-limitrange-cpu.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\nLimit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1869"}
{"instruction": "Write a yaml example for limit ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\nLimit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/limit-range/", "id": "k8s_00138_code_1870"}
{"instruction": "Provide a tutorial on apply pod security standards at the namespace level", "response": "Apply Pod Security Standards at the Namespace LevelNoteThis tutorial applies only for new clusters.Pod Security Admission is an admission controller that applies Pod Security Standards when pods are created. It is a feature GA'ed in v1.25. In this tutorial, you will enforce the baseline Pod Security Standard, one namespace at a time.You can also apply Pod Security Standards to multiple namespaces at once at the cluster level. For instructions, refer to Apply Pod Security Standards at the cluster level.Before you beginInstall the following on your workstation:kindkubectlCreate clusterCreate a kind cluster as follows:kind create cluster --name psa-ns-level The output is similar to this:Creating cluster \"psa-ns-level\" ... ✓ Ensuring node image (kindest/node:v1.34.0) 🖼 ✓ Preparing nodes 📦 ✓ Writing configuration 📜 ✓ Starting control-plane 🕹️ ✓ Installing CNI 🔌 ✓ Installing StorageClass 💾 Set kubectl context to \"kind-psa-ns-level\" You can now use your cluster with: kubectl cluster-info --context kind-psa-ns-level Not sure what to do next? 😅 Check out https://kind.sigs.k8s.io/docs/user/quick-start/ Set the kubectl context to the new cluster:kubectl cluster-info --context kind-psa-ns-level The output is similar to this:Kubernetes control plane is running at https://127.0.0.1:50996 CoreDNS is running at https://127.0.0.1:50996/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. Create a namespaceCreate a new namespace called example:kubectl create ns example The output is similar to this:namespace/example created Enable Pod Security Standards checking for that namespaceEnable Pod Security Standards on this namespace using labels supported by built-in Pod Security Admission. In this step you will configure a check to warn on Pods that don't meet the latest version of the baseline pod security standard.kubectl label --overwrite ns example \\ pod-security.kubernetes.io/warn=baseline \\ pod-security.kubernetes.io/warn-version=latest You can configure multiple pod security standard checks on any namespace, using labels. The following command will enforce the baseline Pod Security Standard, but warn and audit for restricted Pod Security Standards as per the latest version (default value)kubectl label --overwrite ns example \\ pod-security.kubernetes.io/enforce=baseline \\ pod-security.kubernetes.io/enforce-version=latest \\ pod-security.kubernetes.io/warn=restricted \\ pod-security.kubernetes.io/warn-version=latest \\ pod-security.kubernetes.io/audit=restricted \\ pod-security.kubernetes.io/audit-version=latest Verify the Pod Security Standard enforcementCreate a baseline Pod in the example namespace:kubectl apply -n example -f https://k8s.io/examples/security/example-baseline-pod.yaml The Pod does start OK; the output includes a warning. For example:Warning: would violate PodSecurity \"restricted:latest\": allowPrivilegeEscalation != false (container \"nginx\" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container \"nginx\" must set securityContext.capabilities.drop=[\"ALL\"]), runAsNonRoot != true (pod or container \"nginx\" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container \"nginx\" must set securityContext.seccompProfile.type to \"RuntimeDefault\" or \"Localhost\") pod/nginx created Create a baseline Pod in the default namespace:kubectl apply -n default -f https://k8s.io/examples/security/example-baseline-pod.yaml Output is similar to this:pod/nginx created The Pod Security Standards enforcement and warning settings were applied only to the example namespace. You could create the same Pod in the default namespace with no warnings.Clean upNow delete the cluster which you created above by running the following command:kind delete cluster --name psa-ns-level What's nextRun a shell script to perform all the preceding steps all at once.Create kind clusterCreate new namespaceApply baseline Pod Security Standard in", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-ns-level\n```\n\nApply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1872"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl create ns example\n```\n\nApply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1873"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n   pod-security.kubernetes.io/warn=baseline \\\n   pod-security.kubernetes.io/warn-version=latest\n```\n\nApply Pod Security Standards at the Namespace Level | You can configure multiple pod security standard checks on any namespace, using labels. The following command will enforce the baseline Pod Security Standard, but warn and audit for restricted Pod Sec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1874"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n  pod-security.kubernetes.io/enforce=baseline \\\n  pod-security.kubernetes.io/enforce-version=latest \\\n  pod-security.kubernetes.io/warn=restricted \\\n  pod-security.kubernetes.io/warn-version=latest \\\n  pod-security.kubernetes.io/audit=restricted \\\n  pod-security.kubernetes.io/audit-version=latest\n```\n\nApply Pod Security Standards at the Namespace Level | Create a baseline Pod in the example namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1875"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n example -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\nApply Pod Security Standards at the Namespace Level | The Pod does start OK; the output includes a warning. For example:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1876"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n default -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\nApply Pod Security Standards at the Namespace Level | Output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1877"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-ns-level\n```\n\nApply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1878"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl create ns example\n```\n\nApply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1879"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n   pod-security.kubernetes.io/warn=baseline \\\n   pod-security.kubernetes.io/warn-version=latest\n```\n\nApply Pod Security Standards at the Namespace Level | You can configure multiple pod security standard checks on any namespace, using labels. The following command will enforce the baseline Pod Security Standard, but warn and audit for restricted Pod Sec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1880"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n  pod-security.kubernetes.io/enforce=baseline \\\n  pod-security.kubernetes.io/enforce-version=latest \\\n  pod-security.kubernetes.io/warn=restricted \\\n  pod-security.kubernetes.io/warn-version=latest \\\n  pod-security.kubernetes.io/audit=restricted \\\n  pod-security.kubernetes.io/audit-version=latest\n```\n\nApply Pod Security Standards at the Namespace Level | Create a baseline Pod in the example namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1881"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n example -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\nApply Pod Security Standards at the Namespace Level | The Pod does start OK; the output includes a warning. For example:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1882"}
{"instruction": "Write a bash example for apply pod security standards at the namespace level", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n default -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\nApply Pod Security Standards at the Namespace Level | Output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/ns-level-pss/", "id": "k8s_00139_code_1883"}
{"instruction": "What is the reference documentation for kubectl config set-credentials?", "response": "kubectl config set-credentialsSynopsisSet a user entry in kubeconfig.Specifying a name that already exists will merge new fields on top of existing values. Client-certificate flags: --client-certificate=certfile --client-key=keyfile Bearer token flags: --token=bearer_token Basic auth flags: --username=basic_user --password=basic_password Bearer token and basic auth are mutually exclusive.kubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value] Examples # Set only the \"client-key\" field on the \"cluster-admin\" # entry, without touching other values kubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key # Set basic auth for the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif # Embed client certificate data in the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true # Enable the Google Compute Platform auth provider for the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --auth-provider=gcp # Enable the OpenID Connect auth provider for the \"cluster-admin\" entry with additional arguments kubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar # Remove the \"client-secret\" config value for the OpenID Connect auth provider for the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret- # Enable new exec auth plugin for the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1 # Enable new exec auth plugin for the \"cluster-admin\" entry with interactive mode kubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1 --exec-interactive-mode=Never # Define new exec auth plugin arguments for the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2 # Create or update exec auth plugin environment variables for the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2 # Remove exec auth plugin environment variables for the \"cluster-admin\" entry kubectl config set-credentials cluster-admin --exec-env=var-to-remove- Options--auth-provider stringAuth provider for the user entry in kubeconfig--auth-provider-arg strings'key=value' arguments for the auth provider--client-certificate stringPath to client-certificate file for the user entry in kubeconfig--client-key stringPath to client-key file for the user entry in kubeconfig--embed-certs tristate[=true]Embed client cert/key for the user entry in kubeconfig--exec-api-version stringAPI version of the exec credential plugin for the user entry in kubeconfig--exec-arg stringsNew arguments for the exec credential plugin command for the user entry in kubeconfig--exec-command stringCommand for the exec credential plugin for the user entry in kubeconfig--exec-env strings'key=value' environment values for the exec credential plugin--exec-interactive-mode stringInteractiveMode of the exec credentials plugin for the user entry in kubeconfig--exec-provide-cluster-info tristate[=true]ProvideClusterInfo of the exec credentials plugin for the user entry in kubeconfig-h, --helphelp for set-credentials--password stringpassword for the user entry in kubeconfig--token stringtoken for the user entry in kubeconfig--username stringusername for the user entry in kubeconfigParent Options Inherited--as stringUsername to impersona", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-credentials/", "id": "k8s_00140"}
{"instruction": "Write a bash example for kubectl config set-credentials", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value]\n```\n\nkubectl config set-credentials | Auth provider for the user entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-credentials/", "id": "k8s_00140_code_1885"}
{"instruction": "Write a bash example for kubectl config set-credentials", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value]\n```\n\nkubectl config set-credentials | Auth provider for the user entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-credentials/", "id": "k8s_00140_code_1886"}
{"instruction": "What is the reference documentation for kubernetes component sli metrics?", "response": "Kubernetes Component SLI MetricsHigh-level indicators for measuring the reliability and performance of Kubernetes components.FEATURE STATE: Kubernetes v1.27 [beta] (enabled by default: true)By default, Kubernetes 1.34 publishes Service Level Indicator (SLI) metrics for each Kubernetes component binary. This metric endpoint is exposed on the serving HTTPS port of each component, at the path /metrics/slis. The ComponentSLIs feature gate defaults to enabled for each Kubernetes component as of v1.27.SLI MetricsWith SLI metrics enabled, each Kubernetes component exposes two metrics, labeled per healthcheck:a gauge (which represents the current state of the healthcheck)a counter (which records the cumulative counts observed for each healthcheck state)You can use the metric information to calculate per-component availability statistics. For example, the API server checks the health of etcd. You can work out and report how available or unavailable etcd has been - as reported by its client, the API server.The prometheus gauge data looks like this:# HELP kubernetes_healthcheck [ALPHA] This metric records the result of a single healthcheck. # TYPE kubernetes_healthcheck gauge kubernetes_healthcheck{name=\"autoregister-completion\",type=\"healthz\"} 1 kubernetes_healthcheck{name=\"autoregister-completion\",type=\"readyz\"} 1 kubernetes_healthcheck{name=\"etcd\",type=\"healthz\"} 1 kubernetes_healthcheck{name=\"etcd\",type=\"readyz\"} 1 kubernetes_healthcheck{name=\"etcd-readiness\",type=\"readyz\"} 1 kubernetes_healthcheck{name=\"informer-sync\",type=\"readyz\"} 1 kubernetes_healthcheck{name=\"log\",type=\"healthz\"} 1 kubernetes_healthcheck{name=\"log\",type=\"readyz\"} 1 kubernetes_healthcheck{name=\"ping\",type=\"healthz\"} 1 kubernetes_healthcheck{name=\"ping\",type=\"readyz\"} 1 While the counter data looks like this:# HELP kubernetes_healthchecks_total [ALPHA] This metric records the results of all healthcheck. # TYPE kubernetes_healthchecks_total counter kubernetes_healthchecks_total{name=\"autoregister-completion\",status=\"error\",type=\"readyz\"} 1 kubernetes_healthchecks_total{name=\"autoregister-completion\",status=\"success\",type=\"healthz\"} 15 kubernetes_healthchecks_total{name=\"autoregister-completion\",status=\"success\",type=\"readyz\"} 14 kubernetes_healthchecks_total{name=\"etcd\",status=\"success\",type=\"healthz\"} 15 kubernetes_healthchecks_total{name=\"etcd\",status=\"success\",type=\"readyz\"} 15 kubernetes_healthchecks_total{name=\"etcd-readiness\",status=\"success\",type=\"readyz\"} 15 kubernetes_healthchecks_total{name=\"informer-sync\",status=\"error\",type=\"readyz\"} 1 kubernetes_healthchecks_total{name=\"informer-sync\",status=\"success\",type=\"readyz\"} 14 kubernetes_healthchecks_total{name=\"log\",status=\"success\",type=\"healthz\"} 15 kubernetes_healthchecks_total{name=\"log\",status=\"success\",type=\"readyz\"} 15 kubernetes_healthchecks_total{name=\"ping\",status=\"success\",type=\"healthz\"} 15 kubernetes_healthchecks_total{name=\"ping\",status=\"success\",type=\"readyz\"} 15 Using this dataThe component SLIs metrics endpoint is intended to be scraped at a high frequency. Scraping at a high frequency means that you end up with greater granularity of the gauge's signal, which can be then used to calculate SLOs. The /metrics/slis endpoint provides the raw data necessary to calculate an availability SLO for the respective Kubernetes component.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/slis/", "id": "k8s_00141"}
{"instruction": "Explain the Kubernetes concept: Volume Attributes Classes", "response": "Volume Attributes ClassesFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)This page assumes that you are familiar with StorageClasses, volumes and PersistentVolumes in Kubernetes.A VolumeAttributesClass provides a way for administrators to describe the mutable \"classes\" of storage they offer. Different classes might map to different quality-of-service levels. Kubernetes itself is un-opinionated about what these classes represent.This feature is generally available (GA) as of version 1.34, and users have the option to disable it.You can also only use VolumeAttributesClasses with storage backed by Container Storage Interface, and only where the relevant CSI driver implements the ModifyVolume API.The VolumeAttributesClass APIEach VolumeAttributesClass contains the driverName and parameters, which are used when a PersistentVolume (PV) belonging to the class needs to be dynamically provisioned or modified.The name of a VolumeAttributesClass object is significant and is how users can request a particular class. Administrators set the name and other parameters of a class when first creating VolumeAttributesClass objects. While the name of a VolumeAttributesClass object in a PersistentVolumeClaim is mutable, the parameters in an existing class are immutable.apiVersion: storage.k8s.io/v1 kind: VolumeAttributesClass metadata: name: silver driverName: pd.csi.storage.gke.io parameters: provisioned-iops: \"3000\" provisioned-throughput: \"50\" ProvisionerEach VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.The feature support for VolumeAttributesClass is implemented in kubernetes-csi/external-provisioner.You are not restricted to specifying the kubernetes-csi/external-provisioner. You can also run and specify external provisioners, which are independent programs that follow a specification defined by Kubernetes. Authors of external provisioners have full discretion over where their code lives, how the provisioner is shipped, how it needs to be run, what volume plugin it uses, etc.To understand how the provisioner works with VolumeAttributesClass, refer to the CSI external-provisioner documentation.ResizerEach VolumeAttributesClass has a resizer that determines what volume plugin is used for modifying PVs. The field driverName must be specified.The modifying volume feature support for VolumeAttributesClass is implemented in kubernetes-csi/external-resizer.For example, an existing PersistentVolumeClaim is using a VolumeAttributesClass named silver:apiVersion: v1 kind: PersistentVolumeClaim metadata: name: test-pv-claim spec: … volumeAttributesClassName: silver … A new VolumeAttributesClass gold is available in the cluster:apiVersion: storage.k8s.io/v1 kind: VolumeAttributesClass metadata: name: gold driverName: pd.csi.storage.gke.io parameters: iops: \"4000\" throughput: \"60\" The end user can update the PVC with the new VolumeAttributesClass gold and apply:apiVersion: v1 kind: PersistentVolumeClaim metadata: name: test-pv-claim spec: … volumeAttributesClassName: gold … To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.ParametersVolumeAttributeClasses have parameters that describe volumes belonging to them. Different parameters may be accepted depending on the provisioner or the resizer. For example, the value 4000, for the parameter iops, and the parameter throughput are specific to GCE PD. When a parameter is omitted, the default is used at volume provisioning. If a user applies the PVC with a different VolumeAttributesClass with omitted parameters, the default value of the parameters may be used depending on the CSI driver implementation. Please refer to the related CSI driver documentation for more details.There can be at most 512 parameters defined for a VolumeAttributesClass. The total length of the parameters object including its keys and values cannot exceed 256 KiB.", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\nVolume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1889"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\nVolume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1890"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\nVolume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1891"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\nVolume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1892"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\nVolume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1893"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\nVolume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1894"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\nVolume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1895"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\nVolume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1896"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\nVolume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1897"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\nVolume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1898"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\nVolume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1899"}
{"instruction": "Write a yaml example for volume attributes classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\nVolume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/", "id": "k8s_00142_code_1900"}
{"instruction": "How do you set up an extension api server in Kubernetes?", "response": "Set up an Extension API ServerSetting up an extension API server to work with the aggregation layer allows the Kubernetes apiserver to be extended with additional APIs, which are not part of the core Kubernetes APIs.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.You must configure the aggregation layer and enable the apiserver flags.Set up an extension api-server to work with the aggregation layerThe following steps describe how to set up an extension-apiserver at a high level. These steps apply regardless if you're using YAML configs or using APIs. An attempt is made to specifically identify any differences between the two. For a concrete example of how they can be implemented using YAML configs, you can look at the sample-apiserver in the Kubernetes repo.Alternatively, you can use an existing 3rd party solution, such as apiserver-builder, which should generate a skeleton and automate all of the following steps for you.Make sure the APIService API is enabled (check --runtime-config). It should be on by default, unless it's been deliberately turned off in your cluster.You may need to make an RBAC rule allowing you to add APIService objects, or get your cluster administrator to make one. (Since API extensions affect the entire cluster, it is not recommended to do testing/development/debug of an API extension in a live cluster.)Create the Kubernetes namespace you want to run your extension api-service in.Create/get a CA cert to be used to sign the server cert the extension api-server uses for HTTPS.Create a server cert/key for the api-server to use for HTTPS. This cert should be signed by the above CA. It should also have a CN of the Kube DNS name. This is derived from the Kubernetes service and be of the form <service name>.<service name namespace>.svcCreate a Kubernetes secret with the server cert/key in your namespace.Create a Kubernetes deployment for the extension api-server and make sure you are loading the secret as a volume. It should contain a reference to a working image of your extension api-server. The deployment should also be in your namespace.Make sure that your extension-apiserver loads those certs from that volume and that they are used in the HTTPS handshake.Create a Kubernetes service account in your namespace.Create a Kubernetes cluster role for the operations you want to allow on your resources.Create a Kubernetes cluster role binding from the service account in your namespace to the cluster role you created.Create a Kubernetes cluster role binding from the service account in your namespace to the system:auth-delegator cluster role to delegate auth decisions to the Kubernetes core API server.Create a Kubernetes role binding from the service account in your namespace to the extension-apiserver-authentication-reader role. This allows your extension api-server to access the extension-apiserver-authentication configmap.Create a Kubernetes apiservice. The CA cert above should be base64 encoded, stripped of new lines and used as the spec.caBundle in the apiservice. This should not be namespaced. If using the kube-aggregator API, only pass in the PEM encoded CA bundle because the base 64 encoding is done for you.Use kubectl to get your resource. When run, kubectl should return \"No resources found.\". This message indicates that everything worked but you currently have no objects of that resource type created.What's nextWalk through the steps to configure the API aggregation layer and enable the apiserver flags.For a high level overview, see Extending the Kubernetes API with the aggregatio", "category": "tasks", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-extension-api-server/", "id": "k8s_00143"}
{"instruction": "What is the reference documentation for kubelet credentialprovider (v1)?", "response": "Kubelet CredentialProvider (v1)Resource TypesCredentialProviderRequestCredentialProviderResponseCredentialProviderRequestCredentialProviderRequest includes the image that the kubelet requires authentication for. Kubelet will pass this request object to the plugin via stdin. In general, plugins should prefer responding with the same apiVersion they were sent.FieldDescriptionapiVersionstringcredentialprovider.kubelet.k8s.io/v1kindstringCredentialProviderRequestimage [Required]stringimage is the container image that is being pulled as part of the credential provider plugin request. Plugins may optionally parse the image to extract any information required to fetch credentials.serviceAccountToken [Required]stringserviceAccountToken is the service account token bound to the pod for which the image is being pulled. This token is only sent to the plugin if the tokenAttributes.serviceAccountTokenAudience field is configured in the kubelet's credential provider configuration.serviceAccountAnnotations [Required]map[string]stringserviceAccountAnnotations is a map of annotations on the service account bound to the pod for which the image is being pulled. The list of annotations in the service account that need to be passed to the plugin is configured in the kubelet's credential provider configuration.CredentialProviderResponseCredentialProviderResponse holds credentials that the kubelet should use for the specified image provided in the original request. Kubelet will read the response from the plugin via stdout. This response should be set to the same apiVersion as CredentialProviderRequest.FieldDescriptionapiVersionstringcredentialprovider.kubelet.k8s.io/v1kindstringCredentialProviderResponsecacheKeyType [Required]PluginCacheKeyTypecacheKeyType indicates the type of caching key to use based on the image provided in the request. There are three valid values for the cache key type: Image, Registry, and Global. If an invalid value is specified, the response will NOT be used by the kubelet.cacheDurationmeta/v1.DurationcacheDuration indicates the duration the provided credentials should be cached for. The kubelet will use this field to set the in-memory cache duration for credentials in the AuthConfig. If null, the kubelet will use defaultCacheDuration provided in CredentialProviderConfig. If set to 0, the kubelet will not cache the provided AuthConfig.authmap[string]AuthConfigauth is a map containing authentication information passed into the kubelet. Each key is a match image string (more on this below). The corresponding authConfig value should be valid for all images that match against this key. A plugin should set this field to null if no valid credentials can be returned for the requested image.Each key in the map is a pattern which can optionally contain a port and a path. Globs can be used in the domain, but not in the port or the path. Globs are supported as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'. Matching partial subdomains like 'app*.k8s.io' is also supported. Each glob can only match a single subdomain segment, so *.io does not match *.k8s.io.The kubelet will match images against the key when all of the below are true:Both contain the same number of domain parts and each part matches.The URL path of an imageMatch must be a prefix of the target image URL path.If the imageMatch contains a port, then the port must match in the image as well.When multiple keys are returned, the kubelet will traverse all keys in reverse order so that:longer keys come before shorter keys with the same prefixnon-wildcard keys come before wildcard keys with the same prefix.For any given match, the kubelet will attempt an image pull with the provided credentials, stopping after the first successfully authenticated pull.Example keys:123456789.dkr.ecr.us-east-1.amazonaws.com*.azurecr.iogcr.io*.*.registry.ioregistry.io:8080/pathAuthConfigAppears in:CredentialProviderResponseAuthConfig contains authentication informatio", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubelet-credentialprovider.v1/", "id": "k8s_00144"}
{"instruction": "What is the reference documentation for reference?", "response": "This section of the Kubernetes documentation contains references.API ReferenceGlossary - a comprehensive, standardized list of Kubernetes terminologyKubernetes API ReferenceOne-page API Reference for Kubernetes v1.34Using The Kubernetes API - overview of the API for Kubernetes.API access control - details on how Kubernetes controls API accessWell-Known Labels, Annotations and TaintsOfficially supported client librariesTo call the Kubernetes API from a programming language, you can use client libraries. Officially supported client libraries:Kubernetes Go client libraryKubernetes Python client libraryKubernetes Java client libraryKubernetes JavaScript client libraryKubernetes C# client libraryKubernetes Haskell client libraryCLIkubectl - Main CLI tool for running commands and managing Kubernetes clusters.JSONPath - Syntax guide for using JSONPath expressions with kubectl.kubeadm - CLI tool to easily provision a secure Kubernetes cluster.Componentskubelet - The primary agent that runs on each node. The kubelet takes a set of PodSpecs and ensures that the described containers are running and healthy.kube-apiserver - REST API that validates and configures data for API objects such as pods, services, replication controllers.kube-controller-manager - Daemon that embeds the core control loops shipped with Kubernetes.kube-proxy - Can do simple TCP/UDP stream forwarding or round-robin TCP/UDP forwarding across a set of back-ends.kube-scheduler - Scheduler that manages availability, performance, and capacity.Scheduler PoliciesScheduler ProfilesList of ports and protocols that should be open on control plane and worker nodesConfig APIsThis section hosts the documentation for \"unpublished\" APIs which are used to configure kubernetes components or tools. Most of these APIs are not exposed by the API server in a RESTful way though they are essential for a user or an operator to use or manage a cluster.kubeconfig (v1)kuberc (v1alpha1)kube-apiserver admission (v1)kube-apiserver configuration (v1alpha1) andkube-apiserver configuration (v1beta1) and kube-apiserver configuration (v1)kube-apiserver event rate limit (v1alpha1)kubelet configuration (v1alpha1) and kubelet configuration (v1beta1) kubelet configuration (v1)kubelet credential providers (v1) kube-scheduler configuration (v1)kube-controller-manager configuration (v1alpha1)kube-proxy configuration (v1alpha1)audit.k8s.io/v1 APIClient authentication API (v1beta1) and Client authentication API (v1)WebhookAdmission configuration (v1)ImagePolicy API (v1alpha1)Config API for kubeadmv1beta3v1beta4External APIsThese are the APIs defined by the Kubernetes project, but are not implemented by the core project:Metrics API (v1beta1)Custom Metrics API (v1beta2)External Metrics API (v1beta1)Design DocsAn archive of the design docs for Kubernetes functionality. Good starting points are Kubernetes Architecture and Kubernetes Design Overview.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/", "id": "k8s_00145"}
{"instruction": "Explain the Kubernetes concept: Security", "response": "SecurityConcepts for keeping your cloud-native workload secure.This section of the Kubernetes documentation aims to help you learn to run workloads more securely, and about the essential aspects of keeping a Kubernetes cluster secure.Kubernetes is based on a cloud-native architecture, and draws on advice from the CNCF about good practice for cloud native information security.Read Cloud Native Security and Kubernetes for the broader context about how to secure your cluster and the applications that you're running on it.Kubernetes security mechanismsKubernetes includes several APIs and security controls, as well as ways to define policies that can form part of how you manage information security.Control plane protectionA key security mechanism for any Kubernetes cluster is to control access to the Kubernetes API.Kubernetes expects you to configure and use TLS to provide data encryption in transit within the control plane, and between the control plane and its clients. You can also enable encryption at rest for the data stored within Kubernetes control plane; this is separate from using encryption at rest for your own workloads' data, which might also be a good idea.SecretsThe Secret API provides basic protection for configuration values that require confidentiality.Workload protectionEnforce Pod security standards to ensure that Pods and their containers are isolated appropriately. You can also use RuntimeClasses to define custom isolation if you need it.Network policies let you control network traffic between Pods, or between Pods and the network outside your cluster.You can deploy security controls from the wider ecosystem to implement preventative or detective controls around Pods, their containers, and the images that run in them.Admission controlAdmission controllers are plugins that intercept Kubernetes API requests and can validate or mutate the requests based on specific fields in the request. Thoughtfully designing these controllers helps to avoid unintended disruptions as Kubernetes APIs change across version updates. For design considerations, see Admission Webhook Good Practices.AuditingKubernetes audit logging provides a security-relevant, chronological set of records documenting the sequence of actions in a cluster. The cluster audits the activities generated by users, by applications that use the Kubernetes API, and by the control plane itself.Cloud provider securityNote: Items on this page refer to vendors external to Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. To add a vendor, product or project to this list, read the content guide before submitting a change. More information.If you are running a Kubernetes cluster on your own hardware or a different cloud provider, consult your documentation for security best practices. Here are links to some of the popular cloud providers' security documentation:Cloud provider securityIaaS ProviderLinkAlibaba Cloudhttps://www.alibabacloud.com/trust-centerAmazon Web Serviceshttps://aws.amazon.com/securityGoogle Cloud Platformhttps://cloud.google.com/securityHuawei Cloudhttps://www.huaweicloud.com/intl/en-us/securecenter/overallsafetyIBM Cloudhttps://www.ibm.com/cloud/securityMicrosoft Azurehttps://docs.microsoft.com/en-us/azure/security/azure-securityOracle Cloud Infrastructurehttps://www.oracle.com/securityTencent Cloudhttps://www.tencentcloud.com/solutions/data-security-and-information-protectionVMware vSpherehttps://www.vmware.com/solutions/security/hardening-guidesPoliciesYou can define security policies using Kubernetes-native mechanisms, such as NetworkPolicy (declarative control over network packet filtering) or ValidatingAdmissionPolicy (declarative restrictions on what changes someone can make using the Kubernetes API).However, you can also rely on policy implementations from the wider ecosystem around Kubernetes. Kubernetes provides extension mechanisms to let those ecosystem projects implement their own po", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/", "id": "k8s_00146"}
{"instruction": "What is the reference documentation for poddisruptionbudget?", "response": "PodDisruptionBudgetPodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods.apiVersion: policy/v1import \"k8s.io/api/policy/v1\"PodDisruptionBudgetPodDisruptionBudget is an object to define the max disruption that can be caused to a collection of podsapiVersion: policy/v1kind: PodDisruptionBudgetmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (PodDisruptionBudgetSpec)Specification of the desired behavior of the PodDisruptionBudget.status (PodDisruptionBudgetStatus)Most recently observed status of the PodDisruptionBudget.PodDisruptionBudgetSpecPodDisruptionBudgetSpec is a description of a PodDisruptionBudget.maxUnavailable (IntOrString)An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\".IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.minAvailable (IntOrString)An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\".IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.selector (LabelSelector)Label query over pods whose evictions are managed by the disruption budget. A null selector will match no pods, while an empty ({}) selector will select all pods within the namespace.unhealthyPodEvictionPolicy (string)UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type=\"Ready\",status=\"True\".Valid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy.IfHealthyBudget policy means that running pods (status.phase=\"Running\"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction.AlwaysAllow policy means that all running pods (status.phase=\"Running\"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction.Additional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field.PodDisruptionBudgetStatusPodDisruptionBudgetStatus represents information about the status of a PodDisruptionBudget. Status may trail the actual state of a system.currentHealthy (int32), requiredcurrent number of healthy podsdesiredHealthy (int32), requiredminimum desired number of healthy podsdisruptionsAllowed (int32), requiredNumber of pod disruptions that are currently allowed.expectedPods (int32), requiredtotal number of pods counted by this disruption budgetconditions ([]Condition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeConditions contain conditions for PDB. The disruption controller sets the DisruptionAllowed condition. The following are known values for the reason fiel", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/pod-disruption-budget-v1/", "id": "k8s_00147"}
{"instruction": "Write a yaml example for poddisruptionbudget", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\n```\n\nPodDisruptionBudget | import \"k8s.io/api/policy/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/pod-disruption-budget-v1/", "id": "k8s_00147_code_1906"}
{"instruction": "What is the reference documentation for jsonpath support?", "response": "JSONPath SupportThe kubectl tool supports JSONPath templates as an output format.A JSONPath template is composed of JSONPath expressions enclosed by curly braces: { and }. Kubectl uses JSONPath expressions to filter on specific fields in the JSON object and format the output. In addition to the original JSONPath template syntax, the following functions and syntax are valid:Use double quotes to quote text inside JSONPath expressions.Use the range, end operators to iterate lists.Use negative slice indices to step backwards through a list.Negative indices do not \"wrap around\" a list and are valid as long as \\( ( - index + listLength ) \\ge 0 \\).Note:The $ operator is optional since the expression always starts from the root object by default.The result object is printed as its String() function.Functions in Kubernetes JSONPathGiven the JSON input:{ \"kind\": \"List\", \"items\":[ { \"kind\":\"None\", \"metadata\":{ \"name\":\"127.0.0.1\", \"labels\":{ \"kubernetes.io/hostname\":\"127.0.0.1\" } }, \"status\":{ \"capacity\":{\"cpu\":\"4\"}, \"addresses\":[{\"type\": \"LegacyHostIP\", \"address\":\"127.0.0.1\"}] } }, { \"kind\":\"None\", \"metadata\":{\"name\":\"127.0.0.2\"}, \"status\":{ \"capacity\":{\"cpu\":\"8\"}, \"addresses\":[ {\"type\": \"LegacyHostIP\", \"address\":\"127.0.0.2\"}, {\"type\": \"another\", \"address\":\"127.0.0.3\"} ] } } ], \"users\":[ { \"name\": \"myself\", \"user\": {} }, { \"name\": \"e2e\", \"user\": {\"username\": \"admin\", \"password\": \"secret\"} } ] } Functions, their parameters, an example invocation, and the resultFunctionDescriptionExampleResulttextthe plain textkind is {.kind}kind is List@the current object{@}the same as input. or []child operator{.kind}, {['kind']} or {['name\\.type']}List..recursive descent{..name}127.0.0.1 127.0.0.2 myself e2e*wildcard. Get all objects{.items[*].metadata.name}[127.0.0.1 127.0.0.2][start:end:step]subscript operator{.users[0].name}myself[,]union operator{.items[*]['metadata.name', 'status.capacity']}127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]?()filter{.users[?(@.name==\"e2e\")].user.password}secretrange, enditerate list{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]]''quote interpreted string{range .items[*]}{.metadata.name}{'\\t'}{end}127.0.0.1 127.0.0.2\\escape termination character{.items[0].metadata.labels.kubernetes\\.io/hostname}127.0.0.1Using JSONPath expressions with kubectlExamples using kubectl and JSONPath expressions:kubectl get pods -o json kubectl get pods -o=jsonpath='{@}' kubectl get pods -o=jsonpath='{.items[0]}' kubectl get pods -o=jsonpath='{.items[0].metadata.name}' kubectl get pods -o=jsonpath=\"{.items[*]['metadata.name', 'status.capacity']}\" kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.startTime}{\"\\n\"}{end}' kubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\\.io/hostname}' Or, with a \"my_pod\" and \"my_namespace\" (adjust these names to your environment):kubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}' kubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}' kubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}' Note:On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote around any literals in the template. For example:kubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{'\\t'}{.status.startTime}{'\\n'}{end}\" kubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\t\\\"}{.status.startTime}{\\\"\\n\\\"}{end}\" Regular expressions in JSONPathJSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as jq.# kubectl does not support regular expressions for JSONpath output # The following command does not work kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}' # The following command achieves the desired result kubectl get pods -o json | jq -r '.items[] | select(.metada", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/jsonpath/", "id": "k8s_00148"}
{"instruction": "Write a bash example for jsonpath support", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o json\nkubectl get pods -o=jsonpath='{@}'\nkubectl get pods -o=jsonpath='{.items[0]}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.name}'\nkubectl get pods -o=jsonpath=\"{.items[*]['metadata.name', 'status.capacity']}\"\nkubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.startTime}{\"\\n\"}{end}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\\.io/hostname}'\n```\n\nJSONPath Support | Or, with a \"my_pod\" and \"my_namespace\" (adjust these names to your environment):", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/jsonpath/", "id": "k8s_00148_code_1908"}
{"instruction": "Write a bash example for jsonpath support", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}'\n```\n\nJSONPath Support | On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote aro", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/jsonpath/", "id": "k8s_00148_code_1909"}
{"instruction": "Write a bash example for jsonpath support", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{'\\t'}{.status.startTime}{'\\n'}{end}\"\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\t\\\"}{.status.startTime}{\\\"\\n\\\"}{end}\"\n```\n\nJSONPath Support | JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as jq.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/jsonpath/", "id": "k8s_00148_code_1910"}
{"instruction": "Write a bash example for jsonpath support", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o json\nkubectl get pods -o=jsonpath='{@}'\nkubectl get pods -o=jsonpath='{.items[0]}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.name}'\nkubectl get pods -o=jsonpath=\"{.items[*]['metadata.name', 'status.capacity']}\"\nkubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.startTime}{\"\\n\"}{end}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\\.io/hostname}'\n```\n\nJSONPath Support | Or, with a \"my_pod\" and \"my_namespace\" (adjust these names to your environment):", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/jsonpath/", "id": "k8s_00148_code_1911"}
{"instruction": "Write a bash example for jsonpath support", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}'\n```\n\nJSONPath Support | On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote aro", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/jsonpath/", "id": "k8s_00148_code_1912"}
{"instruction": "Write a bash example for jsonpath support", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{'\\t'}{.status.startTime}{'\\n'}{end}\"\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\t\\\"}{.status.startTime}{\\\"\\n\\\"}{end}\"\n```\n\nJSONPath Support | JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as jq.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/jsonpath/", "id": "k8s_00148_code_1913"}
{"instruction": "How do you verify signed kubernetes artifacts in Kubernetes?", "response": "Verify Signed Kubernetes ArtifactsFEATURE STATE: Kubernetes v1.26 [beta]Before you beginYou will need to have the following tools installed:cosign (install guide)curl (often provided by your operating system)jq (download jq)Verifying binary signaturesThe Kubernetes release process signs all binary artifacts (tarballs, SPDX files, standalone binaries) by using cosign's keyless signing. To verify a particular binary, retrieve it together with its signature and certificate:URL=https://dl.k8s.io/release/v1.34.0/bin/linux/amd64 BINARY=kubectl FILES=( \"$BINARY\" \"$BINARY.sig\" \"$BINARY.cert\" ) for FILE in \"${FILES[@]}\"; do curl -sSfL --retry 3 --retry-delay 3 \"$URL/$FILE\" -o \"$FILE\" done Then verify the blob by using cosign verify-blob:cosign verify-blob \"$BINARY\" \\ --signature \"$BINARY\".sig \\ --certificate \"$BINARY\".cert \\ --certificate-identity krel-staging@k8s-releng-prod.iam.gserviceaccount.com \\ --certificate-oidc-issuer https://accounts.google.com Note:Cosign 2.0 requires the --certificate-identity and --certificate-oidc-issuer options.To learn more about keyless signing, please refer to Keyless Signatures.Previous versions of Cosign required that you set COSIGN_EXPERIMENTAL=1.For additional information, please refer to the sigstore BlogVerifying image signaturesFor a complete list of images that are signed please refer to Releases.Pick one image from this list and verify its signature using the cosign verify command:cosign verify registry.k8s.io/kube-apiserver-amd64:v1.34.0 \\ --certificate-identity krel-trust@k8s-releng-prod.iam.gserviceaccount.com \\ --certificate-oidc-issuer https://accounts.google.com \\ | jq . Verifying images for all control plane componentsTo verify all signed control plane images for the latest stable version (v1.34.0), please run the following commands:curl -Ls \"https://sbom.k8s.io/$(curl -Ls https://dl.k8s.io/release/stable.txt)/release\" \\ | grep \"SPDXID: SPDXRef-Package-registry.k8s.io\" \\ | grep -v sha256 | cut -d- -f3- | sed 's/-/\\//' | sed 's/-v1/:v1/' \\ | sort > images.txt input=images.txt while IFS= read -r image do cosign verify \"$image\" \\ --certificate-identity krel-trust@k8s-releng-prod.iam.gserviceaccount.com \\ --certificate-oidc-issuer https://accounts.google.com \\ | jq . done < \"$input\" Once you have verified an image, you can specify the image by its digest in your Pod manifests as per this example:registry-url/image-name@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 For more information, please refer to the Image Pull Policy section.Verifying Image Signatures with Admission ControllerFor non-control plane images (for example conformance image), signatures can also be verified at deploy time using sigstore policy-controller admission controller.Here are some helpful resources to get started with policy-controller:InstallationConfiguration OptionsVerify the Software Bill Of MaterialsYou can verify the Kubernetes Software Bill of Materials (SBOM) by using the sigstore certificate and signature, or the corresponding SHA files:# Retrieve the latest available Kubernetes release version VERSION=$(curl -Ls https://dl.k8s.io/release/stable.txt) # Verify the SHA512 sum curl -Ls \"https://sbom.k8s.io/$VERSION/release\" -o \"$VERSION.spdx\" echo \"$(curl -Ls \"https://sbom.k8s.io/$VERSION/release.sha512\") $VERSION.spdx\" | sha512sum --check # Verify the SHA256 sum echo \"$(curl -Ls \"https://sbom.k8s.io/$VERSION/release.sha256\") $VERSION.spdx\" | sha256sum --check # Retrieve sigstore signature and certificate curl -Ls \"https://sbom.k8s.io/$VERSION/release.sig\" -o \"$VERSION.spdx.sig\" curl -Ls \"https://sbom.k8s.io/$VERSION/release.cert\" -o \"$VERSION.spdx.cert\" # Verify the sigstore signature cosign verify-blob \\ --certificate \"$VERSION.spdx.cert\" \\ --signature \"$VERSION.spdx.sig\" \\ --certificate-identity krel-staging@k8s-releng-prod.iam.gserviceaccount.com \\ --certificate-oidc-issuer https://accounts.google.com \\ \"$VERSION.spdx\"", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/verify-signed-artifacts/", "id": "k8s_00149"}
{"instruction": "Write a bash example for verify signed kubernetes artifacts", "response": "Here's a bash example:\n\n```bash\nURL=https://dl.k8s.io/release/v1.34.0/bin/linux/amd64\nBINARY=kubectl\n\nFILES=(\n    \"$BINARY\"\n    \"$BINARY.sig\"\n    \"$BINARY.cert\"\n)\n\nfor FILE in \"${FILES[@]}\"; do\n    curl -sSfL --retry 3 --retry-delay 3 \"$URL/$FILE\" -o \"$FILE\"\ndone\n```\n\nVerify Signed Kubernetes Artifacts | Then verify the blob by using cosign verify-blob:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/verify-signed-artifacts/", "id": "k8s_00149_code_1915"}
{"instruction": "What is the reference documentation for linux kernel version requirements?", "response": "Linux Kernel Version RequirementsNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Many features rely on specific kernel functionalities and have minimum kernel version requirements. However, relying solely on kernel version numbers may not be sufficient for certain operating system distributions, as maintainers for distributions such as RHEL, Ubuntu and SUSE often backport selected features to older kernel releases (retaining the older kernel version).Pod sysctlsOn Linux, the sysctl() system call configures kernel parameters at run time. There is a command line tool named sysctl that you can use to configure these parameters, and many are exposed via the proc filesystem.Some sysctls are only available if you have a modern enough kernel.The following sysctls have a minimal kernel version requirement, and are supported in the safe set:net.ipv4.ip_local_reserved_ports (since Kubernetes 1.27, needs kernel 3.16+);net.ipv4.tcp_keepalive_time (since Kubernetes 1.29, needs kernel 4.5+);net.ipv4.tcp_fin_timeout (since Kubernetes 1.29, needs kernel 4.6+);net.ipv4.tcp_keepalive_intvl (since Kubernetes 1.29, needs kernel 4.5+);net.ipv4.tcp_keepalive_probes (since Kubernetes 1.29, needs kernel 4.5+);net.ipv4.tcp_syncookies (namespaced since kernel 4.6+).net.ipv4.tcp_rmem (since Kubernetes 1.32, needs kernel 4.15+).net.ipv4.tcp_wmem (since Kubernetes 1.32, needs kernel 4.15+).net.ipv4.vs.conn_reuse_mode (used in ipvs proxy mode, needs kernel 4.1+);kube proxy nftables proxy modeFor Kubernetes 1.34, the nftables mode of kube-proxy requires version 1.0.1 or later of the nft command-line tool, as well as kernel 5.13 or later.For testing/development purposes, you can use older kernels, as far back as 5.4 if you set the nftables.skipKernelVersionCheck option in the kube-proxy config. But this is not recommended in production since it may cause problems with other nftables users on the system.Version 2 control groupsKubernetes cgroup v1 support is in maintained mode starting from Kubernetes v1.31; using cgroup v2 is recommended. In Linux 5.8, the system-level cpu.stat file was added to the root cgroup for convenience.In runc document, Kernel older than 5.2 is not recommended due to lack of freezer.Pressure Stall Information (PSI)Pressure Stall Information is supported in Linux kernel versions 4.20 and up, but requires the following configuration:The kernel must be compiled with the CONFIG_PSI=y option. Most modern distributions enable this by default. You can check your kernel's configuration by running zgrep CONFIG_PSI /proc/config.gz.Some Linux distributions may compile PSI into the kernel but disable it by default. If so, you need to enable it at boot time by adding the psi=1 parameter to the kernel command line.Other kernel requirementsSome features may depend on new kernel functionalities and have specific kernel requirements:Recursive read only mount: This is implemented by applying the MOUNT_ATTR_RDONLY attribute with the AT_RECURSIVE flag using mount_setattr(2) added in Linux kernel v5.12.Pod user namespace support requires minimal kernel version 6.5+, according to KEP-127.For node system swap, tmpfs set to noswap is not supported until kernel 6.3.Linux kernel long term maintenanceActive kernel releases can be found in kernel.org.There are usually several long term maintenance kernel releases provided for the purposes of backporting bug fixes for older kernel trees. Only important bug fixes are applied to such kernels and they don't usually see very frequent releases, especially for older trees. See the Linux kernel website for the list of releases in the Longterm category.What's nextSee sysctls for more details.Allow running kube-proxy with in nftables mode.Read more information in cgroups ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/kernel-version-requirements/", "id": "k8s_00150"}
{"instruction": "Explain the Kubernetes concept: Resource Management for Pods and Containers", "response": "Resource Management for Pods and ContainersWhen you specify a Pod, you can optionally specify how much of each resource a container needs. The most common resources to specify are CPU and memory (RAM); there are others.When you specify the resource request for containers in a Pod, the kube-scheduler uses this information to decide which node to place the Pod on. When you specify a resource limit for a container, the kubelet enforces those limits so that the running container is not allowed to use more of that resource than the limit you set. The kubelet also reserves at least the request amount of that system resource specifically for that container to use.Requests and limitsIf the node where a Pod is running has enough of a resource available, it's possible (and allowed) for a container to use more resource than its request for that resource specifies.For example, if you set a memory request of 256 MiB for a container, and that container is in a Pod scheduled to a Node with 8GiB of memory and no other Pods, then the container can try to use more RAM.Limits are a different story. Both cpu and memory limits are applied by the kubelet (and container runtime), and are ultimately enforced by the kernel. On Linux nodes, the Linux kernel enforces limits with cgroups. The behavior of cpu and memory limit enforcement is slightly different.cpu limits are enforced by CPU throttling. When a container approaches its cpu limit, the kernel will restrict access to the CPU corresponding to the container's limit. Thus, a cpu limit is a hard limit the kernel enforces. Containers may not use more CPU than is specified in their cpu limit.memory limits are enforced by the kernel with out of memory (OOM) kills. When a container uses more than its memory limit, the kernel may terminate it. However, terminations only happen when the kernel detects memory pressure. Thus, a container that over allocates memory may not be immediately killed. This means memory limits are enforced reactively. A container may use more memory than its memory limit, but if it does, it may get killed.Note:There is an alpha feature MemoryQoS which attempts to add more preemptive limit enforcement for memory (as opposed to reactive enforcement by the OOM killer). However, this effort is stalled due to a potential livelock situation a memory hungry can cause.Note:If you specify a limit for a resource, but do not specify any request, and no admission-time mechanism has applied a default request for that resource, then Kubernetes copies the limit you specified and uses it as the requested value for the resource.Resource typesCPU and memory are each a resource type. A resource type has a base unit. CPU represents compute processing and is specified in units of Kubernetes CPUs. Memory is specified in units of bytes. For Linux workloads, you can specify huge page resources. Huge pages are a Linux-specific feature where the node kernel allocates blocks of memory that are much larger than the default page size.For example, on a system where the default page size is 4KiB, you could specify a limit, hugepages-2Mi: 80Mi. If the container tries allocating over 40 2MiB huge pages (a total of 80 MiB), that allocation fails.Note:You cannot overcommit hugepages-* resources. This is different from the memory and cpu resources.CPU and memory are collectively referred to as compute resources, or resources. Compute resources are measurable quantities that can be requested, allocated, and consumed. They are distinct from API resources. API resources, such as Pods and Services are objects that can be read and modified through the Kubernetes API server.Resource requests and limits of Pod and containerFor each container, you can specify resource limits and requests, including the following:spec.containers[].resources.limits.cpuspec.containers[].resources.limits.memoryspec.containers[].resources.limits.hugepages-<size>spec.containers[].resources.requests.cpuspec.containers[].resources.requests.memorysp", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\nResource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1918"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nResource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1919"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\nResource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1920"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\nResource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1921"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod frontend | grep -A 9999999999 Events\n```\n\nResource Management for Pods and Containers | In the preceding example, the Pod named \"frontend\" fails to be scheduled due to insufficient CPU resource on any node. Similar error messages can also suggest failure due to insufficient memory (PodEx", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1922"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes e2e-test-node-pool-4lw4\n```\n\nResource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1923"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod simmemleak-hra99\n```\n\nResource Management for Pods and Containers | The output is similar to:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1924"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\nResource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1925"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nResource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1926"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\nResource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1927"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\n# For ext4, with /dev/block-device not mounted\nsudo tune2fs -O project -Q prjquota /dev/block-device\n```\n\nResource Management for Pods and Containers | Ensure that the root filesystem (or optional runtime filesystem) is mounted with project quotas enabled. For both XFS and ext4fs, the mount option is named prjquota.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1928"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\nResource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1929"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\nResource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1930"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\nResource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1931"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nResource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1932"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nResource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1933"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\nResource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1934"}
{"instruction": "Write a yaml example for resource management for pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\nResource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1935"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod frontend | grep -A 9999999999 Events\n```\n\nResource Management for Pods and Containers | In the preceding example, the Pod named \"frontend\" fails to be scheduled due to insufficient CPU resource on any node. Similar error messages can also suggest failure due to insufficient memory (PodEx", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1936"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes e2e-test-node-pool-4lw4\n```\n\nResource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1937"}
{"instruction": "Write a bash example for resource management for pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod simmemleak-hra99\n```\n\nResource Management for Pods and Containers | The output is similar to:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/", "id": "k8s_00151_code_1938"}
{"instruction": "How do you use kube-router for networkpolicy in Kubernetes?", "response": "Use Kube-router for NetworkPolicyThis page shows how to use Kube-router for NetworkPolicy.Before you beginYou need to have a Kubernetes cluster running. If you do not already have a cluster, you can create one by using any of the cluster installers like Kops, Bootkube, Kubeadm etc.Installing Kube-router addonThe Kube-router Addon comes with a Network Policy Controller that watches Kubernetes API server for any NetworkPolicy and pods updated and configures iptables rules and ipsets to allow or block traffic as directed by the policies. Please follow the trying Kube-router with cluster installers guide to install Kube-router addon.What's nextOnce you have installed the Kube-router addon, you can follow the Declare Network Policy to try out Kubernetes NetworkPolicy.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/kube-router-network-policy/", "id": "k8s_00152"}
{"instruction": "How do you configure minimum and maximum cpu constraints for a namespace in Kubernetes?", "response": "Configure Minimum and Maximum CPU Constraints for a NamespaceDefine a range of valid CPU resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.This page shows how to set minimum and maximum values for the CPU resources used by containers and Pods in a namespace. You specify minimum and maximum CPU values in a LimitRange object. If a Pod does not meet the constraints imposed by the LimitRange, it cannot be created in the namespace.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 1.0 CPU available for Pods. See meaning of CPU to learn what Kubernetes means by “1 CPU”.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace constraints-cpu-example Create a LimitRange and a PodHere's a manifest for an example LimitRange:admin/resource/cpu-constraints.yaml apiVersion: v1 kind: LimitRange metadata: name: cpu-min-max-demo-lr spec: limits: - max: cpu: \"800m\" min: cpu: \"200m\" type: Container Create the LimitRange:kubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints.yaml --namespace=constraints-cpu-example View detailed information about the LimitRange:kubectl get limitrange cpu-min-max-demo-lr --output=yaml --namespace=constraints-cpu-example The output shows the minimum and maximum CPU constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created automatically.limits: - default: cpu: 800m defaultRequest: cpu: 800m max: cpu: 800m min: cpu: 200m type: Container Now whenever you create a Pod in the constraints-cpu-example namespace (or some other client of the Kubernetes API creates an equivalent Pod), Kubernetes performs these steps:If any container in that Pod does not specify its own CPU request and limit, the control plane assigns the default CPU request and limit to that container.Verify that every container in that Pod specifies a CPU request that is greater than or equal to 200 millicpu.Verify that every container in that Pod specifies a CPU limit that is less than or equal to 800 millicpu.Note:When creating a LimitRange object, you can specify limits on huge-pages or GPUs as well. However, when both default and defaultRequest are specified on these resources, the two values must be the same.Here's a manifest for a Pod that has one container. The container manifest specifies a CPU request of 500 millicpu and a CPU limit of 800 millicpu. These satisfy the minimum and maximum CPU constraints imposed by the LimitRange for this namespace.admin/resource/cpu-constraints-pod.yaml apiVersion: v1 kind: Pod metadata: name: constraints-cpu-demo spec: containers: - name: constraints-cpu-demo-ctr image: nginx resources: limits: cpu: \"800m\" requests: cpu: \"500m\" Create the Pod:kubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod.yaml --namespace=constraints-cpu-example Verify that the Pod is running and that its container is healthy:kubectl get pod constraints-cpu-demo --namespace=constraints-cpu-example View detailed information about the Pod:kubectl get pod constraints-cpu-demo --output=yaml --namespace=constraints-cpu-example The output shows that the Pod's only container has a CPU request of 500 millicpu and CPU limit of 800 millicpu. These satisfy the constraints imposed by the LimitRange.resources: limits: cpu: 800m requests: cpu: 500m Delete the Podkubectl delete pod constra", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for an example LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1941"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1942"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1943"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange cpu-min-max-demo-lr --output=yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows the minimum and maximum CPU constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created auto", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1944"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1945"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1946"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1947"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --output=yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's only container has a CPU request of 500 millicpu and CPU limit of 800 millicpu. These satisfy the constraints imposed by the LimitRange.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1948"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a CPU request of 500 millicpu and a cpu limit of 1.5 cpu.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1949"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1950"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-2.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU limit that is too large:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1951"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1952"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-3.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU request that is lower than the enforced mi", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1953"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1954"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-4.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1955"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo-4 --namespace=constraints-cpu-example --output=yaml\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's single container has a CPU request of 800 millicpu and a CPU limit of 800 millicpu. How did that container get those values?", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1956"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo-4 --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The maximum and minimum CPU constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were creat", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1957"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1958"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1959"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nlimits:\n- default:\n    cpu: 800m\n  defaultRequest:\n    cpu: 800m\n  max:\n    cpu: 800m\n  min:\n    cpu: 200m\n  type: Container\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Now whenever you create a Pod in the constraints-cpu-example namespace (or some other client of the Kubernetes API creates an equivalent Pod), Kubernetes performs these steps:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1960"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1961"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n    cpu: 800m\n  requests:\n    cpu: 500m\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a CPU request of 500 millicpu and a cpu limit of 1.5 cpu.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1962"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1963"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1964"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1965"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo-4 --namespace=constraints-cpu-example --output=yaml\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's single container has a CPU request of 800 millicpu and a CPU limit of 800 millicpu. How did that container get those values?", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1966"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n    cpu: 800m\n  requests:\n    cpu: 800m\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Because that container did not specify its own CPU request and limit, the control plane applied the default CPU request and limit from the LimitRange for this namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1967"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo-4 --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The maximum and minimum CPU constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were creat", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1968"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for an example LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1969"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1970"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1971"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1972"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange cpu-min-max-demo-lr --output=yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows the minimum and maximum CPU constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created auto", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1973"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1974"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1975"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1976"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1977"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --output=yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's only container has a CPU request of 500 millicpu and CPU limit of 800 millicpu. These satisfy the constraints imposed by the LimitRange.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1978"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a CPU request of 500 millicpu and a cpu limit of 1.5 cpu.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1979"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1980"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1981"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-2.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU limit that is too large:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1982"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1983"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1984"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-3.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU request that is lower than the enforced mi", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1985"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1986"}
{"instruction": "Write a yaml example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1987"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-4.yaml --namespace=constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1988"}
{"instruction": "Write a bash example for configure minimum and maximum cpu constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-cpu-example\n```\n\nConfigure Minimum and Maximum CPU Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/", "id": "k8s_00153_code_1989"}
{"instruction": "How do you horizontal pod autoscaling in Kubernetes?", "response": "Horizontal Pod AutoscalingIn Kubernetes, a HorizontalPodAutoscaler automatically updates a workload resource (such as a Deployment or StatefulSet), with the aim of automatically scaling the workload to match demand.Horizontal scaling means that the response to increased load is to deploy more Pods. This is different from vertical scaling, which for Kubernetes would mean assigning more resources (for example: memory or CPU) to the Pods that are already running for the workload.If the load decreases, and the number of Pods is above the configured minimum, the HorizontalPodAutoscaler instructs the workload resource (the Deployment, StatefulSet, or other similar resource) to scale back down.Horizontal pod autoscaling does not apply to objects that can't be scaled (for example: a DaemonSet.)The HorizontalPodAutoscaler is implemented as a Kubernetes API resource and a controller. The resource determines the behavior of the controller. The horizontal pod autoscaling controller, running within the Kubernetes control plane, periodically adjusts the desired scale of its target (for example, a Deployment) to match observed metrics such as average CPU utilization, average memory utilization, or any other custom metric you specify.There is walkthrough example of using horizontal pod autoscaling.How does a HorizontalPodAutoscaler work?graph BT hpa[Horizontal Pod Autoscaler] --> scale[Scale] subgraph rc[RC / Deployment] scale end scale -.-> pod1[Pod 1] scale -.-> pod2[Pod 2] scale -.-> pod3[Pod N] classDef hpa fill:#D5A6BD,stroke:#1E1E1D,stroke-width:1px,color:#1E1E1D; classDef rc fill:#F9CB9C,stroke:#1E1E1D,stroke-width:1px,color:#1E1E1D; classDef scale fill:#B6D7A8,stroke:#1E1E1D,stroke-width:1px,color:#1E1E1D; classDef pod fill:#9FC5E8,stroke:#1E1E1D,stroke-width:1px,color:#1E1E1D; class hpa hpa; class rc rc; class scale scale; class pod1,pod2,pod3 podJavaScript must be enabled to view this contentFigure 1. HorizontalPodAutoscaler controls the scale of a Deployment and its ReplicaSetKubernetes implements horizontal pod autoscaling as a control loop that runs intermittently (it is not a continuous process). The interval is set by the --horizontal-pod-autoscaler-sync-period parameter to the kube-controller-manager (and the default interval is 15 seconds).Once during each period, the controller manager queries the resource utilization against the metrics specified in each HorizontalPodAutoscaler definition. The controller manager finds the target resource defined by the scaleTargetRef, then selects the pods based on the target resource's .spec.selector labels, and obtains the metrics from either the resource metrics API (for per-pod resource metrics), or the custom metrics API (for all other metrics).For per-pod resource metrics (like CPU), the controller fetches the metrics from the resource metrics API for each Pod targeted by the HorizontalPodAutoscaler. Then, if a target utilization value is set, the controller calculates the utilization value as a percentage of the equivalent resource request on the containers in each Pod. If a target raw value is set, the raw metric values are used directly. The controller then takes the mean of the utilization or the raw value (depending on the type of target specified) across all targeted Pods, and produces a ratio used to scale the number of desired replicas.Please note that if some of the Pod's containers do not have the relevant resource request set, CPU utilization for the Pod will not be defined and the autoscaler will not take any action for that metric. See the algorithm details section below for more information about how the autoscaling algorithm works.For per-pod custom metrics, the controller functions similarly to per-pod resource metrics, except that it works with raw values, not utilization values.For object metrics and external metrics, a single metric is fetched, which describes the object in question. This metric is compared to the target value, to produce a ratio as above. In the au", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\ntype: Resource\nresource:\n  name: cpu\n  target:\n    type: Utilization\n    averageUtilization: 60\n```\n\nHorizontal Pod Autoscaling | With this metric the HPA controller will keep the average utilization of the pods in the scaling target at 60%. Utilization is the ratio between the current usage of resource to the requested resource", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1991"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\ntype: ContainerResource\ncontainerResource:\n  name: cpu\n  container: application\n  target:\n    type: Utilization\n    averageUtilization: 60\n```\n\nHorizontal Pod Autoscaling | In the above example the HPA controller scales the target such that the average utilization of the cpu in the application container of all the pods is 60%.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1992"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    policies:\n    - type: Pods\n      value: 4\n      periodSeconds: 60\n    - type: Percent\n      value: 10\n      periodSeconds: 60\n```\n\nHorizontal Pod Autoscaling | periodSeconds indicates the length of time in the past for which the policy must hold true. The maximum value that you can set for periodSeconds is 1800 (half an hour). The first policy (Pods) allows", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1993"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    stabilizationWindowSeconds: 300\n```\n\nHorizontal Pod Autoscaling | When the metrics indicate that the target should be scaled down the algorithm looks into previously computed desired states, and uses the highest value from the specified interval. In the above exampl", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1994"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleUp:\n    tolerance: 0.05 # 5% tolerance for scale up\n```\n\nHorizontal Pod Autoscaling | With this configuration, the HPA algorithm will only consider scaling up if the memory consumption is higher than 105MiB (that is: 5% above the target).", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1995"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    stabilizationWindowSeconds: 300\n    policies:\n    - type: Percent\n      value: 100\n      periodSeconds: 15\n  scaleUp:\n    stabilizationWindowSeconds: 0\n    policies:\n    - type: Percent\n      value: 100\n      periodSeconds: 15\n    - type: Pods\n      value: 4\n      periodSeconds: 15\n    selectPolicy: Max\n```\n\nHorizontal Pod Autoscaling | For scaling down the stabilization window is 300 seconds (or the value of the --horizontal-pod-autoscaler-downscale-stabilization flag if provided). There is only a single policy for scaling down whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1996"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    stabilizationWindowSeconds: 60\n```\n\nHorizontal Pod Autoscaling | To limit the rate at which pods are removed by the HPA to 10% per minute, the following behavior would be added to the HPA:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1997"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    policies:\n    - type: Percent\n      value: 10\n      periodSeconds: 60\n```\n\nHorizontal Pod Autoscaling | To ensure that no more than 5 Pods are removed per minute, you can add a second scale-down policy with a fixed size of 5, and set selectPolicy to minimum. Setting selectPolicy to Min means that the au", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1998"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    policies:\n    - type: Percent\n      value: 10\n      periodSeconds: 60\n    - type: Pods\n      value: 5\n      periodSeconds: 60\n    selectPolicy: Min\n```\n\nHorizontal Pod Autoscaling | The selectPolicy value of Disabled turns off scaling the given direction. So to prevent downscaling the following policy would be used:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_1999"}
{"instruction": "Write a yaml example for horizontal pod autoscaling", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    selectPolicy: Disabled\n```\n\nHorizontal Pod Autoscaling | HorizontalPodAutoscaler, like every API resource, is supported in a standard way by kubectl. You can create a new autoscaler using kubectl create command. You can list autoscalers by kubectl get hpa o", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_2000"}
{"instruction": "Write a bash example for horizontal pod autoscaling", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs foo --min=2 --max=5 --cpu-percent=80\n```\n\nHorizontal Pod Autoscaling | You can implicitly deactivate the HPA for a target without the need to change the HPA configuration itself. If the target's desired replica count is set to 0, and the HPA's minimum replica count is gr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_2001"}
{"instruction": "Write a bash example for horizontal pod autoscaling", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f deployment.yaml\n```\n\nHorizontal Pod Autoscaling | Keep in mind that the removal of spec.replicas may incur a one-time degradation of Pod counts as the default value of this key is 1 (reference Deployment Replicas). Upon the update, all Pods except 1", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_2002"}
{"instruction": "Write a bash example for horizontal pod autoscaling", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/<deployment_name>\n```\n\nHorizontal Pod Autoscaling | When using the Server-Side Apply you can follow the transferring ownership guidelines, which cover this exact use case.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_2003"}
{"instruction": "Write a bash example for horizontal pod autoscaling", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f deployment.yaml\n```\n\nHorizontal Pod Autoscaling | When using the Server-Side Apply you can follow the transferring ownership guidelines, which cover this exact use case.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/", "id": "k8s_00154_code_2004"}
{"instruction": "Explain the Kubernetes concept: Windows Storage", "response": "Windows StorageThis page provides an storage overview specific to the Windows operating system.Persistent storageWindows has a layered filesystem driver to mount container layers and create a copy filesystem based on NTFS. All file paths in the container are resolved only within the context of that container.With Docker, volume mounts can only target a directory in the container, and not an individual file. This limitation does not apply to containerd.Volume mounts cannot project files or directories back to the host filesystem.Read-only filesystems are not supported because write access is always required for the Windows registry and SAM database. However, read-only volumes are supported.Volume user-masks and permissions are not available. Because the SAM is not shared between the host & container, there's no mapping between them. All permissions are resolved within the context of the container.As a result, the following storage functionality is not supported on Windows nodes:Volume subpath mounts: only the entire volume can be mounted in a Windows containerSubpath volume mounting for SecretsHost mount projectionRead-only root filesystem (mapped volumes still support readOnly)Block device mappingMemory as the storage medium (for example, emptyDir.medium set to Memory)File system features like uid/gid; per-user Linux filesystem permissionsSetting secret permissions with DefaultMode (due to UID/GID dependency)NFS based storage/volume supportExpanding the mounted volume (resizefs)Kubernetes volumes enable complex applications, with data persistence and Pod volume sharing requirements, to be deployed on Kubernetes. Management of persistent volumes associated with a specific storage back-end or protocol includes actions such as provisioning/de-provisioning/resizing of volumes, attaching/detaching a volume to/from a Kubernetes node and mounting/dismounting a volume to/from individual containers in a pod that needs to persist data.Volume management components are shipped as Kubernetes volume plugin. The following broad classes of Kubernetes volume plugins are supported on Windows:FlexVolume pluginsPlease note that FlexVolumes have been deprecated as of 1.23CSI PluginsIn-tree volume pluginsThe following in-tree plugins support persistent storage on Windows nodes:azureFilevsphereVolume", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/windows-storage/", "id": "k8s_00155"}
{"instruction": "Explain the Kubernetes concept: Extending the Kubernetes API", "response": "Extending the Kubernetes APICustom resources are extensions of the Kubernetes API. Kubernetes provides two ways to add custom resources to your cluster:The CustomResourceDefinition (CRD) mechanism allows you to declaratively define a new custom API with an API group, kind, and schema that you specify. The Kubernetes control plane serves and handles the storage of your custom resource. CRDs allow you to create new types of resources for your cluster without writing and running a custom API server.The aggregation layer sits behind the primary API server, which acts as a proxy. This arrangement is called API Aggregation (AA), which allows you to provide specialized implementations for your custom resources by writing and deploying your own API server. The main API server delegates requests to your API server for the custom APIs that you specify, making them available to all of its clients.Custom ResourcesKubernetes API Aggregation Layer", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/", "id": "k8s_00156"}
{"instruction": "What is the reference documentation for kubectl reference?", "response": "kubectl referencekubectlkubectl annotatekubectl api-resourceskubectl api-versionskubectl applykubectl attachkubectl authkubectl autoscalekubectl certificatekubectl cluster-infokubectl completionkubectl configkubectl cordonkubectl cpkubectl createkubectl debugkubectl deletekubectl describekubectl diffkubectl drainkubectl editkubectl eventskubectl execkubectl explainkubectl exposekubectl getkubectl kustomizekubectl labelkubectl logskubectl optionskubectl patchkubectl pluginkubectl port-forwardkubectl proxykubectl replacekubectl rolloutkubectl runkubectl scalekubectl setkubectl taintkubectl topkubectl uncordonkubectl versionkubectl wait", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/", "id": "k8s_00157"}
{"instruction": "What is the reference documentation for kubelet?", "response": "kubeletSynopsisThe kubelet is the primary \"node agent\" that runs on each node. It can register the node with the apiserver using one of: the hostname; a flag to override the hostname; or specific logic for a cloud provider.The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn't manage containers which were not created by Kubernetes.Other than from an PodSpec from the apiserver, there are two ways that a container manifest can be provided to the Kubelet.File: Path passed as a flag on the command line. Files under this path will be monitored periodically for updates. The monitoring period is 20s by default and is configurable via a flag.HTTP endpoint: HTTP endpoint passed as a parameter on the command line. This endpoint is checked every 20 seconds (also configurable with a flag).kubelet [flags] Options--address string Default: 0.0.0.0The IP address for the Kubelet to serve on (set to '0.0.0.0' or '::' for listening on all interfaces and IP address families) (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--allowed-unsafe-sysctls stringsComma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in *). Use these at your own risk. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--anonymous-auth Default: trueEnables anonymous requests to the Kubelet server. Requests that are not rejected by another authentication method are treated as anonymous requests. Anonymous requests have a username of system:anonymous, and a group name of system:unauthenticated. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authentication-token-webhookUse the TokenReview API to determine authentication for bearer tokens. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authentication-token-webhook-cache-ttl duration Default: 2m0sThe duration to cache responses from the webhook token authenticator. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authorization-mode string Default: \"AlwaysAllow\"Authorization mode for Kubelet server. Valid options are AlwaysAllow or Webhook. Webhook mode uses the SubjectAccessReview API to determine authorization. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authorization-webhook-cache-authorized-ttl duration Default: 5m0sThe duration to cache 'authorized' responses from the webhook authorizer. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authorization-webhook-cache-unauthorized-ttl duration Default: 30sThe duration to cache 'unauthorized' responses from the webhook authorizer. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more informat", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/", "id": "k8s_00158"}
{"instruction": "Explain suggesting content improvements in Kubernetes", "response": "Suggesting content improvementsIf you notice an issue with Kubernetes documentation or have an idea for new content, then open an issue. All you need is a GitHub account and a web browser.In most cases, new work on Kubernetes documentation begins with an issue in GitHub. Kubernetes contributors then review, categorize and tag issues as needed. Next, you or another member of the Kubernetes community open a pull request with changes to resolve the issue.Opening an issueIf you want to suggest improvements to existing content or notice an error, then open an issue.Click the Create an issue link on the right sidebar. This redirects you to a GitHub issue page pre-populated with some headers.Describe the issue or suggestion for improvement. Provide as many details as you can.Click Submit new issue.After submitting, check in on your issue occasionally or turn on GitHub notifications. Reviewers and other community members might ask questions before they can take action on your issue.Suggesting new contentIf you have an idea for new content, but you aren't sure where it should go, you can still file an issue. Either:Choose an existing page in the section you think the content belongs in and click Create an issue.Go to GitHub and file the issue directly.How to file great issuesKeep the following in mind when filing an issue:Provide a clear issue description. Describe what specifically is missing, out of date, wrong, or needs improvement.Explain the specific impact the issue has on users.Limit the scope of a given issue to a reasonable unit of work. For problems with a large scope, break them down into smaller issues. For example, \"Fix the security docs\" is too broad, but \"Add details to the 'Restricting network access' topic\" is specific enough to be actionable.Search the existing issues to see if there's anything related or similar to the new issue.If the new issue relates to another issue or pull request, refer to it either by its full URL or by the issue or pull request number prefixed with a # character. For example, Introduced by #987654.Follow the Code of Conduct. Respect your fellow contributors. For example, \"The docs are terrible\" is not helpful or polite", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/suggesting-improvements/", "id": "k8s_00159"}
{"instruction": "Explain documenting a feature for a release in Kubernetes", "response": "Documenting a feature for a releaseEach major Kubernetes release introduces new features that require documentation. New releases also bring updates to existing features and documentation (such as upgrading a feature from alpha to beta).Generally, the SIG responsible for a feature submits draft documentation of the feature as a pull request to the appropriate development branch of the kubernetes/website repository, and someone on the SIG Docs team provides editorial", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/new-content/new-features/", "id": "k8s_00160"}
{"instruction": "Write a yaml example for documenting a feature for a release", "response": "Here's a yaml example:\n\n```yaml\nstages:\n  - stage: <alpha/beta/stable/deprecated>  # Specify the development stage of the feature gate\n    defaultValue: <true or false>     # Set to true if enabled by default, false otherwise\n    fromVersion: <Version>            # Version from which the feature gate is available\n    toVersion: <Version>              # (Optional) The version until which the feature gate is available\n```\n\nDocumenting a feature for a release | With net new feature gates, a separate description of the feature gate is also required; create a new Markdown file inside content/en/docs/reference/command-line-tools-reference/feature-gates/ (use ot", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/new-content/new-features/", "id": "k8s_00160_code_2011"}
{"instruction": "Write a yaml example for documenting a feature for a release", "response": "Here's a yaml example:\n\n```yaml\nstages:\n  - stage: alpha \n    defaultValue: false\n    fromVersion: \"1.12\"\n    toVersion: \"1.12\"\n  - stage: beta \n    defaultValue: true\n    fromVersion: \"1.13\"\n  # Added a `toVersion` to the previous stage.\n    toVersion: \"1.18\"\n  # Added 'stable' stage block to existing stages.\n  - stage: stable\n    defaultValue: true\n    fromVersion: \"1.19\"\n    toVersion: \"1.27\"\n```\n\nDocumenting a feature for a release | Eventually, Kubernetes will stop including the feature gate at all. To signify the removal of a feature gate, include removed: true in the front matter of the respective description file. Making that", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/new-content/new-features/", "id": "k8s_00160_code_2012"}
{"instruction": "Explain the Kubernetes concept: CronJob", "response": "CronJobA CronJob starts one-time Jobs on a repeating schedule.FEATURE STATE: Kubernetes v1.21 [stable]A CronJob creates Jobs on a repeating schedule.CronJob is meant for performing regular scheduled actions such as backups, report generation, and so on. One CronJob object is like one line of a crontab (cron table) file on a Unix system. It runs a Job periodically on a given schedule, written in Cron format.CronJobs have limitations and idiosyncrasies. For example, in certain circumstances, a single CronJob can create multiple concurrent Jobs. See the limitations below.When the control plane creates new Jobs and (indirectly) Pods for a CronJob, the .metadata.name of the CronJob is part of the basis for naming those Pods. The name of a CronJob must be a valid DNS subdomain value, but this can produce unexpected results for the Pod hostnames. For best compatibility, the name should follow the more restrictive rules for a DNS label. Even when the name is a DNS subdomain, the name must be no longer than 52 characters. This is because the CronJob controller will automatically append 11 characters to the name you provide and there is a constraint that the length of a Job name is no more than 63 characters.ExampleThis example CronJob manifest prints the current time and a hello message every minute:application/job/cronjob.yaml apiVersion: batch/v1 kind: CronJob metadata: name: hello spec: schedule: \"* * * * *\" jobTemplate: spec: template: spec: containers: - name: hello image: busybox:1.28 imagePullPolicy: IfNotPresent command: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure (Running Automated Tasks with a CronJob takes you through this example in more detail).Writing a CronJob specSchedule syntaxThe .spec.schedule field is required. The value of that field follows the Cron syntax:# ┌───────────── minute (0 - 59) # │ ┌───────────── hour (0 - 23) # │ │ ┌───────────── day of the month (1 - 31) # │ │ │ ┌───────────── month (1 - 12) # │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday) # │ │ │ │ │ OR sun, mon, tue, wed, thu, fri, sat # │ │ │ │ │ # │ │ │ │ │ # * * * * * For example, 0 3 * * 1 means this task is scheduled to run weekly on a Monday at 3 AM.The format also includes extended \"Vixie cron\" step values. As explained in the FreeBSD manual:Step values can be used in conjunction with ranges. Following a range with /<number> specifies skips of the number's value through the range. For example, 0-23/2 can be used in the hours field to specify command execution every other hour (the alternative in the V7 standard is 0,2,4,6,8,10,12,14,16,18,20,22). Steps are also permitted after an asterisk, so if you want to say \"every two hours\", just use */2.Note:A question mark (?) in the schedule has the same meaning as an asterisk *, that is, it stands for any of available value for a given field.Other than the standard syntax, some macros like @monthly can also be used:EntryDescriptionEquivalent to@yearly (or @annually)Run once a year at midnight of 1 January0 0 1 1 *@monthlyRun once a month at midnight of the first day of the month0 0 1 * *@weeklyRun once a week at midnight on Sunday morning0 0 * * 0@daily (or @midnight)Run once a day at midnight0 0 * * *@hourlyRun once an hour at the beginning of the hour0 * * * *To generate CronJob schedule expressions, you can also use web tools like crontab.guru.Job templateThe .spec.jobTemplate defines a template for the Jobs that the CronJob creates, and it is required. It has exactly the same schema as a Job, except that it is nested and does not have an apiVersion or kind. You can specify common metadata for the templated Jobs, such as labels or annotations. For information about writing a Job .spec, see Writing a Job Spec.Deadline for delayed Job startThe .spec.startingDeadlineSeconds field is optional. This field defines a deadline (in whole seconds) for starting the Job, if that Job misses its scheduled time for any reason.After missing the deadl", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/", "id": "k8s_00161"}
{"instruction": "Write a yaml example for cronjob", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nCronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/", "id": "k8s_00161_code_2014"}
{"instruction": "Write a yaml example for cronjob", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nCronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/", "id": "k8s_00161_code_2015"}
{"instruction": "Write a yaml example for cronjob", "response": "Here's a yaml example:\n\n```yaml\napplication/job/cronjob.yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nCronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/", "id": "k8s_00161_code_2016"}
{"instruction": "Write a yaml example for cronjob", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nCronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/", "id": "k8s_00161_code_2017"}
{"instruction": "How do you configure access to multiple clusters in Kubernetes?", "response": "Configure Access to Multiple ClustersThis page shows how to configure access to multiple clusters by using configuration files. After your clusters, users, and contexts are defined in one or more configuration files, you can quickly switch between clusters by using the kubectl config use-context command.Note:A file that is used to configure access to a cluster is sometimes called a kubeconfig file. This is a generic way of referring to configuration files. It does not mean that there is a file named kubeconfig.Warning:Only use kubeconfig files from trusted sources. Using a specially-crafted kubeconfig file could result in malicious code execution or file exposure. If you must use an untrusted kubeconfig file, inspect it carefully first, much as you would a shell script.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check that kubectl is installed, run kubectl version --client. The kubectl version should be within one minor version of your cluster's API server.Define clusters, users, and contextsSuppose you have two clusters, one for development work and one for test work. In the development cluster, your frontend developers work in a namespace called frontend, and your storage developers work in a namespace called storage. In your test cluster, developers work in the default namespace, or they create auxiliary namespaces as they see fit. Access to the development cluster requires authentication by certificate. Access to the test cluster requires authentication by username and password.Create a directory named config-exercise. In your config-exercise directory, create a file named config-demo with this content:apiVersion: v1 kind: Config preferences: {} clusters: - cluster: name: development - cluster: name: test users: - name: developer - name: experimenter contexts: - context: name: dev-frontend - context: name: dev-storage - context: name: exp-test A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.Go to your config-exercise directory. Enter these commands to add cluster details to your configuration file:kubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file kubectl config --kubeconfig=config-demo set-cluster test --server=https://5.6.7.8 --insecure-skip-tls-verify Add user details to your configuration file:Caution:Storing passwords in Kubernetes client config is risky. A better alternative would be to use a credential plugin and store them separately. See: client-go credential pluginskubectl config --kubeconfig=config-demo set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile kubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password Note:To delete a user you can run kubectl --kubeconfig=config-demo config unset users.<name>To remove a cluster, you can run kubectl --kubeconfig=config-demo config unset clusters.<name>To remove a context, you can run kubectl --kubeconfig=config-demo config unset contexts.<name>Add context details to your configuration file:kubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer kubectl config --kubeconfig=config-demo set-context dev-storage --cluster=development --namespace=storage --user=developer kubectl config --kubeconfig=config-demo set-context exp-test --cluster=test --namespace=default --user=experimenter Open your config-demo file to see the added details. As an alte", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\nConfigure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2019"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file\nkubectl config --kubeconfig=config-demo set-cluster test --server=https://5.6.7.8 --insecure-skip-tls-verify\n```\n\nConfigure Access to Multiple Clusters | Add user details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2020"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile\nkubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password\n```\n\nConfigure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2021"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer\nkubectl config --kubeconfig=config-demo set-context dev-storage --cluster=development --namespace=storage --user=developer\nkubectl config --kubeconfig=config-demo set-context exp-test --cluster=test --namespace=default --user=experimenter\n```\n\nConfigure Access to Multiple Clusters | Open your config-demo file to see the added details. As an alternative to opening the config-demo file, you can use the config view command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2022"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view\n```\n\nConfigure Access to Multiple Clusters | The output shows the two clusters, two users, and three contexts:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2023"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\nConfigure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2024"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-frontend\n```\n\nConfigure Access to Multiple Clusters | Now whenever you enter a kubectl command, the action will apply to the cluster, and namespace listed in the dev-frontend context. And the command will use the credentials of the user listed in the dev", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2025"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\nConfigure Access to Multiple Clusters | The output shows configuration information associated with the dev-frontend context:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2026"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\nConfigure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2027"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context exp-test\n```\n\nConfigure Access to Multiple Clusters | Now any kubectl command you give will apply to the default namespace of the test cluster. And the command will use the credentials of the user listed in the exp-test context.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2028"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\nConfigure Access to Multiple Clusters | Finally, suppose you want to work for a while in the storage namespace of the development cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2029"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-storage\n```\n\nConfigure Access to Multiple Clusters | View configuration associated with the new current context, dev-storage.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2030"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\nConfigure Access to Multiple Clusters | In your config-exercise directory, create a file named config-demo-2 with this content:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2031"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\nConfigure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2032"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\nConfigure Access to Multiple Clusters | You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two node", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2033"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nConfigure Access to Multiple Clusters | Suppose you have two clusters, one for development work and one for test work. In the development cluster, your frontend developers work in a namespace called frontend, and your storage developers wor", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2034"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\nConfigure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2035"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset users.<name>\n```\n\nConfigure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2036"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset clusters.<name>\n```\n\nConfigure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2037"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset contexts.<name>\n```\n\nConfigure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2038"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\nConfigure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2039"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\nConfigure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2040"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\nConfigure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2041"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\n```\n\nConfigure Access to Multiple Clusters | For more information about how kubeconfig files are merged, see Organizing Cluster Access Using kubeconfig Files", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2042"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\nConfigure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2043"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file\nkubectl config --kubeconfig=config-demo set-cluster test --server=https://5.6.7.8 --insecure-skip-tls-verify\n```\n\nConfigure Access to Multiple Clusters | Add user details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2044"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile\nkubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password\n```\n\nConfigure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2045"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer\nkubectl config --kubeconfig=config-demo set-context dev-storage --cluster=development --namespace=storage --user=developer\nkubectl config --kubeconfig=config-demo set-context exp-test --cluster=test --namespace=default --user=experimenter\n```\n\nConfigure Access to Multiple Clusters | Open your config-demo file to see the added details. As an alternative to opening the config-demo file, you can use the config view command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2046"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view\n```\n\nConfigure Access to Multiple Clusters | The output shows the two clusters, two users, and three contexts:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2047"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\nConfigure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2048"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-frontend\n```\n\nConfigure Access to Multiple Clusters | Now whenever you enter a kubectl command, the action will apply to the cluster, and namespace listed in the dev-frontend context. And the command will use the credentials of the user listed in the dev", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2049"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\nConfigure Access to Multiple Clusters | The output shows configuration information associated with the dev-frontend context:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2050"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\nConfigure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2051"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context exp-test\n```\n\nConfigure Access to Multiple Clusters | Now any kubectl command you give will apply to the default namespace of the test cluster. And the command will use the credentials of the user listed in the exp-test context.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2052"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\nConfigure Access to Multiple Clusters | Finally, suppose you want to work for a while in the storage namespace of the development cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2053"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-storage\n```\n\nConfigure Access to Multiple Clusters | View configuration associated with the new current context, dev-storage.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2054"}
{"instruction": "Write a bash example for configure access to multiple clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\nConfigure Access to Multiple Clusters | In your config-exercise directory, create a file named config-demo-2 with this content:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2055"}
{"instruction": "Write a yaml example for configure access to multiple clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\nConfigure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/", "id": "k8s_00162_code_2056"}
{"instruction": "What is the reference documentation for pod?", "response": "PodPod is a collection of containers that can run on a host.apiVersion: v1import \"k8s.io/api/core/v1\"PodPod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.apiVersion: v1kind: Podmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (PodSpec)Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (PodStatus)Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusPodSpecPodSpec is a description of a pod.Containerscontainers ([]Container), requiredPatch strategy: merge on key nameMap: unique values on key name will be kept during a mergeList of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.initContainers ([]Container)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeList of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ephemeralContainers ([]EphemeralContainer)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeList of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource.imagePullSecrets ([]LocalObjectReference)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-podenableServiceLinks (boolean)EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.os (PodOS)Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set.If the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptionsIf the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.resources - spec.securityContext.appArmorProfile - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGr", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/", "id": "k8s_00163"}
{"instruction": "What is the reference documentation for kubelet systemd watchdog?", "response": "Kubelet Systemd WatchdogFEATURE STATE: Kubernetes v1.32 [beta] (enabled by default: true)On Linux nodes, Kubernetes 1.34 supports integrating with systemd to allow the operating system supervisor to recover a failed kubelet. This integration is not enabled by default. It can be used as an alternative to periodically requesting the kubelet's /healthz endpoint for health checks. If the kubelet does not respond to the watchdog within the timeout period, the watchdog will kill the kubelet.The systemd watchdog works by requiring the service to periodically send a keep-alive signal to the systemd process. If the signal is not received within a specified timeout period, the service is considered unresponsive and is terminated. The service can then be restarted according to the configuration.ConfigurationUsing the systemd watchdog requires configuring the WatchdogSec parameter in the [Service] section of the kubelet service unit file:[Service] WatchdogSec=30s Setting WatchdogSec=30s indicates a service watchdog timeout of 30 seconds. Within the kubelet, the sd_notify() function is invoked, at intervals of \\( WatchdogSec \\div 2\\). to send WATCHDOG=1 (a keep-alive message). If the watchdog is not fed within the timeout period, the kubelet will be killed. Setting Restart to \"always\", \"on-failure\", \"on-watchdog\", or \"on-abnormal\" will ensure that the service is automatically restarted.Some details about the systemd configuration:If you set the systemd value for WatchdogSec to 0, or omit setting it, the systemd watchdog is not enabled for this unit.The kubelet supports a minimum watchdog period of 1.0 seconds; this is to prevent the kubelet from being killed unexpectedly. You can set the value of WatchdogSec in a systemd unit definition to a period shorter than 1 second, but Kubernetes does not support any shorter interval. The timeout does not have to be a whole integer number of seconds.The Kubernetes project suggests setting WatchdogSec to approximately a 15s period. Periods longer than 10 minutes are supported but explicitly not recommended.Example Configuration[Unit] Description=kubelet: The Kubernetes Node Agent Documentation=https://kubernetes.io/docs/home/ Wants=network-online.target After=network-online.target [Service] ExecStart=/usr/bin/kubelet # Configures the watchdog timeout WatchdogSec=30s Restart=on-failure StartLimitInterval=0 RestartSec=10 [Install] WantedBy=multi-user.target What's nextFor more details about systemd configuration, refer to the systemd documentation", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/systemd-watchdog/", "id": "k8s_00164"}
{"instruction": "What is the reference documentation for kubectl create serviceaccount?", "response": "kubectl create serviceaccountSynopsisCreate a service account with the specified name.kubectl create serviceaccount NAME [--dry-run=server|client|none] Examples # Create a new service account named my-service-account kubectl create serviceaccount my-service-account Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for serviceaccount-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_serviceaccount/", "id": "k8s_00165"}
{"instruction": "Write a bash example for kubectl create serviceaccount", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount NAME [--dry-run=server|client|none]\n```\n\nkubectl create serviceaccount | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_serviceaccount/", "id": "k8s_00165_code_2060"}
{"instruction": "Write a bash example for kubectl create serviceaccount", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount NAME [--dry-run=server|client|none]\n```\n\nkubectl create serviceaccount | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_serviceaccount/", "id": "k8s_00165_code_2061"}
{"instruction": "Explain contributing to kubernetes blogs in Kubernetes", "response": "Contributing to Kubernetes blogsThere are two official Kubernetes blogs, and the CNCF has its own blog where you can cover Kubernetes too. For the main Kubernetes blog, we (the Kubernetes project) like to publish articles with different perspectives and special focuses, that have a link to Kubernetes.With only a few special case exceptions, we only publish content that hasn't been submitted or published anywhere else.Read the blog guidelines for more about that aspect.Official Kubernetes blogsMain blogThe main Kubernetes blog is used by the project to communicate new features, community reports, and any news that might be relevant to the Kubernetes community. This includes end users and developers. Most of the blog's content is about things happening in the core project, but Kubernetes as a project encourages you to submit about things happening elsewhere in the ecosystem too!Anyone can write a blog post and submit it for publication. With only a few special case exceptions, we only publish content that hasn't been submitted or published anywhere else.Contributor blogThe Kubernetes contributor blog is aimed at an audience of people who work on Kubernetes more than people who work with Kubernetes. The Kubernetes project deliberately publishes some articles to both blogs.Anyone can write a blog post and submit it for review.Article updates and maintenanceThe Kubernetes project does not maintain older articles for its blogs. This means that any published article more than one year old will normally not be eligible for issues or pull requests that ask for changes. To avoid establishing precedent, even technically correct pull requests are likely to be rejected.However, there are exceptions like the following:(updates to) articles marked as evergreenremoving or correcting articles giving advice that is now wrong and dangerous to followfixes to ensure that an existing article still renders correctlyFor any article that is over a year old and not marked as evergreen, the website automatically displays a notice that the content may be stale.Evergreen articlesYou can mark an article as evergreen by setting evergreen: true in the front matter.We only mark blog articles as maintained (evergreen: true in front matter) if the Kubernetes project can commit to maintaining them indefinitely. Some blog articles absolutely merit this; for example, the release comms team always marks official release announcements as evergreen.What's nextDiscover the official blogs:Kubernetes blogKubernetes contributor blogRead about reviewing blog pull requestsSubmitting articles to Kubernetes blogsBlog guidelinesBlog article mirroringPost-release communicationsHelping as a blog writing buddy", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/blog/", "id": "k8s_00166"}
{"instruction": "Explain diagram guide in Kubernetes", "response": "Diagram GuideThis guide shows you how to create, edit and share diagrams using the Mermaid JavaScript library. Mermaid.js allows you to generate diagrams using a simple markdown-like syntax inside Markdown files. You can also use Mermaid to generate .svg or .png image files that you can add to your documentation.The target audience for this guide is anybody wishing to learn about Mermaid and/or how to create and add diagrams to Kubernetes documentation.Figure 1 outlines the topics covered in this section.flowchart LR subgraph m[Mermaid.js] direction TB S[ ]-.- C[builddiagramswith markdown] --> D[on-linelive editor] end A[Why are diagramsuseful?] --> m m --> N[3 x methodsfor creatingdiagrams] N --> T[Examples] T --> X[Stylingandcaptions] X --> V[Tips] classDef box fill:#fff,stroke:#000,stroke-width:1px,color:#000; classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000 class A,C,D,N,X,m,T,V box class S spacewhite %% you can hyperlink Mermaid diagram nodes to a URL using click statements click A \"https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYnVpbGQ8YnI-ZGlhZ3JhbXM8YnI-d2l0aCBtYXJrZG93bl0gLS0-XG4gICAgICAgIERbb24tbGluZTxicj5saXZlIGVkaXRvcl1cbiAgICBlbmRcbiAgICBBW1doeSBhcmUgZGlhZ3JhbXM8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFhbU3R5bGluZzxicj5hbmQ8YnI-Y2FwdGlvbnNdXG4gICAgWCAtLT4gVltUaXBzXVxuICAgIFxuIFxuICAgIGNsYXNzRGVmIGJveCBmaWxsOiNmZmYsc3Ryb2tlOiMwMDAsc3Ryb2tlLXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9\" _blank click C \"https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYnVpbGQ8YnI-ZGlhZ3JhbXM8YnI-d2l0aCBtYXJrZG93bl0gLS0-XG4gICAgICAgIERbb24tbGluZTxicj5saXZlIGVkaXRvcl1cbiAgICBlbmRcbiAgICBBW1doeSBhcmUgZGlhZ3JhbXM8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFhbU3R5bGluZzxicj5hbmQ8YnI-Y2FwdGlvbnNdXG4gICAgWCAtLT4gVltUaXBzXVxuICAgIFxuIFxuICAgIGNsYXNzRGVmIGJveCBmaWxsOiNmZmYsc3Ryb2tlOiMwMDAsc3Ryb2tlLXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9\" _blank click D \"https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IExSXG4gICAgc3ViZ3JhcGggbVtNZXJtYWlkLmpzXVxuICAgIGRpcmVjdGlvbiBUQlxuICAgICAgICBTWyBdLS4tXG4gICAgICAgIENbYnVpbGQ8YnI-ZGlhZ3JhbXM8YnI-d2l0aCBtYXJrZG93bl0gLS0-XG4gICAgICAgIERbb24tbGluZTxicj5saXZlIGVkaXRvcl1cbiAgICBlbmRcbiAgICBBW1doeSBhcmUgZGlhZ3JhbXM8YnI-dXNlZnVsP10gLS0-IG1cbiAgICBtIC0tPiBOWzMgeCBtZXRob2RzPGJyPmZvciBjcmVhdGluZzxicj5kaWFncmFtc11cbiAgICBOIC0tPiBUW0V4YW1wbGVzXVxuICAgIFQgLS0-IFhbU3R5bGluZzxicj5hbmQ8YnI-Y2FwdGlvbnNdXG4gICAgWCAtLT4gVltUaXBzXVxuICAgIFxuIFxuICAgIGNsYXNzRGVmIGJveCBmaWxsOiNmZmYsc3Ryb2tlOiMwMDAsc3Ryb2tlLXdpZHRoOjFweCxjb2xvcjojMDAwO1xuICAgIGNsYXNzRGVmIHNwYWNld2hpdGUgZmlsbDojZmZmZmZmLHN0cm9rZTojZmZmLHN0cm9rZS13aWR0aDowcHgsY29sb3I6IzAwMFxuICAgIGNsYXNzIEEsQyxELE4sWCxtLFQsViBib3hcbiAgICBjbGFzcyBTIHNwYWNld2hpdGUiLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOnRydWV9\" _blank click N \"https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjo", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/diagram-guide/", "id": "k8s_00167"}
{"instruction": "What is the reference documentation for kubectl config?", "response": "kubectl configSynopsisModify kubeconfig files using subcommands like \"kubectl config set current-context my-context\".The loading order follows these rules:If the --kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes place.If $KUBECONFIG environment variable is set, then it is used as a list of paths (normal path delimiting rules for your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list.Otherwise, ${HOME}/.kube/config is used and no merging takes place.kubectl config SUBCOMMAND Options-h, --helphelp for config--kubeconfig stringuse a particular kubeconfig fileParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerkubectl config current-context - Display the current-contextkubectl config delete-cluster - Delete the specified cluster from the kubeconfigkubectl config delete-context - Delete the spe", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/", "id": "k8s_00168"}
{"instruction": "Write a bash example for kubectl config", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND\n```\n\nkubectl config | help for config", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/", "id": "k8s_00168_code_2065"}
{"instruction": "Write a bash example for kubectl config", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND\n```\n\nkubectl config | help for config", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/", "id": "k8s_00168_code_2066"}
{"instruction": "What is the reference documentation for kubectl taint?", "response": "kubectl taintSynopsisUpdate the taints on one or more nodes.A taint consists of a key, value, and effect. As an argument here, it is expressed as key=value:effect.The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 253 characters.Optionally, the key can begin with a DNS subdomain prefix and a single '/', like example.com/my-app.The value is optional. If given, it must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters.The effect must be NoSchedule, PreferNoSchedule or NoExecute.Currently taint can only apply to node.kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N Examples # Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule' # If a taint with that key and effect already exists, its value is replaced as specified kubectl taint nodes foo dedicated=special-user:NoSchedule # Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists kubectl taint nodes foo dedicated:NoSchedule- # Remove from node 'foo' all the taints with key 'dedicated' kubectl taint nodes foo dedicated- # Add a taint with key 'dedicated' on nodes having label myLabel=X kubectl taint node -l myLabel=X dedicated=foo:PreferNoSchedule # Add to node 'foo' a taint with key 'bar' and no value kubectl taint nodes foo bar:NoSchedule Options--allSelect all nodes in the cluster--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-taint\"Name of the manager used to track field ownership.-h, --helphelp for taint-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--overwriteIf true, allow taints to be overwritten, otherwise reject taint updates that overwrite existing taints.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate fi", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_taint/", "id": "k8s_00169"}
{"instruction": "Write a bash example for kubectl taint", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N\n```\n\nkubectl taint | Select all nodes in the cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_taint/", "id": "k8s_00169_code_2068"}
{"instruction": "Write a bash example for kubectl taint", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N\n```\n\nkubectl taint | Select all nodes in the cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_taint/", "id": "k8s_00169_code_2069"}
{"instruction": "Explain the Kubernetes concept: Logging Architecture", "response": "Logging ArchitectureApplication logs can help you understand what is happening inside your application. The logs are particularly useful for debugging problems and monitoring cluster activity. Most modern applications have some kind of logging mechanism. Likewise, container engines are designed to support logging. The easiest and most adopted logging method for containerized applications is writing to standard output and standard error streams.However, the native functionality provided by a container engine or runtime is usually not enough for a complete logging solution.For example, you may want to access your application's logs if a container crashes, a pod gets evicted, or a node dies.In a cluster, logs should have a separate storage and lifecycle independent of nodes, pods, or containers. This concept is called cluster-level logging.Cluster-level logging architectures require a separate backend to store, analyze, and query logs. Kubernetes does not provide a native storage solution for log data. Instead, there are many logging solutions that integrate with Kubernetes. The following sections describe how to handle and store logs on nodes.Pod and container logsKubernetes captures logs from each container in a running Pod.This example uses a manifest for a Pod with a container that writes text to the standard output stream, once per second.debug/counter-pod.yaml apiVersion: v1 kind: Pod metadata: name: counter spec: containers: - name: count image: busybox:1.28 args: [/bin/sh, -c, 'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done'] To run this pod, use the following command:kubectl apply -f https://k8s.io/examples/debug/counter-pod.yaml The output is:pod/counter created To fetch the logs, use the kubectl logs command, as follows:kubectl logs counter The output is similar to:0: Fri Apr 1 11:42:23 UTC 2022 1: Fri Apr 1 11:42:24 UTC 2022 2: Fri Apr 1 11:42:25 UTC 2022 You can use kubectl logs --previous to retrieve logs from a previous instantiation of a container. If your pod has multiple containers, specify which container's logs you want to access by appending a container name to the command, with a -c flag, like so:kubectl logs counter -c count Container log streamsFEATURE STATE: Kubernetes v1.32 [alpha] (enabled by default: false)As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuerySplitStreams feature gate. With that feature gate enabled, Kubernetes 1.34 allows access to these log streams directly via the Pod API. You can fetch a specific stream by specifying the stream name (either Stdout or Stderr), using the stream query string. You must have access to read the log subresource of that Pod.To demonstrate this feature, you can create a Pod that periodically writes text to both the standard output and error stream.debug/counter-pod-err.yaml apiVersion: v1 kind: Pod metadata: name: counter-err spec: containers: - name: count image: busybox:1.28 args: [/bin/sh, -c, 'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done'] To run this pod, use the following command:kubectl apply -f https://k8s.io/examples/debug/counter-pod-err.yaml To fetch only the stderr log stream, you can run:kubectl get --raw \"/api/v1/namespaces/default/pods/counter-err/log?stream=Stderr\" See the kubectl logs documentation for more details.How nodes handle container logsA container runtime handles and redirects any output generated to a containerized application's stdout and stderr streams. Different container runtimes implement this in different ways; however, the integration with the kubelet is standardized as the CRI logging format.By default, if a container restarts, the kubelet keeps one terminated container with its logs. If a pod is evicted from the node, all corresponding containers are also evicted, along with their logs.The kubelet makes logs availabl", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2071"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod.yaml\n```\n\nLogging Architecture | The output is:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2072"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter -c count\n```\n\nLogging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2073"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2074"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod-err.yaml\n```\n\nLogging Architecture | To fetch only the stderr log stream, you can run:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2075"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/namespaces/default/pods/counter-err/log?stream=Stderr\"\n```\n\nLogging Architecture | See the kubectl logs documentation for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2076"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2077"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2078"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-1\n```\n\nLogging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2079"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-2\n```\n\nLogging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2080"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\nLogging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2081"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\nLogging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2082"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2083"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous\n```\n\nLogging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2084"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2085"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2086"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2087"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\nLogging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2088"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\nLogging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2089"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\ndebug/counter-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2090"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2091"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod.yaml\n```\n\nLogging Architecture | The output is:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2092"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter -c count\n```\n\nLogging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2093"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\ndebug/counter-pod-err.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2094"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\nLogging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2095"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod-err.yaml\n```\n\nLogging Architecture | To fetch only the stderr log stream, you can run:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2096"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/namespaces/default/pods/counter-err/log?stream=Stderr\"\n```\n\nLogging Architecture | See the kubectl logs documentation for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2097"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2098"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2099"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod-streaming-sidecar.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2100"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\nLogging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2101"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-1\n```\n\nLogging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2102"}
{"instruction": "Write a bash example for logging architecture", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-2\n```\n\nLogging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2103"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/fluentd-sidecar-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\nLogging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2104"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\nLogging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2105"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod-agent-sidecar.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\nLogging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2106"}
{"instruction": "Write a yaml example for logging architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\nLogging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/logging/", "id": "k8s_00170_code_2107"}
{"instruction": "Explain the Kubernetes concept: Cluster Administration", "response": "Cluster AdministrationLower-level detail relevant to creating or administering a Kubernetes cluster.The cluster administration overview is for anyone creating or administering a Kubernetes cluster. It assumes some familiarity with core Kubernetes concepts.Planning a clusterSee the guides in Setup for examples of how to plan, set up, and configure Kubernetes clusters. The solutions listed in this article are called distros.Note:Not all distros are actively maintained. Choose distros which have been tested with a recent version of Kubernetes.Before choosing a guide, here are some considerations:Do you want to try out Kubernetes on your computer, or do you want to build a high-availability, multi-node cluster? Choose distros best suited for your needs.Will you be using a hosted Kubernetes cluster, such as Google Kubernetes Engine, or hosting your own cluster?Will your cluster be on-premises, or in the cloud (IaaS)? Kubernetes does not directly support hybrid clusters. Instead, you can set up multiple clusters.If you are configuring Kubernetes on-premises, consider which networking model fits best.Will you be running Kubernetes on \"bare metal\" hardware or on virtual machines (VMs)?Do you want to run a cluster, or do you expect to do active development of Kubernetes project code? If the latter, choose an actively-developed distro. Some distros only use binary releases, but offer a greater variety of choices.Familiarize yourself with the components needed to run a cluster.Managing a clusterLearn how to manage nodes.Read about Node autoscaling.Learn how to set up and manage the resource quota for shared clusters.Securing a clusterGenerate Certificates describes the steps to generate certificates using different tool chains.Kubernetes Container Environment describes the environment for Kubelet managed containers on a Kubernetes node.Controlling Access to the Kubernetes API describes how Kubernetes implements access control for its own API.Authenticating explains authentication in Kubernetes, including the various authentication options.Authorization is separate from authentication, and controls how HTTP calls are handled.Using Admission Controllers explains plug-ins which intercepts requests to the Kubernetes API server after authentication and authorization.Admission Webhook Good Practices provides good practices and considerations when designing mutating admission webhooks and validating admission webhooks.Using Sysctls in a Kubernetes Cluster describes to an administrator how to use the sysctl command-line tool to set kernel parameters .Auditing describes how to interact with Kubernetes' audit logs.Securing the kubeletControl Plane-Node communicationTLS bootstrappingKubelet authentication/authorizationOptional Cluster ServicesDNS Integration describes how to resolve a DNS name directly to a Kubernetes service.Logging and Monitoring Cluster Activity explains how logging in Kubernetes works and how to implement it.", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/", "id": "k8s_00171"}
{"instruction": "Explain the Kubernetes concept: Network Policies", "response": "Network PoliciesIf you want to control traffic flow at the IP address or port level (OSI layer 3 or 4), NetworkPolicies allow you to specify rules for traffic flow within your cluster, and also between Pods and the outside world. Your cluster must use a network plugin that supports NetworkPolicy enforcement.If you want to control traffic flow at the IP address or port level for TCP, UDP, and SCTP protocols, then you might consider using Kubernetes NetworkPolicies for particular applications in your cluster. NetworkPolicies are an application-centric construct which allow you to specify how a pod is allowed to communicate with various network \"entities\" (we use the word \"entity\" here to avoid overloading the more common terms such as \"endpoints\" and \"services\", which have specific Kubernetes connotations) over the network. NetworkPolicies apply to a connection with a pod on one or both ends, and are not relevant to other connections.The entities that a Pod can communicate with are identified through a combination of the following three identifiers:Other pods that are allowed (exception: a pod cannot block access to itself)Namespaces that are allowedIP blocks (exception: traffic to and from the node where a Pod is running is always allowed, regardless of the IP address of the Pod or the node)When defining a pod- or namespace-based NetworkPolicy, you use a selector to specify what traffic is allowed to and from the Pod(s) that match the selector.Meanwhile, when IP-based NetworkPolicies are created, we define policies based on IP blocks (CIDR ranges).PrerequisitesNetwork policies are implemented by the network plugin. To use network policies, you must be using a networking solution which supports NetworkPolicy. Creating a NetworkPolicy resource without a controller that implements it will have no effect.The two sorts of pod isolationThere are two sorts of isolation for a pod: isolation for egress, and isolation for ingress. They concern what connections may be established. \"Isolation\" here is not absolute, rather it means \"some restrictions apply\". The alternative, \"non-isolated for $direction\", means that no restrictions apply in the stated direction. The two sorts of isolation (or not) are declared independently, and are both relevant for a connection from one pod to another.By default, a pod is non-isolated for egress; all outbound connections are allowed. A pod is isolated for egress if there is any NetworkPolicy that both selects the pod and has \"Egress\" in its policyTypes; we say that such a policy applies to the pod for egress. When a pod is isolated for egress, the only allowed connections from the pod are those allowed by the egress list of some NetworkPolicy that applies to the pod for egress. Reply traffic for those allowed connections will also be implicitly allowed. The effects of those egress lists combine additively.By default, a pod is non-isolated for ingress; all inbound connections are allowed. A pod is isolated for ingress if there is any NetworkPolicy that both selects the pod and has \"Ingress\" in its policyTypes; we say that such a policy applies to the pod for ingress. When a pod is isolated for ingress, the only allowed connections into the pod are those from the pod's node and those allowed by the ingress list of some NetworkPolicy that applies to the pod for ingress. Reply traffic for those allowed connections will also be implicitly allowed. The effects of those ingress lists combine additively.Network policies do not conflict; they are additive. If any policy or policies apply to a given pod for a given direction, the connections allowed in that direction from that pod is the union of what the applicable policies allow. Thus, order of evaluation does not affect the policy result.For a connection from a source pod to a destination pod to be allowed, both the egress policy on the source pod and the ingress policy on the destination pod need to allow the connection. If either side does not allow the connec", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\nNetwork Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2110"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2111"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2112"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2113"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2114"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2115"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\nNetwork Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2116"}
{"instruction": "Write a bash example for network policies", "response": "Here's a bash example:\n\n```bash\nkubectl label namespace frontend namespace=frontend\nkubectl label namespace backend namespace=backend\n```\n\nNetwork Policies | Add the labels under namespaceSelector in your NetworkPolicy document. For example:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2117"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\nNetwork Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2118"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\nNetwork Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2119"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n  - from:\n    - namespaceSelector:\n        matchLabels:\n          user: alice\n      podSelector:\n        matchLabels:\n          role: client\n  ...\n```\n\nNetwork Policies | This policy contains a single from element allowing connections from Pods with the label role=client in namespaces with the label user=alice. But the following policy is different:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2120"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n  - from:\n    - namespaceSelector:\n        matchLabels:\n          user: alice\n    - podSelector:\n        matchLabels:\n          role: client\n  ...\n```\n\nNetwork Policies | It contains two elements in the from array, and allows connections from Pods in the local Namespace with the label role=client, or from any Pod in any namespace with the label user=alice.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2121"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2122"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2123"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2124"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2125"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2126"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\nNetwork Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2127"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\nNetwork Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2128"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n...\n  spec:\n    podSelector:\n      matchLabels:\n        role: client\n  ...\n```\n\nNetwork Policies | a hostNetwork pod is selected by a podSelector or namespaceSelector in an ingress or egress rule.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2129"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n    - from:\n      - podSelector:\n          matchLabels:\n            role: client\n  ...\n```\n\nNetwork Policies | At the same time, since hostNetwork pods have the same IP addresses as the nodes they reside on, their connections will be treated as node connections. For example, you can allow traffic from a hostNe", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2130"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/networkpolicy.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\nNetwork Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2131"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\nNetwork Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2132"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-ingress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2133"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2134"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-allow-all-ingress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2135"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2136"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-egress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2137"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2138"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-allow-all-egress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2139"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\nNetwork Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2140"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-all.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2141"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\nNetwork Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2142"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/networkpolicy-multiport-egress.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\nNetwork Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2143"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\nNetwork Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2144"}
{"instruction": "Write a bash example for network policies", "response": "Here's a bash example:\n\n```bash\nkubectl label namespace frontend namespace=frontend\nkubectl label namespace backend namespace=backend\n```\n\nNetwork Policies | Add the labels under namespaceSelector in your NetworkPolicy document. For example:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2145"}
{"instruction": "Write a yaml example for network policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\nNetwork Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/network-policies/", "id": "k8s_00172_code_2146"}
{"instruction": "What is the reference documentation for using node authorization?", "response": "Using Node AuthorizationNode authorization is a special-purpose authorization mode that specifically authorizes API requests made by kubelets.OverviewThe Node authorizer allows a kubelet to perform API operations. This includes:Read operations:servicesendpointsnodespodssecrets, configmaps, persistent volume claims and persistent volumes related to pods bound to the kubelet's nodeFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)Kubelets are limited to reading their own Node objects, and only reading pods bound to their node.Write operations:nodes and node status (enable the NodeRestriction admission plugin to limit a kubelet to modify its own node)pods and pod status (enable the NodeRestriction admission plugin to limit a kubelet to modify pods bound to itself)eventsAuth-related operations:read/write access to the CertificateSigningRequests API for TLS bootstrappingthe ability to create TokenReviews and SubjectAccessReviews for delegated authentication/authorization checksIn future releases, the node authorizer may add or remove permissions to ensure kubelets have the minimal set of permissions required to operate correctly.In order to be authorized by the Node authorizer, kubelets must use a credential that identifies them as being in the system:nodes group, with a username of system:node:<nodeName>. This group and user name format match the identity created for each kubelet as part of kubelet TLS bootstrapping.The value of <nodeName> must match precisely the name of the node as registered by the kubelet. By default, this is the host name as provided by hostname, or overridden via the kubelet option --hostname-override. However, when using the --cloud-provider kubelet option, the specific hostname may be determined by the cloud provider, ignoring the local hostname and the --hostname-override option. For specifics about how the kubelet determines the hostname, see the kubelet options reference.To enable the Node authorizer, start the API server with the --authorization-config flag set to a file that includes the Node authorizer; for example:apiVersion: apiserver.config.k8s.io/v1 kind: AuthorizationConfiguration authorizers: ... - type: Node ... Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes Node; for example:kube-apiserver --authorization-mode=...,Node --other-options --more-options To limit the API objects kubelets are able to write, enable the NodeRestriction admission plugin by starting the apiserver with --enable-admission-plugins=...,NodeRestriction,...Migration considerationsKubelets outside the system:nodes groupKubelets outside the system:nodes group would not be authorized by the Node authorization mode, and would need to continue to be authorized via whatever mechanism currently authorizes them. The node admission plugin would not restrict requests from these kubelets.Kubelets with undifferentiated usernamesIn some deployments, kubelets have credentials that place them in the system:nodes group, but do not identify the particular node they are associated with, because they do not have a username in the system:node:... format. These kubelets would not be authorized by the Node authorization mode, and would need to continue to be authorized via whatever mechanism currently authorizes them.The NodeRestriction admission plugin would ignore requests from these kubelets, since the default node identifier implementation would not consider that a node identity.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/node/", "id": "k8s_00173"}
{"instruction": "Write a yaml example for using node authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: Node\n  ...\n```\n\nUsing Node Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes Node; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/node/", "id": "k8s_00173_code_2148"}
{"instruction": "Write a yaml example for using node authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: Node\n  ...\n```\n\nUsing Node Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes Node; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/node/", "id": "k8s_00173_code_2149"}
{"instruction": "Write a yaml example for using node authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: Node\n  ...\n```\n\nUsing Node Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes Node; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/node/", "id": "k8s_00173_code_2150"}
{"instruction": "Explain generating reference documentation for the kubernetes api in Kubernetes", "response": "Generating Reference Documentation for the Kubernetes APIThis page shows how to update the Kubernetes API reference documentation.The Kubernetes API reference documentation is built from the Kubernetes OpenAPI spec using the kubernetes-sigs/reference-docs generation code.If you find bugs in the generated documentation, you need to fix them upstream.If you need only to regenerate the reference documentation from the OpenAPI spec, continue reading this page.Before you beginRequirements:You need a machine that is running Linux or macOS.You need to have these tools installed:Python v3.7.x+GitGolang version 1.13+Pip used to install PyYAMLPyYAML v5.1.2makegcc compiler/linkerDocker (Required only for kubectl command reference)Your PATH environment variable must include the required build tools, such as the Go binary and python.You need to know how to create a pull request to a GitHub repository. This involves creating your own fork of the repository. For more information, see Work from a local clone.Set up the local repositoriesCreate a local workspace and set your GOPATH:mkdir -p $HOME/<workspace> export GOPATH=$HOME/<workspace> Get a local clone of the following repositories:go get -u github.com/kubernetes-sigs/reference-docs go get -u github.com/go-openapi/loads go get -u github.com/go-openapi/spec If you don't already have the kubernetes/website repository, get it now:git clone https://github.com/<your-username>/website $GOPATH/src/github.com/<your-username>/website Get a clone of the kubernetes/kubernetes repository as k8s.io/kubernetes:git clone https://github.com/kubernetes/kubernetes $GOPATH/src/k8s.io/kubernetes The base directory of your clone of the kubernetes/kubernetes repository is $GOPATH/src/k8s.io/kubernetes. The remaining steps refer to your base directory as <k8s-base>.The base directory of your clone of the kubernetes/website repository is $GOPATH/src/github.com/<your username>/website. The remaining steps refer to your base directory as <web-base>.The base directory of your clone of the kubernetes-sigs/reference-docs repository is $GOPATH/src/github.com/kubernetes-sigs/reference-docs. The remaining steps refer to your base directory as <rdocs-base>.Generate the API reference docsThis section shows how to generate the published Kubernetes API reference documentation.Set build variablesSet K8S_ROOT to <k8s-base>.Set K8S_WEBROOT to <web-base>.Set K8S_RELEASE to the version of the docs you want to build. For example, if you want to build docs for Kubernetes 1.17.0, set K8S_RELEASE to 1.17.0.For example:export K8S_WEBROOT=${GOPATH}/src/github.com/<your-username>/website export K8S_ROOT=${GOPATH}/src/k8s.io/kubernetes export K8S_RELEASE=1.17.0 Create versioned directory and fetch Open API specThe updateapispec build target creates the versioned build directory. After the directory is created, the Open API spec is fetched from the <k8s-base> repository. These steps ensure that the version of the configuration files and Kubernetes Open API spec match the release version. The versioned directory name follows the pattern of v<major>_<minor>.In the <rdocs-base> directory, run the following build target:cd <rdocs-base> make updateapispec Build the API reference docsThe copyapi target builds the API reference and copies the generated files to directories in <web-base>. Run the following command in <rdocs-base>:cd <rdocs-base> make copyapi Verify that these two files have been generated:[ -e \"<rdocs-base>/gen-apidocs/build/index.html\" ] && echo \"index.html built\" || echo \"no index.html\" [ -e \"<rdocs-base>/gen-apidocs/build/navData.js\" ] && echo \"navData.js built\" || echo \"no navData.js\" Go to the base of your local <web-base>, and view which files have been modified:cd <web-base> git status The output is similar to:static/docs/reference/generated/kubernetes-api/v1.34/css/bootstrap.min.css static/docs/reference/generated/kubernetes-api/v1.34/css/font-awesome.min.css static/docs/reference/generated/kubernetes-api/v1.34/css/style", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/kubernetes-api/", "id": "k8s_00174"}
{"instruction": "What is the reference documentation for protocols for services?", "response": "Protocols for ServicesIf you configure a Service, you can select from any network protocol that Kubernetes supports.Kubernetes supports the following protocols with Services:SCTPTCP (the default)UDPWhen you define a Service, you can also specify the application protocol that it uses.This document details some special cases, all of them typically using TCP as a transport protocol:HTTP and HTTPSPROXY protocolTLS termination at the load balancerSupported protocolsThere are 3 valid values for the protocol of a port for a Service:SCTPFEATURE STATE: Kubernetes v1.20 [stable]When using a network plugin that supports SCTP traffic, you can use SCTP for most Services. For type: LoadBalancer Services, SCTP support depends on the cloud provider offering this facility. (Most do not).SCTP is not supported on nodes that run Windows.Support for multihomed SCTP associationsThe support of multihomed SCTP associations requires that the CNI plugin can support the assignment of multiple interfaces and IP addresses to a Pod.NAT for multihomed SCTP associations requires special logic in the corresponding kernel modules.TCPYou can use TCP for any kind of Service, and it's the default network protocol.UDPYou can use UDP for most Services. For type: LoadBalancer Services, UDP support depends on the cloud provider offering this facility.Special casesHTTPIf your cloud provider supports it, you can use a Service in LoadBalancer mode to configure a load balancer outside of your Kubernetes cluster, in a special mode where your cloud provider's load balancer implements HTTP / HTTPS reverse proxying, with traffic forwarded to the backend endpoints for that Service.Typically, you set the protocol for the Service to TCP and add an annotation (usually specific to your cloud provider) that configures the load balancer to handle traffic at the HTTP level. This configuration might also include serving HTTPS (HTTP over TLS) and reverse-proxying plain HTTP to your workload.Note:You can also use an Ingress to expose HTTP/HTTPS Services.You might additionally want to specify that the application protocol of the connection is http or https. Use http if the session from the load balancer to your workload is HTTP without TLS, and use https if the session from the load balancer to your workload uses TLS encryption.PROXY protocolIf your cloud provider supports it, you can use a Service set to type: LoadBalancer to configure a load balancer outside of Kubernetes itself, that will forward connections wrapped with the PROXY protocol.The load balancer then sends an initial series of octets describing the incoming connection, similar to this example (PROXY protocol v1):PROXY TCP4 192.0.2.202 10.0.42.7 12345 7\\r\\n The data after the proxy protocol preamble are the original data from the client. When either side closes the connection, the load balancer also triggers a connection close and sends any remaining data where feasible.Typically, you define a Service with the protocol to TCP. You also set an annotation, specific to your cloud provider, that configures the load balancer to wrap each incoming connection in the PROXY protocol.TLSIf your cloud provider supports it, you can use a Service set to type: LoadBalancer as a way to set up external reverse proxying, where the connection from client to load balancer is TLS encrypted and the load balancer is the TLS server peer. The connection from the load balancer to your workload can also be TLS, or might be plain text. The exact options available to you depend on your cloud provider or custom Service implementation.Typically, you set the protocol to TCP and set an annotation (usually specific to your cloud provider) that configures the load balancer to act as a TLS server. You would configure the TLS identity (as server, and possibly also as a client that connects to your workload) using mechanisms that are specific to your cloud provider.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/service-protocols/", "id": "k8s_00175"}
{"instruction": "Explain the Kubernetes concept: Cloud Native Security and Kubernetes", "response": "Cloud Native Security and KubernetesConcepts for keeping your cloud-native workload secure.Kubernetes is based on a cloud-native architecture, and draws on advice from the CNCF about good practice for cloud native information security.Read on through this page for an overview of how Kubernetes is designed to help you deploy a secure cloud native platform.Cloud native information securityThe CNCF white paper on cloud native security defines security controls and practices that are appropriate to different lifecycle phases.Develop lifecycle phaseEnsure the integrity of development environments.Design applications following good practice for information security, appropriate for your context.Consider end user security as part of solution design.To achieve this, you can:Adopt an architecture, such as zero trust, that minimizes attack surfaces, even for internal threats.Define a code review process that considers security concerns.Build a threat model of your system or application that identifies trust boundaries. Use that to model to identify risks and to help find ways to treat those risks.Incorporate advanced security automation, such as fuzzing and security chaos engineering, where it's justified.Distribute lifecycle phaseEnsure the security of the supply chain for container images you execute.Ensure the security of the supply chain for the cluster and other components that execute your application. An example of another component might be an external database that your cloud-native application uses for persistence.To achieve this, you can:Scan container images and other artifacts for known vulnerabilities.Ensure that software distribution uses encryption in transit, with a chain of trust for the software source.Adopt and follow processes to update dependencies when updates are available, especially in response to security announcements.Use validation mechanisms such as digital certificates for supply chain assurance.Subscribe to feeds and other mechanisms to alert you to security risks.Restrict access to artifacts. Place container images in a private registry that only allows authorized clients to pull images.Deploy lifecycle phaseEnsure appropriate restrictions on what can be deployed, who can deploy it, and where it can be deployed to. You can enforce measures from the distribute phase, such as verifying the cryptographic identity of container image artifacts.You can deploy different applications and cluster components into different namespaces. Containers themselves, and namespaces, both provide isolation mechanisms that are relevant to information security.When you deploy Kubernetes, you also set the foundation for your applications' runtime environment: a Kubernetes cluster (or multiple clusters). That IT infrastructure must provide the security guarantees that higher layers expect.Runtime lifecycle phaseThe Runtime phase comprises three critical areas: access, compute, and storage.Runtime protection: accessThe Kubernetes API is what makes your cluster work. Protecting this API is key to providing effective cluster security.Other pages in the Kubernetes documentation have more detail about how to set up specific aspects of access control. The security checklist has a set of suggested basic checks for your cluster.Beyond that, securing your cluster means implementing effective authentication and authorization for API access. Use ServiceAccounts to provide and manage security identities for workloads and cluster components.Kubernetes uses TLS to protect API traffic; make sure to deploy the cluster using TLS (including for traffic between nodes and the control plane), and protect the encryption keys. If you use Kubernetes' own API for CertificateSigningRequests, pay special attention to restricting misuse there.Runtime protection: computeContainers provide two things: isolation between different applications, and a mechanism to combine those isolated applications to run on the same host computer. Those two aspects, isolation", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/cloud-native-security/", "id": "k8s_00176"}
{"instruction": "What is the reference documentation for deprecated api migration guide?", "response": "Deprecated API Migration GuideAs the Kubernetes API evolves, APIs are periodically reorganized or upgraded. When APIs evolve, the old API is deprecated and eventually removed. This page contains information you need to know when migrating from deprecated API versions to newer and more stable API versions.Removed APIs by releasev1.32The v1.32 release stopped serving the following deprecated API versions:Flow control resourcesThe flowcontrol.apiserver.k8s.io/v1beta3 API version of FlowSchema and PriorityLevelConfiguration is no longer served as of v1.32.Migrate manifests and API clients to use the flowcontrol.apiserver.k8s.io/v1 API version, available since v1.29.All existing persisted objects are accessible via the new APINotable changes in flowcontrol.apiserver.k8s.io/v1:The PriorityLevelConfiguration spec.limited.nominalConcurrencyShares field only defaults to 30 when unspecified, and an explicit value of 0 is not changed to 30.v1.29The v1.29 release stopped serving the following deprecated API versions:Flow control resourcesThe flowcontrol.apiserver.k8s.io/v1beta2 API version of FlowSchema and PriorityLevelConfiguration is no longer served as of v1.29.Migrate manifests and API clients to use the flowcontrol.apiserver.k8s.io/v1 API version, available since v1.29, or the flowcontrol.apiserver.k8s.io/v1beta3 API version, available since v1.26.All existing persisted objects are accessible via the new APINotable changes in flowcontrol.apiserver.k8s.io/v1:The PriorityLevelConfiguration spec.limited.assuredConcurrencyShares field is renamed to spec.limited.nominalConcurrencyShares and only defaults to 30 when unspecified, and an explicit value of 0 is not changed to 30.Notable changes in flowcontrol.apiserver.k8s.io/v1beta3:The PriorityLevelConfiguration spec.limited.assuredConcurrencyShares field is renamed to spec.limited.nominalConcurrencySharesv1.27The v1.27 release stopped serving the following deprecated API versions:CSIStorageCapacityThe storage.k8s.io/v1beta1 API version of CSIStorageCapacity is no longer served as of v1.27.Migrate manifests and API clients to use the storage.k8s.io/v1 API version, available since v1.24.All existing persisted objects are accessible via the new APINo notable changesv1.26The v1.26 release stopped serving the following deprecated API versions:Flow control resourcesThe flowcontrol.apiserver.k8s.io/v1beta1 API version of FlowSchema and PriorityLevelConfiguration is no longer served as of v1.26.Migrate manifests and API clients to use the flowcontrol.apiserver.k8s.io/v1beta2 API version.All existing persisted objects are accessible via the new APINo notable changesHorizontalPodAutoscalerThe autoscaling/v2beta2 API version of HorizontalPodAutoscaler is no longer served as of v1.26.Migrate manifests and API clients to use the autoscaling/v2 API version, available since v1.23.All existing persisted objects are accessible via the new APINotable changes:targetAverageUtilization is replaced with target.averageUtilization and target.type: Utilization. See Autoscaling on multiple metrics and custom metrics.v1.25The v1.25 release stopped serving the following deprecated API versions:CronJobThe batch/v1beta1 API version of CronJob is no longer served as of v1.25.Migrate manifests and API clients to use the batch/v1 API version, available since v1.21.All existing persisted objects are accessible via the new APINo notable changesEndpointSliceThe discovery.k8s.io/v1beta1 API version of EndpointSlice is no longer served as of v1.25.Migrate manifests and API clients to use the discovery.k8s.io/v1 API version, available since v1.21.All existing persisted objects are accessible via the new APINotable changes in discovery.k8s.io/v1:use per Endpoint nodeName field instead of deprecated topology[\"kubernetes.io/hostname\"] fielduse per Endpoint zone field instead of deprecated topology[\"topology.kubernetes.io/zone\"] fieldtopology is replaced with the deprecatedTopology field which is not writable in v1EventThe events.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/deprecation-guide/", "id": "k8s_00177"}
{"instruction": "Write a bash example for deprecated api migration guide", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f <file> --output-version <group>/<version>\n```\n\nDeprecated API Migration Guide | For example, to convert an older Deployment to apps/v1, you can run:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/deprecation-guide/", "id": "k8s_00177_code_2155"}
{"instruction": "Write a bash example for deprecated api migration guide", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f ./my-deployment.yaml --output-version apps/v1\n```\n\nDeprecated API Migration Guide | This conversion may use non-ideal default values. To learn more about a specific resource, check the Kubernetes API reference.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/deprecation-guide/", "id": "k8s_00177_code_2156"}
{"instruction": "What is the reference documentation for articles on dockershim removal and on using cri-compatible runtimes?", "response": "Articles on dockershim Removal and on Using CRI-compatible RuntimesThis is a list of articles and other pages that are either about the Kubernetes' deprecation and removal of dockershim, or about using CRI-compatible container runtimes, in connection with that removal.Kubernetes projectKubernetes blog: Dockershim Removal FAQ (originally published 2020/12/02)Kubernetes blog: Updated: Dockershim Removal FAQ (updated published 2022/02/17)Kubernetes blog: Kubernetes is Moving on From Dockershim: Commitments and Next Steps (published 2022/01/07)Kubernetes blog: Dockershim removal is coming. Are you ready? (published 2021/11/12)Kubernetes documentation: Migrating from dockershimKubernetes documentation: Container RuntimesKubernetes enhancement proposal: KEP-2221: Removing dockershim from kubeletKubernetes enhancement proposal issue: Removing dockershim from kubelet (k/enhancements#2221)You can provide", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/topics-on-dockershim-and-cri-compatible-runtimes/", "id": "k8s_00178"}
{"instruction": "What is the reference documentation for kubectl auth reconcile?", "response": "kubectl auth reconcileSynopsisReconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.Missing objects are created, and the containing namespace is created for namespaced objects, if required.Existing roles are updated to include the permissions in the input objects, and remove extra permissions if --remove-extra-permissions is specified.Existing bindings are updated to include the subjects in the input objects, and remove extra subjects if --remove-extra-subjects is specified.This is preferred to 'apply' for RBAC resources so that semantically-aware merging of rules and subjects is done.kubectl auth reconcile -f FILENAME Examples # Reconcile RBAC resources from a file kubectl auth reconcile -f my-rbac-rules.yaml Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.-f, --filename stringsFilename, directory, or URL to files identifying the resource to reconcile.-h, --helphelp for reconcile-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--remove-extra-permissionsIf true, removes extra permissions added to roles--remove-extra-subjectsIf true, removes extra subjects added to rolebindings--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_reconcile/", "id": "k8s_00179"}
{"instruction": "Write a bash example for kubectl auth reconcile", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f FILENAME\n```\n\nkubectl auth reconcile | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_reconcile/", "id": "k8s_00179_code_2159"}
{"instruction": "Write a bash example for kubectl auth reconcile", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f FILENAME\n```\n\nkubectl auth reconcile | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_reconcile/", "id": "k8s_00179_code_2160"}
{"instruction": "How do you inject data into applications in Kubernetes?", "response": "Inject Data Into ApplicationsSpecify configuration and other data for the Pods that run your workload.Define a Command and Arguments for a ContainerDefine Dependent Environment VariablesDefine Environment Variables for a ContainerDefine Environment Variable Values Using An Init ContainerExpose Pod Information to Containers Through Environment VariablesExpose Pod Information to Containers Through FilesDistribute Credentials Securely Using Secrets", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/inject-data-application/", "id": "k8s_00180"}
{"instruction": "How do you configure runasusername for windows pods and containers in Kubernetes?", "response": "Configure RunAsUserName for Windows pods and containersFEATURE STATE: Kubernetes v1.18 [stable]This page shows how to use the runAsUserName setting for Pods and containers that will run on Windows nodes. This is roughly equivalent of the Linux-specific runAsUser setting, allowing you to run applications in a container as a different username than the default.Before you beginYou need to have a Kubernetes cluster and the kubectl command-line tool must be configured to communicate with your cluster. The cluster is expected to have Windows worker nodes where pods with containers running Windows workloads will get scheduled.Set the Username for a PodTo specify the username with which to execute the Pod's container processes, include the securityContext field (PodSecurityContext) in the Pod specification, and within it, the windowsOptions (WindowsSecurityContextOptions) field containing the runAsUserName field.The Windows security context options that you specify for a Pod apply to all Containers and init Containers in the Pod.Here is a configuration file for a Windows Pod that has the runAsUserName field set:windows/run-as-username-pod.yaml apiVersion: v1 kind: Pod metadata: name: run-as-username-pod-demo spec: securityContext: windowsOptions: runAsUserName: \"ContainerUser\" containers: - name: run-as-username-demo image: mcr.microsoft.com/windows/servercore:ltsc2019 command: [\"ping\", \"-t\", \"localhost\"] nodeSelector: kubernetes.io/os: windows Create the Pod:kubectl apply -f https://k8s.io/examples/windows/run-as-username-pod.yaml Verify that the Pod's Container is running:kubectl get pod run-as-username-pod-demo Get a shell to the running Container:kubectl exec -it run-as-username-pod-demo -- powershell Check that the shell is running user the correct username:echo $env:USERNAME The output should be:ContainerUser Set the Username for a ContainerTo specify the username with which to execute a Container's processes, include the securityContext field (SecurityContext) in the Container manifest, and within it, the windowsOptions (WindowsSecurityContextOptions) field containing the runAsUserName field.The Windows security context options that you specify for a Container apply only to that individual Container, and they override the settings made at the Pod level.Here is the configuration file for a Pod that has one Container, and the runAsUserName field is set at the Pod level and the Container level:windows/run-as-username-container.yaml apiVersion: v1 kind: Pod metadata: name: run-as-username-container-demo spec: securityContext: windowsOptions: runAsUserName: \"ContainerUser\" containers: - name: run-as-username-demo image: mcr.microsoft.com/windows/servercore:ltsc2019 command: [\"ping\", \"-t\", \"localhost\"] securityContext: windowsOptions: runAsUserName: \"ContainerAdministrator\" nodeSelector: kubernetes.io/os: windows Create the Pod:kubectl apply -f https://k8s.io/examples/windows/run-as-username-container.yaml Verify that the Pod's Container is running:kubectl get pod run-as-username-container-demo Get a shell to the running Container:kubectl exec -it run-as-username-container-demo -- powershell Check that the shell is running user the correct username (the one set at the Container level):echo $env:USERNAME The output should be:ContainerAdministrator Windows Username limitationsIn order to use this feature, the value set in the runAsUserName field must be a valid username. It must have the following format: DOMAIN\\USER, where DOMAIN\\ is optional. Windows user names are case insensitive. Additionally, there are some restrictions regarding the DOMAIN and USER:The runAsUserName field cannot be empty, and it cannot contain control characters (ASCII values: 0x00-0x1F, 0x7F)The DOMAIN must be either a NetBios name, or a DNS name, each with their own restrictions:NetBios names: maximum 15 characters, cannot start with . (dot), and cannot contain the following characters: \\ / : * ? \" < > |DNS names: maximum 255 characters, contains only alphanum", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2163"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-pod.yaml\n```\n\nConfigure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2164"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-pod-demo\n```\n\nConfigure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2165"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-pod-demo -- powershell\n```\n\nConfigure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2166"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2167"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-container.yaml\n```\n\nConfigure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2168"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-container-demo\n```\n\nConfigure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2169"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-container-demo -- powershell\n```\n\nConfigure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username (the one set at the Container level):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2170"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2171"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2172"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\nwindows/run-as-username-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2173"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2174"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-pod.yaml\n```\n\nConfigure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2175"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-pod-demo\n```\n\nConfigure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2176"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-pod-demo -- powershell\n```\n\nConfigure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2177"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\nwindows/run-as-username-container.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2178"}
{"instruction": "Write a yaml example for configure runasusername for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\nConfigure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2179"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-container.yaml\n```\n\nConfigure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2180"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-container-demo\n```\n\nConfigure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2181"}
{"instruction": "Write a bash example for configure runasusername for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-container-demo -- powershell\n```\n\nConfigure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username (the one set at the Container level):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-runasusername/", "id": "k8s_00181_code_2182"}
{"instruction": "Explain the Kubernetes concept: DaemonSet", "response": "DaemonSetA DaemonSet defines Pods that provide node-local facilities. These might be fundamental to the operation of your cluster, such as a networking helper tool, or be part of an add-on.A DaemonSet ensures that all (or some) Nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.Some typical uses of a DaemonSet are:running a cluster storage daemon on every noderunning a logs collection daemon on every noderunning a node monitoring daemon on every nodeIn a simple case, one DaemonSet, covering all nodes, would be used for each type of daemon. A more complex setup might use multiple DaemonSets for a single type of daemon, but with different flags and/or different memory and cpu requests for different hardware types.Writing a DaemonSet SpecCreate a DaemonSetYou can describe a DaemonSet in a YAML file. For example, the daemonset.yaml file below describes a DaemonSet that runs the fluentd-elasticsearch Docker image:controllers/daemonset.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: fluentd-elasticsearch namespace: kube-system labels: k8s-app: fluentd-logging spec: selector: matchLabels: name: fluentd-elasticsearch template: metadata: labels: name: fluentd-elasticsearch spec: tolerations: # these tolerations are to have the daemonset runnable on control plane nodes # remove them if your control plane nodes should not run pods - key: node-role.kubernetes.io/control-plane operator: Exists effect: NoSchedule - key: node-role.kubernetes.io/master operator: Exists effect: NoSchedule containers: - name: fluentd-elasticsearch image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1 resources: limits: memory: 200Mi requests: cpu: 100m memory: 200Mi volumeMounts: - name: varlog mountPath: /var/log # it may be desirable to set a high priority class to ensure that a DaemonSet Pod # preempts running Pods # priorityClassName: important terminationGracePeriodSeconds: 30 volumes: - name: varlog hostPath: path: /var/log Create a DaemonSet based on the YAML file:kubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml Required FieldsAs with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object management using kubectl.The name of a DaemonSet object must be a valid DNS subdomain name.A DaemonSet also needs a .spec section.Pod TemplateThe .spec.template is one of the required fields in .spec.The .spec.template is a pod template. It has exactly the same schema as a Pod, except it is nested and does not have an apiVersion or kind.In addition to required fields for a Pod, a Pod template in a DaemonSet has to specify appropriate labels (see pod selector).A Pod Template in a DaemonSet must have a RestartPolicy equal to Always, or be unspecified, which defaults to Always.Pod SelectorThe .spec.selector field is a pod selector. It works the same as the .spec.selector of a Job.You must specify a pod selector that matches the labels of the .spec.template. Also, once a DaemonSet is created, its .spec.selector can not be mutated. Mutating the pod selector can lead to the unintentional orphaning of Pods, and it was found to be confusing to users.The .spec.selector is an object consisting of two fields:matchLabels - works the same as the .spec.selector of a ReplicationController.matchExpressions - allows to build more sophisticated selectors by specifying key, list of values and an operator that relates the key and values.When the two are specified the result is ANDed.The .spec.selector must match the .spec.template.metadata.labels. Config with these two not matching will be rejected by the API.Running Pods on select NodesIf you specify a .spec.template.spec.nodeSelector, then the DaemonSet controller will create Pods on nodes which match that node selector.", "category": "concepts", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182_code_2184"}
{"instruction": "Write a bash example for daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\nDaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182_code_2185"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182_code_2186"}
{"instruction": "Write a bash example for daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\nDaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182_code_2187"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\nnodeAffinity:\n  requiredDuringSchedulingIgnoredDuringExecution:\n    nodeSelectorTerms:\n    - matchFields:\n      - key: metadata.name\n        operator: In\n        values:\n        - target-host-name\n```\n\nDaemonSet | The DaemonSet controller automatically adds a set of tolerations to DaemonSet Pods:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182_code_2188"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182_code_2189"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/", "id": "k8s_00182_code_2190"}
{"instruction": "How do you configure a pod to use a persistentvolume for storage in Kubernetes?", "response": "Configure a Pod to Use a PersistentVolume for StorageThis page shows you how to configure a Pod to use a PersistentVolumeClaim for storage. Here is a summary of the process:You, as cluster administrator, create a PersistentVolume backed by physical storage. You do not associate the volume with any Pod.You, now taking the role of a developer / cluster user, create a PersistentVolumeClaim that is automatically bound to a suitable PersistentVolume.You create a Pod that uses the above PersistentVolumeClaim for storage.Before you beginYou need to have a Kubernetes cluster that has only one Node, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a single-node cluster, you can create one by using Minikube.Familiarize yourself with the material in Persistent Volumes.Create an index.html file on your NodeOpen a shell to the single Node in your cluster. How you open a shell depends on how you set up your cluster. For example, if you are using Minikube, you can open a shell to your Node by entering minikube ssh.In your shell on that Node, create a /mnt/data directory:# This assumes that your Node uses \"sudo\" to run commands # as the superuser sudo mkdir /mnt/data In the /mnt/data directory, create an index.html file:# This again assumes that your Node uses \"sudo\" to run commands # as the superuser sudo sh -c \"echo 'Hello from Kubernetes storage' > /mnt/data/index.html\" Note:If your Node uses a tool for superuser access other than sudo, you can usually make this work if you replace sudo with the name of the other tool.Test that the index.html file exists:cat /mnt/data/index.html The output should be:Hello from Kubernetes storage You can now close the shell to your Node.Create a PersistentVolumeIn this exercise, you create a hostPath PersistentVolume. Kubernetes supports hostPath for development and testing on a single-node cluster. A hostPath PersistentVolume uses a file or directory on the Node to emulate network-attached storage.In a production cluster, you would not use hostPath. Instead a cluster administrator would provision a network resource like a Google Compute Engine persistent disk, an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also use StorageClasses to set up dynamic provisioning.Here is the configuration file for the hostPath PersistentVolume:pods/storage/pv-volume.yaml apiVersion: v1 kind: PersistentVolume metadata: name: task-pv-volume labels: type: local spec: storageClassName: manual capacity: storage: 10Gi accessModes: - ReadWriteOnce hostPath: path: \"/mnt/data\" The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the volume can be mounted as read-write by a single Node. It defines the StorageClass name manual for the PersistentVolume, which will be used to bind PersistentVolumeClaim requests to this PersistentVolume.Note:This example uses the ReadWriteOnce access mode, for simplicity. For production use, the Kubernetes project recommends using the ReadWriteOncePod access mode instead.Create the PersistentVolume:kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml View information about the PersistentVolume:kubectl get pv task-pv-volume The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE task-pv-volume 10Gi RWO Retain Available manual 4s Create a PersistentVolumeClaimThe", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2192"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | View information about the PersistentVolume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2193"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2194"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2195"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume wi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2196"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Now the output shows a STATUS of Bound.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2197"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc task-pv-claim\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, task-pv-volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2198"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2199"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2200"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pod task-pv-pod\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Get a shell to the container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2201"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it task-pv-pod -- /bin/bash\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2202"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod task-pv-pod\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2203"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2204"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2205"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test -- /bin/bash\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2206"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test\nkubectl delete pvc task-pv-claim\nkubectl delete pv task-pv-volume\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | If you don't already have a shell open to the Node in your cluster, open a new shell the same way that you did earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2207"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2208"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2209"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2210"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2211"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2212"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2213"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-volume.yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2214"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2215"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | View information about the PersistentVolume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2216"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2217"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-claim.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2218"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2219"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume wi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2220"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Now the output shows a STATUS of Bound.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2221"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc task-pv-claim\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, task-pv-volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2222"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2223"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2224"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2225"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pod task-pv-pod\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Get a shell to the container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2226"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it task-pv-pod -- /bin/bash\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2227"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod task-pv-pod\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2228"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-duplicate.yaml\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2229"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2230"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2231"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test -- /bin/bash\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2232"}
{"instruction": "Write a bash example for configure a pod to use a persistentvolume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test\nkubectl delete pvc task-pv-claim\nkubectl delete pv task-pv-volume\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | If you don't already have a shell open to the Node in your cluster, open a new shell the same way that you did earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2233"}
{"instruction": "Write a yaml example for configure a pod to use a persistentvolume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\nConfigure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/", "id": "k8s_00183_code_2234"}
{"instruction": "What is the reference documentation for volume?", "response": "VolumeVolume represents a named volume in a pod that may be accessed by any container in the pod.import \"k8s.io/api/core/v1\"VolumeVolume represents a named volume in a pod that may be accessed by any container in the pod.name (string), requiredname of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#namesExposed Persistent volumespersistentVolumeClaim (PersistentVolumeClaimVolumeSource)persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaimsPersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system).persistentVolumeClaim.claimName (string), requiredclaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaimspersistentVolumeClaim.readOnly (boolean)readOnly Will force the ReadOnly setting in VolumeMounts. Default false.ProjectionsconfigMap (ConfigMapVolumeSource)configMap represents a configMap that should populate this volume*Adapts a ConfigMap into a volume.The contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling.*configMap.name (string)Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#namesconfigMap.optional (boolean)optional specify whether the ConfigMap or its keys must be definedconfigMap.defaultMode (int32)defaultMode is optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.configMap.items ([]KeyToPath)Atomic: will be replaced during a mergeitems if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.secret (SecretVolumeSource)secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret*Adapts a Secret into a volume.The contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling.*secret.secretName (string)secretName is the name of the secret in the pod's namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secretsecret.optional (boolean)optional field specify whether the Secret or its keys must be definedsecret.defaultMode (int32)defaultMode is Optional: mode bits used to set permissions on created files by default. Must be an octal va", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume/", "id": "k8s_00184"}
{"instruction": "Explain the Kubernetes concept: Multi-tenancy", "response": "Multi-tenancyThis page provides an overview of available configuration options and best practices for cluster multi-tenancy.Sharing clusters saves costs and simplifies administration. However, sharing clusters also presents challenges such as security, fairness, and managing noisy neighbors.Clusters can be shared in many ways. In some cases, different applications may run in the same cluster. In other cases, multiple instances of the same application may run in the same cluster, one for each end user. All these types of sharing are frequently described using the umbrella term multi-tenancy.While Kubernetes does not have first-class concepts of end users or tenants, it provides several features to help manage different tenancy requirements. These are discussed below.Use casesThe first step to determining how to share your cluster is understanding your use case, so you can evaluate the patterns and tools available. In general, multi-tenancy in Kubernetes clusters falls into two broad categories, though many variations and hybrids are also possible.Multiple teamsA common form of multi-tenancy is to share a cluster between multiple teams within an organization, each of whom may operate one or more workloads. These workloads frequently need to communicate with each other, and with other workloads located on the same or different clusters.In this scenario, members of the teams often have direct access to Kubernetes resources via tools such as kubectl, or indirect access through GitOps controllers or other types of release automation tools. There is often some level of trust between members of different teams, but Kubernetes policies such as RBAC, quotas, and network policies are essential to safely and fairly share clusters.Multiple customersThe other major form of multi-tenancy frequently involves a Software-as-a-Service (SaaS) vendor running multiple instances of a workload for customers. This business model is so strongly associated with this deployment style that many people call it \"SaaS tenancy.\" However, a better term might be \"multi-customer tenancy,\" since SaaS vendors may also use other deployment models, and this deployment model can also be used outside of SaaS.In this scenario, the customers do not have access to the cluster; Kubernetes is invisible from their perspective and is only used by the vendor to manage the workloads. Cost optimization is frequently a critical concern, and Kubernetes policies are used to ensure that the workloads are strongly isolated from each other.TerminologyTenantsWhen discussing multi-tenancy in Kubernetes, there is no single definition for a \"tenant\". Rather, the definition of a tenant will vary depending on whether multi-team or multi-customer tenancy is being discussed.In multi-team usage, a tenant is typically a team, where each team typically deploys a small number of workloads that scales with the complexity of the service. However, the definition of \"team\" may itself be fuzzy, as teams may be organized into higher-level divisions or subdivided into smaller teams.By contrast, if each team deploys dedicated workloads for each new client, they are using a multi-customer model of tenancy. In this case, a \"tenant\" is simply a group of users who share a single workload. This may be as large as an entire company, or as small as a single team at that company.In many cases, the same organization may use both definitions of \"tenants\" in different contexts. For example, a platform team may offer shared services such as security tools and databases to multiple internal “customers” and a SaaS vendor may also have multiple teams sharing a development cluster. Finally, hybrid architectures are also possible, such as a SaaS provider using a combination of per-customer workloads for sensitive data, combined with multi-tenant shared services.A cluster showing coexisting tenancy modelsIsolationThere are several ways to design and build multi-tenant solutions with Kubernetes. Each of these methods come", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/multi-tenancy/", "id": "k8s_00185"}
{"instruction": "Provide a tutorial on security", "response": "SecuritySecurity is an important concern for most organizations and people who run Kubernetes clusters. You can find a basic security checklist elsewhere in the Kubernetes documentation.To learn how to deploy and manage security aspects of Kubernetes, you can follow the tutorials in this section.Apply Pod Security Standards at the Cluster LevelApply Pod Security Standards at the Namespace LevelRestrict a Container's Access to Resources with AppArmorRestrict a Container's Syscalls with seccomp", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/", "id": "k8s_00186"}
{"instruction": "How do you overprovision node capacity for a cluster in Kubernetes?", "response": "Overprovision Node Capacity For A ClusterThis page guides you through configuring Node overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively reserves a portion of your cluster's compute resources. This reservation helps reduce the time required to schedule new pods during scaling events, enhancing your cluster's responsiveness to sudden spikes in traffic or workload demands.By maintaining some unused capacity, you ensure that resources are immediately available when new pods are created, preventing them from entering a pending state while the cluster scales up.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster.You should already have a basic understanding of Deployments, Pod priority, and PriorityClasses.Your cluster must be set up with an autoscaler that manages nodes based on demand.Create a PriorityClassBegin by defining a PriorityClass for the placeholder Pods. First, create a PriorityClass with a negative priority value, that you will shortly assign to the placeholder pods. Later, you will set up a Deployment that uses this PriorityClasspriorityclass/low-priority-class.yaml apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: name: placeholder # these Pods represent placeholder capacity value: -1000 globalDefault: false description: \"Negative priority for placeholder pods to enable overprovisioning.\"Then create the PriorityClass:kubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capacity. Any time there is a capacity shortage, the control plane will pick one these placeholder pods as the first candidate to preempt.Run Pods that request node capacityReview the sample manifest:deployments/deployment-with-capacity-reservation.yaml apiVersion: apps/v1 kind: Deployment metadata: name: capacity-reservation # You should decide what namespace to deploy this into spec: replicas: 1 selector: matchLabels: app.kubernetes.io/name: capacity-placeholder template: metadata: labels: app.kubernetes.io/name: capacity-placeholder annotations: kubernetes.io/description: \"Capacity reservation\" spec: priorityClassName: placeholder affinity: # Try to place these overhead Pods on different nodes # if possible podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchLabels: app.kubernetes.io/name: capacity-placeholder topologyKey: topology.kubernetes.io/hostname containers: - name: pause image: registry.k8s.io/pause:3.6 resources: requests: cpu: \"50m\" memory: \"512Mi\" limits: memory: \"512Mi\" Pick a namespace for the placeholder podsYou should select, or create, a namespace that the placeholder Pods will go into.Create the placeholder deploymentCreate a Deployment based on that manifest:# Change the namespace name \"example\" kubectl --namespace example apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml Adjust placeholder resource requestsConfigure the resource requests and limits for the placeholder pods to define the amount of overprovisioned resources you want to maintain. This reservation ensures that a specific amount of CPU and memory is kept available for new pods.To edit the Deployment, modify the resources section in the Deployment manifest file to set appropriate requests and limits. You can download that file locally and then edit it with whichever text editor you prefer.You can also edit the Deployment using kubectl:kubectl edit deployment capacity-reservation For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, define the resource requests and limits for a single placeholder pod as follows: resources: requests: cpu: \"100m\" memory: \"200Mi\" limits: ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\nOverprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2239"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml\n```\n\nOverprovision Node Capacity For A Cluster | You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capac", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2240"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\nOverprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2241"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment capacity-reservation\n```\n\nOverprovision Node Capacity For A Cluster | For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, define the resource requests and limits for a single placeholder pod as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2242"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment capacity-reservation --replicas=5\n```\n\nOverprovision Node Capacity For A Cluster | Verify the scaling:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2243"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment capacity-reservation\n```\n\nOverprovision Node Capacity For A Cluster | The output should reflect the updated number of replicas:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2244"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\nOverprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2245"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\nOverprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2246"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\nresources:\n    requests:\n      cpu: \"100m\"\n      memory: \"200Mi\"\n    limits:\n      cpu: \"100m\"\n```\n\nOverprovision Node Capacity For A Cluster | For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory:Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity 500m)Total memory reserved: 5 × 200MiB =", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2247"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\npriorityclass/low-priority-class.yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\nOverprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2248"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\nOverprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2249"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml\n```\n\nOverprovision Node Capacity For A Cluster | You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capac", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2250"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-capacity-reservation.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\nOverprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2251"}
{"instruction": "Write a yaml example for overprovision node capacity for a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\nOverprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2252"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment capacity-reservation\n```\n\nOverprovision Node Capacity For A Cluster | For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, define the resource requests and limits for a single placeholder pod as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2253"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment capacity-reservation --replicas=5\n```\n\nOverprovision Node Capacity For A Cluster | Verify the scaling:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2254"}
{"instruction": "Write a bash example for overprovision node capacity for a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment capacity-reservation\n```\n\nOverprovision Node Capacity For A Cluster | The output should reflect the updated number of replicas:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/", "id": "k8s_00187_code_2255"}
{"instruction": "What is the reference documentation for role?", "response": "RoleRole is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.apiVersion: rbac.authorization.k8s.io/v1import \"k8s.io/api/rbac/v1\"RoleRole is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.apiVersion: rbac.authorization.k8s.io/v1kind: Rolemetadata (ObjectMeta)Standard object's metadata.rules ([]PolicyRule)Atomic: will be replaced during a mergeRules holds all the PolicyRules for this RolePolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.rules.apiGroups ([]string)Atomic: will be replaced during a mergeAPIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.rules.resources ([]string)Atomic: will be replaced during a mergeResources is a list of resources this rule applies to. '*' represents all resources.rules.verbs ([]string), requiredAtomic: will be replaced during a mergeVerbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.rules.resourceNames ([]string)Atomic: will be replaced during a mergeResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.rules.nonResourceURLs ([]string)Atomic: will be replaced during a mergeNonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.RoleListRoleList is a collection of RolesapiVersion: rbac.authorization.k8s.io/v1kind: RoleListmetadata (ListMeta)Standard object's metadata.items ([]Role), requiredItems is a list of RolesOperationsget read the specified RoleHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}Parametersname (in path): string, requiredname of the Rolenamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (Role): OK401: Unauthorizedlist list or watch objects of kind RoleHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolesParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (RoleList): OK401: Unauthorizedlist list or watch objects of kind RoleHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/rolesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (RoleList): OK401: Unauthorizedcreate create a RoleHTTP RequestPOST /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolesParametersnamespace (in path): string, requirednamespacebody: Role, requireddryRun (in query): stringdryRunfieldManager", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/role-v1/", "id": "k8s_00188"}
{"instruction": "Write a yaml example for role", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\nRole | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/role-v1/", "id": "k8s_00188_code_2257"}
{"instruction": "How do you debug running pods in Kubernetes?", "response": "Debug Running PodsThis page explains how to debug Pods running (or crashing) on a Node.Before you beginYour Pod should already be scheduled and running. If your Pod is not yet running, start with Debugging Pods.For some of the advanced debugging steps you need to know on which Node the Pod is running and have shell access to run commands on that Node. You don't need that access to run the standard debug steps that use kubectl.Using kubectl describe pod to fetch details about podsFor this example we'll use a Deployment to create two pods, similar to the earlier example.application/nginx-with-request.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx resources: limits: memory: \"128Mi\" cpu: \"500m\" ports: - containerPort: 80 Create deployment by running following command:kubectl apply -f https://k8s.io/examples/application/nginx-with-request.yaml deployment.apps/nginx-deployment created Check pod status by following command:kubectl get pods NAME READY STATUS RESTARTS AGE nginx-deployment-67d4bdd6f5-cx2nz 1/1 Running 0 13s nginx-deployment-67d4bdd6f5-w6kd7 1/1 Running 0 13s We can retrieve a lot more information about each of these pods using kubectl describe pod. For example:kubectl describe pod nginx-deployment-67d4bdd6f5-w6kd7 Name: nginx-deployment-67d4bdd6f5-w6kd7 Namespace: default Priority: 0 Node: kube-worker-1/192.168.0.113 Start Time: Thu, 17 Feb 2022 16:51:01 -0500 Labels: app=nginx pod-template-hash=67d4bdd6f5 Annotations: <none> Status: Running IP: 10.88.0.3 IPs: IP: 10.88.0.3 IP: 2001:db8::1 Controlled By: ReplicaSet/nginx-deployment-67d4bdd6f5 Containers: nginx: Container ID: containerd://5403af59a2b46ee5a23fb0ae4b1e077f7ca5c5fb7af16e1ab21c00e0e616462a Image: nginx Image ID: docker.io/library/nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767 Port: 80/TCP Host Port: 0/TCP State: Running Started: Thu, 17 Feb 2022 16:51:05 -0500 Ready: True Restart Count: 0 Limits: cpu: 500m memory: 128Mi Requests: cpu: 500m memory: 128Mi Environment: <none> Mounts: /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-bgsgp (ro) Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled True Volumes: kube-api-access-bgsgp: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: <nil> DownwardAPI: true QoS Class: Guaranteed Node-Selectors: <none> Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 34s default-scheduler Successfully assigned default/nginx-deployment-67d4bdd6f5-w6kd7 to kube-worker-1 Normal Pulling 31s kubelet Pulling image \"nginx\" Normal Pulled 30s kubelet Successfully pulled image \"nginx\" in 1.146417389s Normal Created 30s kubelet Created container nginx Normal Started 30s kubelet Started container nginx Here you can see configuration information about the container(s) and Pod (labels, resource requirements, etc.), as well as status information about the container(s) and Pod (state, readiness, restart count, events, etc.).The container state is one of Waiting, Running, or Terminated. Depending on the state, additional information will be provided -- here you can see that for a container in Running state, the system tells you when the container started.Ready tells you whether the container passed its last readiness probe. (In this case, the container does not have a readiness probe configured; the container is assumed to be ready if no readiness probe is configured.)Restart Count tells you how many times the container has been restarted; this information can be useful for detecting crash loops in containers that are configured with a rest", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\nDebug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2259"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-with-request.yaml\n```\n\nDebug Running Pods | Check pod status by following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2260"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-67d4bdd6f5-w6kd7\n```\n\nDebug Running Pods | Here you can see configuration information about the container(s) and Pod (labels, resource requirements, etc.), as well as status information about the container(s) and Pod (state, readiness, restart", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2261"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-1370807587-fz9sd\n```\n\nDebug Running Pods | Here you can see the event generated by the scheduler saying that the Pod failed to schedule for reason FailedScheduling (and possibly others). The message tells us that there were not enough resource", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2262"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get events --namespace=my-namespace\n```\n\nDebug Running Pods | To see events from all namespaces, you can use the --all-namespaces argument.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2263"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx-deployment-1006230814-6winp -o yaml\n```\n\nDebug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2264"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2022-02-17T21:51:01Z\"\n  generateName: nginx-deployment-67d4bdd6f5-\n  labels:\n    app: nginx\n    pod-template-hash: 67d4bdd6f5\n  name: nginx-deployment-67d4bdd6f5-w6kd7\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: nginx-deployment-67d4bdd6f5\n    uid: 7d41dfd4-84c0-4be4-88ab-cedbe626ad82\n  resourceVersion: \"1364\"\n  uid: a6501da1-0447-4262-98eb-c03d4002222e\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: nginx\n    ports:\n    - containerPort: 80\n      protocol: TCP\n    resources:\n      limits:\n        cpu: 500m\n        memory: 128Mi\n      requests:\n        cpu: 500m\n        memory: 128Mi\n    terminationMessagePath: /dev/termination-log\n    terminationMessagePolicy: File\n    volumeMounts:\n    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount\n      name: kube-api-access-bgsgp\n      readOnly: true\n  dnsPolicy: ClusterFirst\n  enableServiceLinks: true\n  nodeName: kube-worker-1\n  preemptionPolicy: PreemptLowerPriority\n  priority: 0\n  restartPolicy: Always\n  schedulerName: default-scheduler\n  securityContext: {}\n  serviceAccount: default\n  serviceAccountName: default\n  terminationGracePeriodSeconds: 30\n  tolerations:\n  - effect: NoExecute\n    key: node.kubernetes.io/not-ready\n    operator: Exists\n    tolerationSeconds: 300\n  - effect: NoExecute\n    key: node.kubernetes.io/unreachable\n    operator: Exists\n    tolerationSeconds: 300\n  volumes:\n  - name: kube-api-access-bgsgp\n    projected:\n      defaultMode: 420\n      sources:\n      - serviceAccountToken:\n          expirationSeconds: 3607\n          path: token\n      - configMap:\n          items:\n          - key: ca.crt\n            path: ca.crt\n          name: kube-root-ca.crt\n      - downwardAPI:\n          items:\n          - fieldRef:\n              apiVersion: v1\n              fieldPath: metadata.namespace\n            path: namespace\nstatus:\n  conditions:\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: Initialized\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: Ready\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: ContainersReady\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: PodScheduled\n  containerStatuses:\n  - containerID: containerd://5403af59a2b46ee5a23fb0ae4b1e077f7ca5c5fb7af16e1ab21c00e0e616462a\n    image: docker.io/library/nginx:latest\n    imageID: docker.io/library/nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767\n    lastState: {}\n    name: nginx\n    ready: true\n    restartCount: 0\n    started: true\n    state:\n      running:\n        startedAt: \"2022-02-17T21:51:05Z\"\n  hostIP: 192.168.0.113\n  phase: Running\n  podIP: 10.88.0.3\n  podIPs:\n  - ip: 10.88.0.3\n  - ip: 2001:db8::1\n  qosClass: Guaranteed\n  startTime: \"2022-02-17T21:51:01Z\"\n```\n\nDebug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2265"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl logs ${POD_NAME} ${CONTAINER_NAME}\n```\n\nDebug Running Pods | If your container has previously crashed, you can access the previous container's crash log with:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2266"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous ${POD_NAME} ${CONTAINER_NAME}\n```\n\nDebug Running Pods | If the container image includes debugging utilities, as is the case with images built from Linux and Windows OS base images, you can run commands inside a specific container with kubectl exec:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2267"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec ${POD_NAME} -c ${CONTAINER_NAME} -- ${CMD} ${ARG1} ${ARG2} ... ${ARGN}\n```\n\nDebug Running Pods | As an example, to look at the logs from a running Cassandra pod, you might run", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2268"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec cassandra -- cat /var/log/cassandra/system.log\n```\n\nDebug Running Pods | You can run a shell that's connected to your terminal using the -i and -t arguments to kubectl exec, for example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2269"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra -- sh\n```\n\nDebug Running Pods | For more details, see Get a Shell to a Running Container.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2270"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run ephemeral-demo --image=registry.k8s.io/pause:3.1 --restart=Never\n```\n\nDebug Running Pods | The examples in this section use the pause container image because it does not contain debugging utilities, but this method works with all container images.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2271"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it ephemeral-demo -- sh\n```\n\nDebug Running Pods | You can instead add a debugging container using kubectl debug. If you specify the -i/--interactive argument, kubectl will automatically attach to the console of the Ephemeral Container.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2272"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it ephemeral-demo --image=busybox:1.28 --target=ephemeral-demo\n```\n\nDebug Running Pods | This command adds a new busybox container and attaches to it. The --target parameter targets the process namespace of another container. It's necessary here because kubectl run does not enable process", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2273"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod ephemeral-demo\n```\n\nDebug Running Pods | Use kubectl delete to remove the Pod when you're finished:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2274"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod ephemeral-demo\n```\n\nDebug Running Pods | Sometimes Pod configuration options make it difficult to troubleshoot in certain situations. For example, you can't run kubectl exec to troubleshoot your container if your container image does not inc", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2275"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Run this command to create a copy of myapp named myapp-debug that adds a new Ubuntu container for debugging:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2276"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --image=ubuntu --share-processes --copy-to=myapp-debug\n```\n\nDebug Running Pods | Don't forget to clean up the debugging Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2277"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\nDebug Running Pods | Sometimes it's useful to change the command for a container, for example to add a debugging flag or because the application is crashing.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2278"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run --image=busybox:1.28 myapp -- false\n```\n\nDebug Running Pods | You can see using kubectl describe pod myapp that this container is crashing:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2279"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --copy-to=myapp-debug --container=myapp -- sh\n```\n\nDebug Running Pods | Now you have an interactive shell that you can use to perform tasks like checking filesystem paths or running the container command manually.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2280"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\nDebug Running Pods | In some situations you may want to change a misbehaving Pod from its normal production container images to an image containing a debugging build or additional utilities.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2281"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Now use kubectl debug to make a copy and change its container image to ubuntu:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2282"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp --copy-to=myapp-debug --set-image=*=ubuntu\n```\n\nDebug Running Pods | The syntax of --set-image uses the same container_name=image syntax as kubectl set image. *=ubuntu means change the image of all containers to ubuntu.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2283"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\nDebug Running Pods | If none of these approaches work, you can find the Node on which the Pod is running and create a Pod running on the Node. To create an interactive shell on a Node using kubectl debug, run:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2284"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\nDebug Running Pods | When creating a debugging session on a node, keep in mind that:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2285"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod node-debugger-mynode-pdx84\n```\n\nDebug Running Pods | When using kubectl debug to debug a node via a debugging Pod, a Pod via an ephemeral container, or a copied Pod, you can apply a profile to them. By applying a profile, specific properties such as sec", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2286"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Then, debug the Pod using an ephemeral container. If the ephemeral container needs to have privilege, you can use the sysadmin profile:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2287"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=sysadmin\n```\n\nDebug Running Pods | Check the capabilities of the ephemeral container process by running the following command inside the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2288"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\nDebug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2289"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\nDebug Running Pods | You can define a partial container spec for debugging as a custom profile in either YAML or JSON format, and apply it using the --custom flag.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2290"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Create a custom profile in YAML or JSON format. Here, create a YAML format file named custom-profile.yaml:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2291"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=general --custom=custom-profile.yaml\n```\n\nDebug Running Pods | You can check that the ephemeral container has been added to the target Pod with the custom profile applied:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2292"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].env}'\n```\n\nDebug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2293"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\nDebug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2294"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\nDebug Running Pods |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2295"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\nDebug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2296"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2022-02-17T21:51:01Z\"\n  generateName: nginx-deployment-67d4bdd6f5-\n  labels:\n    app: nginx\n    pod-template-hash: 67d4bdd6f5\n  name: nginx-deployment-67d4bdd6f5-w6kd7\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: nginx-deployment-67d4bdd6f5\n    uid: 7d41dfd4-84c0-4be4-88ab-cedbe626ad82\n  resourceVersion: \"1364\"\n  uid: a6501da1-0447-4262-98eb-c03d4002222e\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: nginx\n    ports:\n    - containerPort: 80\n      protocol: TCP\n    resources:\n      limits:\n        cpu: 500m\n        memory: 128Mi\n      requests:\n        cpu: 500m\n        memory: 128Mi\n    terminationMessagePath: /dev/termination-log\n    terminationMessagePolicy: File\n    volumeMounts:\n    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount\n      name: kube-api-access-bgsgp\n      readOnly: true\n  dnsPolicy: ClusterFirst\n  enableServiceLinks: true\n  nodeName: kube-worker-1\n  preemptionPolicy: PreemptLowerPriority\n  priority: 0\n  restartPolicy: Always\n  schedulerName: default-scheduler\n  securityContext: {}\n  serviceAccount: default\n  serviceAccountName: default\n  terminationGracePeriodSeconds: 30\n  tolerations:\n  - effect: NoExecute\n    key: node.kubernetes.io/not-ready\n    operator: Exists\n    tolerationSeconds: 300\n  - effect: NoExecute\n    key: node.kubernetes.io/unreachable\n    operator: Exists\n    tolerationSeconds: 300\n  volumes:\n  - name: kube-api-access-bgsgp\n    projected:\n      defaultMode: 420\n      sources:\n      - serviceAccountToken:\n          expirationSeconds: 3607\n          path: token\n      - configMap:\n          items:\n          - key: ca.crt\n            path: ca.crt\n          name: kube-root-ca.crt\n      - downwardAPI:\n          items:\n          - fieldRef:\n              apiVersion: v1\n              fieldPath: metadata.namespace\n            path: namespace\nstatus:\n  conditions:\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: Initialized\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: Ready\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: ContainersReady\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: PodScheduled\n  containerStatuses:\n  - containerID: containerd://5403af59a2b46ee5a23fb0ae4b1e077f7ca5c5fb7af16e1ab21c00e0e616462a\n    image: docker.io/library/nginx:latest\n    imageID: docker.io/library/nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767\n    lastState: {}\n    name: nginx\n    ready: true\n    restartCount: 0\n    started: true\n    state:\n      running:\n        startedAt: \"2022-02-17T21:51:05Z\"\n  hostIP: 192.168.0.113\n  phase: Running\n  podIP: 10.88.0.3\n  podIPs:\n  - ip: 10.88.0.3\n  - ip: 2001:db8::1\n  qosClass: Guaranteed\n  startTime: \"2022-02-17T21:51:01Z\"\n```\n\nDebug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2297"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run --image=busybox:1.28 myapp -- false\n```\n\nDebug Running Pods | You can see using kubectl describe pod myapp that this container is crashing:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2298"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod myapp\n```\n\nDebug Running Pods | You can use kubectl debug to create a copy of this Pod with the command changed to an interactive shell:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2299"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --copy-to=myapp-debug --container=myapp -- sh\n```\n\nDebug Running Pods | Now you have an interactive shell that you can use to perform tasks like checking filesystem paths or running the container command manually.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2300"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Now use kubectl debug to make a copy and change its container image to ubuntu:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2301"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp --copy-to=myapp-debug --set-image=*=ubuntu\n```\n\nDebug Running Pods | The syntax of --set-image uses the same container_name=image syntax as kubectl set image. *=ubuntu means change the image of all containers to ubuntu.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2302"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\nenv:\n- name: ENV_VAR_1\n  value: value_1\n- name: ENV_VAR_2\n  value: value_2\nsecurityContext:\n  capabilities:\n    add:\n    - NET_ADMIN\n    - SYS_TIME\n```\n\nDebug Running Pods | Run this command to debug the Pod using an ephemeral container with the custom profile:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2303"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\napplication/nginx-with-request.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\nDebug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2304"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\nDebug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2305"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-with-request.yaml\n```\n\nDebug Running Pods | Check pod status by following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2306"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-67d4bdd6f5-w6kd7\n```\n\nDebug Running Pods | Here you can see configuration information about the container(s) and Pod (labels, resource requirements, etc.), as well as status information about the container(s) and Pod (state, readiness, restart", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2307"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-1370807587-fz9sd\n```\n\nDebug Running Pods | Here you can see the event generated by the scheduler saying that the Pod failed to schedule for reason FailedScheduling (and possibly others). The message tells us that there were not enough resource", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2308"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get events --namespace=my-namespace\n```\n\nDebug Running Pods | To see events from all namespaces, you can use the --all-namespaces argument.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2309"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx-deployment-1006230814-6winp -o yaml\n```\n\nDebug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2310"}
{"instruction": "Write a yaml example for debug running pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2022-02-17T21:51:01Z\"\n  generateName: nginx-deployment-67d4bdd6f5-\n  labels:\n    app: nginx\n    pod-template-hash: 67d4bdd6f5\n  name: nginx-deployment-67d4bdd6f5-w6kd7\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: nginx-deployment-67d4bdd6f5\n    uid: 7d41dfd4-84c0-4be4-88ab-cedbe626ad82\n  resourceVersion: \"1364\"\n  uid: a6501da1-0447-4262-98eb-c03d4002222e\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: nginx\n    ports:\n    - containerPort: 80\n      protocol: TCP\n    resources:\n      limits:\n        cpu: 500m\n        memory: 128Mi\n      requests:\n        cpu: 500m\n        memory: 128Mi\n    terminationMessagePath: /dev/termination-log\n    terminationMessagePolicy: File\n    volumeMounts:\n    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount\n      name: kube-api-access-bgsgp\n      readOnly: true\n  dnsPolicy: ClusterFirst\n  enableServiceLinks: true\n  nodeName: kube-worker-1\n  preemptionPolicy: PreemptLowerPriority\n  priority: 0\n  restartPolicy: Always\n  schedulerName: default-scheduler\n  securityContext: {}\n  serviceAccount: default\n  serviceAccountName: default\n  terminationGracePeriodSeconds: 30\n  tolerations:\n  - effect: NoExecute\n    key: node.kubernetes.io/not-ready\n    operator: Exists\n    tolerationSeconds: 300\n  - effect: NoExecute\n    key: node.kubernetes.io/unreachable\n    operator: Exists\n    tolerationSeconds: 300\n  volumes:\n  - name: kube-api-access-bgsgp\n    projected:\n      defaultMode: 420\n      sources:\n      - serviceAccountToken:\n          expirationSeconds: 3607\n          path: token\n      - configMap:\n          items:\n          - key: ca.crt\n            path: ca.crt\n          name: kube-root-ca.crt\n      - downwardAPI:\n          items:\n          - fieldRef:\n              apiVersion: v1\n              fieldPath: metadata.namespace\n            path: namespace\nstatus:\n  conditions:\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: Initialized\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: Ready\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: ContainersReady\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: PodScheduled\n  containerStatuses:\n  - containerID: containerd://5403af59a2b46ee5a23fb0ae4b1e077f7ca5c5fb7af16e1ab21c00e0e616462a\n    image: docker.io/library/nginx:latest\n    imageID: docker.io/library/nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767\n    lastState: {}\n    name: nginx\n    ready: true\n    restartCount: 0\n    started: true\n    state:\n      running:\n        startedAt: \"2022-02-17T21:51:05Z\"\n  hostIP: 192.168.0.113\n  phase: Running\n  podIP: 10.88.0.3\n  podIPs:\n  - ip: 10.88.0.3\n  - ip: 2001:db8::1\n  qosClass: Guaranteed\n  startTime: \"2022-02-17T21:51:01Z\"\n```\n\nDebug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2311"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl logs ${POD_NAME} ${CONTAINER_NAME}\n```\n\nDebug Running Pods | If your container has previously crashed, you can access the previous container's crash log with:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2312"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous ${POD_NAME} ${CONTAINER_NAME}\n```\n\nDebug Running Pods | If the container image includes debugging utilities, as is the case with images built from Linux and Windows OS base images, you can run commands inside a specific container with kubectl exec:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2313"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec ${POD_NAME} -c ${CONTAINER_NAME} -- ${CMD} ${ARG1} ${ARG2} ... ${ARGN}\n```\n\nDebug Running Pods | As an example, to look at the logs from a running Cassandra pod, you might run", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2314"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec cassandra -- cat /var/log/cassandra/system.log\n```\n\nDebug Running Pods | You can run a shell that's connected to your terminal using the -i and -t arguments to kubectl exec, for example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2315"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra -- sh\n```\n\nDebug Running Pods | For more details, see Get a Shell to a Running Container.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2316"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run ephemeral-demo --image=registry.k8s.io/pause:3.1 --restart=Never\n```\n\nDebug Running Pods | The examples in this section use the pause container image because it does not contain debugging utilities, but this method works with all container images.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2317"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it ephemeral-demo -- sh\n```\n\nDebug Running Pods | You can instead add a debugging container using kubectl debug. If you specify the -i/--interactive argument, kubectl will automatically attach to the console of the Ephemeral Container.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2318"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it ephemeral-demo --image=busybox:1.28 --target=ephemeral-demo\n```\n\nDebug Running Pods | This command adds a new busybox container and attaches to it. The --target parameter targets the process namespace of another container. It's necessary here because kubectl run does not enable process", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2319"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod ephemeral-demo\n```\n\nDebug Running Pods | Use kubectl delete to remove the Pod when you're finished:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2320"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod ephemeral-demo\n```\n\nDebug Running Pods | Sometimes Pod configuration options make it difficult to troubleshoot in certain situations. For example, you can't run kubectl exec to troubleshoot your container if your container image does not inc", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2321"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Run this command to create a copy of myapp named myapp-debug that adds a new Ubuntu container for debugging:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2322"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --image=ubuntu --share-processes --copy-to=myapp-debug\n```\n\nDebug Running Pods | Don't forget to clean up the debugging Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2323"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\nDebug Running Pods | Sometimes it's useful to change the command for a container, for example to add a debugging flag or because the application is crashing.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2324"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\nDebug Running Pods | In some situations you may want to change a misbehaving Pod from its normal production container images to an image containing a debugging build or additional utilities.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2325"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\nDebug Running Pods | If none of these approaches work, you can find the Node on which the Pod is running and create a Pod running on the Node. To create an interactive shell on a Node using kubectl debug, run:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2326"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\nDebug Running Pods | When creating a debugging session on a node, keep in mind that:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2327"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod node-debugger-mynode-pdx84\n```\n\nDebug Running Pods | When using kubectl debug to debug a node via a debugging Pod, a Pod via an ephemeral container, or a copied Pod, you can apply a profile to them. By applying a profile, specific properties such as sec", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2328"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Then, debug the Pod using an ephemeral container. If the ephemeral container needs to have privilege, you can use the sysadmin profile:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2329"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=sysadmin\n```\n\nDebug Running Pods | Check the capabilities of the ephemeral container process by running the following command inside the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2330"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\nDebug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2331"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\nDebug Running Pods | You can define a partial container spec for debugging as a custom profile in either YAML or JSON format, and apply it using the --custom flag.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2332"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\nDebug Running Pods | Create a custom profile in YAML or JSON format. Here, create a YAML format file named custom-profile.yaml:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2333"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=general --custom=custom-profile.yaml\n```\n\nDebug Running Pods | You can check that the ephemeral container has been added to the target Pod with the custom profile applied:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2334"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].env}'\n```\n\nDebug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2335"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\nDebug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2336"}
{"instruction": "Write a bash example for debug running pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\nDebug Running Pods |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/", "id": "k8s_00189_code_2337"}
{"instruction": "What is the reference documentation for ipaddress?", "response": "IPAddressIPAddress represents a single IP of a single IP Family.apiVersion: networking.k8s.io/v1import \"k8s.io/api/networking/v1\"IPAddressIPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1apiVersion: networking.k8s.io/v1kind: IPAddressmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (IPAddressSpec)spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusIPAddressSpecIPAddressSpec describe the attributes in an IP Address.parentRef (ParentReference), requiredParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.ParentReference describes a reference to a parent object.parentRef.name (string), requiredName is the name of the object being referenced.parentRef.resource (string), requiredResource is the resource of the object being referenced.parentRef.group (string)Group is the group of the object being referenced.parentRef.namespace (string)Namespace is the namespace of the object being referenced.IPAddressListIPAddressList contains a list of IPAddress.apiVersion: networking.k8s.io/v1kind: IPAddressListmetadata (ListMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]IPAddress), requireditems is the list of IPAddresses.Operationsget read the specified IPAddressHTTP RequestGET /apis/networking.k8s.io/v1/ipaddresses/{name}Parametersname (in path): string, requiredname of the IPAddresspretty (in query): stringprettyResponse200 (IPAddress): OK401: Unauthorizedlist list or watch objects of kind IPAddressHTTP RequestGET /apis/networking.k8s.io/v1/ipaddressesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (IPAddressList): OK401: Unauthorizedcreate create an IPAddressHTTP RequestPOST /apis/networking.k8s.io/v1/ipaddressesParametersbody: IPAddress, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (IPAddress): OK201 (IPAddress): Created202 (IPAddress): Accepted401: Unauthorizedupdate replace the specified IPAddressHTTP RequestPUT /apis/networking.k8s.io/v1/ipaddresses/{name}Parametersname (in path): string, requiredname of the IPAddressbody: IPAddress, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (IPAddress): OK201 (IPAddress): Created401: Unauthorizedpatch partially update the specified IPAddressHTTP RequestPATCH /apis/networking.k8s.io/v1/ipaddresses/{name}Parametersname (in path): string, requiredname of the IPAddressbody: Patch, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValida", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/ip-address-v1/", "id": "k8s_00190"}
{"instruction": "Write a yaml example for ipaddress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\nIPAddress | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/ip-address-v1/", "id": "k8s_00190_code_2339"}
{"instruction": "What is the reference documentation for objectreference?", "response": "ObjectReferenceObjectReference contains enough information to let you inspect or modify the referred object.import \"k8s.io/api/core/v1\"ObjectReference contains enough information to let you inspect or modify the referred object.apiVersion (string)API version of the referent.fieldPath (string)If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.kind (string)Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsname (string)Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#namesnamespace (string)Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/resourceVersion (string)Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistencyuid (string)UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uidsThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-reference/", "id": "k8s_00191"}
{"instruction": "Explain the Kubernetes concept: Objects In Kubernetes", "response": "Objects In KubernetesKubernetes objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster. Learn about the Kubernetes object model and how to work with these objects.This page explains how Kubernetes objects are represented in the Kubernetes API, and how you can express them in .yaml format.Understanding Kubernetes objectsKubernetes objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster. Specifically, they can describe:What containerized applications are running (and on which nodes)The resources available to those applicationsThe policies around how those applications behave, such as restart policies, upgrades, and fault-toleranceA Kubernetes object is a \"record of intent\"--once you create the object, the Kubernetes system will constantly work to ensure that the object exists. By creating an object, you're effectively telling the Kubernetes system what you want your cluster's workload to look like; this is your cluster's desired state.To work with Kubernetes objects—whether to create, modify, or delete them—you'll need to use the Kubernetes API. When you use the kubectl command-line interface, for example, the CLI makes the necessary Kubernetes API calls for you. You can also use the Kubernetes API directly in your own programs using one of the Client Libraries.Object spec and statusAlmost every Kubernetes object includes two nested object fields that govern the object's configuration: the object spec and the object status. For objects that have a spec, you have to set this when you create the object, providing a description of the characteristics you want the resource to have: its desired state.The status describes the current state of the object, supplied and updated by the Kubernetes system and its components. The Kubernetes control plane continually and actively manages every object's actual state to match the desired state you supplied.For example: in Kubernetes, a Deployment is an object that can represent an application running on your cluster. When you create the Deployment, you might set the Deployment spec to specify that you want three replicas of the application to be running. The Kubernetes system reads the Deployment spec and starts three instances of your desired application--updating the status to match your spec. If any of those instances should fail (a status change), the Kubernetes system responds to the difference between spec and status by making a correction--in this case, starting a replacement instance.For more information on the object spec, status, and metadata, see the Kubernetes API Conventions.Describing a Kubernetes objectWhen you create an object in Kubernetes, you must provide the object spec that describes its desired state, as well as some basic information about the object (such as a name). When you use the Kubernetes API to create the object (either directly or via kubectl), that API request must include that information as JSON in the request body. Most often, you provide the information to kubectl in a file known as a manifest. By convention, manifests are YAML (you could also use JSON format). Tools such as kubectl convert the information from a manifest into JSON or another supported serialization format when making the API request over HTTP.Here's an example manifest that shows the required fields and object spec for a Kubernetes Deployment:application/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/", "id": "k8s_00192"}
{"instruction": "Write a yaml example for objects in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nObjects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/", "id": "k8s_00192_code_2342"}
{"instruction": "Write a bash example for objects in kubernetes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\nObjects In Kubernetes | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/", "id": "k8s_00192_code_2343"}
{"instruction": "Write a yaml example for objects in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nObjects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/", "id": "k8s_00192_code_2344"}
{"instruction": "Write a yaml example for objects in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nObjects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/", "id": "k8s_00192_code_2345"}
{"instruction": "Write a yaml example for objects in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nObjects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/", "id": "k8s_00192_code_2346"}
{"instruction": "Write a bash example for objects in kubernetes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\nObjects In Kubernetes | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/", "id": "k8s_00192_code_2347"}
{"instruction": "What is the reference documentation for kube-apiserver configuration (v1)?", "response": "kube-apiserver Configuration (v1)Package v1 is the v1 version of the API.Resource TypesAdmissionConfigurationAuthorizationConfigurationEncryptionConfigurationAdmissionConfigurationAdmissionConfiguration provides versioned configuration for admission controllers.FieldDescriptionapiVersionstringapiserver.config.k8s.io/v1kindstringAdmissionConfigurationplugins[]AdmissionPluginConfigurationPlugins allows specifying a configuration per admission control plugin.AuthorizationConfigurationFieldDescriptionapiVersionstringapiserver.config.k8s.io/v1kindstringAuthorizationConfigurationauthorizers [Required][]AuthorizerConfigurationAuthorizers is an ordered list of authorizers to authorize requests against. This is similar to the --authorization-modes kube-apiserver flag Must be at least one.EncryptionConfigurationEncryptionConfiguration stores the complete configuration for encryption providers. It also allows the use of wildcards to specify the resources that should be encrypted. Use '*.<group>' to encrypt all resources within a group or '*.*' to encrypt all resources. '*.' can be used to encrypt all resource in the core group. '*.*' will encrypt all resources, even custom resources that are added after API server start. Use of wildcards that overlap within the same resource list or across multiple entries are not allowed since part of the configuration would be ineffective. Resource lists are processed in order, with earlier lists taking precedence.Example:kind: EncryptionConfiguration apiVersion: apiserver.config.k8s.io/v1 resources: - resources: - events providers: - identity: {} # do not encrypt events even though *.* is specified below - resources: - secrets - configmaps - pandas.awesome.bears.example providers: - aescbc: keys: - name: key1 secret: c2VjcmV0IGlzIHNlY3VyZQ== - resources: - '*.apps' providers: - aescbc: keys: - name: key2 secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg== - resources: - '*.*' providers: - aescbc: keys: - name: key3 secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw== FieldDescriptionapiVersionstringapiserver.config.k8s.io/v1kindstringEncryptionConfigurationresources [Required][]ResourceConfigurationresources is a list containing resources, and their corresponding encryption providers.AESConfigurationAppears in:ProviderConfigurationAESConfiguration contains the API configuration for an AES transformer.FieldDescriptionkeys [Required][]Keykeys is a list of keys to be used for creating the AES transformer. Each key has to be 32 bytes long for AES-CBC and 16, 24 or 32 bytes for AES-GCM.AdmissionPluginConfigurationAppears in:AdmissionConfigurationAdmissionPluginConfiguration provides the configuration for a single plug-in.FieldDescriptionname [Required]stringName is the name of the admission controller. It must match the registered admission plugin name.pathstringPath is the path to a configuration file that contains the plugin's configurationconfigurationk8s.io/apimachinery/pkg/runtime.UnknownConfiguration is an embedded configuration object to be used as the plugin's configuration. If present, it will be used instead of the path to the configuration file.AuthorizerConfigurationAppears in:AuthorizationConfigurationFieldDescriptiontype [Required]stringType refers to the type of the authorizer \"Webhook\" is supported in the generic API server Other API servers may support additional authorizer types like Node, RBAC, ABAC, etc.name [Required]stringName used to describe the webhook This is explicitly used in monitoring machinery for metrics Note: Names must be DNS1123 labels like myauthorizername or subdomains like myauthorizer.example.domain Required, with no defaultwebhook [Required]WebhookConfigurationWebhook defines the configuration for a Webhook authorizer Must be defined when Type=Webhook Must not be defined when Type!=WebhookIdentityConfigurationAppears in:ProviderConfigurationIdentityConfiguration is an empty struct to allow identity transformer in provider configuration.KMSConfigurationAppears in:ProviderConfigu", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-config.v1/", "id": "k8s_00193"}
{"instruction": "Write a yaml example for kube-apiserver configuration (v1)", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - events\n  providers:\n  - identity: {}  # do not encrypt events even though *.* is specified below\n- resources:\n  - secrets\n  - configmaps\n  - pandas.awesome.bears.example\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n- resources:\n  - '*.apps'\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n- resources:\n  - '*.*'\n  providers:\n  - aescbc:\n      keys:\n      - name: key3\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\nkube-apiserver Configuration (v1) | resources is a list containing resources, and their corresponding encryption providers.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-config.v1/", "id": "k8s_00193_code_2349"}
{"instruction": "Write a yaml example for kube-apiserver configuration (v1)", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - events\n  providers:\n  - identity: {}  # do not encrypt events even though *.* is specified below\n- resources:\n  - secrets\n  - configmaps\n  - pandas.awesome.bears.example\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n- resources:\n  - '*.apps'\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n- resources:\n  - '*.*'\n  providers:\n  - aescbc:\n      keys:\n      - name: key3\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\nkube-apiserver Configuration (v1) | resources is a list containing resources, and their corresponding encryption providers.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-config.v1/", "id": "k8s_00193_code_2350"}
{"instruction": "How do you running pods on only some nodes in Kubernetes?", "response": "Running Pods on Only Some NodesThis page demonstrates how can you run Pods on only some Nodes as part of a DaemonSetBefore you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesRunning Pods on only some NodesImagine that you want to run a DaemonSet, but you only need to run those daemon pods on nodes that have local solid state (SSD) storage. For example, the Pod might provide cache service to the node, and the cache is only useful when low-latency local storage is available.Step 1: Add labels to your nodesAdd the label ssd=true to the nodes which have SSDs.kubectl label nodes example-node-1 example-node-2 ssd=true Step 2: Create the manifestLet's create a DaemonSet which will provision the daemon pods on the SSD labeled nodes only.Next, use a nodeSelector to ensure that the DaemonSet only runs Pods on nodes with the ssd label set to \"true\".controllers/daemonset-label-selector.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: ssd-driver labels: app: nginx spec: selector: matchLabels: app: ssd-driver-pod template: metadata: labels: app: ssd-driver-pod spec: nodeSelector: ssd: \"true\" containers: - name: example-container image: example-imageStep 3: Create the DaemonSetCreate the DaemonSet from the manifest by using kubectl create or kubectl applyLet's label another node as ssd=true.kubectl label nodes example-node-3 ssd=true Labelling the node automatically triggers the control plane (specifically, the DaemonSet controller) to run a new daemon pod on that node.kubectl get pods -o wide The output is similar to:NAME READY STATUS RESTARTS AGE IP NODE <daemonset-name><some-hash-01> 1/1 Running 0 13s ..... example-node-1 <daemonset-name><some-hash-02> 1/1 Running 0 13s ..... example-node-2 <daemonset-name><some-hash-03> 1/1 Running 0 5s ..... example-node-3", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194"}
{"instruction": "Write a bash example for running pods on only some nodes", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-1 example-node-2 ssd=true\n```\n\nRunning Pods on Only Some Nodes | Let's create a DaemonSet which will provision the daemon pods on the SSD labeled nodes only.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2352"}
{"instruction": "Write a yaml example for running pods on only some nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\nRunning Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2353"}
{"instruction": "Write a bash example for running pods on only some nodes", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-3 ssd=true\n```\n\nRunning Pods on Only Some Nodes | Labelling the node automatically triggers the control plane (specifically, the DaemonSet controller) to run a new daemon pod on that node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2354"}
{"instruction": "Write a bash example for running pods on only some nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nRunning Pods on Only Some Nodes | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2355"}
{"instruction": "Write a yaml example for running pods on only some nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\nRunning Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2356"}
{"instruction": "Write a bash example for running pods on only some nodes", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-1 example-node-2 ssd=true\n```\n\nRunning Pods on Only Some Nodes | Let's create a DaemonSet which will provision the daemon pods on the SSD labeled nodes only.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2357"}
{"instruction": "Write a yaml example for running pods on only some nodes", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/daemonset-label-selector.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\nRunning Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2358"}
{"instruction": "Write a yaml example for running pods on only some nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\nRunning Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2359"}
{"instruction": "Write a bash example for running pods on only some nodes", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-3 ssd=true\n```\n\nRunning Pods on Only Some Nodes | Labelling the node automatically triggers the control plane (specifically, the DaemonSet controller) to run a new daemon pod on that node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2360"}
{"instruction": "Write a bash example for running pods on only some nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nRunning Pods on Only Some Nodes | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/pods-some-nodes/", "id": "k8s_00194_code_2361"}
{"instruction": "How do you manage hugepages in Kubernetes?", "response": "Manage HugePagesConfigure and manage huge pages as a schedulable resource in a cluster.FEATURE STATE: Kubernetes v1.14 [stable] (enabled by default: true)Kubernetes supports the allocation and consumption of pre-allocated huge pages by applications in a Pod. This page describes how users can consume huge pages.Before you beginKubernetes nodes must pre-allocate huge pages in order for the node to report its huge page capacity.A node can pre-allocate huge pages for multiple sizes, for instance, the following line in /etc/default/grub allocates 2*1GiB of 1 GiB and 512*2 MiB of 2 MiB pages:GRUB_CMDLINE_LINUX=\"hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=512\" The nodes will automatically discover and report all huge page resources as schedulable resources.When you describe the Node, you should see something similar to the following in the following in the Capacity and Allocatable sections:Capacity: cpu: ... ephemeral-storage: ... hugepages-1Gi: 2Gi hugepages-2Mi: 1Gi memory: ... pods: ... Allocatable: cpu: ... ephemeral-storage: ... hugepages-1Gi: 2Gi hugepages-2Mi: 1Gi memory: ... pods: ... Note:For dynamically allocated pages (after boot), the Kubelet needs to be restarted for the new allocations to be refrelected.APIHuge pages can be consumed via container level resource requirements using the resource name hugepages-<size>, where <size> is the most compact binary notation using integer values supported on a particular node. For example, if a node supports 2048KiB and 1048576KiB page sizes, it will expose a schedulable resources hugepages-2Mi and hugepages-1Gi. Unlike CPU or memory, huge pages do not support overcommit. Note that when requesting hugepage resources, either memory or CPU resources must be requested as well.A pod may consume multiple huge page sizes in a single pod spec. In this case it must use medium: HugePages-<hugepagesize> notation for all volume mounts.apiVersion: v1 kind: Pod metadata: name: huge-pages-example spec: containers: - name: example image: fedora:latest command: - sleep - inf volumeMounts: - mountPath: /hugepages-2Mi name: hugepage-2mi - mountPath: /hugepages-1Gi name: hugepage-1gi resources: limits: hugepages-2Mi: 100Mi hugepages-1Gi: 2Gi memory: 100Mi requests: memory: 100Mi volumes: - name: hugepage-2mi emptyDir: medium: HugePages-2Mi - name: hugepage-1gi emptyDir: medium: HugePages-1Gi A pod may use medium: HugePages only if it requests huge pages of one size.apiVersion: v1 kind: Pod metadata: name: huge-pages-example spec: containers: - name: example image: fedora:latest command: - sleep - inf volumeMounts: - mountPath: /hugepages name: hugepage resources: limits: hugepages-2Mi: 100Mi memory: 100Mi requests: memory: 100Mi volumes: - name: hugepage emptyDir: medium: HugePages Huge page requests must equal the limits. This is the default if limits are specified, but requests are not.Huge pages are isolated at a container scope, so each container has own limit on their cgroup sandbox as requested in a container spec.EmptyDir volumes backed by huge pages may not consume more huge page memory than the pod request.Applications that consume huge pages via shmget() with SHM_HUGETLB must run with a supplemental group that matches proc/sys/vm/hugetlb_shm_group.Huge page usage in a namespace is controllable via ResourceQuota similar to other compute resources like cpu or memory using the hugepages-<size> token.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/", "id": "k8s_00195"}
{"instruction": "Write a yaml example for manage hugepages", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages-2Mi\n      name: hugepage-2mi\n    - mountPath: /hugepages-1Gi\n      name: hugepage-1gi\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        hugepages-1Gi: 2Gi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage-2mi\n    emptyDir:\n      medium: HugePages-2Mi\n  - name: hugepage-1gi\n    emptyDir:\n      medium: HugePages-1Gi\n```\n\nManage HugePages | A pod may use medium: HugePages only if it requests huge pages of one size.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/", "id": "k8s_00195_code_2363"}
{"instruction": "Write a yaml example for manage hugepages", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages\n      name: hugepage\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage\n    emptyDir:\n      medium: HugePages\n```\n\nManage HugePages |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/", "id": "k8s_00195_code_2364"}
{"instruction": "Write a yaml example for manage hugepages", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages-2Mi\n      name: hugepage-2mi\n    - mountPath: /hugepages-1Gi\n      name: hugepage-1gi\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        hugepages-1Gi: 2Gi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage-2mi\n    emptyDir:\n      medium: HugePages-2Mi\n  - name: hugepage-1gi\n    emptyDir:\n      medium: HugePages-1Gi\n```\n\nManage HugePages | A pod may use medium: HugePages only if it requests huge pages of one size.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/", "id": "k8s_00195_code_2365"}
{"instruction": "Write a yaml example for manage hugepages", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages\n      name: hugepage\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage\n    emptyDir:\n      medium: HugePages\n```\n\nManage HugePages |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/", "id": "k8s_00195_code_2366"}
{"instruction": "Write a yaml example for manage hugepages", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages-2Mi\n      name: hugepage-2mi\n    - mountPath: /hugepages-1Gi\n      name: hugepage-1gi\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        hugepages-1Gi: 2Gi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage-2mi\n    emptyDir:\n      medium: HugePages-2Mi\n  - name: hugepage-1gi\n    emptyDir:\n      medium: HugePages-1Gi\n```\n\nManage HugePages | A pod may use medium: HugePages only if it requests huge pages of one size.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/", "id": "k8s_00195_code_2367"}
{"instruction": "Write a yaml example for manage hugepages", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages\n      name: hugepage\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage\n    emptyDir:\n      medium: HugePages\n```\n\nManage HugePages |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/", "id": "k8s_00195_code_2368"}
{"instruction": "Explain the Kubernetes concept: Pod Quality of Service Classes", "response": "Pod Quality of Service ClassesThis page introduces Quality of Service (QoS) classes in Kubernetes, and explains how Kubernetes assigns a QoS class to each Pod as a consequence of the resource constraints that you specify for the containers in that Pod. Kubernetes relies on this classification to make decisions about which Pods to evict when there are not enough available resources on a Node.Quality of Service classesKubernetes classifies the Pods that you run and allocates each Pod into a specific quality of service (QoS) class. Kubernetes uses that classification to influence how different pods are handled. Kubernetes does this classification based on the resource requests of the Containers in that Pod, along with how those requests relate to resource limits. This is known as Quality of Service (QoS) class. Kubernetes assigns every Pod a QoS class based on the resource requests and limits of its component Containers. QoS classes are used by Kubernetes to decide which Pods to evict from a Node experiencing Node Pressure. The possible QoS classes are Guaranteed, Burstable, and BestEffort. When a Node runs out of resources, Kubernetes will first evict BestEffort Pods running on that Node, followed by Burstable and finally Guaranteed Pods. When this eviction is due to resource pressure, only Pods exceeding resource requests are candidates for eviction.GuaranteedPods that are Guaranteed have the strictest resource limits and are least likely to face eviction. They are guaranteed not to be killed until they exceed their limits or there are no lower-priority Pods that can be preempted from the Node. They may not acquire resources beyond their specified limits. These Pods can also make use of exclusive CPUs using the static CPU management policy.CriteriaFor a Pod to be given a QoS class of Guaranteed:Every Container in the Pod must have a memory limit and a memory request.For every Container in the Pod, the memory limit must equal the memory request.Every Container in the Pod must have a CPU limit and a CPU request.For every Container in the Pod, the CPU limit must equal the CPU request.BurstablePods that are Burstable have some lower-bound resource guarantees based on the request, but do not require a specific limit. If a limit is not specified, it defaults to a limit equivalent to the capacity of the Node, which allows the Pods to flexibly increase their resources if resources are available. In the event of Pod eviction due to Node resource pressure, these Pods are evicted only after all BestEffort Pods are evicted. Because a Burstable Pod can include a Container that has no resource limits or requests, a Pod that is Burstable can try to use any amount of node resources.CriteriaA Pod is given a QoS class of Burstable if:The Pod does not meet the criteria for QoS class Guaranteed.At least one Container in the Pod has a memory or CPU request or limit.BestEffortPods in the BestEffort QoS class can use node resources that aren't specifically assigned to Pods in other QoS classes. For example, if you have a node with 16 CPU cores available to the kubelet, and you assign 4 CPU cores to a Guaranteed Pod, then a Pod in the BestEffort QoS class can try to use any amount of the remaining 12 CPU cores.The kubelet prefers to evict BestEffort Pods if the node comes under resource pressure.CriteriaA Pod has a QoS class of BestEffort if it doesn't meet the criteria for either Guaranteed or Burstable. In other words, a Pod is BestEffort only if none of the Containers in the Pod have a memory limit or a memory request, and none of the Containers in the Pod have a CPU limit or a CPU request. Containers in a Pod can request other resources (not CPU or memory) and still be classified as BestEffort.Memory QoS with cgroup v2FEATURE STATE: Kubernetes v1.22 [alpha] (enabled by default: false)Memory QoS uses the memory controller of cgroup v2 to guarantee memory resources in Kubernetes. Memory requests and limits of containers in pod are used to set specif", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/", "id": "k8s_00196"}
{"instruction": "How do you troubleshooting applications in Kubernetes?", "response": "Troubleshooting ApplicationsDebugging common containerized application issues.This doc contains a set of resources for fixing issues with containerized applications. It covers things like common issues with Kubernetes resources (like Pods, Services, or StatefulSets), advice on making sense of container termination messages, and ways to debug running containers.Debug PodsDebug ServicesDebug a StatefulSetDetermine the Reason for Pod FailureDebug Init ContainersDebug Running PodsGet a Shell to a Running Container", "category": "tasks", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/", "id": "k8s_00197"}
{"instruction": "Explain the Kubernetes concept: Hardening Guide - Authentication Mechanisms", "response": "Hardening Guide - Authentication MechanismsInformation on authentication options in Kubernetes and their security properties.Selecting the appropriate authentication mechanism(s) is a crucial aspect of securing your cluster. Kubernetes provides several built-in mechanisms, each with its own strengths and weaknesses that should be carefully considered when choosing the best authentication mechanism for your cluster.In general, it is recommended to enable as few authentication mechanisms as possible to simplify user management and prevent cases where users retain access to a cluster that is no longer required.It is important to note that Kubernetes does not have an in-built user database within the cluster. Instead, it takes user information from the configured authentication system and uses that to make authorization decisions. Therefore, to audit user access, you need to review credentials from every configured authentication source.For production clusters with multiple users directly accessing the Kubernetes API, it is recommended to use external authentication sources such as OIDC. The internal authentication mechanisms, such as client certificates and service account tokens, described below, are not suitable for this use case.X.509 client certificate authenticationKubernetes leverages X.509 client certificate authentication for system components, such as when the kubelet authenticates to the API Server. While this mechanism can also be used for user authentication, it might not be suitable for production use due to several restrictions:Client certificates cannot be individually revoked. Once compromised, a certificate can be used by an attacker until it expires. To mitigate this risk, it is recommended to configure short lifetimes for user authentication credentials created using client certificates.If a certificate needs to be invalidated, the certificate authority must be re-keyed, which can introduce availability risks to the cluster.There is no permanent record of client certificates created in the cluster. Therefore, all issued certificates must be recorded if you need to keep track of them.Private keys used for client certificate authentication cannot be password-protected. Anyone who can read the file containing the key will be able to make use of it.Using client certificate authentication requires a direct connection from the client to the API server without any intervening TLS termination points, which can complicate network architectures.Group data is embedded in the O value of the client certificate, which means the user's group memberships cannot be changed for the lifetime of the certificate.Static token fileAlthough Kubernetes allows you to load credentials from a static token file located on the control plane node disks, this approach is not recommended for production servers due to several reasons:Credentials are stored in clear text on control plane node disks, which can be a security risk.Changing any credential requires a restart of the API server process to take effect, which can impact availability.There is no mechanism available to allow users to rotate their credentials. To rotate a credential, a cluster administrator must modify the token on disk and distribute it to the users.There is no lockout mechanism available to prevent brute-force attacks.Bootstrap tokensBootstrap tokens are used for joining nodes to clusters and are not recommended for user authentication due to several reasons:They have hard-coded group memberships that are not suitable for general use, making them unsuitable for authentication purposes.Manually generating bootstrap tokens can lead to weak tokens that can be guessed by an attacker, which can be a security risk.There is no lockout mechanism available to prevent brute-force attacks, making it easier for attackers to guess or crack the token.ServiceAccount secret tokensService account secrets are available as an option to allow workloads running in the cluster to authenticate ", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/hardening-guide/authentication-mechanisms/", "id": "k8s_00198"}
{"instruction": "How do you use a service to access an application in a cluster in Kubernetes?", "response": "Use a Service to Access an Application in a ClusterThis page shows how to create a Kubernetes Service object that external clients can use to access an application running in a cluster. The Service provides load balancing for an application that has two running instances.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesObjectivesRun two instances of a Hello World application.Create a Service object that exposes a node port.Use the Service object to access the running application.Creating a service for an application running in two podsHere is the configuration file for the application Deployment:service/access/hello-application.yaml apiVersion: apps/v1 kind: Deployment metadata: name: hello-world spec: selector: matchLabels: run: load-balancer-example replicas: 2 template: metadata: labels: run: load-balancer-example spec: containers: - name: hello-world image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0 ports: - containerPort: 8080 protocol: TCP Run a Hello World application in your cluster: Create the application Deployment using the file above:kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has two Pods each of which runs the Hello World application.Display information about the Deployment:kubectl get deployments hello-world kubectl describe deployments hello-world Display information about your ReplicaSet objects:kubectl get replicasets kubectl describe replicasets Create a Service object that exposes the deployment:kubectl expose deployment hello-world --type=NodePort --name=example-service Display information about the Service:kubectl describe services example-service The output is similar to this:Name: example-service Namespace: default Labels: run=load-balancer-example Annotations: <none> Selector: run=load-balancer-example Type: NodePort IP: 10.32.0.16 Port: <unset> 8080/TCP TargetPort: 8080/TCP NodePort: <unset> 31496/TCP Endpoints: 10.200.1.4:8080,10.200.2.5:8080 Session Affinity: None Events: <none> Make a note of the NodePort value for the Service. For example, in the preceding output, the NodePort value is 31496.List the pods that are running the Hello World application:kubectl get pods --selector=\"run=load-balancer-example\" --output=wide The output is similar to this:NAME READY STATUS ... IP NODE hello-world-2895499144-bsbk5 1/1 Running ... 10.200.1.4 worker1 hello-world-2895499144-m1pwt 1/1 Running ... 10.200.2.5 worker2 Get the public IP address of one of your nodes that is running a Hello World pod. How you get this address depends on how you set up your cluster. For example, if you are using Minikube, you can see the node address by running kubectl cluster-info. If you are using Google Compute Engine instances, you can use the gcloud compute instances list command to see the public addresses of your nodes.On your chosen node, create a firewall rule that allows TCP traffic on your node port. For example, if your Service has a NodePort value of 31568, create a firewall rule that allows TCP traffic on port 31568. Different cloud providers offer different ways of configuring firewall rules.Use the node address and node port to access the Hello World application:curl http://<public-node-ip>:<node-port> where <public-node-ip> is the public IP address of your node, and <node-port> is the NodePort value for your service. The response to a successful request is a hello message:Hello, world! Version: 2.0.0 Hostname: hello-world-cdd4458f4-m47c8 Using a service configuration fileAs an alternative to usi", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199"}
{"instruction": "Write a yaml example for use a service to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\nUse a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2373"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml\n```\n\nUse a Service to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has two Pods each of which runs the Hello World application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2374"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\nUse a Service to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2375"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\nUse a Service to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2376"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=NodePort --name=example-service\n```\n\nUse a Service to Access an Application in a Cluster | Display information about the Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2377"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\nUse a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2378"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=\"run=load-balancer-example\" --output=wide\n```\n\nUse a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2379"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services example-service\n```\n\nUse a Service to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2380"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\nUse a Service to Access an Application in a Cluster | Follow the Connecting Applications with Services tutorial.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2381"}
{"instruction": "Write a yaml example for use a service to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\nUse a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2382"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services example-service\n```\n\nUse a Service to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2383"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\nUse a Service to Access an Application in a Cluster | Follow the Connecting Applications with Services tutorial.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2384"}
{"instruction": "Write a yaml example for use a service to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/access/hello-application.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\nUse a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2385"}
{"instruction": "Write a yaml example for use a service to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\nUse a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2386"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml\n```\n\nUse a Service to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has two Pods each of which runs the Hello World application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2387"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\nUse a Service to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2388"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\nUse a Service to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2389"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=NodePort --name=example-service\n```\n\nUse a Service to Access an Application in a Cluster | Display information about the Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2390"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\nUse a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2391"}
{"instruction": "Write a bash example for use a service to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=\"run=load-balancer-example\" --output=wide\n```\n\nUse a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/", "id": "k8s_00199_code_2392"}
{"instruction": "Explain custom hugo shortcodes in Kubernetes", "response": "Custom Hugo ShortcodesThis page explains the custom Hugo shortcodes that can be used in Kubernetes Markdown documentation.Read more about shortcodes in the Hugo documentation.Feature stateIn a Markdown page (.md file) on this site, you can add a shortcode to display version and state of the documented feature.Feature state demoBelow is a demo of the feature state snippet, which displays the feature as stable in the latest Kubernetes version.{{< feature-state state=\"stable\" >}} Renders to:FEATURE STATE: Kubernetes v1.34 [stable]The valid values for state are:alphabetadeprecatedstableFeature state codeThe displayed Kubernetes version defaults to that of the page or the site. You can change the feature state version by passing the for_k8s_version shortcode parameter. For example:{{< feature-state for_k8s_version=\"v1.10\" state=\"beta\" >}} Renders to:FEATURE STATE: Kubernetes v1.10 [beta]Feature state retrieval from description fileTo dynamically determine the state of the feature, make use of the feature_gate_name shortcode parameter. The feature state details will be extracted from the corresponding feature gate description file located in content/en/docs/reference/command-line-tools-reference/feature-gates/. For example:{{< feature-state feature_gate_name=\"NodeSwap\" >}} Renders to:FEATURE STATE: Kubernetes v1.30 [beta] (enabled by default: true)Feature gate descriptionIn a Markdown page (.md file) on this site, you can add a shortcode to display the description for a shortcode.Feature gate description demoBelow is a demo of the feature state snippet, which displays the feature as stable in the latest Kubernetes version.{{< feature-gate-description name=\"DryRun\" >}} Renders to:DryRun: Enable server-side dry run requests so that validation, merging, and mutation can be tested without committing.GlossaryThere are two glossary shortcodes: glossary_tooltip and glossary_definition.You can reference glossary terms with an inclusion that automatically updates and replaces content with the relevant links from our glossary. When the glossary term is moused-over, the glossary entry displays a tooltip. The glossary term also displays as a link.As well as inclusions with tooltips, you can reuse the definitions from the glossary in page content.The raw data for glossary terms is stored at the glossary directory, with a content file for each glossary term.Glossary demoFor example, the following include within the Markdown renders to cluster with a tooltip:{{< glossary_tooltip text=\"cluster\" term_id=\"cluster\" >}} Here's a short glossary definition:{{< glossary_definition prepend=\"A cluster is\" term_id=\"cluster\" length=\"short\" >}} which renders as:A cluster is a set of worker machines, called nodes, that run containerized applications. Every cluster has at least one worker node.You can also include a full definition:{{< glossary_definition term_id=\"cluster\" length=\"all\" >}} which renders as:A set of worker machines, called nodes, that run containerized applications. Every cluster has at least one worker node.The worker node(s) host the Pods that are the components of the application workload. The control plane manages the worker nodes and the Pods in the cluster. In production environments, the control plane usually runs across multiple computers and a cluster usually runs multiple nodes, providing fault-tolerance and high availability.Links to API ReferenceYou can link to a page of the Kubernetes API reference using the api-reference shortcode, for example to the Pod reference:{{< api-reference page=\"workload-resources/pod-v1\" >}} The content of the page parameter is the suffix of the URL of the API reference page.You can link to a specific place into a page by specifying an anchor parameter, for example to the PodSpec reference or the environment-variables section of the page:{{< api-reference page=\"workload-resources/pod-v1\" anchor=\"PodSpec\" >}} {{< api-reference page=\"workload-resources/pod-v1\" anchor=\"environment-variables\" >}} You can chang", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/hugo-shortcodes/", "id": "k8s_00200"}
{"instruction": "Write a yaml example for custom hugo shortcodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nCustom Hugo Shortcodes | When adding a new sample file, such as a YAML file, create the file in one of the <LANG>/examples/ subdirectories where <LANG> is the language for the page. In the markdown of your page, use the code", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/hugo-shortcodes/", "id": "k8s_00200_code_2394"}
{"instruction": "Write a bash example for custom hugo shortcodes", "response": "Here's a bash example:\n\n```bash\necho \"This is tab 1.\"\n```\n\nCustom Hugo Shortcodes | println \"This is tab 2.\"", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/hugo-shortcodes/", "id": "k8s_00200_code_2395"}
{"instruction": "Write a yaml example for custom hugo shortcodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nCustom Hugo Shortcodes | When adding a new sample file, such as a YAML file, create the file in one of the <LANG>/examples/ subdirectories where <LANG> is the language for the page. In the markdown of your page, use the code", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/hugo-shortcodes/", "id": "k8s_00200_code_2396"}
{"instruction": "Write a yaml example for custom hugo shortcodes", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-scale.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nCustom Hugo Shortcodes | When adding a new sample file, such as a YAML file, create the file in one of the <LANG>/examples/ subdirectories where <LANG> is the language for the page. In the markdown of your page, use the code", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/hugo-shortcodes/", "id": "k8s_00200_code_2397"}
{"instruction": "Write a yaml example for custom hugo shortcodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nCustom Hugo Shortcodes | When adding a new sample file, such as a YAML file, create the file in one of the <LANG>/examples/ subdirectories where <LANG> is the language for the page. In the markdown of your page, use the code", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/hugo-shortcodes/", "id": "k8s_00200_code_2398"}
{"instruction": "What is the reference documentation for kubectl set serviceaccount?", "response": "kubectl set serviceaccountSynopsisUpdate the service account of pod template resources.Possible resources (case insensitive) can be:replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulsetkubectl set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT Examples # Set deployment nginx-deployment's service account to serviceaccount1 kubectl set serviceaccount deployment nginx-deployment serviceaccount1 # Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server kubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml Options--allSelect all resources, in the namespace of the specified resource types--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-set\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for serviceaccount-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--localIf true, set serviceaccount will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero m", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_serviceaccount/", "id": "k8s_00201"}
{"instruction": "Write a bash example for kubectl set serviceaccount", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT\n```\n\nkubectl set serviceaccount | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_serviceaccount/", "id": "k8s_00201_code_2400"}
{"instruction": "Write a bash example for kubectl set serviceaccount", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT\n```\n\nkubectl set serviceaccount | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_serviceaccount/", "id": "k8s_00201_code_2401"}
{"instruction": "Explain generating reference documentation for metrics in Kubernetes", "response": "Generating Reference Documentation for MetricsThis page demonstrates the generation of metrics reference documentation.Before you beginRequirements:You need a machine that is running Linux or macOS.You need to have these tools installed:Python v3.7.x+GitGolang version 1.13+Pip used to install PyYAMLPyYAML v5.1.2makegcc compiler/linkerDocker (Required only for kubectl command reference)Your PATH environment variable must include the required build tools, such as the Go binary and python.You need to know how to create a pull request to a GitHub repository. This involves creating your own fork of the repository. For more information, see Work from a local clone.Clone the Kubernetes repositoryThe metric generation happens in the Kubernetes repository. To clone the repository, change directories to where you want the clone to exist.Then, execute the following command:git clone https://www.github.com/kubernetes/kubernetes This creates a kubernetes folder in your current working directory.Generate the metricsInside the cloned Kubernetes repository, locate the test/instrumentation/documentation directory. The metrics documentation is generated in this directory.With each release, new metrics are added. After you run the metrics documentation generator script, copy the metrics documentation to the Kubernetes website and publish the updated metrics documentation.To generate the latest metrics, make sure you are in the root of the cloned Kubernetes directory. Then, execute the following command:./test/instrumentation/update-documentation.sh To check for changes, execute:git status The output is similar to:./test/instrumentation/documentation/documentation.md ./test/instrumentation/documentation/documentation-list.yaml Copy the generated metrics documentation file to the Kubernetes website repositorySet the Kubernetes website root environment variable.Execute the following command to set the website root:export WEBSITE_ROOT=<path to website root> Copy the generated metrics file to the Kubernetes website repository.cp ./test/instrumentation/documentation/documentation.md \"${WEBSITE_ROOT}/content/en/docs/reference/instrumentation/metrics.md\" Note:If you get an error, check that you have permission to copy the file. You can use chown to change the file ownership back to your own user.Create a pull requestTo create a pull request, follow the instructions in Opening a pull request.What's nextContribute-upstreamGenerating Reference Docs for Kubernetes Components and ToolsGenerating Reference Documentation for kubectl Commands", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/metrics-reference/", "id": "k8s_00202"}
{"instruction": "Explain the Kubernetes concept: Liveness, Readiness, and Startup Probes", "response": "Liveness, Readiness, and Startup ProbesKubernetes has various types of probes:Liveness probeReadiness probeStartup probeLiveness probeLiveness probes determine when to restart a container. For example, liveness probes could catch a deadlock when an application is running but unable to make progress.If a container fails its liveness probe repeatedly, the kubelet restarts the container.Liveness probes do not wait for readiness probes to succeed. If you want to wait before executing a liveness probe, you can either define initialDelaySeconds or use a startup probe.Readiness probeReadiness probes determine when a container is ready to accept traffic. This is useful when waiting for an application to perform time-consuming initial tasks that depend on its backing services; for example: establishing network connections, loading files, and warming caches. Readiness probes can also be useful later in the container’s lifecycle, for example, when recovering from temporary faults or overloads.If the readiness probe returns a failed state, Kubernetes removes the pod from all matching service endpoints.Readiness probes run on the container during its whole lifecycle.Startup probeA startup probe verifies whether the application within a container is started. This can be used to adopt liveness checks on slow starting containers, avoiding them getting killed by the kubelet before they are up and running.If such a probe is configured, it disables liveness and readiness checks until it succeeds.This type of probe is only executed at startup, unlike liveness and readiness probes, which are run periodically.Read more about the Configure Liveness, Readiness and Startup Probes.", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/", "id": "k8s_00203"}
{"instruction": "What is the reference documentation for kubectl config current-context?", "response": "kubectl config current-contextSynopsisDisplay the current-context.kubectl config current-context [flags] Examples # Display the current-context kubectl config current-context Options-h, --helphelp for current-contextParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_current-context/", "id": "k8s_00204"}
{"instruction": "Write a bash example for kubectl config current-context", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context [flags]\n```\n\nkubectl config current-context | help for current-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_current-context/", "id": "k8s_00204_code_2405"}
{"instruction": "Write a bash example for kubectl config current-context", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context [flags]\n```\n\nkubectl config current-context | help for current-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_current-context/", "id": "k8s_00204_code_2406"}
{"instruction": "Explain dual-stack support with kubeadm in Kubernetes", "response": "Dual-stack support with kubeadmFEATURE STATE: Kubernetes v1.23 [stable]Your Kubernetes cluster includes dual-stack networking, which means that cluster networking lets you use either address family. In a cluster, the control plane can assign both an IPv4 address and an IPv6 address to a single Pod or a Service.Before you beginYou need to have installed the kubeadm tool, following the steps from Installing kubeadm.For each server that you want to use as a node, make sure it allows IPv6 forwarding.Enable IPv6 packet forwardingTo check if IPv6 packet forwarding is enabled:sysctl net.ipv6.conf.all.forwarding If the output is net.ipv6.conf.all.forwarding = 1 it is already enabled. Otherwise it is not enabled yet.To manually enable IPv6 packet forwarding:# sysctl params required by setup, params persist across reboots cat <<EOF | sudo tee -a /etc/sysctl.d/k8s.conf net.ipv6.conf.all.forwarding = 1 EOF # Apply sysctl params without reboot sudo sysctl --system You need to have an IPv4 and and IPv6 address range to use. Cluster operators typically use private address ranges for IPv4. For IPv6, a cluster operator typically chooses a global unicast address block from within 2000::/3, using a range that is assigned to the operator. You don't have to route the cluster's IP address ranges to the public internet.The size of the IP address allocations should be suitable for the number of Pods and Services that you are planning to run.Note:If you are upgrading an existing cluster with the kubeadm upgrade command, kubeadm does not support making modifications to the pod IP address range (“cluster CIDR”) nor to the cluster's Service address range (“Service CIDR”).Create a dual-stack clusterTo create a dual-stack cluster with kubeadm init you can pass command line arguments similar to the following example:# These address ranges are examples kubeadm init --pod-network-cidr=10.244.0.0/16,2001:db8:42:0::/56 --service-cidr=10.96.0.0/16,2001:db8:42:1::/112 To make things clearer, here is an example kubeadm configuration file kubeadm-config.yaml for the primary dual-stack control plane node.--- apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration networking: podSubnet: 10.244.0.0/16,2001:db8:42:0::/56 serviceSubnet: 10.96.0.0/16,2001:db8:42:1::/112 --- apiVersion: kubeadm.k8s.io/v1beta4 kind: InitConfiguration localAPIEndpoint: advertiseAddress: \"10.100.0.1\" bindPort: 6443 nodeRegistration: kubeletExtraArgs: - name: \"node-ip\" value: \"10.100.0.2,fd00:1:2:3::2\" advertiseAddress in InitConfiguration specifies the IP address that the API Server will advertise it is listening on. The value of advertiseAddress equals the --apiserver-advertise-address flag of kubeadm init.Run kubeadm to initiate the dual-stack control plane node:kubeadm init --config=kubeadm-config.yaml The kube-controller-manager flags --node-cidr-mask-size-ipv4|--node-cidr-mask-size-ipv6 are set with default values. See configure IPv4/IPv6 dual stack.Note:The --apiserver-advertise-address flag does not support dual-stack.Join a node to dual-stack clusterBefore joining a node, make sure that the node has IPv6 routable network interface and allows IPv6 forwarding.Here is an example kubeadm configuration file kubeadm-config.yaml for joining a worker node to the cluster.apiVersion: kubeadm.k8s.io/v1beta4 kind: JoinConfiguration discovery: bootstrapToken: apiServerEndpoint: 10.100.0.1:6443 token: \"clvldh.vjjwg16ucnhp94qr\" caCertHashes: - \"sha256:a4863cde706cfc580a439f842cc65d5ef112b7b2be31628513a9881cf0d9fe0e\" # change auth info above to match the actual token and CA certificate hash for your cluster nodeRegistration: kubeletExtraArgs: - name: \"node-ip\" value: \"10.100.0.2,fd00:1:2:3::3\" Also, here is an example kubeadm configuration file kubeadm-config.yaml for joining another control plane node to the cluster.apiVersion: kubeadm.k8s.io/v1beta4 kind: JoinConfiguration controlPlane: localAPIEndpoint: advertiseAddress: \"10.100.0.2\" bindPort: 6443 discovery: bootstrapToken: apiServerEndpoi", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  podSubnet: 10.244.0.0/16,2001:db8:42:0::/56\n  serviceSubnet: 10.96.0.0/16,2001:db8:42:1::/112\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nlocalAPIEndpoint:\n  advertiseAddress: \"10.100.0.1\"\n  bindPort: 6443\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::2\"\n```\n\nDual-stack support with kubeadm | advertiseAddress in InitConfiguration specifies the IP address that the API Server will advertise it is listening on. The value of advertiseAddress equals the --apiserver-advertise-address flag of kub", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2408"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: 10.100.0.1:6443\n    token: \"clvldh.vjjwg16ucnhp94qr\"\n    caCertHashes:\n    - \"sha256:a4863cde706cfc580a439f842cc65d5ef112b7b2be31628513a9881cf0d9fe0e\"\n    # change auth info above to match the actual token and CA certificate hash for your cluster\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::3\"\n```\n\nDual-stack support with kubeadm | Also, here is an example kubeadm configuration file kubeadm-config.yaml for joining another control plane node to the cluster.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2409"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ncontrolPlane:\n  localAPIEndpoint:\n    advertiseAddress: \"10.100.0.2\"\n    bindPort: 6443\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: 10.100.0.1:6443\n    token: \"clvldh.vjjwg16ucnhp94qr\"\n    caCertHashes:\n    - \"sha256:a4863cde706cfc580a439f842cc65d5ef112b7b2be31628513a9881cf0d9fe0e\"\n    # change auth info above to match the actual token and CA certificate hash for your cluster\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::4\"\n```\n\nDual-stack support with kubeadm | advertiseAddress in JoinConfiguration.controlPlane specifies the IP address that the API Server will advertise it is listening on. The value of advertiseAddress equals the --apiserver-advertise-addres", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2410"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  podSubnet: 10.244.0.0/16\n  serviceSubnet: 10.96.0.0/16\n```\n\nDual-stack support with kubeadm |", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2411"}
{"instruction": "Write a bash example for dual-stack support with kubeadm", "response": "Here's a bash example:\n\n```bash\nsysctl net.ipv6.conf.all.forwarding\n```\n\nDual-stack support with kubeadm | If the output is net.ipv6.conf.all.forwarding = 1 it is already enabled. Otherwise it is not enabled yet.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2412"}
{"instruction": "Write a bash example for dual-stack support with kubeadm", "response": "Here's a bash example:\n\n```bash\n# sysctl params required by setup, params persist across reboots\ncat <<EOF | sudo tee -a /etc/sysctl.d/k8s.conf\nnet.ipv6.conf.all.forwarding = 1\nEOF\n\n# Apply sysctl params without reboot\nsudo sysctl --system\n```\n\nDual-stack support with kubeadm | You need to have an IPv4 and and IPv6 address range to use. Cluster operators typically use private address ranges for IPv4. For IPv6, a cluster operator typically chooses a global unicast address blo", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2413"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  podSubnet: 10.244.0.0/16,2001:db8:42:0::/56\n  serviceSubnet: 10.96.0.0/16,2001:db8:42:1::/112\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nlocalAPIEndpoint:\n  advertiseAddress: \"10.100.0.1\"\n  bindPort: 6443\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::2\"\n```\n\nDual-stack support with kubeadm | advertiseAddress in InitConfiguration specifies the IP address that the API Server will advertise it is listening on. The value of advertiseAddress equals the --apiserver-advertise-address flag of kub", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2414"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: 10.100.0.1:6443\n    token: \"clvldh.vjjwg16ucnhp94qr\"\n    caCertHashes:\n    - \"sha256:a4863cde706cfc580a439f842cc65d5ef112b7b2be31628513a9881cf0d9fe0e\"\n    # change auth info above to match the actual token and CA certificate hash for your cluster\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::3\"\n```\n\nDual-stack support with kubeadm | Also, here is an example kubeadm configuration file kubeadm-config.yaml for joining another control plane node to the cluster.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2415"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ncontrolPlane:\n  localAPIEndpoint:\n    advertiseAddress: \"10.100.0.2\"\n    bindPort: 6443\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: 10.100.0.1:6443\n    token: \"clvldh.vjjwg16ucnhp94qr\"\n    caCertHashes:\n    - \"sha256:a4863cde706cfc580a439f842cc65d5ef112b7b2be31628513a9881cf0d9fe0e\"\n    # change auth info above to match the actual token and CA certificate hash for your cluster\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::4\"\n```\n\nDual-stack support with kubeadm | advertiseAddress in JoinConfiguration.controlPlane specifies the IP address that the API Server will advertise it is listening on. The value of advertiseAddress equals the --apiserver-advertise-addres", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2416"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  podSubnet: 10.244.0.0/16\n  serviceSubnet: 10.96.0.0/16\n```\n\nDual-stack support with kubeadm |", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2417"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  podSubnet: 10.244.0.0/16,2001:db8:42:0::/56\n  serviceSubnet: 10.96.0.0/16,2001:db8:42:1::/112\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nlocalAPIEndpoint:\n  advertiseAddress: \"10.100.0.1\"\n  bindPort: 6443\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::2\"\n```\n\nDual-stack support with kubeadm | advertiseAddress in InitConfiguration specifies the IP address that the API Server will advertise it is listening on. The value of advertiseAddress equals the --apiserver-advertise-address flag of kub", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2418"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: 10.100.0.1:6443\n    token: \"clvldh.vjjwg16ucnhp94qr\"\n    caCertHashes:\n    - \"sha256:a4863cde706cfc580a439f842cc65d5ef112b7b2be31628513a9881cf0d9fe0e\"\n    # change auth info above to match the actual token and CA certificate hash for your cluster\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::3\"\n```\n\nDual-stack support with kubeadm | Also, here is an example kubeadm configuration file kubeadm-config.yaml for joining another control plane node to the cluster.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2419"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ncontrolPlane:\n  localAPIEndpoint:\n    advertiseAddress: \"10.100.0.2\"\n    bindPort: 6443\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: 10.100.0.1:6443\n    token: \"clvldh.vjjwg16ucnhp94qr\"\n    caCertHashes:\n    - \"sha256:a4863cde706cfc580a439f842cc65d5ef112b7b2be31628513a9881cf0d9fe0e\"\n    # change auth info above to match the actual token and CA certificate hash for your cluster\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"node-ip\"\n    value: \"10.100.0.2,fd00:1:2:3::4\"\n```\n\nDual-stack support with kubeadm | advertiseAddress in JoinConfiguration.controlPlane specifies the IP address that the API Server will advertise it is listening on. The value of advertiseAddress equals the --apiserver-advertise-addres", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2420"}
{"instruction": "Write a yaml example for dual-stack support with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  podSubnet: 10.244.0.0/16\n  serviceSubnet: 10.96.0.0/16\n```\n\nDual-stack support with kubeadm |", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/dual-stack-support/", "id": "k8s_00205_code_2421"}
{"instruction": "Explain the Kubernetes concept: Deployments", "response": "DeploymentsA Deployment manages a set of Pods to run an application workload, usually one that doesn't maintain state.A Deployment provides declarative updates for Pods and ReplicaSets.You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.Note:Do not manage ReplicaSets owned by a Deployment. Consider opening an issue in the main Kubernetes repository if your use case is not covered below.Use CaseThe following are typical use cases for Deployments:Create a Deployment to rollout a ReplicaSet. The ReplicaSet creates Pods in the background. Check the status of the rollout to see if it succeeds or not.Declare the new state of the Pods by updating the PodTemplateSpec of the Deployment. A new ReplicaSet is created, and the Deployment gradually scales it up while scaling down the old ReplicaSet, ensuring Pods are replaced at a controlled rate. Each new ReplicaSet updates the revision of the Deployment.Rollback to an earlier Deployment revision if the current state of the Deployment is not stable. Each rollback updates the revision of the Deployment.Scale up the Deployment to facilitate more load.Pause the rollout of a Deployment to apply multiple fixes to its PodTemplateSpec and then resume it to start a new rollout.Use the status of the Deployment as an indicator that a rollout has stuck.Clean up older ReplicaSets that you don't need anymore.Creating a DeploymentThe following is an example of a Deployment. It creates a ReplicaSet to bring up three nginx Pods:controllers/nginx-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 In this example:A Deployment named nginx-deployment is created, indicated by the .metadata.name field. This name will become the basis for the ReplicaSets and Pods which are created later. See Writing a Deployment Spec for more details.The Deployment creates a ReplicaSet that creates three replicated Pods, indicated by the .spec.replicas field.The .spec.selector field defines how the created ReplicaSet finds which Pods to manage. In this case, you select a label that is defined in the Pod template (app: nginx). However, more sophisticated selection rules are possible, as long as the Pod template itself satisfies the rule.Note:The .spec.selector.matchLabels field is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". All of the requirements, from both matchLabels and matchExpressions, must be satisfied in order to match.The .spec.template field contains the following sub-fields:The Pods are labeled app: nginxusing the .metadata.labels field.The Pod template's specification, or .spec field, indicates that the Pods run one container, nginx, which runs the nginx Docker Hub image at version 1.14.2.Create one container and name it nginx using the .spec.containers[0].name field.Before you begin, make sure your Kubernetes cluster is up and running. Follow the steps given below to create the above Deployment:Create the Deployment by running the following command:kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml Run kubectl get deployments to check if the Deployment was created.If the Deployment is still being created, the output is similar to the following:NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 0/3 0 0 1s When you inspect the Deployments in your cluster, the following fields are displayed:NAME lists the names of the Deployments in the namespace.READY displays how many replicas of ", "category": "concepts", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeployments | In this example:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2423"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml\n```\n\nDeployments | Run kubectl get deployments to check if the Deployment was created.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2424"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1\n```\n\nDeployments | or use the following command:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2425"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\nDeployments | where deployment/nginx-deployment indicates the Deployment, nginx indicates the Container the update will take place and nginx:1.16.1 indicates the new image and its tag.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2426"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/nginx-deployment\n```\n\nDeployments | The output is similar to:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2427"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2428"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2429"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.161\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2430"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2431"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2432"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2433"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment --revision=2\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2434"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2435"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment --to-revision=2\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2436"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2437"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2438"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=10\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2439"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment/nginx-deployment --min=10 --max=15 --cpu-percent=80\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2440"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:sometag\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2441"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2442"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2443"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2444"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2445"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2446"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --watch\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2447"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2448"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment/nginx-deployment -p '{\"spec\":{\"progressDeadlineSeconds\":600}}'\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2449"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2450"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2451"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\nDeployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2452"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\nDeployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2453"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\nDeployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2454"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeployments | In this example:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2455"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nDeployments | If the Deployment is still being created, the output is similar to the following:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2456"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2457"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nDeployments | Notice that the Deployment has created all three replicas, and all replicas are up-to-date (they contain the latest Pod template) and available.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2458"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --show-labels\n```\n\nDeployments | The created ReplicaSet ensures that there are three nginx Pods.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2459"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nDeployments | Run kubectl get rs to see that the Deployment updated the Pods by creating a new ReplicaSet and scaling it up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2460"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl annotate deployment/nginx-deployment kubernetes.io/change-cause=\"image updated to 1.16.1\"\n```\n\nDeployments | To see the details of each revision, run:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2461"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\nDeployments | Kubernetes marks a Deployment as complete when it has the following characteristics:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2462"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2463"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2464"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\nDeployments | Eventually, once the Deployment progress deadline is exceeded, Kubernetes updates the status and the reason for the Progressing condition:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2465"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2466"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2467"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment deployment --replicas=X\n```\n\nDeployments | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Deployment, don't set .spec.replicas.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2468"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f deployment.yaml\n```\n\nDeployments | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Deployment, don't set .spec.replicas.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2469"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\nDeployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2470"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\nDeployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2471"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\nDeployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2472"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/nginx-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeployments | In this example:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2473"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeployments | In this example:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2474"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml\n```\n\nDeployments | Run kubectl get deployments to check if the Deployment was created.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2475"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1\n```\n\nDeployments | or use the following command:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2476"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\nDeployments | where deployment/nginx-deployment indicates the Deployment, nginx indicates the Container the update will take place and nginx:1.16.1 indicates the new image and its tag.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2477"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/nginx-deployment\n```\n\nDeployments | The output is similar to:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2478"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2479"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2480"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.161\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2481"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2482"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2483"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2484"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment --revision=2\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2485"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2486"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment --to-revision=2\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2487"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2488"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2489"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=10\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2490"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment/nginx-deployment --min=10 --max=15 --cpu-percent=80\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2491"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:sometag\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2492"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2493"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2494"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2495"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2496"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2497"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --watch\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2498"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2499"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment/nginx-deployment -p '{\"spec\":{\"progressDeadlineSeconds\":600}}'\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2500"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2501"}
{"instruction": "Write a bash example for deployments", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\nDeployments | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2502"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\nDeployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2503"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\nDeployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2504"}
{"instruction": "Write a yaml example for deployments", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\nDeployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/deployment/", "id": "k8s_00206_code_2505"}
{"instruction": "What is the reference documentation for kubectl config set-cluster?", "response": "kubectl config set-clusterSynopsisSet a cluster entry in kubeconfig.Specifying a name that already exists will merge new fields on top of existing values for those fields.kubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com] Examples # Set only the server field on the e2e cluster entry without touching other values kubectl config set-cluster e2e --server=https://1.2.3.4 # Embed certificate authority data for the e2e cluster entry kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt # Disable cert checking for the e2e cluster entry kubectl config set-cluster e2e --insecure-skip-tls-verify=true # Set the custom TLS server name to use for validation for the e2e cluster entry kubectl config set-cluster e2e --tls-server-name=my-cluster-name # Set the proxy URL for the e2e cluster entry kubectl config set-cluster e2e --proxy-url=https://1.2.3.4 Options--certificate-authority stringPath to certificate-authority file for the cluster entry in kubeconfig--embed-certs tristate[=true]embed-certs for the cluster entry in kubeconfig-h, --helphelp for set-cluster--insecure-skip-tls-verify tristate[=true]insecure-skip-tls-verify for the cluster entry in kubeconfig--proxy-url stringproxy-url for the cluster entry in kubeconfig--server stringserver for the cluster entry in kubeconfig--tls-server-name stringtls-server-name for the cluster entry in kubeconfigParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings rece", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-cluster/", "id": "k8s_00207"}
{"instruction": "Write a bash example for kubectl config set-cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]\n```\n\nkubectl config set-cluster | Path to certificate-authority file for the cluster entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-cluster/", "id": "k8s_00207_code_2507"}
{"instruction": "Write a bash example for kubectl config set-cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]\n```\n\nkubectl config set-cluster | Path to certificate-authority file for the cluster entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-cluster/", "id": "k8s_00207_code_2508"}
{"instruction": "Explain the Kubernetes concept: ConfigMaps", "response": "ConfigMapsA ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.A ConfigMap allows you to decouple environment-specific configuration from your container images, so that your applications are easily portable.Caution:ConfigMap does not provide secrecy or encryption. If the data you want to store are confidential, use a Secret rather than a ConfigMap, or use additional (third party) tools to keep your data private.MotivationUse a ConfigMap for setting configuration data separately from application code.For example, imagine that you are developing an application that you can run on your own computer (for development) and in the cloud (to handle real traffic). You write the code to look in an environment variable named DATABASE_HOST. Locally, you set that variable to localhost. In the cloud, you set it to refer to a Kubernetes Service that exposes the database component to your cluster. This lets you fetch a container image running in the cloud and debug the exact same code locally if needed.Note:A ConfigMap is not designed to hold large chunks of data. The data stored in a ConfigMap cannot exceed 1 MiB. If you need to store settings that are larger than this limit, you may want to consider mounting a volume or use a separate database or file service.ConfigMap objectA ConfigMap is an API object that lets you store configuration for other objects to use. Unlike most Kubernetes objects that have a spec, a ConfigMap has data and binaryData fields. These fields accept key-value pairs as their values. Both the data field and the binaryData are optional. The data field is designed to contain UTF-8 strings while the binaryData field is designed to contain binary data as base64-encoded strings.The name of a ConfigMap must be a valid DNS subdomain name.Each key under the data or the binaryData field must consist of alphanumeric characters, -, _ or .. The keys stored in data must not overlap with the keys in the binaryData field.Starting from v1.19, you can add an immutable field to a ConfigMap definition to create an immutable ConfigMap.ConfigMaps and PodsYou can write a Pod spec that refers to a ConfigMap and configures the container(s) in that Pod based on the data in the ConfigMap. The Pod and the ConfigMap must be in the same namespace.Note:The spec of a static Pod cannot refer to a ConfigMap or any other API objects.Here's an example ConfigMap that has some keys with single values, and other keys where the value looks like a fragment of a configuration format.apiVersion: v1 kind: ConfigMap metadata: name: game-demo data: # property-like keys; each key maps to a simple value player_initial_lives: \"3\" ui_properties_file_name: \"user-interface.properties\" # file-like keys game.properties: | enemy.types=aliens,monsters player.maximum-lives=5 user-interface.properties: | color.good=purple color.bad=yellow allow.textmode=true There are four different ways that you can use a ConfigMap to configure a container inside a Pod:Inside a container command and argsEnvironment variables for a containerAdd a file in read-only volume, for the application to readWrite code to run inside the Pod that uses the Kubernetes API to read a ConfigMapThese different methods lend themselves to different ways of modeling the data being consumed. For the first three methods, the kubelet uses the data from the ConfigMap when it launches container(s) for a Pod.The fourth method means you have to write code to read the ConfigMap and its data. However, because you're using the Kubernetes API directly, your application can subscribe to get updates whenever the ConfigMap changes, and react when that happens. By accessing the Kubernetes API directly, this technique also lets you access a ConfigMap in a different namespace.Here's an example Pod that uses values from game-demo to configure a Pod:configmap/configure-pod.yaml apiVer", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\nConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2510"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\nConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2511"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\nConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2512"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\nConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2513"}
{"instruction": "Write a bash example for configmaps", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myconfigmap.yaml\n```\n\nConfigMaps | The following Pod consumes the content of the ConfigMap as environment variables:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2514"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\nConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2515"}
{"instruction": "Write a bash example for configmaps", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f env-configmap.yaml\n```\n\nConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2516"}
{"instruction": "Write a bash example for configmaps", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/ env-configmap\n```\n\nConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2517"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\nConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2518"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\nConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2519"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\nConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2520"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\nConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2521"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\nConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2522"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\nConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2523"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\nConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2524"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\nConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2525"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\nConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2526"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\nConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2527"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configure-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\nConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2528"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\nConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2529"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\nConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2530"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\nConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2531"}
{"instruction": "Write a bash example for configmaps", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myconfigmap.yaml\n```\n\nConfigMaps | The following Pod consumes the content of the ConfigMap as environment variables:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2532"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/env-configmap.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\nConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2533"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\nConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2534"}
{"instruction": "Write a bash example for configmaps", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f env-configmap.yaml\n```\n\nConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2535"}
{"instruction": "Write a bash example for configmaps", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/ env-configmap\n```\n\nConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2536"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\nConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2537"}
{"instruction": "Write a yaml example for configmaps", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\nConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/configmap/", "id": "k8s_00208_code_2538"}
{"instruction": "Explain the Kubernetes concept: Sidecar Containers", "response": "Sidecar ContainersFEATURE STATE: Kubernetes v1.33 [stable] (enabled by default: true)Sidecar containers are the secondary containers that run along with the main application container within the same Pod. These containers are used to enhance or to extend the functionality of the primary app container by providing additional services, or functionality such as logging, monitoring, security, or data synchronization, without directly altering the primary application code.Typically, you only have one app container in a Pod. For example, if you have a web application that requires a local webserver, the local webserver is a sidecar and the web application itself is the app container.Sidecar containers in KubernetesKubernetes implements sidecar containers as a special case of init containers; sidecar containers remain running after Pod startup. This document uses the term regular init containers to clearly refer to containers that only run during Pod startup.Provided that your cluster has the SidecarContainers feature gate enabled (the feature is active by default since Kubernetes v1.29), you can specify a restartPolicy for containers listed in a Pod's initContainers field. These restartable sidecar containers are independent from other init containers and from the main application container(s) within the same pod. These can be started, stopped, or restarted without affecting the main application container and other init containers.You can also run a Pod with multiple containers that are not marked as init or sidecar containers. This is appropriate if the containers within the Pod are required for the Pod to work overall, but you don't need to control which containers start or stop first. You could also do this if you need to support older versions of Kubernetes that don't support a container-level restartPolicy field.Example applicationHere's an example of a Deployment with two containers, one of which is a sidecar:application/deployment-sidecar.yaml apiVersion: apps/v1 kind: Deployment metadata: name: myapp labels: app: myapp spec: replicas: 1 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: myapp image: alpine:latest command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done'] volumeMounts: - name: data mountPath: /opt initContainers: - name: logshipper image: alpine:latest restartPolicy: Always command: ['sh', '-c', 'tail -F /opt/logs.txt'] volumeMounts: - name: data mountPath: /opt volumes: - name: data emptyDir: {}Sidecar containers and Pod lifecycleIf an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated from the main application containers.If a readinessProbe is specified for this init container, its result will be used to determine the ready state of the Pod.Since these containers are defined as init containers, they benefit from the same ordering and sequential guarantees as regular init containers, allowing you to mix sidecar containers with regular init containers for complex Pod initialization flows.Compared to regular init containers, sidecars defined within initContainers continue to run after they have started. This is important when there is more than one entry inside .spec.initContainers for a Pod. After a sidecar-style init container is running (the kubelet has set the started status for that init container to true), the kubelet then starts the next init container from the ordered .spec.initContainers list. That status either becomes true because there is a process running in the container and no startup probe defined, or as a result of its startupProbe succeeding.Upon Pod termination, the kubelet postpones terminating sidecar containers until the main application container has fully stopped. The sidecar containers are then shut down in the opposite order of their appearance in the Pod specification.", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2540"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2541"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2542"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2543"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-sidecar.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2544"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2545"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napplication/job/job-sidecar.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2546"}
{"instruction": "Write a yaml example for sidecar containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\nSidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/", "id": "k8s_00209_code_2547"}
{"instruction": "What is the reference documentation for kubectl rollout resume?", "response": "kubectl rollout resumeSynopsisResume a paused resource.Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.kubectl rollout resume RESOURCE Examples # Resume an already paused deployment kubectl rollout resume deployment/nginx Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--field-manager string Default: \"kubectl-rollout\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for resume-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_resume/", "id": "k8s_00210"}
{"instruction": "Write a bash example for kubectl rollout resume", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume RESOURCE\n```\n\nkubectl rollout resume | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_resume/", "id": "k8s_00210_code_2549"}
{"instruction": "Write a bash example for kubectl rollout resume", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume RESOURCE\n```\n\nkubectl rollout resume | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_resume/", "id": "k8s_00210_code_2550"}
{"instruction": "How do you create a windows hostprocess pod in Kubernetes?", "response": "Create a Windows HostProcess PodFEATURE STATE: Kubernetes v1.26 [stable]Windows HostProcess containers enable you to run containerized workloads on a Windows host. These containers operate as normal processes but have access to the host network namespace, storage, and devices when given the appropriate user privileges. HostProcess containers can be used to deploy network plugins, storage configurations, device plugins, kube-proxy, and other components to Windows nodes without the need for dedicated proxies or the direct installation of host services.Administrative tasks such as installation of security patches, event log collection, and more can be performed without requiring cluster operators to log onto each Windows node. HostProcess containers can run as any user that is available on the host or is in the domain of the host machine, allowing administrators to restrict resource access through user permissions. While neither filesystem or process isolation are supported, a new volume is created on the host upon starting the container to give it a clean and consolidated workspace. HostProcess containers can also be built on top of existing Windows base images and do not inherit the same compatibility requirements as Windows server containers, meaning that the version of the base images does not need to match that of the host. It is, however, recommended that you use the same base image version as your Windows Server container workloads to ensure you do not have any unused images taking up space on the node. HostProcess containers also support volume mounts within the container volume.When should I use a Windows HostProcess container?When you need to perform tasks which require the networking namespace of the host. HostProcess containers have access to the host's network interfaces and IP addresses.You need access to resources on the host such as the filesystem, event logs, etc.Installation of specific device drivers or Windows services.Consolidation of administrative tasks and security policies. This reduces the degree of privileges needed by Windows nodes.Before you beginThis task guide is specific to Kubernetes v1.34. If you are not running Kubernetes v1.34, check the documentation for that version of Kubernetes.In Kubernetes 1.34, the HostProcess container feature is enabled by default. The kubelet will communicate with containerd directly by passing the hostprocess flag via CRI. You can use the latest version of containerd (v1.6+) to run HostProcess containers. How to install containerd.LimitationsThese limitations are relevant for Kubernetes v1.34:HostProcess containers require containerd 1.6 or higher container runtime and containerd 1.7 is recommended.HostProcess pods can only contain HostProcess containers. This is a current limitation of the Windows OS; non-privileged Windows containers cannot share a vNIC with the host IP namespace.HostProcess containers run as a process on the host and do not have any degree of isolation other than resource constraints imposed on the HostProcess user account. Neither filesystem or Hyper-V isolation are supported for HostProcess containers.Volume mounts are supported and are mounted under the container volume. See Volume MountsA limited set of host user accounts are available for HostProcess containers by default. See Choosing a User Account.Resource limits (disk, memory, cpu count) are supported in the same fashion as processes on the host.Both Named pipe mounts and Unix domain sockets are not supported and should instead be accessed via their path on the host (e.g. \\\\.\\pipe\\*)HostProcess Pod configuration requirementsEnabling a Windows HostProcess pod requires setting the right configurations in the pod security configuration. Of the policies defined in the Pod Security Standards HostProcess pods are disallowed by the baseline and restricted policies. It is therefore recommended that HostProcess pods run in alignment with the privileged profile.When running under the privileged pol", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/", "id": "k8s_00211"}
{"instruction": "Write a yaml example for create a windows hostprocess pod", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  securityContext:\n    windowsOptions:\n      hostProcess: true\n      runAsUserName: \"NT AUTHORITY\\\\Local service\"\n  hostNetwork: true\n  containers:\n  - name: test\n    image: image1:latest\n    command:\n      - ping\n      - -t\n      - 127.0.0.1\n  nodeSelector:\n    \"kubernetes.io/os\": windows\n```\n\nCreate a Windows HostProcess Pod | HostProcess containers support the ability to mount volumes within the container volume space. Volume mount behavior differs depending on the version of containerd runtime used by on the node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/", "id": "k8s_00211_code_2552"}
{"instruction": "Write a yaml example for create a windows hostprocess pod", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  windowsOptions:\n    hostProcess: true\n    runAsUserName: hpc-localgroup\n```\n\nCreate a Windows HostProcess Pod | Schedule the pod!", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/", "id": "k8s_00211_code_2553"}
{"instruction": "What is the reference documentation for ports and protocols?", "response": "Ports and ProtocolsWhen running Kubernetes in an environment with strict network boundaries, such as on-premises datacenter with physical network firewalls or Virtual Networks in Public Cloud, it is useful to be aware of the ports and protocols used by Kubernetes components.Control planeProtocolDirectionPort RangePurposeUsed ByTCPInbound6443Kubernetes API serverAllTCPInbound2379-2380etcd server client APIkube-apiserver, etcdTCPInbound10250Kubelet APISelf, Control planeTCPInbound10259kube-schedulerSelfTCPInbound10257kube-controller-managerSelfAlthough etcd ports are included in control plane section, you can also host your own etcd cluster externally or on custom ports.Worker node(s)ProtocolDirectionPort RangePurposeUsed ByTCPInbound10250Kubelet APISelf, Control planeTCPInbound10256kube-proxySelf, Load balancersTCPInbound30000-32767NodePort Services†AllUDPInbound30000-32767NodePort Services†All† Default port range for NodePort Services.All default port numbers can be overridden. When custom ports are used those ports need to be open instead of defaults mentioned here.One common example is API server port that is sometimes switched to 443. Alternatively, the default port is kept as is and API server is put behind a load balancer that listens on 443 and routes the requests to API server on the default port.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/ports-and-protocols/", "id": "k8s_00212"}
{"instruction": "Explain the Kubernetes concept: Secrets", "response": "SecretsA Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. Such information might otherwise be put in a Pod specification or in a container image. Using a Secret means that you don't need to include confidential data in your application code.Because Secrets can be created independently of the Pods that use them, there is less risk of the Secret (and its data) being exposed during the workflow of creating, viewing, and editing Pods. Kubernetes, and applications that run in your cluster, can also take additional precautions with Secrets, such as avoiding writing sensitive data to nonvolatile storage.Secrets are similar to ConfigMaps but are specifically intended to hold confidential data.Caution:Kubernetes Secrets are, by default, stored unencrypted in the API server's underlying data store (etcd). Anyone with API access can retrieve or modify a Secret, and so can anyone with access to etcd. Additionally, anyone who is authorized to create a Pod in a namespace can use that access to read any Secret in that namespace; this includes indirect access such as the ability to create a Deployment.In order to safely use Secrets, take at least the following steps:Enable Encryption at Rest for Secrets.Enable or configure RBAC rules with least-privilege access to Secrets.Restrict Secret access to specific containers.Consider using external Secret store providers.For more guidelines to manage and improve the security of your Secrets, refer to Good practices for Kubernetes Secrets.See Information security for Secrets for more details.Uses for SecretsYou can use Secrets for purposes such as the following:Set environment variables for a container.Provide credentials such as SSH keys or passwords to Pods.Allow the kubelet to pull container images from private registries.The Kubernetes control plane also uses Secrets; for example, bootstrap token Secrets are a mechanism to help automate node registration.Use case: dotfiles in a secret volumeYou can make your data \"hidden\" by defining a key that begins with a dot. This key represents a dotfile or \"hidden\" file. For example, when the following Secret is mounted into a volume, secret-volume, the volume will contain a single file, called .secret-file, and the dotfile-test-container will have this file present at the path /etc/secret-volume/.secret-file.Note:Files beginning with dot characters are hidden from the output of ls -l; you must use ls -la to see them when listing directory contents.secret/dotfile-secret.yaml apiVersion: v1 kind: Secret metadata: name: dotfile-secret data: .secret-file: dmFsdWUtMg0KDQo= --- apiVersion: v1 kind: Pod metadata: name: secret-dotfiles-pod spec: volumes: - name: secret-volume secret: secretName: dotfile-secret containers: - name: dotfile-test-container image: registry.k8s.io/busybox command: - ls - \"-l\" - \"/etc/secret-volume\" volumeMounts: - name: secret-volume readOnly: true mountPath: \"/etc/secret-volume\"Use case: Secret visible to one container in a PodConsider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed remote file reading exploit in the server, which could expose the private key to an attacker.This could be divided into two processes in two containers: a frontend container which handles user interaction and business logic, but which cannot see the private key; and a signer container that can see the private key, and responds to simple signing requests from the frontend (for example, over localhost networking).With this partitioned approach, an attacker now has to trick the application server into doing something rather arbitrary, which may be harder than getting it to read a file.Alternatives to SecretsRather than using a Secret to protect confidential data, you can pick from alternatives.Here are some of your options:If your cloud-native component needs to aut", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\nSecrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2556"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic empty-secret\nkubectl get secret empty-secret\n```\n\nSecrets | The output looks like:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2557"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\nSecrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2558"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\nSecrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2559"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry secret-tiger-docker \\\n  --docker-email=tiger@acme.example \\\n  --docker-username=tiger \\\n  --docker-password=pass1234 \\\n  --docker-server=my-registry.example:5000\n```\n\nSecrets | This command creates a Secret of type kubernetes.io/dockerconfigjson.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2560"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret-tiger-docker -o jsonpath='{.data.*}' | base64 -d\n```\n\nSecrets | The output is equivalent to the following JSON document (which is also a valid Docker configuration file):", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2561"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\nSecrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2562"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\nSecrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2563"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\nSecrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2564"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls my-tls-secret \\\n  --cert=path/to/cert/file \\\n  --key=path/to/key/file\n```\n\nSecrets | The public/private key pair must exist before hand. The public key certificate for --cert must be .PEM encoded and must match the given private key for --key.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2565"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\nSecrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2566"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\nSecrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2567"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\nSecrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2568"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\nSecrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2569"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\nSecrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2570"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\nSecrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2571"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\nSecrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2572"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\nSecrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2573"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\nSecrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2574"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\nSecrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2575"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\nSecrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2576"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\nSecrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2577"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\nSecrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2578"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\nSecrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2579"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/dotfile-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\nSecrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2580"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\nSecrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2581"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic empty-secret\nkubectl get secret empty-secret\n```\n\nSecrets | The output looks like:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2582"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/serviceaccount-token-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\nSecrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2583"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\nSecrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2584"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/dockercfg-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\nSecrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2585"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\nSecrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2586"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry secret-tiger-docker \\\n  --docker-email=tiger@acme.example \\\n  --docker-username=tiger \\\n  --docker-password=pass1234 \\\n  --docker-server=my-registry.example:5000\n```\n\nSecrets | This command creates a Secret of type kubernetes.io/dockerconfigjson.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2587"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret-tiger-docker -o jsonpath='{.data.*}' | base64 -d\n```\n\nSecrets | The output is equivalent to the following JSON document (which is also a valid Docker configuration file):", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2588"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/basicauth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\nSecrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2589"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\nSecrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2590"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/ssh-auth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\nSecrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2591"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\nSecrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2592"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/tls-auth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\nSecrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2593"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\nSecrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2594"}
{"instruction": "Write a bash example for secrets", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls my-tls-secret \\\n  --cert=path/to/cert/file \\\n  --key=path/to/key/file\n```\n\nSecrets | The public/private key pair must exist before hand. The public key certificate for --cert must be .PEM encoded and must match the given private key for --key.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2595"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/bootstrap-token-secret-base64.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\nSecrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2596"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\nSecrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2597"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/bootstrap-token-secret-literal.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\nSecrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2598"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\nSecrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2599"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\nsecret/optional-secret.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\nSecrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2600"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\nSecrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2601"}
{"instruction": "Write a yaml example for secrets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\nSecrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/secret/", "id": "k8s_00213_code_2602"}
{"instruction": "What is the reference documentation for virtual ips and service proxies?", "response": "Virtual IPs and Service ProxiesEvery node in a Kubernetes cluster runs a kube-proxy (unless you have deployed your own alternative component in place of kube-proxy).The kube-proxy component is responsible for implementing a virtual IP mechanism for Services of type other than ExternalName. Each instance of kube-proxy watches the Kubernetes control plane for the addition and removal of Service and EndpointSlice objects. For each Service, kube-proxy calls appropriate APIs (depending on the kube-proxy mode) to configure the node to capture traffic to the Service's clusterIP and port, and redirect that traffic to one of the Service's endpoints (usually a Pod, but possibly an arbitrary user-provided IP address). A control loop ensures that the rules on each node are reliably synchronized with the Service and EndpointSlice state as indicated by the API server.Virtual IP mechanism for Services, using iptables modeA question that pops up every now and then is why Kubernetes relies on proxying to forward inbound traffic to backends. What about other approaches? For example, would it be possible to configure DNS records that have multiple A values (or AAAA for IPv6), and rely on round-robin name resolution?There are a few reasons for using proxying for Services:There is a long history of DNS implementations not respecting record TTLs, and caching the results of name lookups after they should have expired.Some apps do DNS lookups only once and cache the results indefinitely.Even if apps and libraries did proper re-resolution, the low or zero TTLs on the DNS records could impose a high load on DNS that then becomes difficult to manage.Later in this page you can read about how various kube-proxy implementations work. Overall, you should note that, when running kube-proxy, kernel level rules may be modified (for example, iptables rules might get created), which won't get cleaned up, in some cases until you reboot. Thus, running kube-proxy is something that should only be done by an administrator who understands the consequences of having a low level, privileged network proxying service on a computer. Although the kube-proxy executable supports a cleanup function, this function is not an official feature and thus is only available to use as-is.Some of the details in this reference refer to an example: the backend Pods for a stateless image-processing workloads, running with three replicas. Those replicas are fungible—frontends do not care which backend they use. While the actual Pods that compose the backend set may change, the frontend clients should not need to be aware of that, nor should they need to keep track of the set of backends themselves.Proxy modesThe kube-proxy starts up in different modes, which are determined by its configuration.On Linux nodes, the available modes for kube-proxy are:iptablesA mode where the kube-proxy configures packet forwarding rules using iptables.ipvsa mode where the kube-proxy configures packet forwarding rules using ipvs.nftablesa mode where the kube-proxy configures packet forwarding rules using nftables.There is only one mode available for kube-proxy on Windows:kernelspacea mode where the kube-proxy configures packet forwarding rules in the Windows kerneliptables proxy modeThis proxy mode is only available on Linux nodes.In this mode, kube-proxy configures packet forwarding rules using the iptables API of the kernel netfilter subsystem. For each endpoint, it installs iptables rules which, by default, select a backend Pod at random.ExampleAs an example, consider the image processing application described earlier in the page. When the backend Service is created, the Kubernetes control plane assigns a virtual IP address, for example 10.0.0.1. For this example, assume that the Service port is 1234. All of the kube-proxy instances in the cluster observe the creation of the new Service.When kube-proxy on a node sees a new Service, it installs a series of iptables rules which redirect from the virtual IP add", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214"}
{"instruction": "Write a bash example for virtual ips and service proxies", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddresses\n```\n\nVirtual IPs and Service Proxies | Kubernetes also allow users to dynamically define the available IP ranges for Services using ServiceCIDR objects. During bootstrap, a default ServiceCIDR object named kubernetes is created from the va", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2604"}
{"instruction": "Write a bash example for virtual ips and service proxies", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\nVirtual IPs and Service Proxies | Users can create or delete new ServiceCIDR objects to manage the available IP ranges for Services:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2605"}
{"instruction": "Write a yaml example for virtual ips and service proxies", "response": "Here's a yaml example:\n\n```yaml\ncat <<'EOF' | kubectl apply -f -\napiVersion: networking.k8s.io/v1\nkind: ServiceCIDR\nmetadata:\n  name: newservicecidr\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\nVirtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2606"}
{"instruction": "Write a bash example for virtual ips and service proxies", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\nVirtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2607"}
{"instruction": "Write a yaml example for virtual ips and service proxies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs-default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(i , variables.allowed.exists(j , cidr(j).containsCIDR(i)))\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs-default\"\n  validationActions: [Deny,Audit]\n---\n```\n\nVirtual IPs and Service Proxies | Kubernetes divides the ClusterIP range into two bands, based on the size of the configured service-cluster-ip-range by using the following formula min(max(16, cidrSize / 16), 256). That formula means", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2608"}
{"instruction": "Write a yaml example for virtual ips and service proxies", "response": "Here's a yaml example:\n\n```yaml\n...\niptables:\n  minSyncPeriod: 1s\n  syncPeriod: 30s\n...\n```\n\nVirtual IPs and Service Proxies | The minSyncPeriod parameter sets the minimum duration between attempts to resynchronize iptables rules with the kernel. If it is 0s, then kube-proxy will always immediately synchronize the rules every", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2609"}
{"instruction": "Write a yaml example for virtual ips and service proxies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs-default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(i , variables.allowed.exists(j , cidr(j).containsCIDR(i)))\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs-default\"\n  validationActions: [Deny,Audit]\n---\n```\n\nVirtual IPs and Service Proxies | Kubernetes divides the ClusterIP range into two bands, based on the size of the configured service-cluster-ip-range by using the following formula min(max(16, cidrSize / 16), 256). That formula means", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2610"}
{"instruction": "Write a bash example for virtual ips and service proxies", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddresses\n```\n\nVirtual IPs and Service Proxies | Kubernetes also allow users to dynamically define the available IP ranges for Services using ServiceCIDR objects. During bootstrap, a default ServiceCIDR object named kubernetes is created from the va", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2611"}
{"instruction": "Write a bash example for virtual ips and service proxies", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\nVirtual IPs and Service Proxies | Users can create or delete new ServiceCIDR objects to manage the available IP ranges for Services:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2612"}
{"instruction": "Write a yaml example for virtual ips and service proxies", "response": "Here's a yaml example:\n\n```yaml\ncat <<'EOF' | kubectl apply -f -\napiVersion: networking.k8s.io/v1\nkind: ServiceCIDR\nmetadata:\n  name: newservicecidr\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\nVirtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2613"}
{"instruction": "Write a bash example for virtual ips and service proxies", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\nVirtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2614"}
{"instruction": "Write a yaml example for virtual ips and service proxies", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs-default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(i , variables.allowed.exists(j , cidr(j).containsCIDR(i)))\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs-default\"\n  validationActions: [Deny,Audit]\n---\n```\n\nVirtual IPs and Service Proxies | Kubernetes divides the ClusterIP range into two bands, based on the size of the configured service-cluster-ip-range by using the following formula min(max(16, cidrSize / 16), 256). That formula means", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/networking/virtual-ips/", "id": "k8s_00214_code_2615"}
{"instruction": "What is the reference documentation for common expression language in kubernetes?", "response": "Common Expression Language in KubernetesThe Common Expression Language (CEL) is used in the Kubernetes API to declare validation rules, policy rules, and other constraints or conditions.CEL expressions are evaluated directly in the API server, making CEL a convenient alternative to out-of-process mechanisms, such as webhooks, for many extensibility use cases. Your CEL expressions continue to execute so long as the control plane's API server component remains available.Language overviewThe CEL language has a straightforward syntax that is similar to the expressions in C, C++, Java, JavaScript and Go.CEL was designed to be embedded into applications. Each CEL \"program\" is a single expression that evaluates to a single value. CEL expressions are typically short \"one-liners\" that inline well into the string fields of Kubernetes API resources.Inputs to a CEL program are \"variables\". Each Kubernetes API field that contains CEL declares in the API documentation which variables are available to use for that field. For example, in the x-kubernetes-validations[i].rules field of CustomResourceDefinitions, the self and oldSelf variables are available and refer to the previous and current state of the custom resource data to be validated by the CEL expression. Other Kubernetes API fields may declare different variables. See the API documentation of the API fields to learn which variables are available for that field.Example CEL expressions:Examples of CEL expressions and the purpose of eachRulePurposeself.minReplicas <= self.replicas && self.replicas <= self.maxReplicasValidate that the three fields defining replicas are ordered appropriately'Available' in self.stateCountsValidate that an entry with the 'Available' key exists in a map(self.list1.size() == 0) != (self.list2.size() == 0)Validate that one of two lists is non-empty, but not bothself.envars.filter(e, e.name = 'MY_ENV').all(e, e.value.matches('^[a-zA-Z]*$'))Validate the 'value' field of a listMap entry where key field 'name' is 'MY_ENV'has(self.expired) && self.created + self.ttl < self.expiredValidate that 'expired' date is after a 'create' date plus a 'ttl' durationself.health.startsWith('ok')Validate a 'health' string field has the prefix 'ok'self.widgets.exists(w, w.key == 'x' && w.foo < 10)Validate that the 'foo' property of a listMap item with a key 'x' is less than 10type(self) == string ? self == '99%' : self == 42Validate an int-or-string field for both the int and string casesself.metadata.name == 'singleton'Validate that an object's name matches a specific value (making it a singleton)self.set1.all(e, !(e in self.set2))Validate that two listSets are disjointself.names.size() == self.details.size() && self.names.all(n, n in self.details)Validate the 'details' map is keyed by the items in the 'names' listSetself.details.all(key, key.matches('^[a-zA-Z]*$'))Validate the keys of the 'details' mapself.details.all(key, self.details[key].matches('^[a-zA-Z]*$'))Validate the values of the 'details' mapCEL options, language features, and librariesCEL is configured with the following options, libraries and language features, introduced at the specified Kubernetes versions:CEL option, library or language featureIncludedAvailabilityStandard macroshas, all, exists, exists_one, map, filterAll Kubernetes versionsStandard functionsSee official list of standard definitionsAll Kubernetes versionsHomogeneous Aggregate Literals-All Kubernetes versionsDefault UTC Time Zone-All Kubernetes versionsEagerly Validate Declarations-All Kubernetes versionsExtended strings library, Version 1charAt, indexOf, lastIndexOf, lowerAscii, upperAscii, replace, split, join, substring, trimKubernetes versions between 1.25 and 1.30Extended strings library, Version 2charAt, indexOf, lastIndexOf, lowerAscii, upperAscii, replace, split, join, substring, trimKubernetes versions 1.30+Kubernetes list librarySee Kubernetes list libraryAll Kubernetes versionsKubernetes regex librarySee Kubernetes regex libraryAll Kube", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/cel/", "id": "k8s_00215"}
{"instruction": "What is the reference documentation for selfsubjectrulesreview?", "response": "SelfSubjectRulesReviewSelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.apiVersion: authorization.k8s.io/v1import \"k8s.io/api/authorization/v1\"SelfSubjectRulesReviewSelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.apiVersion: authorization.k8s.io/v1kind: SelfSubjectRulesReviewmetadata (ObjectMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (SelfSubjectRulesReviewSpec), requiredSpec holds information about the request being evaluated.status (SubjectRulesReviewStatus)Status is filled in by the server and indicates the set of actions a user can perform.SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.status.incomplete (boolean), requiredIncomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.status.nonResourceRules ([]NonResourceRule), requiredAtomic: will be replaced during a mergeNonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.NonResourceRule holds information that describes a rule for the non-resourcestatus.nonResourceRules.verbs ([]string), requiredAtomic: will be replaced during a mergeVerb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.status.nonResourceRules.nonResourceURLs ([]string)Atomic: will be replaced during a mergeNonResourceURLs is a set of partial urls that a user should have access to. s are allowed, but only as the full, final step in the path. \"\" means all.status.resourceRules ([]ResourceRule), requiredAtomic: will be replaced during a mergeResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.status.resourceRules.verbs ([]string), requiredAtomic: will be replaced during a mergeVerb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.status.resourceRules.apiGroups ([]string)Atomic: will be replaced during a mergeAPIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.status.resourceRules.resourceNames ([]string)Atomic: will be replaced during a mergeResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.status.resourceRules.resources ([]string)Atomic: will be replaced during a mergeResources is a list of resources this rule applies to. \"\" means all in the specified apiGroups.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/self-subject-rules-review-v1/", "id": "k8s_00216"}
{"instruction": "Write a yaml example for selfsubjectrulesreview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\nSelfSubjectRulesReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/self-subject-rules-review-v1/", "id": "k8s_00216_code_2618"}
{"instruction": "What is the reference documentation for kubectl create namespace?", "response": "kubectl create namespaceSynopsisCreate a namespace with the specified name.kubectl create namespace NAME [--dry-run=server|client|none] Examples # Create a new namespace named my-namespace kubectl create namespace my-namespace Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for namespace-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--stor", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_namespace/", "id": "k8s_00217"}
{"instruction": "Write a bash example for kubectl create namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace NAME [--dry-run=server|client|none]\n```\n\nkubectl create namespace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_namespace/", "id": "k8s_00217_code_2620"}
{"instruction": "Write a bash example for kubectl create namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace NAME [--dry-run=server|client|none]\n```\n\nkubectl create namespace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_namespace/", "id": "k8s_00217_code_2621"}
{"instruction": "How do you install and set up kubectl on linux in Kubernetes?", "response": "Install and Set Up kubectl on LinuxBefore you beginYou must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.34 client can communicate with v1.33, v1.34, and v1.35 control planes. Using the latest compatible version of kubectl helps avoid unforeseen issues.Install kubectl on LinuxThe following methods exist for installing kubectl on Linux:Install kubectl binary with curl on LinuxInstall using native package managementInstall using other package managementInstall kubectl binary with curl on LinuxDownload the latest release with the command: curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl\" curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl\" Note:To download a specific version, replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) portion of the command with the specific version.For example, to download version 1.34.0 on Linux x86-64, type:curl -LO https://dl.k8s.io/release/v1.34.0/bin/linux/amd64/kubectl And for Linux ARM64, type:curl -LO https://dl.k8s.io/release/v1.34.0/bin/linux/arm64/kubectl Validate the binary (optional)Download the kubectl checksum file: curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256\" curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl.sha256\" Validate the kubectl binary against the checksum file:echo \"$(cat kubectl.sha256) kubectl\" | sha256sum --check If valid, the output is:kubectl: OK If the check fails, sha256 exits with nonzero status and prints output similar to:kubectl: FAILED sha256sum: WARNING: 1 computed checksum did NOT match Note:Download the same version of the binary and checksum.Install kubectlsudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl Note:If you do not have root access on the target system, you can still install kubectl to the ~/.local/bin directory:chmod +x kubectl mkdir -p ~/.local/bin mv ./kubectl ~/.local/bin/kubectl # and then append (or prepend) ~/.local/bin to $PATH Test to ensure the version you installed is up-to-date:kubectl version --client Or use this for detailed view of version:kubectl version --client --output=yaml Install using native package managementUpdate the apt package index and install packages needed to use the Kubernetes apt repository:sudo apt-get update # apt-transport-https may be a dummy package; if so, you can skip that package sudo apt-get install -y apt-transport-https ca-certificates curl gnupg Download the public signing key for the Kubernetes package repositories. The same signing key is used for all repositories so you can disregard the version in the URL:# If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below. # sudo mkdir -p -m 755 /etc/apt/keyrings curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.34/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # allow unprivileged APT programs to read this keyring Note:In releases older than Debian 12 and Ubuntu 22.04, folder /etc/apt/keyrings does not exist by default, and it should be created before the curl command.Add the appropriate Kubernetes apt repository. If you want to use Kubernetes version different than v1.34, replace v1.34 with the desired minor version in the command below:# This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.34/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list # helps tools such as command-not-found to work correctly Note:To upgrade kubectl to another minor release, you'll need to bump the version", "category": "tasks", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on Linux | Install kubectl", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2623"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on Linux | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2624"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\nInstall and Set Up kubectl on Linux | Update the apt package index and install packages needed to use the Kubernetes apt repository:sudo apt-get update # apt-transport-https may be a dummy package; if so, you can skip that package sudo ap", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2625"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nInstall and Set Up kubectl on Linux | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2626"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null\nsudo chmod a+r /etc/bash_completion.d/kubectl\n```\n\nInstall and Set Up kubectl on Linux | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2627"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\nInstall and Set Up kubectl on Linux | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2628"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on Linux | Install kubectl-convert", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2629"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\nInstall and Set Up kubectl on Linux | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2630"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl\"\n```\n\nInstall and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2631"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl\"\n```\n\nInstall and Set Up kubectl on Linux | To download a specific version, replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) portion of the command with the specific version.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2632"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO https://dl.k8s.io/release/v1.34.0/bin/linux/amd64/kubectl\n```\n\nInstall and Set Up kubectl on Linux | And for Linux ARM64, type:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2633"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO https://dl.k8s.io/release/v1.34.0/bin/linux/arm64/kubectl\n```\n\nInstall and Set Up kubectl on Linux | Validate the binary (optional)", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2634"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256\"\n```\n\nInstall and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl.sha256\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2635"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl.sha256\"\n```\n\nInstall and Set Up kubectl on Linux | Validate the kubectl binary against the checksum file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2636"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl.sha256)  kubectl\" | sha256sum --check\n```\n\nInstall and Set Up kubectl on Linux | If valid, the output is:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2637"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nsudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl\n```\n\nInstall and Set Up kubectl on Linux | If you do not have root access on the target system, you can still install kubectl to the ~/.local/bin directory:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2638"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nchmod +x kubectl\nmkdir -p ~/.local/bin\nmv ./kubectl ~/.local/bin/kubectl\n# and then append (or prepend) ~/.local/bin to $PATH\n```\n\nInstall and Set Up kubectl on Linux | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2639"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on Linux | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2640"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\n# This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo\ncat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo\n[kubernetes]\nname=Kubernetes\nbaseurl=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/\nenabled=1\ngpgcheck=1\ngpgkey=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/repodata/repomd.xml.key\nEOF\n```\n\nInstall and Set Up kubectl on Linux | Install kubectl using yum:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2641"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nsudo yum install -y kubectl\n```\n\nInstall and Set Up kubectl on Linux | Add the Kubernetes zypper repository. If you want to use Kubernetes version different than v1.34, replace v1.34 with the desired minor version in the command below.# This overwrites any existing confi", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2642"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\n# This overwrites any existing configuration in /etc/zypp/repos.d/kubernetes.repo\ncat <<EOF | sudo tee /etc/zypp/repos.d/kubernetes.repo\n[kubernetes]\nname=Kubernetes\nbaseurl=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/\nenabled=1\ngpgcheck=1\ngpgkey=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/repodata/repomd.xml.key\nEOF\n```\n\nInstall and Set Up kubectl on Linux | Update zypper and confirm the new repo addition:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2643"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nsudo zypper install -y kubectl\n```\n\nInstall and Set Up kubectl on Linux | If you are on Ubuntu or another Linux distribution that supports the snap package manager, kubectl is available as a snap application.snap install kubectl --classic kubectl version --client", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2644"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash\n```\n\nInstall and Set Up kubectl on Linux | However, the completion script depends on bash-completion, which means that you have to install this software first (you can test if you have bash-completion already installed by running type _init_co", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2645"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nsource /usr/share/bash-completion/bash_completion\n```\n\nInstall and Set Up kubectl on Linux | Reload your shell and verify that bash-completion is correctly installed by typing type _init_completion.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2646"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\necho 'source <(kubectl completion bash)' >>~/.bashrc\n```\n\nInstall and Set Up kubectl on Linux | kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null sudo chmod a+r /etc/bash_completion.d/kubectl", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2647"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null\nsudo chmod a+r /etc/bash_completion.d/kubectl\n```\n\nInstall and Set Up kubectl on Linux | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2648"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\necho 'alias k=kubectl' >>~/.bashrc\necho 'complete -o default -F __start_kubectl k' >>~/.bashrc\n```\n\nInstall and Set Up kubectl on Linux | Both approaches are equivalent. After reloading your shell, kubectl autocompletion should be working. To enable bash autocompletion in current session of shell, source the ~/.bashrc file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2649"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish\n```\n\nInstall and Set Up kubectl on Linux | To do so in all your shell sessions, add the following line to your ~/.config/fish/config.fish file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2650"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh\n```\n\nInstall and Set Up kubectl on Linux | To do so in all your shell sessions, add the following to your ~/.zshrc file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2651"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert\"\n```\n\nInstall and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2652"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert\"\n```\n\nInstall and Set Up kubectl on Linux | Validate the binary (optional)", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2653"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256\"\n```\n\nInstall and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert.sha256\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2654"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert.sha256\"\n```\n\nInstall and Set Up kubectl on Linux | Validate the kubectl-convert binary against the checksum file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2655"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl-convert.sha256) kubectl-convert\" | sha256sum --check\n```\n\nInstall and Set Up kubectl on Linux | If valid, the output is:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2656"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nsudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert\n```\n\nInstall and Set Up kubectl on Linux | Verify plugin is successfully installed", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2657"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nrm kubectl-convert kubectl-convert.sha256\n```\n\nInstall and Set Up kubectl on Linux |", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2658"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on Linux | Install kubectl", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2659"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on Linux | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2660"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\nInstall and Set Up kubectl on Linux | Update the apt package index and install packages needed to use the Kubernetes apt repository:sudo apt-get update # apt-transport-https may be a dummy package; if so, you can skip that package sudo ap", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2661"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nInstall and Set Up kubectl on Linux | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2662"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null\nsudo chmod a+r /etc/bash_completion.d/kubectl\n```\n\nInstall and Set Up kubectl on Linux | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2663"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\nInstall and Set Up kubectl on Linux | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2664"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on Linux | Install kubectl-convert", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2665"}
{"instruction": "Write a bash example for install and set up kubectl on linux", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\nInstall and Set Up kubectl on Linux | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/", "id": "k8s_00218_code_2666"}
{"instruction": "How do you configure minimum and maximum memory constraints for a namespace in Kubernetes?", "response": "Configure Minimum and Maximum Memory Constraints for a NamespaceDefine a range of valid memory resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.This page shows how to set minimum and maximum values for memory used by containers running in a namespace. You specify minimum and maximum memory values in a LimitRange object. If a Pod does not meet the constraints imposed by the LimitRange, it cannot be created in the namespace.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 1 GiB of memory available for Pods.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace constraints-mem-example Create a LimitRange and a PodHere's an example manifest for a LimitRange:admin/resource/memory-constraints.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-min-max-demo-lr spec: limits: - max: memory: 1Gi min: memory: 500Mi type: Container Create the LimitRange:kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example View detailed information about the LimitRange:kubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created automatically. limits: - default: memory: 1Gi defaultRequest: memory: 1Gi max: memory: 1Gi min: memory: 500Mi type: Container Now whenever you define a Pod within the constraints-mem-example namespace, Kubernetes performs these steps:If any container in that Pod does not specify its own memory request and limit, the control plane assigns the default memory request and limit to that container.Verify that every container in that Pod requests at least 500 MiB of memory.Verify that every container in that Pod requests no more than 1024 MiB (1 GiB) of memory.Here's a manifest for a Pod that has one container. Within the Pod spec, the sole container specifies a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the minimum and maximum memory constraints imposed by the LimitRange.admin/resource/memory-constraints-pod.yaml apiVersion: v1 kind: Pod metadata: name: constraints-mem-demo spec: containers: - name: constraints-mem-demo-ctr image: nginx resources: limits: memory: \"800Mi\" requests: memory: \"600Mi\" Create the Pod:kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod.yaml --namespace=constraints-mem-example Verify that the Pod is running and that its container is healthy:kubectl get pod constraints-mem-demo --namespace=constraints-mem-example View detailed information about the Pod:kubectl get pod constraints-mem-demo --output=yaml --namespace=constraints-mem-example The output shows that the container within that Pod has a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the constraints imposed by the LimitRange for this namespace:resources: limits: memory: 800Mi requests: memory: 600Mi Delete your Pod:kubectl delete pod constraints-mem-demo --namespace=constraints-mem-example Attempt to create a Pod that exceeds the maximum memory constraintHere's a manifest for a Pod that has one container. The container specifies a memory request of 800 MiB and a memory limit of 1.5 GiB.admin/resource/memory-constraints-pod-2.yaml apiVersion: v1", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Here's an example manifest for a LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2668"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2669"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2670"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created a", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2671"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2672"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2673"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2674"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --output=yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the container within that Pod has a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the constraints imposed by the LimitRange for this namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2675"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory request of 800 MiB and a memory limit of 1.5 GiB.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2676"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2677"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-2.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests more memory than is allowed:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2678"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2679"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-3.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests less memory than the enforced minimum:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2680"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2681"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-4.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2682"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo-4 --namespace=constraints-mem-example --output=yaml\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod's only container has a memory request of 1 GiB and a memory limit of 1 GiB. How did that container get those values?", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2683"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo-4 --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The maximum and minimum memory constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were cr", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2684"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2685"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2686"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2687"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n     memory: 800Mi\n  requests:\n    memory: 600Mi\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Delete your Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2688"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2689"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2690"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2691"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Here's an example manifest for a LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2692"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2693"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2694"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2695"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created a", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2696"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2697"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2698"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2699"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2700"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --output=yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the container within that Pod has a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the constraints imposed by the LimitRange for this namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2701"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory request of 800 MiB and a memory limit of 1.5 GiB.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2702"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2703"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2704"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-2.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests more memory than is allowed:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2705"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2706"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2707"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-3.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests less memory than the enforced minimum:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2708"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2709"}
{"instruction": "Write a yaml example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2710"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-4.yaml --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2711"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo-4 --namespace=constraints-mem-example --output=yaml\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod's only container has a memory request of 1 GiB and a memory limit of 1 GiB. How did that container get those values?", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2712"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo-4 --namespace=constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | The maximum and minimum memory constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were cr", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2713"}
{"instruction": "Write a bash example for configure minimum and maximum memory constraints for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-mem-example\n```\n\nConfigure Minimum and Maximum Memory Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/", "id": "k8s_00219_code_2714"}
{"instruction": "Provide a tutorial on running zookeeper, a distributed system coordinator", "response": "Running ZooKeeper, A Distributed System CoordinatorThis tutorial demonstrates running Apache Zookeeper on Kubernetes using StatefulSets, PodDisruptionBudgets, and PodAntiAffinity.Before you beginBefore starting this tutorial, you should be familiar with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningStatefulSetsPodDisruptionBudgetsPodAntiAffinitykubectl CLIYou must have a cluster with at least four nodes, and each node requires at least 2 CPUs and 4 GiB of memory. In this tutorial you will cordon and drain the cluster's nodes. This means that the cluster will terminate and evict all Pods on its nodes, and the nodes will temporarily become unschedulable. You should use a dedicated cluster for this tutorial, or you should ensure that the disruption you cause will not interfere with other tenants.This tutorial assumes that you have configured your cluster to dynamically provision PersistentVolumes. If your cluster is not configured to do so, you will have to manually provision three 20 GiB volumes before starting this tutorial.ObjectivesAfter this tutorial, you will know the following.How to deploy a ZooKeeper ensemble using StatefulSet.How to consistently configure the ensemble.How to spread the deployment of ZooKeeper servers in the ensemble.How to use PodDisruptionBudgets to ensure service availability during planned maintenance.ZooKeeperApache ZooKeeper is a distributed, open-source coordination service for distributed applications. ZooKeeper allows you to read, write, and observe updates to data. Data are organized in a file system like hierarchy and replicated to all ZooKeeper servers in the ensemble (a set of ZooKeeper servers). All operations on data are atomic and sequentially consistent. ZooKeeper ensures this by using the Zab consensus protocol to replicate a state machine across all servers in the ensemble.The ensemble uses the Zab protocol to elect a leader, and the ensemble cannot write data until that election is complete. Once complete, the ensemble uses Zab to ensure that it replicates all writes to a quorum before it acknowledges and makes them visible to clients. Without respect to weighted quorums, a quorum is a majority component of the ensemble containing the current leader. For instance, if the ensemble has three servers, a component that contains the leader and one other server constitutes a quorum. If the ensemble can not achieve a quorum, the ensemble cannot write data.ZooKeeper servers keep their entire state machine in memory, and write every mutation to a durable WAL (Write Ahead Log) on storage media. When a server crashes, it can recover its previous state by replaying the WAL. To prevent the WAL from growing without bound, ZooKeeper servers will periodically snapshot them in memory state to storage media. These snapshots can be loaded directly into memory, and all WAL entries that preceded the snapshot may be discarded.Creating a ZooKeeper ensembleThe manifest below contains a Headless Service, a Service, a PodDisruptionBudget, and a StatefulSet.application/zookeeper/zookeeper.yaml apiVersion: v1 kind: Service metadata: name: zk-hs labels: app: zk spec: ports: - port: 2888 name: server - port: 3888 name: leader-election clusterIP: None selector: app: zk --- apiVersion: v1 kind: Service metadata: name: zk-cs labels: app: zk spec: ports: - port: 2181 name: client selector: app: zk --- apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: zk-pdb spec: selector: matchLabels: app: zk maxUnavailable: 1 --- apiVersion: apps/v1 kind: StatefulSet metadata: name: zk spec: selector: matchLabels: app: zk serviceName: zk-hs replicas: 3 updateStrategy: type: RollingUpdate podManagementPolicy: OrderedReady template: metadata: labels: app: zk spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: \"app\" operator: In values: - zk topologyKey: \"kubernetes.io/hostname\" containe", "category": "tutorials", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2716"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | This creates the zk-hs Headless Service, the zk-cs Service, the zk-pdb PodDisruptionBudget, and the zk StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2717"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2718"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- cat /opt/zookeeper/conf/zoo.cfg\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In the server.1, server.2, and server.3 properties at the bottom of the file, the 1, 2, and 3 correspond to the identifiers in the ZooKeeper servers' myid files. They are set to the FQDNs for the Pods", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2719"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The A records for each Pod are entered when the Pod becomes Ready. Therefore, the FQDNs of the ZooKeeper servers will resolve to a single endpoint, and that endpoint will be the unique ZooKeeper serve", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2720"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- zkCli.sh create /hello world\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | To get the data from the zk-1 Pod use the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2721"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-1 -- zkCli.sh get /hello\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The data that you created on zk-0 is available on all the servers in the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2722"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Watch the termination of the Pods in the StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2723"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | When zk-0 if fully terminated, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2724"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | This creates the zk StatefulSet object, but the other API objects in the manifest are not modified because they already exist.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2725"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2726"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-2 zkCli.sh get /hello\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Even though you terminated and recreated all of the Pods in the zk StatefulSet, the ensemble still serves the original value.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2727"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | When the StatefulSet recreated its Pods, it remounts the Pods' PersistentVolumes.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2728"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get sts zk -o yaml\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The command used to start the ZooKeeper servers passed the configuration as command line parameter. You can also use environment variables to pass configuration to the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2729"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 cat /usr/etc/zookeeper/log4j.properties\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The logging configuration below will cause the ZooKeeper process to write all of its logs to the standard output file stream.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2730"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl logs zk-0 --tail 20\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | You can view application logs written to standard out or standard error using kubectl logs and from the Kubernetes Dashboard.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2731"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -elf\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | As the runAsUser field of the securityContext object is set to 1000, instead of running as root, the ZooKeeper process runs as the zookeeper user.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2732"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti zk-0 -- ls -ld /var/lib/zookeeper/data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Because the fsGroup field of the securityContext object is set to 1000, the ownership of the Pods' PersistentVolumes is set to the zookeeper group, and the ZooKeeper process is able to read and write", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2733"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts zk --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/resources/requests/cpu\", \"value\":\"0.3\"}]'\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Use kubectl rollout status to watch the status of the update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2734"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2735"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history sts/zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2736"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo sts/zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2737"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -ef\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The command used as the container's entry point has PID 1, and the ZooKeeper process, a child of the entry point, has PID 27.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2738"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In another terminal, terminate the ZooKeeper process in Pod zk-0 with the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2739"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- pkill java\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The termination of the ZooKeeper process caused its parent process to terminate. Because the RestartPolicy of the container is Always, it restarted the parent process.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2740"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In another window, using the following command to delete the zookeeper-ready script from the file system of Pod zk-0.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2741"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- rm /opt/zookeeper/bin/zookeeper-ready\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | When the liveness probe for the ZooKeeper process fails, Kubernetes will automatically restart the process for you, ensuring that unhealthy processes in the ensemble are restarted.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2742"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Readiness is not the same as liveness. If a process is alive, it is scheduled and healthy. If a process is ready, it is able to process input. Liveness is a necessary, but not sufficient, condition fo", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2743"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl cordon <node-name>\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Use this command to get the zk-pdb PodDisruptionBudget.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2744"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pdb zk-pdb\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The max-unavailable field indicates to Kubernetes that at most one Pod from zk StatefulSet can be unavailable at any time.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2745"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In another terminal, use this command to get the nodes that the Pods are currently scheduled on.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2746"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-0 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2747"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-1 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2748"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2749"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2750"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 zkCli.sh get /hello\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The service is still available because its PodDisruptionBudget is respected.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2751"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-pb41\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2752"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2753"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2754"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-ixsl\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2755"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2756"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\nvolumeClaimTemplates:\n  - metadata:\n      name: datadir\n      annotations:\n        volume.alpha.kubernetes.io/storage-class: anything\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 20Gi\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The StatefulSet controller generates a PersistentVolumeClaim for each Pod in the StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2757"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\nvolumeMounts:\n- name: datadir\n  mountPath: /var/lib/zookeeper\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | When a Pod in the zk StatefulSet is (re)scheduled, it will always have the same PersistentVolume mounted to the ZooKeeper server's data directory. Even when the Pods are rescheduled, all the writes ma", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2758"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  runAsUser: 1000\n  fsGroup: 1000\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In the Pods' containers, UID 1000 corresponds to the zookeeper user and GID 1000 corresponds to the zookeeper group.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2759"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2760"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2761"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n    exec:\n      command:\n      - sh\n      - -c\n      - \"zookeeper-ready 2181\"\n    initialDelaySeconds: 15\n    timeoutSeconds: 5\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The probe calls a bash script that uses the ZooKeeper ruok four letter word to test the server's health.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2762"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\nreadinessProbe:\n    exec:\n      command:\n      - sh\n      - -c\n      - \"zookeeper-ready 2181\"\n    initialDelaySeconds: 15\n    timeoutSeconds: 5\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Even though the liveness and readiness probes are identical, it is important to specify both. This ensures that only healthy servers in the ZooKeeper ensemble receive network traffic.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2763"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\naffinity:\n  podAntiAffinity:\n    requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n            - key: \"app\"\n              operator: In\n              values:\n                - zk\n        topologyKey: \"kubernetes.io/hostname\"\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The requiredDuringSchedulingIgnoredDuringExecution field tells the Kubernetes Scheduler that it should never co-locate two Pods which have app label as zk in the domain defined by the topologyKey. The", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2764"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\napplication/zookeeper/zookeeper.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2765"}
{"instruction": "Write a yaml example for running zookeeper, a distributed system coordinator", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2766"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | This creates the zk-hs Headless Service, the zk-cs Service, the zk-pdb PodDisruptionBudget, and the zk StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2767"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2768"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- cat /opt/zookeeper/conf/zoo.cfg\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In the server.1, server.2, and server.3 properties at the bottom of the file, the 1, 2, and 3 correspond to the identifiers in the ZooKeeper servers' myid files. They are set to the FQDNs for the Pods", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2769"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The A records for each Pod are entered when the Pod becomes Ready. Therefore, the FQDNs of the ZooKeeper servers will resolve to a single endpoint, and that endpoint will be the unique ZooKeeper serve", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2770"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- zkCli.sh create /hello world\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | To get the data from the zk-1 Pod use the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2771"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-1 -- zkCli.sh get /hello\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The data that you created on zk-0 is available on all the servers in the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2772"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Watch the termination of the Pods in the StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2773"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | When zk-0 if fully terminated, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2774"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | This creates the zk StatefulSet object, but the other API objects in the manifest are not modified because they already exist.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2775"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2776"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-2 zkCli.sh get /hello\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Even though you terminated and recreated all of the Pods in the zk StatefulSet, the ensemble still serves the original value.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2777"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | When the StatefulSet recreated its Pods, it remounts the Pods' PersistentVolumes.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2778"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get sts zk -o yaml\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The command used to start the ZooKeeper servers passed the configuration as command line parameter. You can also use environment variables to pass configuration to the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2779"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 cat /usr/etc/zookeeper/log4j.properties\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The logging configuration below will cause the ZooKeeper process to write all of its logs to the standard output file stream.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2780"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl logs zk-0 --tail 20\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | You can view application logs written to standard out or standard error using kubectl logs and from the Kubernetes Dashboard.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2781"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -elf\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | As the runAsUser field of the securityContext object is set to 1000, instead of running as root, the ZooKeeper process runs as the zookeeper user.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2782"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti zk-0 -- ls -ld /var/lib/zookeeper/data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Because the fsGroup field of the securityContext object is set to 1000, the ownership of the Pods' PersistentVolumes is set to the zookeeper group, and the ZooKeeper process is able to read and write", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2783"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts zk --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/resources/requests/cpu\", \"value\":\"0.3\"}]'\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Use kubectl rollout status to watch the status of the update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2784"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2785"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history sts/zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2786"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo sts/zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2787"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -ef\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The command used as the container's entry point has PID 1, and the ZooKeeper process, a child of the entry point, has PID 27.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2788"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In another terminal, terminate the ZooKeeper process in Pod zk-0 with the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2789"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- pkill java\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The termination of the ZooKeeper process caused its parent process to terminate. Because the RestartPolicy of the container is Always, it restarted the parent process.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2790"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In another window, using the following command to delete the zookeeper-ready script from the file system of Pod zk-0.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2791"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- rm /opt/zookeeper/bin/zookeeper-ready\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | When the liveness probe for the ZooKeeper process fails, Kubernetes will automatically restart the process for you, ensuring that unhealthy processes in the ensemble are restarted.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2792"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Readiness is not the same as liveness. If a process is alive, it is scheduled and healthy. If a process is ready, it is able to process input. Liveness is a necessary, but not sufficient, condition fo", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2793"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl cordon <node-name>\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | Use this command to get the zk-pdb PodDisruptionBudget.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2794"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pdb zk-pdb\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The max-unavailable field indicates to Kubernetes that at most one Pod from zk StatefulSet can be unavailable at any time.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2795"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | In another terminal, use this command to get the nodes that the Pods are currently scheduled on.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2796"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-0 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2797"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-1 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2798"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2799"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2800"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 zkCli.sh get /hello\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The service is still available because its PodDisruptionBudget is respected.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2801"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-pb41\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2802"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2803"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2804"}
{"instruction": "Write a bash example for running zookeeper, a distributed system coordinator", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-ixsl\n```\n\nRunning ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/", "id": "k8s_00220_code_2805"}
{"instruction": "Explain the Kubernetes concept: Configuration", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.ConfigurationResources that Kubernetes provides for configuring Pods.1: Configuration Best Practices2: ConfigMaps3: Secrets4: Liveness, Readiness, and Startup Probes5: Resource Management for Pods and Containers6: Organizing Cluster Access Using kubeconfig Files7: Resource Management for Windows nodes1 - Configuration Best PracticesThis document highlights and consolidates configuration best practices that are introduced throughout the user guide, Getting Started documentation, and examples.This is a living document. If you think of something that is not on this list but might be useful to others, please don't hesitate to file an issue or submit a PR.General Configuration TipsWhen defining configurations, specify the latest stable API version.Configuration files should be stored in version control before being pushed to the cluster. This allows you to quickly roll back a configuration change if necessary. It also aids cluster re-creation and restoration.Write your configuration files using YAML rather than JSON. Though these formats can be used interchangeably in almost all scenarios, YAML tends to be more user-friendly.Group related objects into a single file whenever it makes sense. One file is often easier to manage than several. See the guestbook-all-in-one.yaml file as an example of this syntax.Note also that many kubectl commands can be called on a directory. For example, you can call kubectl apply on a directory of config files.Don't specify default values unnecessarily: simple, minimal configuration will make errors less likely.Put object descriptions in annotations, to allow better introspection.Note:There is a breaking change introduced in the YAML 1.2 boolean values specification with respect to YAML 1.1. This is a known issue in Kubernetes. YAML 1.2 only recognizes true and false as valid booleans, while YAML 1.1 also accepts yes, no, on, and off as booleans. However, Kubernetes uses YAML parsers that are mostly compatible with YAML 1.1, which means that using yes or no instead of true or false in a YAML manifest may cause unexpected errors or behaviors. To avoid this issue, it is recommended to always use true or false for boolean values in YAML manifests, and to quote any strings that may be confused with booleans, such as \"yes\" or \"no\".Besides booleans, there are additional specifications changes between YAML versions. Please refer to the YAML Specification Changes documentation for a comprehensive list.\"Naked\" Pods versus ReplicaSets, Deployments, and JobsDon't use naked Pods (that is, Pods not bound to a ReplicaSet or Deployment) if you can avoid it. Naked Pods will not be rescheduled in the event of a node failure.A Deployment, which both creates a ReplicaSet to ensure that the desired number of Pods is always available, and specifies a strategy to replace Pods (such as RollingUpdate), is almost always preferable to creating Pods directly, except for some explicit restartPolicy: Never scenarios. A Job may also be appropriate.ServicesCreate a Service before its corresponding backend workloads (Deployments or ReplicaSets), and before any workloads that need to access it. When Kubernetes starts a container, it provides environment variables pointing to all the Services which were running when the container was started. For example, if a Service named foo exists, all containers will get the following variables in their initial environment:FOO_SERVICE_HOST=<the host the Service is running on> FOO_SERVICE_PORT=<the port the Service is running on> This does imply an ordering requirement - any Service that a Pod wants to access must be created before the Pod itself, or else the environment variables will not be populated. DNS does not have this restriction.An optional (though strongly recommended) cluster add-on is a DNS server. The DNS server watches the Kubernetes API for new Services and creates a set", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\n2 - ConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2807"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2808"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\n2 - ConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2809"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\n2 - ConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2810"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myconfigmap.yaml\n```\n\n2 - ConfigMaps | The following Pod consumes the content of the ConfigMap as environment variables:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2811"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2812"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f env-configmap.yaml\n```\n\n2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2813"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/ env-configmap\n```\n\n2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2814"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\n2 - ConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2815"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\n2 - ConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2816"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2817"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic empty-secret\nkubectl get secret empty-secret\n```\n\n3 - Secrets | The output looks like:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2818"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2819"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2820"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry secret-tiger-docker \\\n  --docker-email=tiger@acme.example \\\n  --docker-username=tiger \\\n  --docker-password=pass1234 \\\n  --docker-server=my-registry.example:5000\n```\n\n3 - Secrets | This command creates a Secret of type kubernetes.io/dockerconfigjson.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2821"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret-tiger-docker -o jsonpath='{.data.*}' | base64 -d\n```\n\n3 - Secrets | The output is equivalent to the following JSON document (which is also a valid Docker configuration file):", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2822"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2823"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2824"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2825"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls my-tls-secret \\\n  --cert=path/to/cert/file \\\n  --key=path/to/key/file\n```\n\n3 - Secrets | The public/private key pair must exist before hand. The public key certificate for --cert must be .PEM encoded and must match the given private key for --key.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2826"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2827"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2828"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2829"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\n3 - Secrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2830"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\n5 - Resource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2831"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2832"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\n5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2833"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\n5 - Resource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2834"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod frontend | grep -A 9999999999 Events\n```\n\n5 - Resource Management for Pods and Containers | In the preceding example, the Pod named \"frontend\" fails to be scheduled due to insufficient CPU resource on any node. Similar error messages can also suggest failure due to insufficient memory (PodEx", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2835"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes e2e-test-node-pool-4lw4\n```\n\n5 - Resource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2836"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod simmemleak-hra99\n```\n\n5 - Resource Management for Pods and Containers | The output is similar to:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2837"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\n6 - Organizing Cluster Access Using kubeconfig Files | The KUBECONFIG environment variable holds a list of kubeconfig files. For Linux and Mac, the list is colon-delimited. For Windows, the list is semicolon-delimited. The KUBECONFIG environment variable", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2838"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\n6 - Organizing Cluster Access Using kubeconfig Files | This page outlines the differences in how resources are managed between Linux and Windows.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2839"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\n1 - Configuration Best Practices | Use label selectors for get and delete operations instead of specific object names. See the sections on label selectors and using labels effectively.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2840"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\n1 - Configuration Best Practices | A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2841"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\n2 - ConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2842"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2843"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\n2 - ConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2844"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\n2 - ConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2845"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2846"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\n2 - ConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2847"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\n2 - ConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2848"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2849"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2850"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2851"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2852"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2853"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2854"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2855"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2856"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2857"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\n3 - Secrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2858"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\n5 - Resource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2859"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2860"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\n5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2861"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\n# For ext4, with /dev/block-device not mounted\nsudo tune2fs -O project -Q prjquota /dev/block-device\n```\n\n5 - Resource Management for Pods and Containers | Ensure that the root filesystem (or optional runtime filesystem) is mounted with project quotas enabled. For both XFS and ext4fs, the mount option is named prjquota.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2862"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\n5 - Resource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2863"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\n5 - Resource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2864"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\n6 - Organizing Cluster Access Using kubeconfig Files | The KUBECONFIG environment variable holds a list of kubeconfig files. For Linux and Mac, the list is colon-delimited. For Windows, the list is semicolon-delimited. The KUBECONFIG environment variable", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2865"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\n6 - Organizing Cluster Access Using kubeconfig Files | This page outlines the differences in how resources are managed between Linux and Windows.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2866"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\n2 - ConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2867"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configure-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2868"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2869"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\n2 - ConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2870"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\n2 - ConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2871"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myconfigmap.yaml\n```\n\n2 - ConfigMaps | The following Pod consumes the content of the ConfigMap as environment variables:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2872"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/env-configmap.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2873"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2874"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f env-configmap.yaml\n```\n\n2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2875"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/ env-configmap\n```\n\n2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2876"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\n2 - ConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2877"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\n2 - ConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2878"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/dotfile-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2879"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2880"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic empty-secret\nkubectl get secret empty-secret\n```\n\n3 - Secrets | The output looks like:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2881"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/serviceaccount-token-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2882"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2883"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/dockercfg-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2884"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2885"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry secret-tiger-docker \\\n  --docker-email=tiger@acme.example \\\n  --docker-username=tiger \\\n  --docker-password=pass1234 \\\n  --docker-server=my-registry.example:5000\n```\n\n3 - Secrets | This command creates a Secret of type kubernetes.io/dockerconfigjson.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2886"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret-tiger-docker -o jsonpath='{.data.*}' | base64 -d\n```\n\n3 - Secrets | The output is equivalent to the following JSON document (which is also a valid Docker configuration file):", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2887"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/basicauth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2888"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2889"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/ssh-auth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2890"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2891"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/tls-auth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2892"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2893"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls my-tls-secret \\\n  --cert=path/to/cert/file \\\n  --key=path/to/key/file\n```\n\n3 - Secrets | The public/private key pair must exist before hand. The public key certificate for --cert must be .PEM encoded and must match the given private key for --key.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2894"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/bootstrap-token-secret-base64.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2895"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2896"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/bootstrap-token-secret-literal.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2897"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2898"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\nsecret/optional-secret.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2899"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2900"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\n3 - Secrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2901"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\n5 - Resource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2902"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2903"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2904"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\n5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2905"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\n5 - Resource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2906"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod frontend | grep -A 9999999999 Events\n```\n\n5 - Resource Management for Pods and Containers | In the preceding example, the Pod named \"frontend\" fails to be scheduled due to insufficient CPU resource on any node. Similar error messages can also suggest failure due to insufficient memory (PodEx", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2907"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes e2e-test-node-pool-4lw4\n```\n\n5 - Resource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2908"}
{"instruction": "Write a bash example for configuration", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod simmemleak-hra99\n```\n\n5 - Resource Management for Pods and Containers | The output is similar to:", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2909"}
{"instruction": "Write a yaml example for configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\n6 - Organizing Cluster Access Using kubeconfig Files | This page outlines the differences in how resources are managed between Linux and Windows.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/_print/", "id": "k8s_00221_code_2910"}
{"instruction": "What is the reference documentation for kubectl for docker users?", "response": "kubectl for Docker UsersYou can use the Kubernetes command line tool kubectl to interact with the API Server. Using kubectl is straightforward if you are familiar with the Docker command line tool. However, there are a few differences between the Docker commands and the kubectl commands. The following sections show a Docker sub-command and describe the equivalent kubectl command.docker runTo run an nginx Deployment and expose the Deployment, see kubectl create deployment.docker:docker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx 55c103fa129692154a7652490236fee9be47d70a8dd562281ae7d2f9a339a6db docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 55c103fa1296 nginx \"nginx -g 'daemon of…\" 9 seconds ago Up 9 seconds 0.0.0.0:80->80/tcp nginx-app kubectl:# start the pod running nginx kubectl create deployment --image=nginx nginx-app deployment.apps/nginx-app created # add env to nginx-app kubectl set env deployment/nginx-app DOMAIN=cluster deployment.apps/nginx-app env updated Note:kubectl commands print the type and name of the resource created or mutated, which can then be used in subsequent commands. You can expose a new Service after a Deployment is created.# expose a port through with a service kubectl expose deployment nginx-app --port=80 --name=nginx-http service \"nginx-http\" exposed By using kubectl, you can create a Deployment to ensure that N pods are running nginx, where N is the number of replicas stated in the spec and defaults to 1. You can also create a service with a selector that matches the pod labels. For more information, see Use a Service to Access an Application in a Cluster.By default images run in the background, similar to docker run -d .... To run things in the foreground, use kubectl run to create pod:kubectl run [-i] [--tty] --attach <name> --image=<image> Unlike docker run ..., if you specify --attach, then you attach stdin, stdout and stderr. You cannot control which streams are attached (docker -a ...). To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.docker psTo list what is currently running, see kubectl get.docker:docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 14636241935f ubuntu:16.04 \"echo test\" 5 seconds ago Exited (0) 5 seconds ago cocky_fermi 55c103fa1296 nginx \"nginx -g 'daemon of…\" About a minute ago Up About a minute 0.0.0.0:80->80/tcp nginx-app kubectl:kubectl get po NAME READY STATUS RESTARTS AGE nginx-app-8df569cb7-4gd89 1/1 Running 0 3m ubuntu 0/1 Completed 0 20s docker attachTo attach a process that is already running in a container, see kubectl attach.docker:docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 55c103fa1296 nginx \"nginx -g 'daemon of…\" 5 minutes ago Up 5 minutes 0.0.0.0:80->80/tcp nginx-app docker attach 55c103fa1296 ... kubectl:kubectl get pods NAME READY STATUS RESTARTS AGE nginx-app-5jyvm 1/1 Running 0 10m kubectl attach -it nginx-app-5jyvm ... To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.docker execTo execute a command in a container, see kubectl exec.docker:docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 55c103fa1296 nginx \"nginx -g 'daemon of…\" 6 minutes ago Up 6 minutes 0.0.0.0:80->80/tcp nginx-app docker exec 55c103fa1296 cat /etc/hostname 55c103fa1296 kubectl:kubectl get po NAME READY STATUS RESTARTS AGE nginx-app-5jyvm 1/1 Running 0 10m kubectl exec nginx-app-5jyvm -- cat /etc/hostname nginx-app-5jyvm To use interactive commands.docker:docker exec -ti 55c103fa1296 /bin/sh # exit kubectl:kubectl exec -ti nginx-app-5jyvm -- /bin/sh # exit For more information, see Get a Shell to a Running Container.docker logsTo follow stdout/stderr of a process that is running, see kubectl logs.docker:docker logs -f a9e 192.168.9.1 - - [14/Jul/2015:01:04:02 +0000] \"GET / HTTP/1.1\" 200 612 \"-\" \"curl/7.35.0\" \"-\" 192.168.9.1 - - [14/Jul/2015:01:04:03 +0000] \"GET / HTTP/1.1\" 200 612 \"-\" \"curl/7.35.0\" \"-\" kubectl:k", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2912"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl run [-i] [--tty] --attach <name> --image=<image>\n```\n\nkubectl for Docker Users | Unlike docker run ..., if you specify --attach, then you attach stdin, stdout and stderr. You cannot control which streams are attached (docker -a ...). To detach from the container, you can type the", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2913"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker attach 55c103fa1296\n...\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2914"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it nginx-app-5jyvm\n...\n```\n\nkubectl for Docker Users | To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2915"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker exec 55c103fa1296 cat /etc/hostname\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2916"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx-app-5jyvm -- cat /etc/hostname\n```\n\nkubectl for Docker Users | To use interactive commands.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2917"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker exec -ti 55c103fa1296 /bin/sh\n# exit\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2918"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti nginx-app-5jyvm -- /bin/sh\n# exit\n```\n\nkubectl for Docker Users | For more information, see Get a Shell to a Running Container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2919"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f nginx-app-zibvs\n```\n\nkubectl for Docker Users | There is a slight difference between pods and containers; by default pods do not terminate if their processes exit. Instead the pods restart the process. This is similar to the docker run option --res", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2920"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous nginx-app-zibvs\n```\n\nkubectl for Docker Users | For more information, see Logging Architecture.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2921"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker stop a9ec34d98787\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2922"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker rm a9ec34d98787\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2923"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-app\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2924"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2925"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-app\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2926"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n# Return nothing\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2927"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2928"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl run [-i] [--tty] --attach <name> --image=<image>\n```\n\nkubectl for Docker Users | Unlike docker run ..., if you specify --attach, then you attach stdin, stdout and stderr. You cannot control which streams are attached (docker -a ...). To detach from the container, you can type the", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2929"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker attach 55c103fa1296\n...\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2930"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it nginx-app-5jyvm\n...\n```\n\nkubectl for Docker Users | To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2931"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker exec 55c103fa1296 cat /etc/hostname\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2932"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx-app-5jyvm -- cat /etc/hostname\n```\n\nkubectl for Docker Users | To use interactive commands.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2933"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker exec -ti 55c103fa1296 /bin/sh\n# exit\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2934"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti nginx-app-5jyvm -- /bin/sh\n# exit\n```\n\nkubectl for Docker Users | For more information, see Get a Shell to a Running Container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2935"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f nginx-app-zibvs\n```\n\nkubectl for Docker Users | There is a slight difference between pods and containers; by default pods do not terminate if their processes exit. Instead the pods restart the process. This is similar to the docker run option --res", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2936"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous nginx-app-zibvs\n```\n\nkubectl for Docker Users | For more information, see Logging Architecture.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2937"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker stop a9ec34d98787\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2938"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\ndocker rm a9ec34d98787\n```\n\nkubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2939"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-app\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2940"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2941"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-app\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2942"}
{"instruction": "Write a bash example for kubectl for docker users", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n# Return nothing\n```\n\nkubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/", "id": "k8s_00222_code_2943"}
{"instruction": "What is the reference documentation for validatingadmissionpolicybinding?", "response": "ValidatingAdmissionPolicyBindingValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources.apiVersion: admissionregistration.k8s.io/v1import \"k8s.io/api/admissionregistration/v1\"ValidatingAdmissionPolicyBindingValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.The CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.apiVersion: admissionregistration.k8s.io/v1kind: ValidatingAdmissionPolicyBindingmetadata (ObjectMeta)Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.spec (ValidatingAdmissionPolicyBindingSpec)Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.spec.matchResources (MatchResources)MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)spec.matchResources.excludeResourceRules ([]NamedRuleWithOperations)Atomic: will be replaced during a mergeExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.spec.matchResources.excludeResourceRules.apiGroups ([]string)Atomic: will be replaced during a mergeAPIGroups is the API groups the resources belong to. '' is all groups. If '' is present, the length of the slice must be one. Required.spec.matchResources.excludeResourceRules.apiVersions ([]string)Atomic: will be replaced during a mergeAPIVersions is the API versions the resources belong to. '' is all versions. If '' is present, the length of the slice must be one. Required.spec.matchResources.excludeResourceRules.operations ([]string)Atomic: will be replaced during a mergeOperations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.spec.matchResources.excludeResourceRules.resourceNames ([]string)Atomic: will be replaced during a mergeResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.spec.matchResources.excludeResourceRules.resources ([]string)Atomic: will be replaced during a mergeResources is a list of resources this rule applies to.For example: 'pods' means pods. 'pods/log' means the log subresource of pods. '' means all resources, but not ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/validating-admission-policy-binding-v1/", "id": "k8s_00223"}
{"instruction": "Write a yaml example for validatingadmissionpolicybinding", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\nValidatingAdmissionPolicyBinding | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/validating-admission-policy-binding-v1/", "id": "k8s_00223_code_2945"}
{"instruction": "Explain the Kubernetes concept: Security", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.SecurityConcepts for keeping your cloud-native workload secure.1: Cloud Native Security and Kubernetes2: Pod Security Standards3: Pod Security Admission4: Service Accounts5: Pod Security Policies6: Security For Linux Nodes7: Security For Windows Nodes8: Controlling Access to the Kubernetes API9: Role Based Access Control Good Practices10: Good practices for Kubernetes Secrets11: Multi-tenancy12: Hardening Guide - Authentication Mechanisms13: Hardening Guide - Scheduler Configuration14: Kubernetes API Server Bypass Risks15: Linux kernel security constraints for Pods and containers16: Security Checklist17: Application Security ChecklistThis section of the Kubernetes documentation aims to help you learn to run workloads more securely, and about the essential aspects of keeping a Kubernetes cluster secure.Kubernetes is based on a cloud-native architecture, and draws on advice from the CNCF about good practice for cloud native information security.Read Cloud Native Security and Kubernetes for the broader context about how to secure your cluster and the applications that you're running on it.Kubernetes security mechanismsKubernetes includes several APIs and security controls, as well as ways to define policies that can form part of how you manage information security.Control plane protectionA key security mechanism for any Kubernetes cluster is to control access to the Kubernetes API.Kubernetes expects you to configure and use TLS to provide data encryption in transit within the control plane, and between the control plane and its clients. You can also enable encryption at rest for the data stored within Kubernetes control plane; this is separate from using encryption at rest for your own workloads' data, which might also be a good idea.SecretsThe Secret API provides basic protection for configuration values that require confidentiality.Workload protectionEnforce Pod security standards to ensure that Pods and their containers are isolated appropriately. You can also use RuntimeClasses to define custom isolation if you need it.Network policies let you control network traffic between Pods, or between Pods and the network outside your cluster.You can deploy security controls from the wider ecosystem to implement preventative or detective controls around Pods, their containers, and the images that run in them.Admission controlAdmission controllers are plugins that intercept Kubernetes API requests and can validate or mutate the requests based on specific fields in the request. Thoughtfully designing these controllers helps to avoid unintended disruptions as Kubernetes APIs change across version updates. For design considerations, see Admission Webhook Good Practices.AuditingKubernetes audit logging provides a security-relevant, chronological set of records documenting the sequence of actions in a cluster. The cluster audits the activities generated by users, by applications that use the Kubernetes API, and by the control plane itself.Cloud provider securityNote: Items on this page refer to vendors external to Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. To add a vendor, product or project to this list, read the content guide before submitting a change. More information.If you are running a Kubernetes cluster on your own hardware or a different cloud provider, consult your documentation for security best practices. Here are links to some of the popular cloud providers' security documentation:Cloud provider securityIaaS ProviderLinkAlibaba Cloudhttps://www.alibabacloud.com/trust-centerAmazon Web Serviceshttps://aws.amazon.com/securityGoogle Cloud Platformhttps://cloud.google.com/securityHuawei Cloudhttps://www.huaweicloud.com/intl/en-us/securecenter/overallsafetyIBM Cloudhttps://www.ibm.com/cloud/securityMicrosoft Azurehttps://docs.microsoft.com/en-us/azure/security", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224"}
{"instruction": "Write a yaml example for security", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\n4 - Service Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2947"}
{"instruction": "Write a yaml example for security", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\n13 - Hardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2948"}
{"instruction": "Write a yaml example for security", "response": "Here's a yaml example:\n\n```yaml\n# The per-mode level label indicates which policy level to apply for the mode.\n#\n# MODE must be one of `enforce`, `audit`, or `warn`.\n# LEVEL must be one of `privileged`, `baseline`, or `restricted`.\npod-security.kubernetes.io/<MODE>: <LEVEL>\n\n# Optional: per-mode version label that can be used to pin the policy to the\n# version that shipped with a given Kubernetes minor version (for example v1.34).\n#\n# MODE must be one of `enforce`, `audit`, or `warn`.\n# VERSION must be a valid Kubernetes minor version, or `latest`.\npod-security.kubernetes.io/<MODE>-version: <VERSION>\n```\n\n3 - Pod Security Admission | Check out Enforce Pod Security Standards with Namespace Labels to see example usage.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2949"}
{"instruction": "Write a yaml example for security", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\n4 - Service Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2950"}
{"instruction": "Write a bash example for security", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets -A -o yaml\n```\n\n9 - Role Based Access Control Good Practices | Permission to create workloads (either Pods, or workload resources that manage Pods) in a namespace implicitly grants access to many other resources in that namespace, such as Secrets, ConfigMaps, and", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2951"}
{"instruction": "Write a yaml example for security", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\n13 - Hardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2952"}
{"instruction": "Write a yaml example for security", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\n4 - Service Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2953"}
{"instruction": "Write a yaml example for security", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\n13 - Hardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/_print/", "id": "k8s_00224_code_2954"}
{"instruction": "Explain post-release communications in Kubernetes", "response": "Post-release communicationsThe Kubernetes Release Comms team (part of SIG Release) looks after release announcements, which go onto the main project blog.After each release, the Release Comms team take over the main blog for a period and publish a series of additional articles to explain or announce changes related to that release. These additional articles are termed post-release comms.Opting in to post-release commsDuring a release cycle, as a contributor, you can opt in to post-release comms about an upcoming change to Kubernetes.To opt in you open a draft, placeholder pull request (PR) against k/website. Initially, this can be an empty commit. Mention the KEP issue or other Kubernetes improvement issue in the description of your placeholder PR.When you open the draft pull request, you open it against main as the base branch and not against the dev-1.35 branch. This is different from the process for upcoming release changes and new features.You should also leave a comment on the related kubernetes/enhancements issue with a link to the PR to notify the Release Comms team managing this release. Your comment helps the team see that the change needs announcing and that your SIG has opted in.As well as the above, you should ideally contact the Release Comms team via Slack (channel #release-comms) to let them know that you have done this and would like to opt in.Preparing the article contentYou should follow the usual article submission process to turn your placeholder PR into something ready for review. However, for post-release comms, you may not have a writing buddy; instead, the Release Comms team may assign a member of the team to help guide what you're doing.You should squash the commits in your pull request; if you're not sure how to, it's absolutely OK to ask Release Comms or the blog team for help.Provided that your article is flagged as a draft (draft: true) in the front matter, the PR can merge at any time during the release cycle.PublicationAhead of the actual release, the Release Comms team check what content is ready (if it's not ready by the deadline, and you didn't get an exception, then the announcement won't be included). They build a schedule for the articles that will go out and open new pull requests to turn those articles from draft to published.Caution:All these pull requests to actually publish post-release articles must be held (Prow command /hold) until the release has actually happened.The blog team approvers still provide final sign off on promoting the content from draft to accepted for publication. Ahead of release day, the PR (or PRs) for publishing these announcements should have LGTM (“looks good to me”) and approved labels, along with the do-not-merge/hold label to ensure the PR doesn't merge too early.Release Comms / the Release Team can then unhold that PR (or set of PRs) as soon as the website Git repository is unfrozen after the actual release.On the day each article is scheduled to publish, automation triggers a website build and that article becomes visible.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/blog/release-comms/", "id": "k8s_00225"}
{"instruction": "How do you translate a docker compose file to kubernetes resources in Kubernetes?", "response": "Translate a Docker Compose File to Kubernetes ResourcesWhat's Kompose? It's a conversion tool for all things compose (namely Docker Compose) to container orchestrators (Kubernetes or OpenShift).More information can be found on the Kompose website at https://kompose.io/.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Install KomposeWe have multiple ways to install Kompose. Our preferred method is downloading the binary from the latest GitHub release.Kompose is released via GitHub on a three-week cycle, you can see all current releases on the GitHub release page.# Linux curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-linux-amd64 -o kompose # macOS curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-darwin-amd64 -o kompose # Windows curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-windows-amd64.exe -o kompose.exe chmod +x kompose sudo mv ./kompose /usr/local/bin/kompose Alternatively, you can download the tarball.Installing using go get pulls from the master branch with the latest development changes.go get -u github.com/kubernetes/kompose On macOS you can install the latest release via Homebrew:brew install kompose Use KomposeIn a few steps, we'll take you from Docker Compose to Kubernetes. All you need is an existing docker-compose.yml file.Go to the directory containing your docker-compose.yml file. If you don't have one, test using this one. services: redis-leader: container_name: redis-leader image: redis ports: - \"6379\" redis-replica: container_name: redis-replica image: redis ports: - \"6379\" command: redis-server --replicaof redis-leader 6379 --dir /tmp web: container_name: web image: quay.io/kompose/web ports: - \"8080:8080\" environment: - GET_HOSTS_FROM=dns labels: kompose.service.type: LoadBalancer To convert the docker-compose.yml file to files that you can use with kubectl, run kompose convert and then kubectl apply -f <output file>.kompose convert The output is similar to:INFO Kubernetes file \"redis-leader-service.yaml\" created INFO Kubernetes file \"redis-replica-service.yaml\" created INFO Kubernetes file \"web-tcp-service.yaml\" created INFO Kubernetes file \"redis-leader-deployment.yaml\" created INFO Kubernetes file \"redis-replica-deployment.yaml\" created INFO Kubernetes file \"web-deployment.yaml\" created kubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml The output is similar to:deployment.apps/redis-leader created deployment.apps/redis-replica created deployment.apps/web created service/redis-leader created service/redis-replica created service/web-tcp created Your deployments are running in Kubernetes.Access your application.If you're already using minikube for your development process:minikube service web-tcp Otherwise, let's look up what IP your service is using!kubectl describe svc web-tcp Name: web-tcp Namespace: default Labels: io.kompose.service=web-tcp Annotations: kompose.cmd: kompose convert kompose.service.type: LoadBalancer kompose.version: 1.33.0 (3ce457399) Selector: io.kompose.service=web Type: LoadBalancer IP Family Policy: SingleStack IP Families: IPv4 IP: 10.102.30.3 IPs: 10.102.30.3 Port: 8080 8080/TCP TargetPort: 8080/TCP NodePort: 8080 31624/TCP Endpoints: 10.244.0.5:8080 Session Affinity: None External Traffic Policy: Cluster Events: <none> If you're using a cloud provider, your IP will be listed next to LoadBalancer Ingress.curl http://192.0.2.89 Clean-up.After ", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2957"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc web-tcp\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | If you're using a cloud provider, your IP will be listed next to LoadBalancer Ingress.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2958"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | Kompose has support for two providers: OpenShift and Kubernetes. You can choose a targeted provider using global option --provider. If no provider is specified, Kubernetes is set by default.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2959"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\ndocker-compose\n├── Chart.yaml\n├── README.md\n└── templates\n    ├── redis-deployment.yaml\n    ├── redis-svc.yaml\n    ├── web-deployment.yaml\n    └── web-svc.yaml\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | The chart structure is aimed at providing a skeleton for building your Helm charts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2960"}
{"instruction": "Write a yaml example for translate a docker compose file to kubernetes resources", "response": "Here's a yaml example:\n\n```yaml\nservices:\n\n  redis-leader:\n    container_name: redis-leader\n    image: redis\n    ports:\n      - \"6379\"\n\n  redis-replica:\n    container_name: redis-replica\n    image: redis\n    ports:\n      - \"6379\"\n    command: redis-server --replicaof redis-leader 6379 --dir /tmp\n\n  web:\n    container_name: web\n    image: quay.io/kompose/web\n    ports:\n      - \"8080:8080\"\n    environment:\n      - GET_HOSTS_FROM=dns\n    labels:\n      kompose.service.type: LoadBalancer\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | To convert the docker-compose.yml file to files that you can use with kubectl, run kompose convert and then kubectl apply -f <output file>.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2961"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <output file>\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2962"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2963"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nminikube service web-tcp\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | Otherwise, let's look up what IP your service is using!", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2964"}
{"instruction": "Write a yaml example for translate a docker compose file to kubernetes resources", "response": "Here's a yaml example:\n\n```yaml\nversion: \"2\"\nservices:\n  nginx:\n    image: nginx\n    dockerfile: foobar\n    build: ./foobar\n    cap_add:\n      - ALL\n    container_name: foobar\n    labels:\n      kompose.service.type: nodeport\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | kompose.service.expose defines if the service needs to be made accessible from outside the cluster or not. If the value is set to \"true\", the provider sets the endpoint automatically, and for any othe", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2965"}
{"instruction": "Write a yaml example for translate a docker compose file to kubernetes resources", "response": "Here's a yaml example:\n\n```yaml\nversion: \"2\"\nservices:\n  web:\n    image: tuna/docker-counter23\n    ports:\n    - \"5000:5000\"\n    links:\n    - redis\n    labels:\n      kompose.service.expose: \"counter.example.com\"\n  redis:\n    image: redis:3.0\n    ports:\n    - \"6379\"\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | The currently supported options are:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2966"}
{"instruction": "Write a yaml example for translate a docker compose file to kubernetes resources", "response": "Here's a yaml example:\n\n```yaml\nversion: '2'\n\nservices:\n  pival:\n    image: perl\n    command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n    restart: \"on-failure\"\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | If the Docker Compose file has a volume specified for a service, the Deployment (Kubernetes) or DeploymentConfig (OpenShift) strategy is changed to \"Recreate\" instead of \"RollingUpdate\" (default). Thi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2967"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2968"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc web-tcp\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | If you're using a cloud provider, your IP will be listed next to LoadBalancer Ingress.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2969"}
{"instruction": "Write a bash example for translate a docker compose file to kubernetes resources", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\nTranslate a Docker Compose File to Kubernetes Resources | Kompose has support for two providers: OpenShift and Kubernetes. You can choose a targeted provider using global option --provider. If no provider is specified, Kubernetes is set by default.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/", "id": "k8s_00226_code_2970"}
{"instruction": "How do you expose pod information to containers through environment variables in Kubernetes?", "response": "Expose Pod Information to Containers Through Environment VariablesThis page shows how a Pod can use environment variables to expose information about itself to containers running in the Pod, using the downward API. You can use environment variables to expose Pod fields, container fields, or both.In Kubernetes, there are two ways to expose Pod and container fields to a running container:Environment variables, as explained in this taskVolume filesTogether, these two ways of exposing Pod and container fields are called the downward API.As Services are the primary mode of communication between containerized applications managed by Kubernetes, it is helpful to be able to discover them at runtime.Read more about accessing Services here.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesUse Pod fields as values for environment variablesIn this part of exercise, you create a Pod that has one container, and you project Pod-level fields into the running container as environment variables.pods/inject/dapi-envars-pod.yaml apiVersion: v1 kind: Pod metadata: name: dapi-envars-fieldref spec: containers: - name: test-container image: registry.k8s.io/busybox:1.27.2 command: [ \"sh\", \"-c\"] args: - while true; do echo -en '\\n'; printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE; printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT; sleep 10; done; env: - name: MY_NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: MY_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: MY_POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: MY_POD_IP valueFrom: fieldRef: fieldPath: status.podIP - name: MY_POD_SERVICE_ACCOUNT valueFrom: fieldRef: fieldPath: spec.serviceAccountName restartPolicy: Never In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment variable gets its value from the Pod's spec.nodeName field. Similarly, the other environment variables get their names from Pod fields.Note:The fields in this example are Pod fields. They are not fields of the container in the Pod.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-pod.yaml Verify that the container in the Pod is running:# If the new Pod isn't yet healthy, rerun this command a few times. kubectl get pods View the container's logs:kubectl logs dapi-envars-fieldref The output shows the values of selected environment variables:minikube dapi-envars-fieldref default 172.17.0.4 default To see why these values are in the log, look at the command and args fields in the configuration file. When the container starts, it writes the values of five environment variables to stdout. It repeats this every ten seconds.Next, get a shell into the container that is running in your Pod:kubectl exec -it dapi-envars-fieldref -- sh In your shell, view the environment variables:# Run this in a shell inside the container printenv The output shows that certain environment variables have been assigned the values of Pod fields:MY_POD_SERVICE_ACCOUNT=default ... MY_POD_NAMESPACE=default MY_POD_IP=172.17.0.4 ... MY_NODE_NAME=minikube ... MY_POD_NAME=dapi-envars-fieldref Use container fields as values for environment variablesIn the preceding exercise, you used information from Pod-level fields as the values for environment variables. In this next exercise, you are going to pass fields that are part of the Pod definition, but taken from the specific container rather than from the Pod overall.Here is a manifest for another Pod that again has just one c", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2972"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-pod.yaml\n```\n\nExpose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2973"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-fieldref\n```\n\nExpose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2974"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dapi-envars-fieldref -- sh\n```\n\nExpose Pod Information to Containers Through Environment Variables | In your shell, view the environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2975"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2976"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-container.yaml\n```\n\nExpose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2977"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-resourcefieldref\n```\n\nExpose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2978"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2979"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2980"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-envars-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2981"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2982"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-pod.yaml\n```\n\nExpose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2983"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-fieldref\n```\n\nExpose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2984"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dapi-envars-fieldref -- sh\n```\n\nExpose Pod Information to Containers Through Environment Variables | In your shell, view the environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2985"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-envars-container.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2986"}
{"instruction": "Write a yaml example for expose pod information to containers through environment variables", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\nExpose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2987"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-container.yaml\n```\n\nExpose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2988"}
{"instruction": "Write a bash example for expose pod information to containers through environment variables", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-resourcefieldref\n```\n\nExpose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/", "id": "k8s_00227_code_2989"}
{"instruction": "What is the reference documentation for kubeadm reset phase?", "response": "kubeadm reset phasekubeadm reset phase enables you to invoke atomic steps of the node reset process. Hence, you can let kubeadm do some of the work and you can fill in the gaps if you wish to apply customization.kubeadm reset phase is consistent with the kubeadm reset workflow, and behind the scene both use the same code.kubeadm reset phaseSynopsisUse this command to invoke single phase of the \"reset\" workflowkubeadm reset phase [flags] Options-h, --helphelp for phaseOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm reset phase preflightUsing this phase you can execute preflight checks on a node that is being reset.Run reset pre-flight checksSynopsisRun pre-flight checks for kubeadm reset.kubeadm reset phase preflight [flags] Options--dry-runDon't apply any changes; just output what would be done.-f, --forceReset the node without prompting for confirmation.-h, --helphelp for preflight--ignore-preflight-errors stringsA list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm reset phase remove-etcd-memberUsing this phase you can remove this control-plane node's etcd member from the etcd cluster.SynopsisRemove a local etcd member for a control plane node.kubeadm reset phase remove-etcd-member [flags] Options--dry-runDon't apply any changes; just output what would be done.-h, --helphelp for remove-etcd-member--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm reset phase cleanup-nodeUsing this phase you can perform cleanup on this node.SynopsisRun cleanup node.kubeadm reset phase cleanup-node [flags] Options--cert-dir string Default: \"/etc/kubernetes/pki\"The path to the directory where the certificates are stored. If specified, clean this directory.--cleanup-tmp-dirCleanup the \"/etc/kubernetes/tmp\" directory--cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.--dry-runDon't apply any changes; just output what would be done.-h, --helphelp for cleanup-nodeOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.What's nextkubeadm init to bootstrap a Kubernetes control-plane nodekubeadm join to connect a node to the clusterkubeadm reset to revert any changes made to this host by kubeadm init or kubeadm joinkubeadm alpha to try experimental functionality", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset-phase/", "id": "k8s_00228"}
{"instruction": "What is the reference documentation for kube-apiserver admission (v1)?", "response": "kube-apiserver Admission (v1)Resource TypesAdmissionReviewAdmissionReviewAdmissionReview describes an admission review request/response.FieldDescriptionapiVersionstringadmission.k8s.io/v1kindstringAdmissionReviewrequestAdmissionRequestRequest describes the attributes for the admission request.responseAdmissionResponseResponse describes the attributes for the admission response.AdmissionRequestAppears in:AdmissionReviewAdmissionRequest describes the admission.Attributes for the admission request.FieldDescriptionuid [Required]k8s.io/apimachinery/pkg/types.UIDUID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are otherwise identical (parallel requests, requests when earlier requests did not modify etc) The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request. It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.kind [Required]meta/v1.GroupVersionKindKind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale)resource [Required]meta/v1.GroupVersionResourceResource is the fully-qualified resource being requested (for example, v1.pods)subResourcestringSubResource is the subresource being requested, if any (for example, \"status\" or \"scale\")requestKindmeta/v1.GroupVersionKindRequestKind is the fully-qualified type of the original API request (for example, v1.Pod or autoscaling.v1.Scale). If this is specified and differs from the value in \"kind\", an equivalent match and conversion was performed.For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"] and matchPolicy: Equivalent, an API request to apps/v1beta1 deployments would be converted and sent to the webhook with kind: {group:\"apps\", version:\"v1\", kind:\"Deployment\"} (matching the rule the webhook registered for), and requestKind: {group:\"apps\", version:\"v1beta1\", kind:\"Deployment\"} (indicating the kind of the original API request).See documentation for the \"matchPolicy\" field in the webhook configuration type for more details.requestResourcemeta/v1.GroupVersionResourceRequestResource is the fully-qualified resource of the original API request (for example, v1.pods). If this is specified and differs from the value in \"resource\", an equivalent match and conversion was performed.For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"] and matchPolicy: Equivalent, an API request to apps/v1beta1 deployments would be converted and sent to the webhook with resource: {group:\"apps\", version:\"v1\", resource:\"deployments\"} (matching the resource the webhook registered for), and requestResource: {group:\"apps\", version:\"v1beta1\", resource:\"deployments\"} (indicating the resource of the original API request).See documentation for the \"matchPolicy\" field in the webhook configuration type.requestSubResourcestringRequestSubResource is the name of the subresource of the original API request, if any (for example, \"status\" or \"scale\") If this is specified and differs from the value in \"subResource\", an equivalent match and conversion was performed. See documentation for the \"matchPolicy\" field in the webhook configuration type.namestringName is the name of the object as presented in the request. On a CREATE operation, the client may omit name and rely on the server to generate the name. If that is the case, this field will contain an empty string.namespacestringNamespace is the namespace associated with the request (if any).operation [Required]OperationOperation is the operation being performed. This may be different than the operation requested. e.g. a patch can result in either a CREATE or UPDATE Operation.userInfo [Required]authentication/v1.UserIn", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-admission.v1/", "id": "k8s_00229"}
{"instruction": "Write a yaml example for kube-apiserver admission (v1)", "response": "Here's a yaml example:\n\n```yaml\nkind: {group:\"apps\", version:\"v1\", kind:\"Deployment\"}\n```\n\nkube-apiserver Admission (v1) | See documentation for the \"matchPolicy\" field in the webhook configuration type for more details.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-admission.v1/", "id": "k8s_00229_code_2992"}
{"instruction": "Write a yaml example for kube-apiserver admission (v1)", "response": "Here's a yaml example:\n\n```yaml\nrequestKind: {group:\"apps\", version:\"v1beta1\", kind:\"Deployment\"}\n```\n\nkube-apiserver Admission (v1) | See documentation for the \"matchPolicy\" field in the webhook configuration type for more details.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-admission.v1/", "id": "k8s_00229_code_2993"}
{"instruction": "What is the reference documentation for volumeattachment?", "response": "VolumeAttachmentVolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.apiVersion: storage.k8s.io/v1import \"k8s.io/api/storage/v1\"VolumeAttachmentVolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.VolumeAttachment objects are non-namespaced.apiVersion: storage.k8s.io/v1kind: VolumeAttachmentmetadata (ObjectMeta)Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (VolumeAttachmentSpec), requiredspec represents specification of the desired attach/detach volume behavior. Populated by the Kubernetes system.status (VolumeAttachmentStatus)status represents status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher.VolumeAttachmentSpecVolumeAttachmentSpec is the specification of a VolumeAttachment request.attacher (string), requiredattacher indicates the name of the volume driver that MUST handle this request. This is the name returned by GetPluginName().nodeName (string), requirednodeName represents the node that the volume should be attached to.source (VolumeAttachmentSource), requiredsource represents the volume that should be attached.VolumeAttachmentSource represents a volume that should be attached. Right now only PersistentVolumes can be attached via external attacher, in the future we may allow also inline volumes in pods. Exactly one member can be set.source.inlineVolumeSpec (PersistentVolumeSpec)inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource. This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is beta-level and is only honored by servers that enabled the CSIMigration feature.source.persistentVolumeName (string)persistentVolumeName represents the name of the persistent volume to attach.VolumeAttachmentStatusVolumeAttachmentStatus is the status of a VolumeAttachment request.attached (boolean), requiredattached indicates the volume is successfully attached. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.attachError (VolumeError)attachError represents the last error encountered during attach operation, if any. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.VolumeError captures an error encountered during a volume operation.attachError.errorCode (int32)errorCode is a numeric gRPC code representing the error encountered during Attach or Detach operations.This is an optional, beta field that requires the MutableCSINodeAllocatableCount feature gate being enabled to be set.attachError.message (string)message represents the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information.attachError.time (Time)time represents the time the error was encountered.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.attachmentMetadata (map[string]string)attachmentMetadata is populated with any information returned by the attach operation, upon successful attach, that must be passed into subsequent WaitForAttach or Mount calls. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.detachError (VolumeError)detachError represents the last error encountered during detach operation, if any. This field must only be set by the entity completing the detach operation, i.e. the external-attacher.VolumeError captures an error encountered during a volume operation.detachError.errorCode (int32)errorCode is a numeric gRPC code representing the error encountered during Attach or Deta", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume-attachment-v1/", "id": "k8s_00230"}
{"instruction": "Write a yaml example for volumeattachment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\nVolumeAttachment | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume-attachment-v1/", "id": "k8s_00230_code_2995"}
{"instruction": "What is the reference documentation for subjectaccessreview?", "response": "SubjectAccessReviewSubjectAccessReview checks whether or not a user or group can perform an action.apiVersion: authorization.k8s.io/v1import \"k8s.io/api/authorization/v1\"SubjectAccessReviewSubjectAccessReview checks whether or not a user or group can perform an action.apiVersion: authorization.k8s.io/v1kind: SubjectAccessReviewmetadata (ObjectMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (SubjectAccessReviewSpec), requiredSpec holds information about the request being evaluatedstatus (SubjectAccessReviewStatus)Status is filled in by the server and indicates whether the request is allowed or notSubjectAccessReviewSpecSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be setextra (map[string][]string)Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.groups ([]string)Atomic: will be replaced during a mergeGroups is the groups you're testing for.nonResourceAttributes (NonResourceAttributes)NonResourceAttributes describes information for a non-resource access requestNonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interfacenonResourceAttributes.path (string)Path is the URL path of the requestnonResourceAttributes.verb (string)Verb is the standard HTTP verbresourceAttributes (ResourceAttributes)ResourceAuthorizationAttributes describes information for a resource access requestResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interfaceresourceAttributes.fieldSelector (FieldSelectorAttributes)fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it.*FieldSelectorAttributes indicates a field limited access. Webhook authors are encouraged to * ensure rawSelector and requirements are not both set * consider the requirements field if set * not try to parse or consider the rawSelector field if set. This is to avoid another CVE-2022-2880 (i.e. getting different systems to agree on how exactly to parse a query is not something we want), see https://www.oxeye.io/resources/golang-parameter-smuggling-attack for more details. For the SubjectAccessReview endpoints of the kube-apiserver: * If rawSelector is empty and requirements are empty, the request is not limited. * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds. * If rawSelector is empty and requirements are present, the requirements should be honored * If rawSelector is present and requirements are present, the request is invalid.resourceAttributes.fieldSelector.rawSelector (string)rawSelector is the serialization of a field selector that would be included in a query parameter. Webhook implementations are encouraged to ignore rawSelector. The kube-apiserver's *SubjectAccessReview will parse the rawSelector as long as the requirements are not present.resourceAttributes.fieldSelector.requirements ([]FieldSelectorRequirement)Atomic: will be replaced during a mergerequirements is the parsed interpretation of a field selector. All requirements must be met for a resource instance to match the selector. Webhook implementations should handle requirements, but how to handle them is up to the webhook. Since requirements can only limit the request, it is safe to authorize as unlimited request if the requirements are not understood.FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.resourceAttributes.fieldSelector.requirements.key (string), requiredkey is the field selector key that the requirement applies to.resourceAttributes.fieldSelector.requirements.operator (string), requiredoperator represents a key's relations", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/subject-access-review-v1/", "id": "k8s_00231"}
{"instruction": "Write a yaml example for subjectaccessreview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\nSubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/subject-access-review-v1/", "id": "k8s_00231_code_2997"}
{"instruction": "What is the reference documentation for podcertificaterequest v1alpha1?", "response": "PodCertificateRequest v1alpha1PodCertificateRequest encodes a pod requesting a certificate from a given signer.apiVersion: certificates.k8s.io/v1alpha1import \"k8s.io/api/certificates/v1alpha1\"PodCertificateRequestPodCertificateRequest encodes a pod requesting a certificate from a given signer.Kubelets use this API to implement podCertificate projected volumesapiVersion: certificates.k8s.io/v1alpha1kind: PodCertificateRequestmetadata (ObjectMeta)metadata contains the object metadata.spec (PodCertificateRequestSpec), requiredspec contains the details about the certificate being requested.status (PodCertificateRequestStatus)status contains the issued certificate, and a standard set of conditions.PodCertificateRequestSpecPodCertificateRequestSpec describes the certificate request. All fields are immutable after creation.nodeName (string), requirednodeName is the name of the node the pod is assigned to.nodeUID (string), requirednodeUID is the UID of the node the pod is assigned to.pkixPublicKey ([]byte), requiredpkixPublicKey is the PKIX-serialized public key the signer will issue the certificate to.The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.Signer implementations do not need to support all key types supported by kube-apiserver and kubelet. If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of \"Denied\" and a reason of \"UnsupportedKeyType\". It may also suggest a key type that it does support in the message field.podName (string), requiredpodName is the name of the pod into which the certificate will be mounted.podUID (string), requiredpodUID is the UID of the pod into which the certificate will be mounted.proofOfPossession ([]byte), requiredproofOfPossession proves that the requesting kubelet holds the private key corresponding to pkixPublicKey.It is contructed by signing the ASCII bytes of the pod's UID using pkixPublicKey.kube-apiserver validates the proof of possession during creation of the PodCertificateRequest.If the key is an RSA key, then the signature is over the ASCII bytes of the pod UID, using RSASSA-PSS from RFC 8017 (as implemented by the golang function crypto/rsa.SignPSS with nil options).If the key is an ECDSA key, then the signature is as described by SEC 1, Version 2.0 (as implemented by the golang library function crypto/ecdsa.SignASN1)If the key is an ED25519 key, the the signature is as described by the ED25519 Specification (as implemented by the golang library crypto/ed25519.Sign).serviceAccountName (string), requiredserviceAccountName is the name of the service account the pod is running as.serviceAccountUID (string), requiredserviceAccountUID is the UID of the service account the pod is running as.signerName (string), requiredsignerName indicates the requested signer.All signer names beginning with kubernetes.io are reserved for use by the Kubernetes project. There is currently one well-known signer documented by the Kubernetes project, kubernetes.io/kube-apiserver-client-pod, which will issue client certificates understood by kube-apiserver. It is currently unimplemented.maxExpirationSeconds (int32)maxExpirationSeconds is the maximum lifetime permitted for the certificate.If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver will reject values shorter than 3600 (1 hour). The maximum allowable value is 7862400 (91 days).The signer implementation is then free to issue a certificate with any lifetime shorter than MaxExpirationSeconds, but no shorter than 3600 seconds (1 hour). This constraint is enforced by kube-apiserver. kubernetes.io signers will never issue certificates with a lifetime longer than 24 hours.PodCertificateRequestStatusPodCertificateRequestStatus describes the status of the request, and holds the certificate data if the request is issued.beginRefreshAt (Time)beginRefreshAt is t", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/pod-certificate-request-v1alpha1/", "id": "k8s_00232"}
{"instruction": "Write a yaml example for podcertificaterequest v1alpha1", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\n```\n\nPodCertificateRequest v1alpha1 | import \"k8s.io/api/certificates/v1alpha1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/pod-certificate-request-v1alpha1/", "id": "k8s_00232_code_2999"}
{"instruction": "Explain container runtimes in Kubernetes", "response": "Container RuntimesNote: Dockershim has been removed from the Kubernetes project as of release 1.24. Read the Dockershim Removal FAQ for further details.You need to install a container runtime into each node in the cluster so that Pods can run there. This page outlines what is involved and describes related tasks for setting up nodes.Kubernetes 1.34 requires that you use a runtime that conforms with the Container Runtime Interface (CRI).See CRI version support for more information.This page provides an outline of how to use several common container runtimes with Kubernetes.containerdCRI-ODocker EngineMirantis Container RuntimeNote:Kubernetes releases before v1.24 included a direct integration with Docker Engine, using a component named dockershim. That special direct integration is no longer part of Kubernetes (this removal was announced as part of the v1.20 release). You can read Check whether Dockershim removal affects you to understand how this removal might affect you. To learn about migrating from using dockershim, see Migrating from dockershim.If you are running a version of Kubernetes other than v1.34, check the documentation for that version.Install and configure prerequisitesNetwork configurationBy default, the Linux kernel does not allow IPv4 packets to be routed between interfaces. Most Kubernetes cluster networking implementations will change this setting (if needed), but some might expect the administrator to do it for them. (Some might also expect other sysctl parameters to be set, kernel modules to be loaded, etc; consult the documentation for your specific network implementation.)Enable IPv4 packet forwardingTo manually enable IPv4 packet forwarding:# sysctl params required by setup, params persist across reboots cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.ipv4.ip_forward = 1 EOF # Apply sysctl params without reboot sudo sysctl --system Verify that net.ipv4.ip_forward is set to 1 with:sysctl net.ipv4.ip_forward cgroup driversOn Linux, control groups are used to constrain resources that are allocated to processes.Both the kubelet and the underlying container runtime need to interface with control groups to enforce resource management for pods and containers and set resources such as cpu/memory requests and limits. To interface with control groups, the kubelet and the container runtime need to use a cgroup driver. It's critical that the kubelet and the container runtime use the same cgroup driver and are configured the same.There are two cgroup drivers available:cgroupfssystemdcgroupfs driverThe cgroupfs driver is the default cgroup driver in the kubelet. When the cgroupfs driver is used, the kubelet and the container runtime directly interface with the cgroup filesystem to configure cgroups.The cgroupfs driver is not recommended when systemd is the init system because systemd expects a single cgroup manager on the system. Additionally, if you use cgroup v2, use the systemd cgroup driver instead of cgroupfs.systemd cgroup driverWhen systemd is chosen as the init system for a Linux distribution, the init process generates and consumes a root control group (cgroup) and acts as a cgroup manager.systemd has a tight integration with cgroups and allocates a cgroup per systemd unit. As a result, if you use systemd as the init system with the cgroupfs driver, the system gets two different cgroup managers.Two cgroup managers result in two views of the available and in-use resources in the system. In some cases, nodes that are configured to use cgroupfs for the kubelet and container runtime, but use systemd for the rest of the processes become unstable under resource pressure.The approach to mitigate this instability is to use systemd as the cgroup driver for the kubelet and the container runtime when systemd is the selected init system.To set systemd as the cgroup driver, edit the KubeletConfiguration option of cgroupDriver and set it to systemd. For example:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfig", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes/", "id": "k8s_00233"}
{"instruction": "Write a yaml example for container runtimes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\ncgroupDriver: systemd\n```\n\nContainer Runtimes | If you configure systemd as the cgroup driver for the kubelet, you must also configure systemd as the cgroup driver for the container runtime. Refer to the documentation for your container runtime for", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes/", "id": "k8s_00233_code_3001"}
{"instruction": "Write a bash example for container runtimes", "response": "Here's a bash example:\n\n```bash\n# sysctl params required by setup, params persist across reboots\ncat <<EOF | sudo tee /etc/sysctl.d/k8s.conf\nnet.ipv4.ip_forward = 1\nEOF\n\n# Apply sysctl params without reboot\nsudo sysctl --system\n```\n\nContainer Runtimes | Verify that net.ipv4.ip_forward is set to 1 with:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes/", "id": "k8s_00233_code_3002"}
{"instruction": "Write a bash example for container runtimes", "response": "Here's a bash example:\n\n```bash\nsysctl net.ipv4.ip_forward\n```\n\nContainer Runtimes | On Linux, control groups are used to constrain resources that are allocated to processes.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes/", "id": "k8s_00233_code_3003"}
{"instruction": "Write a yaml example for container runtimes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\ncgroupDriver: systemd\n```\n\nContainer Runtimes | If you configure systemd as the cgroup driver for the kubelet, you must also configure systemd as the cgroup driver for the container runtime. Refer to the documentation for your container runtime for", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes/", "id": "k8s_00233_code_3004"}
{"instruction": "Write a yaml example for container runtimes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\ncgroupDriver: systemd\n```\n\nContainer Runtimes | If you configure systemd as the cgroup driver for the kubelet, you must also configure systemd as the cgroup driver for the container runtime. Refer to the documentation for your container runtime for", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes/", "id": "k8s_00233_code_3005"}
{"instruction": "Explain the Kubernetes concept: Volume Snapshot Classes", "response": "Volume Snapshot ClassesThis document describes the concept of VolumeSnapshotClass in Kubernetes. Familiarity with volume snapshots and storage classes is suggested.IntroductionJust like StorageClass provides a way for administrators to describe the \"classes\" of storage they offer when provisioning a volume, VolumeSnapshotClass provides a way to describe the \"classes\" of storage when provisioning a volume snapshot.The VolumeSnapshotClass ResourceEach VolumeSnapshotClass contains the fields driver, deletionPolicy, and parameters, which are used when a VolumeSnapshot belonging to the class needs to be dynamically provisioned.The name of a VolumeSnapshotClass object is significant, and is how users can request a particular class. Administrators set the name and other parameters of a class when first creating VolumeSnapshotClass objects, and the objects cannot be updated once they are created.Note:Installation of the CRDs is the responsibility of the Kubernetes distribution. Without the required CRDs present, the creation of a VolumeSnapshotClass fails.apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshotClass metadata: name: csi-hostpath-snapclass driver: hostpath.csi.k8s.io deletionPolicy: Delete parameters: Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" annotation:apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshotClass metadata: name: csi-hostpath-snapclass annotations: snapshot.storage.kubernetes.io/is-default-class: \"true\" driver: hostpath.csi.k8s.io deletionPolicy: Delete parameters: If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.VolumeSnapshotClass dependenciesWhen you create a VolumeSnapshot without specifying a VolumeSnapshotClass, Kubernetes automatically selects a default VolumeSnapshotClass that has a CSI driver matching the CSI driver of the PVC’s StorageClass.This behavior allows multiple default VolumeSnapshotClass objects to coexist in a cluster, as long as each one is associated with a unique CSI driver.Always ensure that there is only one default VolumeSnapshotClass for each CSI driver. If multiple default VolumeSnapshotClass objects are created using the same CSI driver, a VolumeSnapshot creation will fail because Kubernetes cannot determine which one to use.DriverVolume snapshot classes have a driver that determines what CSI volume plugin is used for provisioning VolumeSnapshots. This field must be specified.DeletionPolicyVolume snapshot classes have a deletionPolicy. It enables you to configure what happens to a VolumeSnapshotContent when the VolumeSnapshot object it is bound to is to be deleted. The deletionPolicy of a volume snapshot class can either be Retain or Delete. This field must be specified.If the deletionPolicy is Delete, then the underlying storage snapshot will be deleted along with the VolumeSnapshotContent object. If the deletionPolicy is Retain, then both the underlying snapshot and VolumeSnapshotContent remain.ParametersVolume snapshot classes have parameters that describe volume snapshots belonging to the volume snapshot class. Different parameters may be accepted depending on the driver.", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes/", "id": "k8s_00234"}
{"instruction": "Write a yaml example for volume snapshot classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\nVolume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes/", "id": "k8s_00234_code_3007"}
{"instruction": "Write a yaml example for volume snapshot classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\nVolume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes/", "id": "k8s_00234_code_3008"}
{"instruction": "Write a yaml example for volume snapshot classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\nVolume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes/", "id": "k8s_00234_code_3009"}
{"instruction": "Write a yaml example for volume snapshot classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\nVolume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes/", "id": "k8s_00234_code_3010"}
{"instruction": "Write a yaml example for volume snapshot classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\nVolume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes/", "id": "k8s_00234_code_3011"}
{"instruction": "Write a yaml example for volume snapshot classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\nVolume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes/", "id": "k8s_00234_code_3012"}
{"instruction": "How do you securing a cluster in Kubernetes?", "response": "Securing a ClusterThis document covers topics related to protecting a cluster from accidental or malicious access and provides recommendations on overall security.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Controlling access to the Kubernetes APIAs Kubernetes is entirely API-driven, controlling and limiting who can access the cluster and what actions they are allowed to perform is the first line of defense.Use Transport Layer Security (TLS) for all API trafficKubernetes expects that all API communication in the cluster is encrypted by default with TLS, and the majority of installation methods will allow the necessary certificates to be created and distributed to the cluster components. Note that some components and installation methods may enable local ports over HTTP and administrators should familiarize themselves with the settings of each component to identify potentially unsecured traffic.API AuthenticationChoose an authentication mechanism for the API servers to use that matches the common access patterns when you install a cluster. For instance, small, single-user clusters may wish to use a simple certificate or static Bearer token approach. Larger clusters may wish to integrate an existing OIDC or LDAP server that allow users to be subdivided into groups.All API clients must be authenticated, even those that are part of the infrastructure like nodes, proxies, the scheduler, and volume plugins. These clients are typically service accounts or use x509 client certificates, and they are created automatically at cluster startup or are setup as part of the cluster installation.Consult the authentication reference document for more information.API AuthorizationOnce authenticated, every API call is also expected to pass an authorization check. Kubernetes ships an integrated Role-Based Access Control (RBAC) component that matches an incoming user or group to a set of permissions bundled into roles. These permissions combine verbs (get, create, delete) with resources (pods, services, nodes) and can be namespace-scoped or cluster-scoped. A set of out-of-the-box roles are provided that offer reasonable default separation of responsibility depending on what actions a client might want to perform. It is recommended that you use the Node and RBAC authorizers together, in combination with the NodeRestriction admission plugin.As with authentication, simple and broad roles may be appropriate for smaller clusters, but as more users interact with the cluster, it may become necessary to separate teams into separate namespaces with more limited roles.With authorization, it is important to understand how updates on one object may cause actions in other places. For instance, a user may not be able to create pods directly, but allowing them to create a deployment, which creates pods on their behalf, will let them create those pods indirectly. Likewise, deleting a node from the API will result in the pods scheduled to that node being terminated and recreated on other nodes. The out-of-the box roles represent a balance between flexibility and common use cases, but more limited roles should be carefully reviewed to prevent accidental escalation. You can make roles specific to your use case if the out-of-box ones don't meet your needs.Consult the authorization reference section for more information.Controlling access to the KubeletKubelets expose HTTPS endpoints which grant powerful control over the node and containers. By default Kubelets allow unauthenticated access to this API.Production clusters should enable Kub", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/securing-a-cluster/", "id": "k8s_00235"}
{"instruction": "Explain troubleshooting kubeadm in Kubernetes", "response": "Troubleshooting kubeadmAs with any program, you might run into an error installing or running kubeadm. This page lists some common failure scenarios and have provided steps that can help you understand and fix the problem.If your problem is not listed below, please follow the following steps:If you think your problem is a bug with kubeadm:Go to github.com/kubernetes/kubeadm and search for existing issues.If no issue exists, please open one and follow the issue template.If you are unsure about how kubeadm works, you can ask on Slack in #kubeadm, or open a question on StackOverflow. Please include relevant tags like #kubernetes and #kubeadm so folks can help you.Not possible to join a v1.18 Node to a v1.17 cluster due to missing RBACIn v1.18 kubeadm added prevention for joining a Node in the cluster if a Node with the same name already exists. This required adding RBAC for the bootstrap-token user to be able to GET a Node object.However this causes an issue where kubeadm join from v1.18 cannot join a cluster created by kubeadm v1.17.To workaround the issue you have two options:Execute kubeadm init phase bootstrap-token on a control-plane node using kubeadm v1.18. Note that this enables the rest of the bootstrap-token permissions as well.orApply the following RBAC manually using kubectl apply -f ...:apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: kubeadm:get-nodes rules: - apiGroups: - \"\" resources: - nodes verbs: - get --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: kubeadm:get-nodes roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: kubeadm:get-nodes subjects: - apiGroup: rbac.authorization.k8s.io kind: Group name: system:bootstrappers:kubeadm:default-node-token ebtables or some similar executable not found during installationIf you see the following warnings while running kubeadm init[preflight] WARNING: ebtables not found in system path [preflight] WARNING: ethtool not found in system path Then you may be missing ebtables, ethtool or a similar executable on your node. You can install them with the following commands:For Ubuntu/Debian users, run apt install ebtables ethtool.For CentOS/Fedora users, run yum install ebtables ethtool.kubeadm blocks waiting for control plane during installationIf you notice that kubeadm init hangs after printing out the following line:[apiclient] Created API client, waiting for the control plane to become ready This may be caused by a number of problems. The most common are:network connection problems. Check that your machine has full network connectivity before continuing.the cgroup driver of the container runtime differs from that of the kubelet. To understand how to configure it properly, see Configuring a cgroup driver.control plane containers are crashlooping or hanging. You can check this by running docker ps and investigating each container by running docker logs. For other container runtime, see Debugging Kubernetes nodes with crictl.kubeadm blocks when removing managed containersThe following could happen if the container runtime halts and does not remove any Kubernetes-managed containers:sudo kubeadm reset [preflight] Running pre-flight checks [reset] Stopping the kubelet service [reset] Unmounting mounted directories in \"/var/lib/kubelet\" [reset] Removing kubernetes-managed containers (block) A possible solution is to restart the container runtime and then re-run kubeadm reset. You can also use crictl to debug the state of the container runtime. See Debugging Kubernetes nodes with crictl.Pods in RunContainerError, CrashLoopBackOff or Error stateRight after kubeadm init there should not be any pods in these states.If there are pods in one of these states right after kubeadm init, please open an issue in the kubeadm repo. coredns (or kube-dns) should be in the Pending state until you have deployed the network add-on.If you see Pods in the RunContainerError, CrashLoopBackOff or Error state after deploying th", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: kubeadm:get-nodes\nrules:\n  - apiGroups:\n      - \"\"\n    resources:\n      - nodes\n    verbs:\n      - get\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: kubeadm:get-nodes\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: kubeadm:get-nodes\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: Group\n    name: system:bootstrappers:kubeadm:default-node-token\n```\n\nTroubleshooting kubeadm | If you see the following warnings while running kubeadm init", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3015"}
{"instruction": "Write a bash example for troubleshooting kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get deployment coredns -o yaml | \\\n  sed 's/allowPrivilegeEscalation: false/allowPrivilegeEscalation: true/g' | \\\n  kubectl apply -f -\n```\n\nTroubleshooting kubeadm | Another cause for CoreDNS to have CrashLoopBackOff is when a CoreDNS Pod deployed in Kubernetes detects a loop. A number of workarounds are available to avoid Kubernetes trying to restart the CoreDNS", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3016"}
{"instruction": "Write a bash example for troubleshooting kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system patch ds kube-proxy -p='{\n  \"spec\": {\n    \"template\": {\n      \"spec\": {\n        \"tolerations\": [\n          {\n            \"key\": \"CriticalAddonsOnly\",\n            \"operator\": \"Exists\"\n          },\n          {\n            \"effect\": \"NoSchedule\",\n            \"key\": \"node-role.kubernetes.io/control-plane\"\n          }\n        ]\n      }\n    }\n  }\n}'\n```\n\nTroubleshooting kubeadm | The tracking issue for this problem is here.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3017"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"flex-volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n```\n\nTroubleshooting kubeadm | On joining Nodes:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3018"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n```\n\nTroubleshooting kubeadm | Alternatively, you can modify /etc/fstab to make the /usr mount writeable, but please be advised that this is modifying a design principle of the Linux distribution.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3019"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: kubeadm:get-nodes\nrules:\n  - apiGroups:\n      - \"\"\n    resources:\n      - nodes\n    verbs:\n      - get\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: kubeadm:get-nodes\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: kubeadm:get-nodes\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: Group\n    name: system:bootstrappers:kubeadm:default-node-token\n```\n\nTroubleshooting kubeadm | If you see the following warnings while running kubeadm init", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3020"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\nclient-certificate: /var/lib/kubelet/pki/kubelet-client-current.pem\nclient-key: /var/lib/kubelet/pki/kubelet-client-current.pem\n```\n\nTroubleshooting kubeadm | Restart the kubelet.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3021"}
{"instruction": "Write a bash example for troubleshooting kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get deployment coredns -o yaml | \\\n  sed 's/allowPrivilegeEscalation: false/allowPrivilegeEscalation: true/g' | \\\n  kubectl apply -f -\n```\n\nTroubleshooting kubeadm | Another cause for CoreDNS to have CrashLoopBackOff is when a CoreDNS Pod deployed in Kubernetes detects a loop. A number of workarounds are available to avoid Kubernetes trying to restart the CoreDNS", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3022"}
{"instruction": "Write a bash example for troubleshooting kubeadm", "response": "Here's a bash example:\n\n```bash\nsudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo\nyum install docker-ce-18.06.1.ce-3.el7.x86_64\n```\n\nTroubleshooting kubeadm | kubeadm init flags such as --component-extra-args allow you to pass custom arguments to a control-plane component like the kube-apiserver. However, this mechanism is limited due to the underlying type", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3023"}
{"instruction": "Write a bash example for troubleshooting kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system patch ds kube-proxy -p='{\n  \"spec\": {\n    \"template\": {\n      \"spec\": {\n        \"tolerations\": [\n          {\n            \"key\": \"CriticalAddonsOnly\",\n            \"operator\": \"Exists\"\n          },\n          {\n            \"effect\": \"NoSchedule\",\n            \"key\": \"node-role.kubernetes.io/control-plane\"\n          }\n        ]\n      }\n    }\n  }\n}'\n```\n\nTroubleshooting kubeadm | The tracking issue for this problem is here.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3024"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"flex-volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n```\n\nTroubleshooting kubeadm | On joining Nodes:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3025"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n```\n\nTroubleshooting kubeadm | Alternatively, you can modify /etc/fstab to make the /usr mount writeable, but please be advised that this is modifying a design principle of the Linux distribution.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3026"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: kubeadm:get-nodes\nrules:\n  - apiGroups:\n      - \"\"\n    resources:\n      - nodes\n    verbs:\n      - get\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: kubeadm:get-nodes\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: kubeadm:get-nodes\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: Group\n    name: system:bootstrappers:kubeadm:default-node-token\n```\n\nTroubleshooting kubeadm | If you see the following warnings while running kubeadm init", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3027"}
{"instruction": "Write a bash example for troubleshooting kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get deployment coredns -o yaml | \\\n  sed 's/allowPrivilegeEscalation: false/allowPrivilegeEscalation: true/g' | \\\n  kubectl apply -f -\n```\n\nTroubleshooting kubeadm | Another cause for CoreDNS to have CrashLoopBackOff is when a CoreDNS Pod deployed in Kubernetes detects a loop. A number of workarounds are available to avoid Kubernetes trying to restart the CoreDNS", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3028"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"flex-volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n```\n\nTroubleshooting kubeadm | On joining Nodes:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3029"}
{"instruction": "Write a yaml example for troubleshooting kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\nnodeRegistration:\n  kubeletExtraArgs:\n  - name: \"volume-plugin-dir\"\n    value: \"/opt/libexec/kubernetes/kubelet-plugins/volume/exec/\"\n```\n\nTroubleshooting kubeadm | Alternatively, you can modify /etc/fstab to make the /usr mount writeable, but please be advised that this is modifying a design principle of the Linux distribution.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/", "id": "k8s_00236_code_3030"}
{"instruction": "How do you manual rotation of ca certificates in Kubernetes?", "response": "Manual Rotation of CA CertificatesThis page shows how to manually rotate the certificate authority (CA) certificates.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesFor more information about authentication in Kubernetes, see Authenticating.For more information about best practices for CA certificates, see Single root CA.Rotate the CA certificates manuallyCaution:Make sure to back up your certificate directory along with configuration files and any other necessary files.This approach assumes operation of the Kubernetes control plane in a HA configuration with multiple API servers. Graceful termination of the API server is also assumed so clients can cleanly disconnect from one API server and reconnect to another.Configurations with a single API server will experience unavailability while the API server is being restarted.Distribute the new CA certificates and private keys (for example: ca.crt, ca.key, front-proxy-ca.crt, and front-proxy-ca.key) to all your control plane nodes in the Kubernetes certificates directory.Update the --root-ca-file flag for the kube-controller-manager to include both old and new CA, then restart the kube-controller-manager.Any ServiceAccount created after this point will get Secrets that include both old and new CAs.Note:The files specified by the kube-controller-manager flags --client-ca-file and --cluster-signing-cert-file cannot be CA bundles. If these flags and --root-ca-file point to the same ca.crt file which is now a bundle (includes both old and new CA) you will face an error. To workaround this problem you can copy the new CA to a separate file and make the flags --client-ca-file and --cluster-signing-cert-file point to the copy. Once ca.crt is no longer a bundle you can restore the problem flags to point to ca.crt and delete the copy.Issue 1350 for kubeadm tracks an bug with the kube-controller-manager being unable to accept a CA bundle.Wait for the controller manager to update ca.crt in the service account Secrets to include both old and new CA certificates.If any Pods are started before new CA is used by API servers, the new Pods get this update and will trust both old and new CAs.Restart all pods using in-cluster configurations (for example: kube-proxy, CoreDNS, etc) so they can use the updated certificate authority data from Secrets that link to ServiceAccounts.Make sure CoreDNS, kube-proxy and other Pods using in-cluster configurations are working as expected.Append the both old and new CA to the file against --client-ca-file and --kubelet-certificate-authority flag in the kube-apiserver configuration.Append the both old and new CA to the file against --client-ca-file flag in the kube-scheduler configuration.Update certificates for user accounts by replacing the content of client-certificate-data and client-key-data respectively.For information about creating certificates for individual user accounts, see Configure certificates for user accounts.Additionally, update the certificate-authority-data section in the kubeconfig files, respectively with Base64-encoded old and new certificate authority dataUpdate the --root-ca-file flag for the Cloud Controller Manager to include both old and new CA, then restart the cloud-controller-manager.Note:If your cluster does not have a cloud-controller-manager, you can skip this step.Follow the steps below in a rolling fashion.Restart any other aggregated API servers or webhook handlers to trust the new CA certificates.Restart the kubelet by update the file against clientCAFile in kubelet configuration and certificate-authority-data in kubelet.conf to use both the old", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/manual-rotation-of-ca-certificates/", "id": "k8s_00237"}
{"instruction": "What is the reference documentation for kubectl rollout pause?", "response": "kubectl rollout pauseSynopsisMark the provided resource as paused.Paused resources will not be reconciled by a controller. Use \"kubectl rollout resume\" to resume a paused resource. Currently only deployments support being paused.kubectl rollout pause RESOURCE Examples # Mark the nginx deployment as paused # Any current state of the deployment will continue its function; new updates # to the deployment will not have an effect as long as the deployment is paused kubectl rollout pause deployment/nginx Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--field-manager string Default: \"kubectl-rollout\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for pause-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-ho", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_pause/", "id": "k8s_00238"}
{"instruction": "Write a bash example for kubectl rollout pause", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause RESOURCE\n```\n\nkubectl rollout pause | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_pause/", "id": "k8s_00238_code_3033"}
{"instruction": "Write a bash example for kubectl rollout pause", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause RESOURCE\n```\n\nkubectl rollout pause | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_pause/", "id": "k8s_00238_code_3034"}
{"instruction": "How do you declarative management of kubernetes objects using kustomize in Kubernetes?", "response": "Declarative Management of Kubernetes Objects Using KustomizeKustomize is a standalone tool to customize Kubernetes objects through a kustomization file.Since 1.14, kubectl also supports the management of Kubernetes objects using a kustomization file. To view resources found in a directory containing a kustomization file, run the following command:kubectl kustomize <kustomization_directory> To apply those resources, run kubectl apply with --kustomize or -k flag:kubectl apply -k <kustomization_directory> Before you beginInstall kubectl.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Overview of KustomizeKustomize is a tool for customizing Kubernetes configurations. It has the following features to manage application configuration files:generating resources from other sourcessetting cross-cutting fields for resourcescomposing and customizing collections of resourcesGenerating ResourcesConfigMaps and Secrets hold configuration or sensitive data that are used by other Kubernetes objects, such as Pods. The source of truth of ConfigMaps or Secrets are usually external to a cluster, such as a .properties file or an SSH keyfile. Kustomize has secretGenerator and configMapGenerator, which generate Secret and ConfigMap from files or literals.configMapGeneratorTo generate a ConfigMap from a file, add an entry to the files list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .properties file:# Create a application.properties file cat <<EOF >application.properties FOO=Bar EOF cat <<EOF >./kustomization.yaml configMapGenerator: - name: example-configmap-1 files: - application.properties EOF The generated ConfigMap can be examined with the following command:kubectl kustomize ./ The generated ConfigMap is:apiVersion: v1 data: application.properties: | FOO=Bar kind: ConfigMap metadata: name: example-configmap-1-8mbdf7882g To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:# Create a .env file cat <<EOF >.env FOO=Bar EOF cat <<EOF >./kustomization.yaml configMapGenerator: - name: example-configmap-1 envs: - .env EOF The generated ConfigMap can be examined with the following command:kubectl kustomize ./ The generated ConfigMap is:apiVersion: v1 data: FOO: Bar kind: ConfigMap metadata: name: example-configmap-1-42cfbf598f Note:Each variable in the .env file becomes a separate key in the ConfigMap that you generate. This is different from the previous example which embeds a file named application.properties (and all its entries) as the value for a single key.ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a key-value pair:cat <<EOF >./kustomization.yaml configMapGenerator: - name: example-configmap-2 literals: - FOO=Bar EOF The generated ConfigMap can be checked by the following command:kubectl kustomize ./ The generated ConfigMap is:apiVersion: v1 data: FOO: Bar kind: ConfigMap metadata: name: example-configmap-2-g2hdhfc6tk To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.This is an example deployment that uses a generated ConfigMap:# Create an application.properties file cat <<EOF >application.properties FOO=Bar EOF cat <<EOF >deployment.yaml apiVersion: apps/v1 k", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <kustomization_directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To apply those resources, run kubectl apply with --kustomize or -k flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3036"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization_directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Install kubectl.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3037"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3038"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3039"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3040"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3041"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3042"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3043"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3044"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a password.txt file\ncat <<EOF >./password.txt\nusername=admin\npassword=secret\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: password\n          mountPath: /secrets\n      volumes:\n      - name: password\n        secret:\n          secretName: example-secret-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nsecretGenerator:\n- name: example-secret-1\n  files:\n  - password.txt\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | The generated ConfigMaps and Secrets have a content hash suffix appended. This ensures that a new ConfigMap or Secret is generated when the contents are changed. To disable the behavior of appending a", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3045"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3046"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml\ncat <<EOF >./deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamespace: my-namespace\nnamePrefix: dev-\nnameSuffix: \"-001\"\nlabels:\n  - pairs:\n      app: bingo\n    includeSelectors: true \ncommonAnnotations:\n  oncallPager: 800-555-1212\nresources:\n- deployment.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view those fields are all set in the Deployment Resource:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3047"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3048"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\n# Create a kustomization.yaml composing them\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | The resources from kubectl kustomize ./ contain both the Deployment and the Service objects.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3049"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a patch increase_replicas.yaml\ncat <<EOF > increase_replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\nEOF\n\n# Create another patch set_memory.yaml\ncat <<EOF > set_memory.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  template:\n    spec:\n      containers:\n      - name: my-nginx\n        resources:\n          limits:\n            memory: 512Mi\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\npatches:\n  - path: increase_replicas.yaml\n  - path: set_memory.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3050"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3051"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a json patch\ncat <<EOF > patch.yaml\n- op: replace\n  path: /spec/replicas\n  value: 3\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n\npatches:\n- target:\n    group: apps\n    version: v1\n    kind: Deployment\n    name: my-nginx\n  path: patch.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see the replicas field is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3052"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3053"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nimages:\n- name: nginx\n  newName: my.image.registry/nginx\n  newTag: \"1.4.0\"\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the image being used is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3054"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3055"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file (quoting the here doc delimiter)\ncat <<'EOF' > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        command: [\"start\", \"--host\", \"MY_SERVICE_NAME_PLACEHOLDER\"]\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nnameSuffix: \"-001\"\n\nresources:\n- deployment.yaml\n- service.yaml\n\nreplacements:\n- source:\n    kind: Service\n    name: my-nginx\n    fieldPath: metadata.name\n  targets:\n  - select:\n      kind: Deployment\n      name: my-nginx\n    fieldPaths:\n    - spec.template.spec.containers.0.command.2\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the Service name injected into containers is dev-my-nginx-001:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3056"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3057"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a directory to hold the base\nmkdir base\n# Create a base/deployment.yaml\ncat <<EOF > base/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\nEOF\n\n# Create a base/service.yaml file\ncat <<EOF > base/service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n# Create a base/kustomization.yaml\ncat <<EOF > base/kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | This base can be used in multiple overlays. You can add different namePrefix or other cross-cutting fields in different overlays. Here are two overlays using the same base.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3058"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization directory>/\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Given the following kustomization.yaml,", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3059"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nlabels:\n  - pairs:\n      app: my-nginx\n    includeSelectors: true \nresources:\n- deployment.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run the following command to apply the Deployment object dev-my-nginx:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3060"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl describe -k ./\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run the following command to compare the Deployment object dev-my-nginx against the state that the cluster would be in if the manifest was applied:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3061"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3062"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3063"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3064"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3065"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3066"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3067"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3068"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3069"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3070"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3071"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3072"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3073"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3074"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <kustomization_directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To apply those resources, run kubectl apply with --kustomize or -k flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3075"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization_directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Install kubectl.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3076"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3077"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3078"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3079"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3080"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3081"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3082"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3083"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a password.txt file\ncat <<EOF >./password.txt\nusername=admin\npassword=secret\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: password\n          mountPath: /secrets\n      volumes:\n      - name: password\n        secret:\n          secretName: example-secret-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nsecretGenerator:\n- name: example-secret-1\n  files:\n  - password.txt\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | The generated ConfigMaps and Secrets have a content hash suffix appended. This ensures that a new ConfigMap or Secret is generated when the contents are changed. To disable the behavior of appending a", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3084"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3085"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml\ncat <<EOF >./deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamespace: my-namespace\nnamePrefix: dev-\nnameSuffix: \"-001\"\nlabels:\n  - pairs:\n      app: bingo\n    includeSelectors: true \ncommonAnnotations:\n  oncallPager: 800-555-1212\nresources:\n- deployment.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view those fields are all set in the Deployment Resource:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3086"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3087"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\n# Create a kustomization.yaml composing them\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | The resources from kubectl kustomize ./ contain both the Deployment and the Service objects.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3088"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a patch increase_replicas.yaml\ncat <<EOF > increase_replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\nEOF\n\n# Create another patch set_memory.yaml\ncat <<EOF > set_memory.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  template:\n    spec:\n      containers:\n      - name: my-nginx\n        resources:\n          limits:\n            memory: 512Mi\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\npatches:\n  - path: increase_replicas.yaml\n  - path: set_memory.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3089"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3090"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a json patch\ncat <<EOF > patch.yaml\n- op: replace\n  path: /spec/replicas\n  value: 3\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n\npatches:\n- target:\n    group: apps\n    version: v1\n    kind: Deployment\n    name: my-nginx\n  path: patch.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see the replicas field is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3091"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3092"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nimages:\n- name: nginx\n  newName: my.image.registry/nginx\n  newTag: \"1.4.0\"\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the image being used is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3093"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3094"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file (quoting the here doc delimiter)\ncat <<'EOF' > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        command: [\"start\", \"--host\", \"MY_SERVICE_NAME_PLACEHOLDER\"]\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nnameSuffix: \"-001\"\n\nresources:\n- deployment.yaml\n- service.yaml\n\nreplacements:\n- source:\n    kind: Service\n    name: my-nginx\n    fieldPath: metadata.name\n  targets:\n  - select:\n      kind: Deployment\n      name: my-nginx\n    fieldPaths:\n    - spec.template.spec.containers.0.command.2\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the Service name injected into containers is dev-my-nginx-001:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3095"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3096"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a directory to hold the base\nmkdir base\n# Create a base/deployment.yaml\ncat <<EOF > base/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\nEOF\n\n# Create a base/service.yaml file\ncat <<EOF > base/service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n# Create a base/kustomization.yaml\ncat <<EOF > base/kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | This base can be used in multiple overlays. You can add different namePrefix or other cross-cutting fields in different overlays. Here are two overlays using the same base.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3097"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization directory>/\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Given the following kustomization.yaml,", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3098"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using kustomize", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nlabels:\n  - pairs:\n      app: my-nginx\n    includeSelectors: true \nresources:\n- deployment.yaml\nEOF\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run the following command to apply the Deployment object dev-my-nginx:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3099"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl describe -k ./\n```\n\nDeclarative Management of Kubernetes Objects Using Kustomize | Run the following command to compare the Deployment object dev-my-nginx against the state that the cluster would be in if the manifest was applied:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/", "id": "k8s_00239_code_3100"}
{"instruction": "What is the reference documentation for tls bootstrapping?", "response": "TLS bootstrappingIn a Kubernetes cluster, the components on the worker nodes - kubelet and kube-proxy - need to communicate with Kubernetes control plane components, specifically kube-apiserver. In order to ensure that communication is kept private, not interfered with, and ensure that each component of the cluster is talking to another trusted component, we strongly recommend using client TLS certificates on nodes.The normal process of bootstrapping these components, especially worker nodes that need certificates so they can communicate safely with kube-apiserver, can be a challenging process as it is often outside of the scope of Kubernetes and requires significant additional work. This in turn, can make it challenging to initialize or scale a cluster.In order to simplify the process, beginning in version 1.4, Kubernetes introduced a certificate request and signing API. The proposal can be found here.This document describes the process of node initialization, how to set up TLS client certificate bootstrapping for kubelets, and how it works.Initialization processWhen a worker node starts up, the kubelet does the following:Look for its kubeconfig fileRetrieve the URL of the API server and credentials, normally a TLS key and signed certificate from the kubeconfig fileAttempt to communicate with the API server using the credentials.Assuming that the kube-apiserver successfully validates the kubelet's credentials, it will treat the kubelet as a valid node, and begin to assign pods to it.Note that the above process depends upon:Existence of a key and certificate on the local host in the kubeconfigThe certificate having been signed by a Certificate Authority (CA) trusted by the kube-apiserverAll of the following are responsibilities of whoever sets up and manages the cluster:Creating the CA key and certificateDistributing the CA certificate to the control plane nodes, where kube-apiserver is runningCreating a key and certificate for each kubelet; strongly recommended to have a unique one, with a unique CN, for each kubeletSigning the kubelet certificate using the CA keyDistributing the kubelet key and signed certificate to the specific node on which the kubelet is runningThe TLS Bootstrapping described in this document is intended to simplify, and partially or even completely automate, steps 3 onwards, as these are the most common when initializing or scaling a cluster.Bootstrap initializationIn the bootstrap initialization process, the following occurs:kubelet beginskubelet sees that it does not have a kubeconfig filekubelet searches for and finds a bootstrap-kubeconfig filekubelet reads its bootstrap file, retrieving the URL of the API server and a limited usage \"token\"kubelet connects to the API server, authenticates using the tokenkubelet now has limited credentials to create and retrieve a certificate signing request (CSR)kubelet creates a CSR for itself with the signerName set to kubernetes.io/kube-apiserver-client-kubeletCSR is approved in one of two ways:If configured, kube-controller-manager automatically approves the CSRIf configured, an outside process, possibly a person, approves the CSR using the Kubernetes API or via kubectlCertificate is created for the kubeletCertificate is issued to the kubeletkubelet retrieves the certificatekubelet creates a proper kubeconfig with the key and signed certificatekubelet begins normal operationOptional: if configured, kubelet automatically requests renewal of the certificate when it is close to expiryThe renewed certificate is approved and issued, either automatically or manually, depending on configuration.The rest of this document describes the necessary steps to configure TLS Bootstrapping, and its limitations.ConfigurationTo configure for TLS bootstrapping and optional automatic approval, you must configure options on the following components:kube-apiserverkube-controller-managerkubeletin-cluster resources: ClusterRoleBinding and potentially ClusterRoleIn addition, you need your", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# enable bootstrapping nodes to create CSR\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: create-csrs-for-bootstrapping\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:node-bootstrapper\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | While the apiserver receives the requests for certificates from the kubelet and authenticates those requests, the controller-manager is responsible for issuing actual signed certificates.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3102"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# Approve all CSRs for the group \"system:bootstrappers\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-csrs-for-group\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:nodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | To enable the kubelet to renew its own client certificate, create a ClusterRoleBinding that binds the group in which the fully functioning node is a member system:nodes to the ClusterRole that grants", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3103"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# Approve renewal CSRs for the group \"system:nodes\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-renewals-for-nodes\nsubjects:\n- kind: Group\n  name: system:nodes\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:selfnodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | The csrapproving controller that ships as part of kube-controller-manager and is enabled by default. The controller uses the SubjectAccessReview API to determine if a given user is authorized to reque", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3104"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority: /var/lib/kubernetes/ca.pem\n    server: https://my.server.example.com:6443\n  name: bootstrap\ncontexts:\n- context:\n    cluster: bootstrap\n    user: kubelet-bootstrap\n  name: bootstrap\ncurrent-context: bootstrap\npreferences: {}\nusers:\n- name: kubelet-bootstrap\n  user:\n    token: 07401b.f395accd246ae52d\n```\n\nTLS bootstrapping | The important elements to note are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3105"}
{"instruction": "Write a bash example for tls bootstrapping", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-cluster bootstrap --server='https://my.server.example.com:6443' --certificate-authority=/var/lib/kubernetes/ca.pem\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-credentials kubelet-bootstrap --token=07401b.f395accd246ae52d\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-context bootstrap --user=kubelet-bootstrap --cluster=bootstrap\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig use-context bootstrap\n```\n\nTLS bootstrapping | To indicate to the kubelet to use the bootstrap kubeconfig, use the following kubelet flag:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3106"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# enable bootstrapping nodes to create CSR\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: create-csrs-for-bootstrapping\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:node-bootstrapper\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | While the apiserver receives the requests for certificates from the kubelet and authenticates those requests, the controller-manager is responsible for issuing actual signed certificates.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3107"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# Approve all CSRs for the group \"system:bootstrappers\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-csrs-for-group\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:nodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | To enable the kubelet to renew its own client certificate, create a ClusterRoleBinding that binds the group in which the fully functioning node is a member system:nodes to the ClusterRole that grants", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3108"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# Approve renewal CSRs for the group \"system:nodes\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-renewals-for-nodes\nsubjects:\n- kind: Group\n  name: system:nodes\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:selfnodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | The csrapproving controller that ships as part of kube-controller-manager and is enabled by default. The controller uses the SubjectAccessReview API to determine if a given user is authorized to reque", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3109"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority: /var/lib/kubernetes/ca.pem\n    server: https://my.server.example.com:6443\n  name: bootstrap\ncontexts:\n- context:\n    cluster: bootstrap\n    user: kubelet-bootstrap\n  name: bootstrap\ncurrent-context: bootstrap\npreferences: {}\nusers:\n- name: kubelet-bootstrap\n  user:\n    token: 07401b.f395accd246ae52d\n```\n\nTLS bootstrapping | The important elements to note are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3110"}
{"instruction": "Write a bash example for tls bootstrapping", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-cluster bootstrap --server='https://my.server.example.com:6443' --certificate-authority=/var/lib/kubernetes/ca.pem\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-credentials kubelet-bootstrap --token=07401b.f395accd246ae52d\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-context bootstrap --user=kubelet-bootstrap --cluster=bootstrap\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig use-context bootstrap\n```\n\nTLS bootstrapping | To indicate to the kubelet to use the bootstrap kubeconfig, use the following kubelet flag:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3111"}
{"instruction": "Write a bash example for tls bootstrapping", "response": "Here's a bash example:\n\n```bash\nkubectl describe csr <name>\n```\n\nTLS bootstrapping |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3112"}
{"instruction": "Write a bash example for tls bootstrapping", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <name>\n```\n\nTLS bootstrapping |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3113"}
{"instruction": "Write a bash example for tls bootstrapping", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny <name>\n```\n\nTLS bootstrapping |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3114"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# enable bootstrapping nodes to create CSR\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: create-csrs-for-bootstrapping\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:node-bootstrapper\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | While the apiserver receives the requests for certificates from the kubelet and authenticates those requests, the controller-manager is responsible for issuing actual signed certificates.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3115"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# Approve all CSRs for the group \"system:bootstrappers\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-csrs-for-group\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:nodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | To enable the kubelet to renew its own client certificate, create a ClusterRoleBinding that binds the group in which the fully functioning node is a member system:nodes to the ClusterRole that grants", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3116"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\n# Approve renewal CSRs for the group \"system:nodes\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-renewals-for-nodes\nsubjects:\n- kind: Group\n  name: system:nodes\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:selfnodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\nTLS bootstrapping | The csrapproving controller that ships as part of kube-controller-manager and is enabled by default. The controller uses the SubjectAccessReview API to determine if a given user is authorized to reque", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3117"}
{"instruction": "Write a yaml example for tls bootstrapping", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority: /var/lib/kubernetes/ca.pem\n    server: https://my.server.example.com:6443\n  name: bootstrap\ncontexts:\n- context:\n    cluster: bootstrap\n    user: kubelet-bootstrap\n  name: bootstrap\ncurrent-context: bootstrap\npreferences: {}\nusers:\n- name: kubelet-bootstrap\n  user:\n    token: 07401b.f395accd246ae52d\n```\n\nTLS bootstrapping | The important elements to note are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/", "id": "k8s_00240_code_3118"}
{"instruction": "What is the reference documentation for daemonset?", "response": "DaemonSetDaemonSet represents the configuration of a daemon set.apiVersion: apps/v1import \"k8s.io/api/apps/v1\"DaemonSetDaemonSet represents the configuration of a daemon set.apiVersion: apps/v1kind: DaemonSetmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (DaemonSetSpec)The desired behavior of this daemon set. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (DaemonSetStatus)The current status of this daemon set. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusDaemonSetSpecDaemonSetSpec is the specification of a daemon set.selector (LabelSelector), requiredA label query over pods that are managed by the daemon set. Must match in order to be controlled. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectorstemplate (PodTemplateSpec), requiredAn object that describes the pod that will be created. The DaemonSet will create exactly one copy of this pod on every node that matches the template's node selector (or on every node if no node selector is specified). The only allowed template.spec.restartPolicy value is \"Always\". More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-templateminReadySeconds (int32)The minimum number of seconds for which a newly created DaemonSet pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready).updateStrategy (DaemonSetUpdateStrategy)An update strategy to replace existing DaemonSet pods with new pods.DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet.updateStrategy.type (string)Type of daemon set update. Can be \"RollingUpdate\" or \"OnDelete\". Default is RollingUpdate.updateStrategy.rollingUpdate (RollingUpdateDaemonSet)Rolling update config params. Present only if type = \"RollingUpdate\".Spec to control the desired behavior of daemon set rolling update.updateStrategy.rollingUpdate.maxSurge (IntOrString)The maximum number of nodes with an existing available DaemonSet pod that can have an updated DaemonSet pod during during an update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up to a minimum of 1. Default value is 0. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their a new pod created before the old pod is marked as deleted. The update starts by launching new pods on 30% of nodes. Once an updated pod is available (Ready for at least minReadySeconds) the old DaemonSet pod on that node is marked deleted. If the old pod becomes unavailable for any reason (Ready transitions to false, is evicted, or is drained) an updated pod is immediately created on that node without considering surge limits. Allowing surge implies the possibility that the resources consumed by the daemonset on any given node can double if the readiness check fails, and so resource intensive daemonsets should take into account that they may cause evictions during disruption.IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.updateStrategy.rollingUpdate.maxUnavailable (IntOrString)The maximum number of DaemonSet pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage o", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/", "id": "k8s_00241"}
{"instruction": "What is the reference documentation for customresourcedefinition?", "response": "CustomResourceDefinitionCustomResourceDefinition represents a resource that should be exposed on the API server.apiVersion: apiextensions.k8s.io/v1import \"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\"CustomResourceDefinitionCustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format <.spec.name>.<.spec.group>.apiVersion: apiextensions.k8s.io/v1kind: CustomResourceDefinitionmetadata (ObjectMeta)Standard object's metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (CustomResourceDefinitionSpec), requiredspec describes how the user wants the resources to appearstatus (CustomResourceDefinitionStatus)status indicates the actual state of the CustomResourceDefinitionCustomResourceDefinitionSpecCustomResourceDefinitionSpec describes how a user wants their resource to appeargroup (string), requiredgroup is the API group of the defined custom resource. The custom resources are served under /apis/\\<group>/.... Must match the name of the CustomResourceDefinition (in the form \\<names.plural>.\\<group>).names (CustomResourceDefinitionNames), requirednames specify the resource and kind names for the custom resource.CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinitionnames.kind (string), requiredkind is the serialized kind of the resource. It is normally CamelCase and singular. Custom resource instances will use this value as the kind attribute in API calls.names.plural (string), requiredplural is the plural name of the resource to serve. The custom resources are served under /apis/\\<group>/\\<version>/.../\\<plural>. Must match the name of the CustomResourceDefinition (in the form \\<names.plural>.\\<group>). Must be all lowercase.names.categories ([]string)Atomic: will be replaced during a mergecategories is a list of grouped resources this custom resource belongs to (e.g. 'all'). This is published in API discovery documents, and used by clients to support invocations like kubectl get all.names.listKind (string)listKind is the serialized kind of the list for this resource. Defaults to \"kindList\".names.shortNames ([]string)Atomic: will be replaced during a mergeshortNames are short names for the resource, exposed in API discovery documents, and used by clients to support invocations like kubectl get \\<shortname>. It must be all lowercase.names.singular (string)singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased kind.scope (string), requiredscope indicates whether the defined custom resource is cluster- or namespace-scoped. Allowed values are Cluster and Namespaced.versions ([]CustomResourceDefinitionVersion), requiredAtomic: will be replaced during a mergeversions is the list of all API versions of the defined custom resource. Version names are used to compute the order in which served versions are listed in API discovery. If the version string is \"kube-like\", it will sort above non \"kube-like\" version strings, which are ordered lexicographically. \"Kube-like\" versions start with a \"v\", then are followed by a number (the major version), then optionally the string \"alpha\" or \"beta\" and another number (the minor version). These are sorted first by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.CustomResourceDefinitionVersion describes a version for CRD.versions.name (string), requiredname is the version name, e.g. “v1”, “v2beta1”, etc. The custom resources are served under this version at /apis/\\<group>/\\<version>/... if served is true.versions.served (boolean), requiredserved is a flag enabling/disabling this version from being served via REST APIsversions.storage (boolean), requiredstorage indicates this version should be used when pers", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1/", "id": "k8s_00242"}
{"instruction": "Write a yaml example for customresourcedefinition", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\n```\n\nCustomResourceDefinition | import \"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1/", "id": "k8s_00242_code_3121"}
{"instruction": "Write a bash example for customresourcedefinition", "response": "Here's a bash example:\n\n```bash\nkubectl get \\<shortname>\n```\n\nCustomResourceDefinition | names.singular (string)", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1/", "id": "k8s_00242_code_3122"}
{"instruction": "Write a bash example for customresourcedefinition", "response": "Here's a bash example:\n\n```bash\nkubectl get \\<shortname>\n```\n\nCustomResourceDefinition | acceptedNames.singular (string)", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1/", "id": "k8s_00242_code_3123"}
{"instruction": "Explain the Kubernetes concept: Overview", "response": "OverviewKubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.This page is an overview of Kubernetes.The name Kubernetes originates from Greek, meaning helmsman or pilot. K8s as an abbreviation results from counting the eight letters between the \"K\" and the \"s\". Google open-sourced the Kubernetes project in 2014. Kubernetes combines over 15 years of Google's experience running production workloads at scale with best-of-breed ideas and practices from the community.Why you need Kubernetes and what it can doContainers are a good way to bundle and run your applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if a container goes down, another container needs to start. Wouldn't it be easier if this behavior was handled by a system?That's how Kubernetes comes to the rescue! Kubernetes provides you with a framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more. For example: Kubernetes can easily manage a canary deployment for your system.Kubernetes provides you with:Service discovery and load balancing Kubernetes can expose a container using the DNS name or using their own IP address. If traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic so that the deployment is stable.Storage orchestration Kubernetes allows you to automatically mount a storage system of your choice, such as local storages, public cloud providers, and more.Automated rollouts and rollbacks You can describe the desired state for your deployed containers using Kubernetes, and it can change the actual state to the desired state at a controlled rate. For example, you can automate Kubernetes to create new containers for your deployment, remove existing containers and adopt all their resources to the new container.Automatic bin packing You provide Kubernetes with a cluster of nodes that it can use to run containerized tasks. You tell Kubernetes how much CPU and memory (RAM) each container needs. Kubernetes can fit containers onto your nodes to make the best use of your resources.Self-healing Kubernetes restarts containers that fail, replaces containers, kills containers that don't respond to your user-defined health check, and doesn't advertise them to clients until they are ready to serve.Secret and configuration management Kubernetes lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys. You can deploy and update secrets and application configuration without rebuilding your container images, and without exposing secrets in your stack configuration.Batch execution In addition to services, Kubernetes can manage your batch and CI workloads, replacing containers that fail, if desired.Horizontal scaling Scale your application up and down with a simple command, with a UI, or automatically based on CPU usage.IPv4/IPv6 dual-stack Allocation of IPv4 and IPv6 addresses to Pods and ServicesDesigned for extensibility Add features to your Kubernetes cluster without changing upstream source code.What Kubernetes is notKubernetes is not a traditional, all-inclusive PaaS (Platform as a Service) system. Since Kubernetes operates at the container level rather than at the hardware level, it provides some generally applicable features common to PaaS offerings, such as deployment, scaling, load balancing, and lets users integrate their logging, monitoring, and alerting solutions. However, Kubernetes is not monolithic, and these default solutions are optional and pluggable. Kubernetes provides the building blocks for building developer platforms, but preserves user choice and flexibility where ", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/", "id": "k8s_00243"}
{"instruction": "Explain installing kubeadm in Kubernetes", "response": "Installing kubeadm This page shows how to install the kubeadm toolbox. For information on how to create a cluster with kubeadm once you have performed this installation process, see the Creating a cluster with kubeadm page.This installation guide is for Kubernetes v1.34. If you want to use a different Kubernetes version, please refer to the following pages instead:Installing kubeadm (Kubernetes v1.33)Installing kubeadm (Kubernetes v1.32)Installing kubeadm (Kubernetes v1.31)Installing kubeadm (Kubernetes v1.30)Before you beginA compatible Linux host. The Kubernetes project provides generic instructions for Linux distributions based on Debian and Red Hat, and those distributions without a package manager.2 GB or more of RAM per machine (any less will leave little room for your apps).2 CPUs or more for control plane machines.Full network connectivity between all machines in the cluster (public or private network is fine).Unique hostname, MAC address, and product_uuid for every node. See here for more details.Certain ports are open on your machines. See here for more details.Note:The kubeadm installation is done via binaries that use dynamic linking and assumes that your target system provides glibc. This is a reasonable assumption on many Linux distributions (including Debian, Ubuntu, Fedora, CentOS, etc.) but it is not always the case with custom and lightweight distributions which don't include glibc by default, such as Alpine Linux. The expectation is that the distribution either includes glibc or a compatibility layer that provides the expected symbols.Check your OS versionNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.The kubeadm project supports LTS kernels. See List of LTS kernels.You can get the kernel version using the command uname -rFor more information, see Linux Kernel Requirements.The kubeadm project supports recent kernel versions. For a list of recent kernels, see Windows Server Release Information.You can get the kernel version (also called the OS version) using the command systeminfoFor more information, see Windows OS version compatibility.A Kubernetes cluster created by kubeadm depends on software that use kernel features. This software includes, but is not limited to the container runtime, the kubelet, and a Container Network Interface plugin.To help you avoid unexpected errors as a result of an unsupported kernel version, kubeadm runs the SystemVerification pre-flight check. This check fails if the kernel version is not supported.You may choose to skip the check, if you know that your kernel provides the required features, even though kubeadm does not support its version.Verify the MAC address and product_uuid are unique for every nodeYou can get the MAC address of the network interfaces using the command ip link or ifconfig -aThe product_uuid can be checked by using the command sudo cat /sys/class/dmi/id/product_uuidIt is very likely that hardware devices will have unique addresses, although some virtual machines may have identical values. Kubernetes uses these values to uniquely identify the nodes in the cluster. If these values are not unique to each node, the installation process may fail.Check network adaptersIf you have more than one network adapter, and your Kubernetes components are not reachable on the default route, we recommend you add IP route(s) so Kubernetes cluster addresses go via the appropriate adapter.Check required portsThese required ports need to be open in order for Kubernetes components to communicate with each other. You can use tools like netcat to check if a port is open. For example:nc 127.0.0.1 6443 -zv -w 2 The pod network plugin you use may also require certain ports to be open. Since this differs with each pod network plugin, ", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/", "id": "k8s_00244"}
{"instruction": "Write a bash example for installing kubeadm", "response": "Here's a bash example:\n\n```bash\nCNI_PLUGINS_VERSION=\"v1.3.0\"\nARCH=\"amd64\"\nDEST=\"/opt/cni/bin\"\nsudo mkdir -p \"$DEST\"\ncurl -L \"https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-${ARCH}-${CNI_PLUGINS_VERSION}.tgz\" | sudo tar -C \"$DEST\" -xz\n```\n\nInstalling kubeadm | Define the directory to download command files:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/", "id": "k8s_00244_code_3126"}
{"instruction": "Write a bash example for installing kubeadm", "response": "Here's a bash example:\n\n```bash\nDOWNLOAD_DIR=\"/usr/local/bin\"\nsudo mkdir -p \"$DOWNLOAD_DIR\"\n```\n\nInstalling kubeadm | Optionally install crictl (required for interaction with the Container Runtime Interface (CRI), optional for kubeadm):", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/", "id": "k8s_00244_code_3127"}
{"instruction": "Write a bash example for installing kubeadm", "response": "Here's a bash example:\n\n```bash\nCRICTL_VERSION=\"v1.31.0\"\nARCH=\"amd64\"\ncurl -L \"https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-${ARCH}.tar.gz\" | sudo tar -C $DOWNLOAD_DIR -xz\n```\n\nInstalling kubeadm | Install kubeadm, kubelet and add a kubelet systemd service:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/", "id": "k8s_00244_code_3128"}
{"instruction": "Write a bash example for installing kubeadm", "response": "Here's a bash example:\n\n```bash\nRELEASE=\"$(curl -sSL https://dl.k8s.io/release/stable.txt)\"\nARCH=\"amd64\"\ncd $DOWNLOAD_DIR\nsudo curl -L --remote-name-all https://dl.k8s.io/release/${RELEASE}/bin/linux/${ARCH}/{kubeadm,kubelet}\nsudo chmod +x {kubeadm,kubelet}\n\nRELEASE_VERSION=\"v0.16.2\"\ncurl -sSL \"https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/krel/templates/latest/kubelet/kubelet.service\" | sed \"s:/usr/bin:${DOWNLOAD_DIR}:g\" | sudo tee /usr/lib/systemd/system/kubelet.service\nsudo mkdir -p /usr/lib/systemd/system/kubelet.service.d\ncurl -sSL \"https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/krel/templates/latest/kubeadm/10-kubeadm.conf\" | sed \"s:/usr/bin:${DOWNLOAD_DIR}:g\" | sudo tee /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf\n```\n\nInstalling kubeadm | Install kubectl by following the instructions on Install Tools page.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/", "id": "k8s_00244_code_3129"}
{"instruction": "Write a bash example for installing kubeadm", "response": "Here's a bash example:\n\n```bash\nsudo systemctl enable --now kubelet\n```\n\nInstalling kubeadm | The kubelet is now restarting every few seconds, as it waits in a crashloop for kubeadm to tell it what to do.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/", "id": "k8s_00244_code_3130"}
{"instruction": "How do you encrypting confidential data at rest in Kubernetes?", "response": "Encrypting Confidential Data at RestAll of the APIs in Kubernetes that let you write persistent API resource data support at-rest encryption. For example, you can enable at-rest encryption for Secrets. This at-rest encryption is additional to any system-level encryption for the etcd cluster or for the filesystem(s) on hosts where you are running the kube-apiserver.This page shows how to enable and configure encryption of API data at rest.Note:This task covers encryption for resource data stored using the Kubernetes API. For example, you can encrypt Secret objects, including the key-value data they contain.If you want to encrypt data in filesystems that are mounted into containers, you instead need to either:use a storage integration that provides encrypted volumesencrypt the data within your own applicationBefore you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesThis task assumes that you are running the Kubernetes API server as a static pod on each control plane node.Your cluster's control plane must use etcd v3.x (major version 3, any minor version).To encrypt a custom resource, your cluster must be running Kubernetes v1.26 or newer.To use a wildcard to match resources, your cluster must be running Kubernetes v1.27 or newer.To check the version, enter kubectl version.Determine whether encryption at rest is already enabledBy default, the API server stores plain-text representations of resources into etcd, with no at-rest encryption.The kube-apiserver process accepts an argument --encryption-provider-config that specifies a path to a configuration file. The contents of that file, if you specify one, control how Kubernetes API data is encrypted in etcd. If you are running the kube-apiserver without the --encryption-provider-config command line argument, you do not have encryption at rest enabled. If you are running the kube-apiserver with the --encryption-provider-config command line argument, and the file that it references specifies the identity provider as the first encryption provider in the list, then you do not have at-rest encryption enabled (the default identity provider does not provide any confidentiality protection.)If you are running the kube-apiserver with the --encryption-provider-config command line argument, and the file that it references specifies a provider other than identity as the first encryption provider in the list, then you already have at-rest encryption enabled. However, that check does not tell you whether a previous migration to encrypted storage has succeeded. If you are not sure, see ensure all relevant data are encrypted.Understanding the encryption at rest configuration--- # # CAUTION: this is an example configuration. # Do not use this for your own cluster! # apiVersion: apiserver.config.k8s.io/v1 kind: EncryptionConfiguration resources: - resources: - secrets - configmaps - pandas.awesome.bears.example # a custom resource API providers: # This configuration does not provide data confidentiality. The first # configured provider is specifying the \"identity\" mechanism, which # stores resources as plain text. # - identity: {} # plain text, in other words NO encryption - aesgcm: keys: - name: key1 secret: c2VjcmV0IGlzIHNlY3VyZQ== - name: key2 secret: dGhpcyBpcyBwYXNzd29yZA== - aescbc: keys: - name: key1 secret: c2VjcmV0IGlzIHNlY3VyZQ== - name: key2 secret: dGhpcyBpcyBwYXNzd29yZA== - secretbox: keys: - name: key1 secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY= - resources: - events providers: - identity: {} # do not encrypt Events even though *.* is specified below - resources: - '*.apps' # wildcard match requires Kube", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example # a custom resource API\n    providers:\n      # This configuration does not provide data confidentiality. The first\n      # configured provider is specifying the \"identity\" mechanism, which\n      # stores resources as plain text.\n      #\n      - identity: {} # plain text, in other words NO encryption\n      - aesgcm:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - secretbox:\n          keys:\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n  - resources:\n      - events\n    providers:\n      - identity: {} # do not encrypt Events even though *.* is specified below\n  - resources:\n      - '*.apps' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key2\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n  - resources:\n      - '*.*' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key3\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\nEncrypting Confidential Data at Rest | Each resources array item is a separate config and contains a complete configuration. The resources.resources field is an array of Kubernetes resource names (resource or resource.group) that should be", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3132"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              # See the following text for more details about the secret value\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # this fallback allows reading unencrypted secrets;\n                     # for example, during initial migration\n```\n\nEncrypting Confidential Data at Rest | To create a new encryption key (that does not use KMS), see Generate the encryption key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3133"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# This is a fragment of a manifest for a static Pod.\n# Check whether this is correct for your cluster and for your API server.\n#\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.20.30.40:443\n  creationTimestamp: null\n  labels:\n    app.kubernetes.io/component: kube-apiserver\n    tier: control-plane\n  name: kube-apiserver\n  namespace: kube-system\nspec:\n  containers:\n  - command:\n    - kube-apiserver\n    ...\n    - --encryption-provider-config=/etc/kubernetes/enc/enc.yaml  # add this line\n    volumeMounts:\n    ...\n    - name: enc                           # add this line\n      mountPath: /etc/kubernetes/enc      # add this line\n      readOnly: true                      # add this line\n    ...\n  volumes:\n  ...\n  - name: enc                             # add this line\n    hostPath:                             # add this line\n      path: /etc/kubernetes/enc           # add this line\n      type: DirectoryOrCreate             # add this line\n  ...\n```\n\nEncrypting Confidential Data at Rest | Restart your API server.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3134"}
{"instruction": "Write a bash example for encrypting confidential data at rest", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\nEncrypting Confidential Data at Rest | Using the etcdctl command line tool, read that Secret out of etcd:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3135"}
{"instruction": "Write a bash example for encrypting confidential data at rest", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret1 -n default -o yaml\n```\n\nEncrypting Confidential Data at Rest | The output should contain mykey: bXlkYXRh, with contents of mydata encoded using base64; read decoding a Secret to learn how to completely decode the Secret.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3136"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # REMOVE THIS LINE\n```\n\nEncrypting Confidential Data at Rest | …and then restart each API server in turn. This change prevents the API server from accessing a plain-text Secret, even by accident.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3137"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      # list any other resources here that you previously were\n      # encrypting at rest\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET> # keep this in place\n                                               # make sure it comes after \"identity\"\n```\n\nEncrypting Confidential Data at Rest | Then run the following command to force decryption of all Secrets:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3138"}
{"instruction": "Write a bash example for encrypting confidential data at rest", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\nEncrypting Confidential Data at Rest | Once you have replaced all existing encrypted resources with backing data that don't use encryption, you can remove the encryption settings from the kube-apiserver.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3139"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example # a custom resource API\n    providers:\n      # This configuration does not provide data confidentiality. The first\n      # configured provider is specifying the \"identity\" mechanism, which\n      # stores resources as plain text.\n      #\n      - identity: {} # plain text, in other words NO encryption\n      - aesgcm:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - secretbox:\n          keys:\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n  - resources:\n      - events\n    providers:\n      - identity: {} # do not encrypt Events even though *.* is specified below\n  - resources:\n      - '*.apps' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key2\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n  - resources:\n      - '*.*' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key3\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\nEncrypting Confidential Data at Rest | Each resources array item is a separate config and contains a complete configuration. The resources.resources field is an array of Kubernetes resource names (resource or resource.group) that should be", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3140"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n...\n  - resources:\n      - configmaps. # specifically from the core API group,\n                    # because of trailing \".\"\n      - events\n    providers:\n      - identity: {}\n  # and then other entries in resources\n```\n\nEncrypting Confidential Data at Rest | Ensure that the exemption is listed before the wildcard '*.*' item in the resources array to give it precedence.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3141"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              # See the following text for more details about the secret value\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # this fallback allows reading unencrypted secrets;\n                     # for example, during initial migration\n```\n\nEncrypting Confidential Data at Rest | To create a new encryption key (that does not use KMS), see Generate the encryption key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3142"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# This is a fragment of a manifest for a static Pod.\n# Check whether this is correct for your cluster and for your API server.\n#\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.20.30.40:443\n  creationTimestamp: null\n  labels:\n    app.kubernetes.io/component: kube-apiserver\n    tier: control-plane\n  name: kube-apiserver\n  namespace: kube-system\nspec:\n  containers:\n  - command:\n    - kube-apiserver\n    ...\n    - --encryption-provider-config=/etc/kubernetes/enc/enc.yaml  # add this line\n    volumeMounts:\n    ...\n    - name: enc                           # add this line\n      mountPath: /etc/kubernetes/enc      # add this line\n      readOnly: true                      # add this line\n    ...\n  volumes:\n  ...\n  - name: enc                             # add this line\n    hostPath:                             # add this line\n      path: /etc/kubernetes/enc           # add this line\n      type: DirectoryOrCreate             # add this line\n  ...\n```\n\nEncrypting Confidential Data at Rest | Restart your API server.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3143"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # REMOVE THIS LINE\n```\n\nEncrypting Confidential Data at Rest | …and then restart each API server in turn. This change prevents the API server from accessing a plain-text Secret, even by accident.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3144"}
{"instruction": "Write a bash example for encrypting confidential data at rest", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\nEncrypting Confidential Data at Rest | This example shows how to stop encrypting the Secret API at rest. If you are encrypting other API kinds, adjust the steps to match.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3145"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      # list any other resources here that you previously were\n      # encrypting at rest\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET> # keep this in place\n                                               # make sure it comes after \"identity\"\n```\n\nEncrypting Confidential Data at Rest | Then run the following command to force decryption of all Secrets:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3146"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example # a custom resource API\n    providers:\n      # This configuration does not provide data confidentiality. The first\n      # configured provider is specifying the \"identity\" mechanism, which\n      # stores resources as plain text.\n      #\n      - identity: {} # plain text, in other words NO encryption\n      - aesgcm:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - secretbox:\n          keys:\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n  - resources:\n      - events\n    providers:\n      - identity: {} # do not encrypt Events even though *.* is specified below\n  - resources:\n      - '*.apps' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key2\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n  - resources:\n      - '*.*' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key3\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\nEncrypting Confidential Data at Rest | Each resources array item is a separate config and contains a complete configuration. The resources.resources field is an array of Kubernetes resource names (resource or resource.group) that should be", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3147"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              # See the following text for more details about the secret value\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # this fallback allows reading unencrypted secrets;\n                     # for example, during initial migration\n```\n\nEncrypting Confidential Data at Rest | To create a new encryption key (that does not use KMS), see Generate the encryption key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3148"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# This is a fragment of a manifest for a static Pod.\n# Check whether this is correct for your cluster and for your API server.\n#\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.20.30.40:443\n  creationTimestamp: null\n  labels:\n    app.kubernetes.io/component: kube-apiserver\n    tier: control-plane\n  name: kube-apiserver\n  namespace: kube-system\nspec:\n  containers:\n  - command:\n    - kube-apiserver\n    ...\n    - --encryption-provider-config=/etc/kubernetes/enc/enc.yaml  # add this line\n    volumeMounts:\n    ...\n    - name: enc                           # add this line\n      mountPath: /etc/kubernetes/enc      # add this line\n      readOnly: true                      # add this line\n    ...\n  volumes:\n  ...\n  - name: enc                             # add this line\n    hostPath:                             # add this line\n      path: /etc/kubernetes/enc           # add this line\n      type: DirectoryOrCreate             # add this line\n  ...\n```\n\nEncrypting Confidential Data at Rest | Restart your API server.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3149"}
{"instruction": "Write a bash example for encrypting confidential data at rest", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\nEncrypting Confidential Data at Rest | Using the etcdctl command line tool, read that Secret out of etcd:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3150"}
{"instruction": "Write a bash example for encrypting confidential data at rest", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret1 -n default -o yaml\n```\n\nEncrypting Confidential Data at Rest | The output should contain mykey: bXlkYXRh, with contents of mydata encoded using base64; read decoding a Secret to learn how to completely decode the Secret.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3151"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # REMOVE THIS LINE\n```\n\nEncrypting Confidential Data at Rest | …and then restart each API server in turn. This change prevents the API server from accessing a plain-text Secret, even by accident.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3152"}
{"instruction": "Write a yaml example for encrypting confidential data at rest", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      # list any other resources here that you previously were\n      # encrypting at rest\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET> # keep this in place\n                                               # make sure it comes after \"identity\"\n```\n\nEncrypting Confidential Data at Rest | Then run the following command to force decryption of all Secrets:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3153"}
{"instruction": "Write a bash example for encrypting confidential data at rest", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\nEncrypting Confidential Data at Rest | Once you have replaced all existing encrypted resources with backing data that don't use encryption, you can remove the encryption settings from the kube-apiserver.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/", "id": "k8s_00245_code_3154"}
{"instruction": "How do you migrate from podsecuritypolicy to the built-in podsecurity admission controller in Kubernetes?", "response": "Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission ControllerThis page describes the process of migrating from PodSecurityPolicies to the built-in PodSecurity admission controller. This can be done effectively using a combination of dry-run and audit and warn modes, although this becomes harder if mutating PSPs are used.Before you beginYour Kubernetes server must be at or later than version v1.22.To check the version, enter kubectl version.If you are currently running a version of Kubernetes other than 1.34, you may want to switch to viewing this page in the documentation for the version of Kubernetes that you are actually running.This page assumes you are already familiar with the basic Pod Security Admission concepts.Overall approachThere are multiple strategies you can take for migrating from PodSecurityPolicy to Pod Security Admission. The following steps are one possible migration path, with a goal of minimizing both the risks of a production outage and of a security gap.Decide whether Pod Security Admission is the right fit for your use case.Review namespace permissionsSimplify & standardize PodSecurityPoliciesUpdate namespacesIdentify an appropriate Pod Security levelVerify the Pod Security levelEnforce the Pod Security levelBypass PodSecurityPolicyReview namespace creation processesDisable PodSecurityPolicy0. Decide whether Pod Security Admission is right for youPod Security Admission was designed to meet the most common security needs out of the box, and to provide a standard set of security levels across clusters. However, it is less flexible than PodSecurityPolicy. Notably, the following features are supported by PodSecurityPolicy but not Pod Security Admission:Setting default security constraints - Pod Security Admission is a non-mutating admission controller, meaning it won't modify pods before validating them. If you were relying on this aspect of PSP, you will need to either modify your workloads to meet the Pod Security constraints, or use a Mutating Admission Webhook to make those changes. See Simplify & Standardize PodSecurityPolicies below for more detail.Fine-grained control over policy definition - Pod Security Admission only supports 3 standard levels. If you require more control over specific constraints, then you will need to use a Validating Admission Webhook to enforce those policies.Sub-namespace policy granularity - PodSecurityPolicy lets you bind different policies to different Service Accounts or users, even within a single namespace. This approach has many pitfalls and is not recommended, but if you require this feature anyway you will need to use a 3rd party webhook instead. The exception to this is if you only need to completely exempt specific users or RuntimeClasses, in which case Pod Security Admission does expose some static configuration for exemptions.Even if Pod Security Admission does not meet all of your needs it was designed to be complementary to other policy enforcement mechanisms, and can provide a useful fallback running alongside other admission webhooks.1. Review namespace permissionsPod Security Admission is controlled by labels on namespaces. This means that anyone who can update (or patch or create) a namespace can also modify the Pod Security level for that namespace, which could be used to bypass a more restrictive policy. Before proceeding, ensure that only trusted, privileged users have these namespace permissions. It is not recommended to grant these powerful permissions to users that shouldn't have elevated permissions, but if you must you will need to use an admission webhook to place additional restrictions on setting Pod Security labels on Namespace objects.2. Simplify & standardize PodSecurityPoliciesIn this section, you will reduce mutating PodSecurityPolicies and remove options that are outside the scope of the Pod Security Standards. You should make the changes recommended here to an offline copy of the original PodSecurityPolicy being modified.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/", "id": "k8s_00246"}
{"instruction": "Write a bash example for migrate from podsecuritypolicy to the built-in podsecurity admission controller", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n $NAMESPACE -o jsonpath=\"{.items[*].metadata.annotations.kubernetes\\.io\\/psp}\" | tr \" \" \"\\n\" | sort -u\n```\n\nMigrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Once you have selected a Pod Security level for the namespace (or if you're trying several), it's a good idea to test it out first (you can skip this step if using the Privileged level). Pod Security", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/", "id": "k8s_00246_code_3156"}
{"instruction": "Write a bash example for migrate from podsecuritypolicy to the built-in podsecurity admission controller", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/audit=$LEVEL\n```\n\nMigrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | If either of these approaches yield unexpected violations, you will need to either update the violating workloads to meet the policy requirements, or relax the namespace Pod Security level.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/", "id": "k8s_00246_code_3157"}
{"instruction": "Write a bash example for migrate from podsecuritypolicy to the built-in podsecurity admission controller", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/enforce=$LEVEL\n```\n\nMigrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Finally, you can effectively bypass PodSecurityPolicy at the namespace level by binding the fully privileged PSP to all service accounts in the namespace.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/", "id": "k8s_00246_code_3158"}
{"instruction": "Write a bash example for migrate from podsecuritypolicy to the built-in podsecurity admission controller", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n $NAMESPACE -o jsonpath=\"{.items[*].metadata.annotations.kubernetes\\.io\\/psp}\" | tr \" \" \"\\n\" | sort -u\n```\n\nMigrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Once you have selected a Pod Security level for the namespace (or if you're trying several), it's a good idea to test it out first (you can skip this step if using the Privileged level). Pod Security", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/", "id": "k8s_00246_code_3159"}
{"instruction": "Write a bash example for migrate from podsecuritypolicy to the built-in podsecurity admission controller", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/audit=$LEVEL\n```\n\nMigrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | If either of these approaches yield unexpected violations, you will need to either update the violating workloads to meet the policy requirements, or relax the namespace Pod Security level.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/", "id": "k8s_00246_code_3160"}
{"instruction": "Write a bash example for migrate from podsecuritypolicy to the built-in podsecurity admission controller", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/enforce=$LEVEL\n```\n\nMigrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Finally, you can effectively bypass PodSecurityPolicy at the namespace level by binding the fully privileged PSP to all service accounts in the namespace.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/", "id": "k8s_00246_code_3161"}
{"instruction": "What is the reference documentation for cluster resources?", "response": "Cluster ResourcesAPIServiceAPIService represents a server for a particular GroupVersion.ComponentStatusComponentStatus (and ComponentStatusList) holds the cluster validation info.EventEvent is a report of an event somewhere in the cluster.IPAddressIPAddress represents a single IP of a single IP Family.LeaseLease defines a lease concept.LeaseCandidate v1beta1LeaseCandidate defines a candidate for a Lease object.NamespaceNamespace provides a scope for Names.NodeNode is a worker node in Kubernetes.RuntimeClassRuntimeClass defines a class of container runtime supported in the cluster.ServiceCIDRServiceCIDR defines a range of IP addresses using CIDR format (e.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/", "id": "k8s_00247"}
{"instruction": "What is the reference documentation for kubectl diff?", "response": "kubectl diffSynopsisDiff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied.The output is always YAML.KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff command. Users can use external commands with params too, example: KUBECTL_EXTERNAL_DIFF=\"colordiff -N -u\"By default, the \"diff\" command available in your path will be run with the \"-u\" (unified diff) and \"-N\" (treat absent files as empty) options.Exit status: 0 No differences were found. 1 Differences were found. >1 Kubectl or diff failed with an error.Note: KUBECTL_EXTERNAL_DIFF, if used, is expected to follow that convention.kubectl diff -f FILENAME Examples # Diff resources included in pod.json kubectl diff -f pod.json # Diff file read from stdin cat service.yaml | kubectl diff -f - Options--concurrency int Default: 1Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.--field-manager string Default: \"kubectl-client-side-apply\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files contains the configuration to diff--force-conflictsIf true, server-side apply will force the changes against conflicts.-h, --helphelp for diff-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--pruneInclude resources that would be deleted by pruning. Can be used with -l and default shows all resources would be pruned--prune-allowlist stringsOverwrite the default allowlist with <group/version/kind> for --prune-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--server-sideIf true, apply runs in the server instead of the client.--show-managed-fieldsIf true, include managed fields in the diff.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't ti", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_diff/", "id": "k8s_00248"}
{"instruction": "Write a bash example for kubectl diff", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME\n```\n\nkubectl diff | Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_diff/", "id": "k8s_00248_code_3164"}
{"instruction": "Write a bash example for kubectl diff", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME\n```\n\nkubectl diff | Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_diff/", "id": "k8s_00248_code_3165"}
{"instruction": "Explain the Kubernetes concept: Proxies in Kubernetes", "response": "Proxies in KubernetesThis page explains proxies used with Kubernetes.ProxiesThere are several different proxies you may encounter when using Kubernetes:The kubectl proxy:runs on a user's desktop or in a podproxies from a localhost address to the Kubernetes apiserverclient to proxy uses HTTPproxy to apiserver uses HTTPSlocates apiserveradds authentication headersThe apiserver proxy:is a bastion built into the apiserverconnects a user outside of the cluster to cluster IPs which otherwise might not be reachableruns in the apiserver processesclient to proxy uses HTTPS (or http if apiserver so configured)proxy to target may use HTTP or HTTPS as chosen by proxy using available informationcan be used to reach a Node, Pod, or Servicedoes load balancing when used to reach a ServiceThe kube proxy:runs on each nodeproxies UDP, TCP and SCTPdoes not understand HTTPprovides load balancingis only used to reach servicesA Proxy/Load-balancer in front of apiserver(s):existence and implementation varies from cluster to cluster (e.g. nginx)sits between all clients and one or more apiserversacts as load balancer if there are several apiservers.Cloud Load Balancers on external services:are provided by some cloud providers (e.g. AWS ELB, Google Cloud Load Balancer)are created automatically when the Kubernetes service has type LoadBalancerusually supports UDP/TCP onlySCTP support is up to the load balancer implementation of the cloud providerimplementation varies by cloud provider.Kubernetes users will typically not need to worry about anything other than the first two types. The cluster admin will typically ensure that the latter types are set up correctly.Requesting redirectsProxies have replaced redirect capabilities. Redirects have been deprecated.", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/proxies/", "id": "k8s_00249"}
{"instruction": "What is the reference documentation for resourcefieldselector?", "response": "ResourceFieldSelectorResourceFieldSelector represents container resources (cpu, memory) and their output format.import \"k8s.io/api/core/v1\"ResourceFieldSelector represents container resources (cpu, memory) and their output formatresource (string), requiredRequired: resource to selectcontainerName (string)Container name: required for volumes, optional for env varsdivisor (Quantity)Specifies the output format of the exposed resources, defaults to \"1\"This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/resource-field-selector/", "id": "k8s_00250"}
{"instruction": "Explain the Kubernetes concept: Scheduling, Preemption and Eviction", "response": "Scheduling, Preemption and EvictionIn Kubernetes, scheduling refers to making sure that Pods are matched to Nodes so that the kubelet can run them. Preemption is the process of terminating Pods with lower Priority so that Pods with higher Priority can schedule on Nodes. Eviction is the process of terminating one or more Pods on Nodes.SchedulingKubernetes SchedulerAssigning Pods to NodesPod OverheadPod Topology Spread ConstraintsTaints and TolerationsScheduling FrameworkDynamic Resource AllocationScheduler Performance TuningResource Bin Packing for Extended ResourcesPod Scheduling ReadinessDeschedulerPod DisruptionPod disruption is the process by which Pods on Nodes are terminated either voluntarily or involuntarily.Voluntary disruptions are started intentionally by application owners or cluster administrators. Involuntary disruptions are unintentional and can be triggered by unavoidable issues like Nodes running out of resources, or by accidental deletions.Pod Priority and PreemptionNode-pressure EvictionAPI-initiated Eviction", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/", "id": "k8s_00251"}
{"instruction": "What is the reference documentation for runtimeclass?", "response": "RuntimeClassRuntimeClass defines a class of container runtime supported in the cluster.apiVersion: node.k8s.io/v1import \"k8s.io/api/node/v1\"RuntimeClassRuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/apiVersion: node.k8s.io/v1kind: RuntimeClassmetadata (ObjectMeta)More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatahandler (string), requiredhandler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.overhead (Overhead)overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/Overhead structure represents the resource overhead associated with running a pod.overhead.podFixed (map[string]Quantity)podFixed represents the fixed resource overhead associated with running a pod.scheduling (Scheduling)scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.Scheduling specifies the scheduling constraints for nodes supporting a RuntimeClass.scheduling.nodeSelector (map[string]string)nodeSelector lists labels that must be present on nodes that support this RuntimeClass. Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The RuntimeClass nodeSelector is merged with a pod's existing nodeSelector. Any conflicts will cause the pod to be rejected in admission.scheduling.tolerations ([]Toleration)Atomic: will be replaced during a mergetolerations are appended (excluding duplicates) to pods running with this RuntimeClass during admission, effectively unioning the set of nodes tolerated by the pod and the RuntimeClass.The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator .scheduling.tolerations.key (string)Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.scheduling.tolerations.operator (string)Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.scheduling.tolerations.value (string)Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.scheduling.tolerations.effect (string)Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.scheduling.tolerations.tolerationSeconds (int64)TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/runtime-class-v1/", "id": "k8s_00252"}
{"instruction": "Write a yaml example for runtimeclass", "response": "Here's a yaml example:\n\n```yaml\napiVersion: node.k8s.io/v1\n```\n\nRuntimeClass | import \"k8s.io/api/node/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/runtime-class-v1/", "id": "k8s_00252_code_3170"}
{"instruction": "What is the reference documentation for kubectl create service?", "response": "kubectl create serviceSynopsisCreate a service using a specified subcommand.kubectl create service [flags] Options-h, --helphelp for serviceParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl create - Create a resource from a file or from stdinkubectl create service clusterip - Create a ClusterIP servicekubectl create service externalname - Create an ExternalName servicekubectl create service loadbalancer - Create a LoadBalancer servicekubectl create service nodeport - Create a NodePort serviceThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service/", "id": "k8s_00253"}
{"instruction": "Write a bash example for kubectl create service", "response": "Here's a bash example:\n\n```bash\nkubectl create service [flags]\n```\n\nkubectl create service | help for service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service/", "id": "k8s_00253_code_3172"}
{"instruction": "Write a bash example for kubectl create service", "response": "Here's a bash example:\n\n```bash\nkubectl create service [flags]\n```\n\nkubectl create service | help for service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service/", "id": "k8s_00253_code_3173"}
{"instruction": "Explain submitting articles to kubernetes blogs in Kubernetes", "response": "Submitting articles to Kubernetes blogsThere are two official Kubernetes blogs, and the CNCF has its own blog where you can cover Kubernetes too. For the main Kubernetes blog, we (the Kubernetes project) like to publish articles with different perspectives and special focuses, that have a link to Kubernetes.With only a few special case exceptions, we only publish content that hasn't been submitted or published anywhere else.Writing for the Kubernetes blog(s)As an author, you have three different routes towards publication.Recommended routeThe approach the Kubernetes project recommends is: pitch your article by contacting the blog team. You can do that via Kubernetes Slack (#sig-docs-blog). For articles that you want to publish to the contributor blog only, you can also pitch directly to SIG ContribEx comms.Unless there's a problem with your submission, the blog team / SIG ContribEx will pair you up with:a blog editoryour writing buddy (another blog author)When the team pairs you up with another author, the idea is that you both support each other by reviewing the other author's draft article. You don't need to be a subject matter expert; most of the people who read the article also won't be experts. We, the Kubernetes blog team, call the other author a writing buddy.The editor is there to help you along the journey from draft to publication. They will either be directly able to approve your article for publication, or can arrange for the approval to happen.Read authoring a blog article to learn more about the process.Starting with a pull requestThe second route to writing for our blogs is to start directly with a pull request in GitHub. The blog team actually don't recommend this; GitHub is quite useful for collaborating on code, but isn't an ideal fit for prose text.It's absolutely fine to open a placeholder pull request with just an empty commit, and then work elsewhere before returning to your placeholder PR.Similar to the recommended route, we'll try to pair you up with a writing buddy and a blog editor. They'll help you get the article ready for publication.Post-release blog article processThe third route is for blog articles about changes in Kubernetes relating to a release. Each time there is a release, the Release Comms team takes over the blog publication schedule. People adding features to a release, or who are planning other changes that the project needs to announce, can liaise with Release Comms to get their article planned, drafted, edited, and eventually published.Article schedulingFor the Kubernetes blog, the blog team usually schedules blog articles to publish on weekdays (Gregorian calendar, as used in the USA and other countries). When it's important to publish on a specific date that falls on a weekend, the blog team try to accommodate that.The section on authoring a blog article explains what to do:initially, don't specify a date for the articlehowever, do set the article as draft (put draft: true in the front matter)When the Prow bot merges the PR you write, it will be a draft and won't be set to publish. A Kubernetes contributor (either you, your writing buddy or someone from the blog team) then opens a small follow-up PR that marks it for publication. Merging that second PR releases the previously-draft article so that it can automatically publish.On the day the article is scheduled to publish, automation triggers a website build and your article becomes visible.Authoring an articleAfter you've pitched, we'll encourage you to use either HackMD (a web Markdown editor) or a Google doc, to share an editable version of the article text. Your writing buddy can read your draft text and then either directly make suggestions or provide other", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/blog/article-submission/", "id": "k8s_00254"}
{"instruction": "Write a yaml example for submitting articles to kubernetes blogs", "response": "Here's a yaml example:\n\n```yaml\n---\nlayout: blog\ntitle: \"Your Title Here\"\ndraft: true # will be changed to date: YYYY-MM-DD before publication\nslug: lowercase-text-for-link-goes-here-no-spaces # optional\nauthor: >\n  Author-1 (Affiliation),\n  Author-2 (Affiliation),\n  Author-3 (Affiliation)  \n---\n```\n\nSubmitting articles to Kubernetes blogs | Make sure to use second-level Markdown headings (## not #) as the topmost heading level in the article. The title you set in the front matter becomes the first-level heading for that page.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/blog/article-submission/", "id": "k8s_00254_code_3175"}
{"instruction": "Explain the Kubernetes concept: Container Runtime Interface (CRI)", "response": "Container Runtime Interface (CRI)The CRI is a plugin interface which enables the kubelet to use a wide variety of container runtimes, without having a need to recompile the cluster components.You need a working container runtime on each Node in your cluster, so that the kubelet can launch Pods and their containers.The Container Runtime Interface (CRI) is the main protocol for the communication between the kubelet and Container Runtime.The Kubernetes Container Runtime Interface (CRI) defines the main gRPC protocol for the communication between the node components kubelet and container runtime.The APIFEATURE STATE: Kubernetes v1.23 [stable]The kubelet acts as a client when connecting to the container runtime via gRPC. The runtime and image service endpoints have to be available in the container runtime, which can be configured separately within the kubelet by using the --container-runtime-endpoint command line flag.For Kubernetes v1.26 and later, the kubelet requires that the container runtime supports the v1 CRI API. If a container runtime does not support the v1 API, the kubelet will not register the node.UpgradingWhen upgrading the Kubernetes version on a node, the kubelet restarts. If the container runtime does not support the v1 CRI API, the kubelet will fail to register and report an error. If a gRPC re-dial is required because the container runtime has been upgraded, the runtime must support the v1 CRI API for the connection to succeed. This might require a restart of the kubelet after the container runtime is correctly configured.What's nextLearn more about the CRI protocol definition", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/architecture/cri/", "id": "k8s_00255"}
{"instruction": "What is the reference documentation for ingressclass?", "response": "IngressClassIngressClass represents the class of the Ingress, referenced by the Ingress Spec.apiVersion: networking.k8s.io/v1import \"k8s.io/api/networking/v1\"IngressClassIngressClass represents the class of the Ingress, referenced by the Ingress Spec. The ingressclass.kubernetes.io/is-default-class annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class.apiVersion: networking.k8s.io/v1kind: IngressClassmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (IngressClassSpec)spec is the desired state of the IngressClass. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusIngressClassSpecIngressClassSpec provides information about the class of an Ingress.controller (string)controller refers to the name of the controller that should handle this class. This allows for different \"flavors\" that are controlled by the same controller. For example, you may have different parameters for the same implementing controller. This should be specified as a domain-prefixed path no more than 250 characters in length, e.g. \"acme.io/ingress-controller\". This field is immutable.parameters (IngressClassParametersReference)parameters is a link to a custom resource containing additional configuration for the controller. This is optional if the controller does not require extra parameters.IngressClassParametersReference identifies an API object. This can be used to specify a cluster or namespace-scoped resource.parameters.kind (string), requiredkind is the type of resource being referenced.parameters.name (string), requiredname is the name of resource being referenced.parameters.apiGroup (string)apiGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.parameters.namespace (string)namespace is the namespace of the resource being referenced. This field is required when scope is set to \"Namespace\" and must be unset when scope is set to \"Cluster\".parameters.scope (string)scope represents if this refers to a cluster or namespace scoped resource. This may be set to \"Cluster\" (default) or \"Namespace\".IngressClassListIngressClassList is a collection of IngressClasses.apiVersion: networking.k8s.io/v1kind: IngressClassListmetadata (ListMeta)Standard list metadata.items ([]IngressClass), requireditems is the list of IngressClasses.Operationsget read the specified IngressClassHTTP RequestGET /apis/networking.k8s.io/v1/ingressclasses/{name}Parametersname (in path): string, requiredname of the IngressClasspretty (in query): stringprettyResponse200 (IngressClass): OK401: Unauthorizedlist list or watch objects of kind IngressClassHTTP RequestGET /apis/networking.k8s.io/v1/ingressclassesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (IngressClassList): OK401: Unauthorizedcreate create an IngressClassHTTP RequestPOST /apis/networking.k8s.io/v1/ingressclassesParametersbody: IngressClass, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (IngressClass): OK201 (IngressClass): Created202 (IngressClass): Accepted401: Unauthorizedupdat", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/ingress-class-v1/", "id": "k8s_00256"}
{"instruction": "Write a yaml example for ingressclass", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\nIngressClass | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/ingress-class-v1/", "id": "k8s_00256_code_3178"}
{"instruction": "What is the reference documentation for kubeconfig (v1)?", "response": "kubeconfig (v1)Resource TypesConfigConfigConfig holds the information needed to build connect to remote kubernetes clusters as a given userFieldDescriptionapiVersionstring/v1kindstringConfigkindstringLegacy field from pkg/api/types.go TypeMeta. TODO(jlowdermilk): remove this after eliminating downstream dependencies.apiVersionstringLegacy field from pkg/api/types.go TypeMeta. TODO(jlowdermilk): remove this after eliminating downstream dependencies.preferences [Required]PreferencesPreferences holds general information to be use for cli interactionsclusters [Required][]NamedClusterClusters is a map of referenceable names to cluster configsusers [Required][]NamedAuthInfoAuthInfos is a map of referenceable names to user configscontexts [Required][]NamedContextContexts is a map of referenceable names to context configscurrent-context [Required]stringCurrentContext is the name of the context that you would like to use by defaultextensions[]NamedExtensionExtensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fieldsAuthInfoAppears in:NamedAuthInfoAuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are.FieldDescriptionclient-certificatestringClientCertificate is the path to a client cert file for TLS.client-certificate-data[]byteClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificateclient-keystringClientKey is the path to a client key file for TLS.client-key-data[]byteClientKeyData contains PEM-encoded data from a client key file for TLS. Overrides ClientKeytokenstringToken is the bearer token for authentication to the kubernetes cluster.tokenFilestringTokenFile is a pointer to a file that contains a bearer token (as described above). If both Token and TokenFile are present, Token takes precedence.asstringImpersonate is the username to impersonate. The name matches the flag.as-uidstringImpersonateUID is the uid to impersonate.as-groups[]stringImpersonateGroups is the groups to impersonate.as-user-extramap[string][]stringImpersonateUserExtra contains additional information for impersonated user.usernamestringUsername is the username for basic authentication to the kubernetes cluster.passwordstringPassword is the password for basic authentication to the kubernetes cluster.auth-providerAuthProviderConfigAuthProvider specifies a custom authentication plugin for the kubernetes cluster.execExecConfigExec specifies a custom exec-based authentication plugin for the kubernetes cluster.extensions[]NamedExtensionExtensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fieldsAuthProviderConfigAppears in:AuthInfoAuthProviderConfig holds the configuration for a specified auth provider.FieldDescriptionname [Required]stringNo description provided.config [Required]map[string]stringNo description provided.ClusterAppears in:NamedClusterCluster contains information about how to communicate with a kubernetes clusterFieldDescriptionserver [Required]stringServer is the address of the kubernetes cluster (https://hostname:port).tls-server-namestringTLSServerName is used to check server certificate. If TLSServerName is empty, the hostname used to contact the server is used.insecure-skip-tls-verifyboolInsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure.certificate-authoritystringCertificateAuthority is the path to a cert file for the certificate authority.certificate-authority-data[]byteCertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthorityproxy-urlstringProxyURL is the URL to the proxy to be used for all requests made by this client. URLs with \"http\", \"https\", and \"socks5\" schemes are supported. If this configuration is not provided or the empty string, the client attempts to construct a proxy co", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeconfig.v1/", "id": "k8s_00257"}
{"instruction": "What is the reference documentation for kubectl create secret docker-registry?", "response": "kubectl create secret docker-registrySynopsisCreate a new secret for use with Docker registries. Dockercfg secrets are used to authenticate against Docker registries. When using the Docker command line to push images, you can authenticate to a given registry by running: '$ docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'. That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to authenticate to the registry. The email address is optional. When creating applications, you may have a Docker registry that requires authentication. In order for the nodes to pull images on your behalf, they must have the credentials. You can provide this information by creating a dockercfg secret and attaching it to your service account. kubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none] Examples # If you do not already have a .dockercfg file, create a dockercfg secret directly kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL # Create a new secret named my-secret from ~/.docker/config.json kubectl create secret docker-registry my-secret --from-file=path/to/.docker/config.json Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--append-hashAppend a hash of the secret to its name.--docker-email stringEmail for Docker registry--docker-password stringPassword for Docker registry authentication--docker-server string Default: \"https://index.docker.io/v1/\"Server location for Docker registry--docker-username stringUsername for Docker registry authentication--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--from-file stringsKey files can be specified using their file path, in which case a default name of .dockerconfigjson will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iterate each named file in the directory that is a valid secret key. For this command, the key should always be .dockerconfigjson.-h, --helphelp for docker-registry-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_docker-registry/", "id": "k8s_00258"}
{"instruction": "Write a bash example for kubectl create secret docker-registry", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]\n```\n\nkubectl create secret docker-registry | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_docker-registry/", "id": "k8s_00258_code_3181"}
{"instruction": "Write a bash example for kubectl create secret docker-registry", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]\n```\n\nkubectl create secret docker-registry | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_docker-registry/", "id": "k8s_00258_code_3182"}
{"instruction": "What is the reference documentation for clustertrustbundle v1beta1?", "response": "ClusterTrustBundle v1beta1ClusterTrustBundle is a cluster-scoped container for X.apiVersion: certificates.k8s.io/v1beta1import \"k8s.io/api/certificates/v1beta1\"ClusterTrustBundleClusterTrustBundle is a cluster-scoped container for X.509 trust anchors (root certificates).ClusterTrustBundle objects are considered to be readable by any authenticated user in the cluster, because they can be mounted by pods using the clusterTrustBundle projection. All service accounts have read access to ClusterTrustBundles by default. Users who only have namespace-level access to a cluster can read ClusterTrustBundles by impersonating a serviceaccount that they have access to.It can be optionally associated with a particular assigner, in which case it contains one valid set of trust anchors for that signer. Signers may have multiple associated ClusterTrustBundles; each is an independent set of trust anchors for that signer. Admission control is used to enforce that only users with permissions on the signer can create or modify the corresponding bundle.apiVersion: certificates.k8s.io/v1beta1kind: ClusterTrustBundlemetadata (ObjectMeta)metadata contains the object metadata.spec (ClusterTrustBundleSpec), requiredspec contains the signer (if any) and trust anchors.ClusterTrustBundleSpecClusterTrustBundleSpec contains the signer and trust anchors.trustBundle (string), requiredtrustBundle contains the individual X.509 trust anchors for this bundle, as PEM bundle of PEM-wrapped, DER-formatted X.509 certificates.The data must consist only of PEM certificate blocks that parse as valid X.509 certificates. Each certificate must include a basic constraints extension with the CA bit set. The API server will reject objects that contain duplicate certificates, or that use PEM block headers.Users of ClusterTrustBundles, including Kubelet, are free to reorder and deduplicate certificate blocks in this file according to their own logic, as well as to drop PEM block headers and inter-block data.signerName (string)signerName indicates the associated signer, if any.In order to create or update a ClusterTrustBundle that sets signerName, you must have the following cluster-scoped permission: group=certificates.k8s.io resource=signers resourceName=<the signer name> verb=attest.If signerName is not empty, then the ClusterTrustBundle object must be named with the signer name as a prefix (translating slashes to colons). For example, for the signer name example.com/foo, valid ClusterTrustBundle object names include example.com:foo:abc and example.com:foo:v1.If signerName is empty, then the ClusterTrustBundle object's name must not have such a prefix.List/watch requests for ClusterTrustBundles can filter on this field using a spec.signerName=NAME field selector.ClusterTrustBundleListClusterTrustBundleList is a collection of ClusterTrustBundle objectsapiVersion: certificates.k8s.io/v1beta1kind: ClusterTrustBundleListmetadata (ListMeta)metadata contains the list metadata.items ([]ClusterTrustBundle), requireditems is a collection of ClusterTrustBundle objectsOperationsget read the specified ClusterTrustBundleHTTP RequestGET /apis/certificates.k8s.io/v1beta1/clustertrustbundles/{name}Parametersname (in path): string, requiredname of the ClusterTrustBundlepretty (in query): stringprettyResponse200 (ClusterTrustBundle): OK401: Unauthorizedlist list or watch objects of kind ClusterTrustBundleHTTP RequestGET /apis/certificates.k8s.io/v1beta1/clustertrustbundlesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ClusterTrustBundleList): ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/cluster-trust-bundle-v1beta1/", "id": "k8s_00259"}
{"instruction": "Write a yaml example for clustertrustbundle v1beta1", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1beta1\n```\n\nClusterTrustBundle v1beta1 | import \"k8s.io/api/certificates/v1beta1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/cluster-trust-bundle-v1beta1/", "id": "k8s_00259_code_3184"}
{"instruction": "What is the reference documentation for kubectl certificate?", "response": "kubectl certificateSynopsisModify certificate resources.kubectl certificate SUBCOMMAND Options-h, --helphelp for certificateParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerkubectl certificate approve - Approve a certificate signing requestkubectl certificate deny - Deny a certificate signing requestThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/", "id": "k8s_00260"}
{"instruction": "Write a bash example for kubectl certificate", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND\n```\n\nkubectl certificate | help for certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/", "id": "k8s_00260_code_3186"}
{"instruction": "Write a bash example for kubectl certificate", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND\n```\n\nkubectl certificate | help for certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/", "id": "k8s_00260_code_3187"}
{"instruction": "What is the reference documentation for kubectl expose?", "response": "kubectl exposeSynopsisExpose a resource as a new Kubernetes service.Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. A deployment or replica set will be exposed as a service only if its selector is convertible to a selector that service supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the exposed resource has multiple ports, all will be re-used by the new service. Also if no labels are specified, the new service will re-use the labels from the resource it exposes.Possible resources include (case insensitive):pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] Examples # Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000 kubectl expose rc nginx --port=80 --target-port=8000 # Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000 kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000 # Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\" kubectl expose pod valid-pod --port=444 --name=frontend # Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\" kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https # Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'. kubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream # Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000 kubectl expose rs nginx --port=80 --target-port=8000 # Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000 kubectl expose deployment nginx --port=80 --target-port=8000 Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--cluster-ip stringClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--external-ip stringAdditional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP.--field-manager string Default: \"kubectl-expose\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to expose a service-h, --helphelp for expose-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-l, --labels stringLabels to apply to the service created by this call.--load-balancer-ip stringIP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).--name stringThe name for the newly created object.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--override-type string Default: \"merge\"The method used to override the generated object: json, merge, or strategic.--overrides stringAn inline JSON o", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_expose/", "id": "k8s_00261"}
{"instruction": "Write a bash example for kubectl expose", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]\n```\n\nkubectl expose | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_expose/", "id": "k8s_00261_code_3189"}
{"instruction": "Write a bash example for kubectl expose", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]\n```\n\nkubectl expose | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_expose/", "id": "k8s_00261_code_3190"}
{"instruction": "Explain the Kubernetes concept: Gateway API", "response": "Gateway APIGateway API is a family of API kinds that provide dynamic infrastructure provisioning and advanced traffic routing.Make network services available by using an extensible, role-oriented, protocol-aware configuration mechanism. Gateway API is an add-on containing API kinds that provide dynamic infrastructure provisioning and advanced traffic routing.Design principlesThe following principles shaped the design and architecture of Gateway API:Role-oriented: Gateway API kinds are modeled after organizational roles that are responsible for managing Kubernetes service networking:Infrastructure Provider: Manages infrastructure that allows multiple isolated clusters to serve multiple tenants, e.g. a cloud provider.Cluster Operator: Manages clusters and is typically concerned with policies, network access, application permissions, etc.Application Developer: Manages an application running in a cluster and is typically concerned with application-level configuration and Service composition.Portable: Gateway API specifications are defined as custom resources and are supported by many implementations.Expressive: Gateway API kinds support functionality for common traffic routing use cases such as header-based matching, traffic weighting, and others that were only possible in Ingress by using custom annotations.Extensible: Gateway allows for custom resources to be linked at various layers of the API. This makes granular customization possible at the appropriate places within the API structure.Resource modelGateway API has four stable API kinds:GatewayClass: Defines a set of gateways with common configuration and managed by a controller that implements the class.Gateway: Defines an instance of traffic handling infrastructure, such as cloud load balancer.HTTPRoute: Defines HTTP-specific rules for mapping traffic from a Gateway listener to a representation of backend network endpoints. These endpoints are often represented as a Service.GRPCRoute: Defines gRPC-specific rules for mapping traffic from a Gateway listener to a representation of backend network endpoints. These endpoints are often represented as a Service.Gateway API is organized into different API kinds that have interdependent relationships to support the role-oriented nature of organizations. A Gateway object is associated with exactly one GatewayClass; the GatewayClass describes the gateway controller responsible for managing Gateways of this class. One or more route kinds such as HTTPRoute, are then associated to Gateways. A Gateway can filter the routes that may be attached to its listeners, forming a bidirectional trust model with routes.The following figure illustrates the relationships of the three stable Gateway API kinds:GatewayClassGateways can be implemented by different controllers, often with different configurations. A Gateway must reference a GatewayClass that contains the name of the controller that implements the class.A minimal GatewayClass example:apiVersion: gateway.networking.k8s.io/v1 kind: GatewayClass metadata: name: example-class spec: controllerName: example.com/gateway-controller In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by the implementation's controller.See the GatewayClass reference for a full definition of this API kind.GatewayA Gateway describes an instance of traffic handling infrastructure. It defines a network endpoint that can be used for processing traffic, i.e. filtering, balancing, splitting, etc. for backends such as a Service. For example, a Gateway may represent a cloud load balancer or an in-cluster proxy server that is configured to accept HTTP traffic.A minimal Gateway resource example:apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: example-gateway spec: gatewayClassName: example-class listeners: - name: http protocol: HTTP port: 80 In this example, an i", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\nGateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3192"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\nGateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3193"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\nGateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3194"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\nGateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3195"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\nGateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3196"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\nGateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3197"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\nGateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3198"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\nGateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3199"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\nGateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3200"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\nGateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3201"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\nGateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3202"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\nGateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3203"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\nGateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3204"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\nGateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3205"}
{"instruction": "Write a yaml example for gateway api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\nGateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/gateway/", "id": "k8s_00262_code_3206"}
{"instruction": "Explain the Kubernetes concept: Kubernetes API Server Bypass Risks", "response": "Kubernetes API Server Bypass RisksSecurity architecture information relating to the API server and other componentsThe Kubernetes API server is the main point of entry to a cluster for external parties (users and services) interacting with it.As part of this role, the API server has several key built-in security controls, such as audit logging and admission controllers. However, there are ways to modify the configuration or content of the cluster that bypass these controls.This page describes the ways in which the security controls built into the Kubernetes API server can be bypassed, so that cluster operators and security architects can ensure that these bypasses are appropriately restricted.Static PodsThe kubelet on each node loads and directly manages any manifests that are stored in a named directory or fetched from a specific URL as static Pods in your cluster. The API server doesn't manage these static Pods. An attacker with write access to this location could modify the configuration of static pods loaded from that source, or could introduce new static Pods.Static Pods are restricted from accessing other objects in the Kubernetes API. For example, you can't configure a static Pod to mount a Secret from the cluster. However, these Pods can take other security sensitive actions, such as using hostPath mounts from the underlying node.By default, the kubelet creates a mirror pod so that the static Pods are visible in the Kubernetes API. However, if the attacker uses an invalid namespace name when creating the Pod, it will not be visible in the Kubernetes API and can only be discovered by tooling that has access to the affected host(s).If a static Pod fails admission control, the kubelet won't register the Pod with the API server. However, the Pod still runs on the node. For more information, refer to kubeadm issue #1541.MitigationsOnly enable the kubelet static Pod manifest functionality if required by the node.If a node uses the static Pod functionality, restrict filesystem access to the static Pod manifest directory or URL to users who need the access.Restrict access to kubelet configuration parameters and files to prevent an attacker setting a static Pod path or URL.Regularly audit and centrally report all access to directories or web storage locations that host static Pod manifests and kubelet configuration files.The kubelet APIThe kubelet provides an HTTP API that is typically exposed on TCP port 10250 on cluster worker nodes. The API might also be exposed on control plane nodes depending on the Kubernetes distribution in use. Direct access to the API allows for disclosure of information about the pods running on a node, the logs from those pods, and execution of commands in every container running on the node.When Kubernetes cluster users have RBAC access to Node object sub-resources, that access serves as authorization to interact with the kubelet API. The exact access depends on which sub-resource access has been granted, as detailed in kubelet authorization.Direct access to the kubelet API is not subject to admission control and is not logged by Kubernetes audit logging. An attacker with direct access to this API may be able to bypass controls that detect or prevent certain actions.The kubelet API can be configured to authenticate requests in a number of ways. By default, the kubelet configuration allows anonymous access. Most Kubernetes providers change the default to use webhook and certificate authentication. This lets the control plane ensure that the caller is authorized to access the nodes API resource or sub-resources. The default anonymous access doesn't make this assertion with the control plane.MitigationsRestrict access to sub-resources of the nodes API object using mechanisms such as RBAC. Only grant this access when required, such as by monitoring services.Restrict access to the kubelet port. Only allow specified and trusted IP address ranges to access the port.Ensure that kubelet authentication. is se", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/api-server-bypass-risks/", "id": "k8s_00263"}
{"instruction": "How do you access applications in a cluster in Kubernetes?", "response": "Access Applications in a ClusterConfigure load balancing, port forwarding, or setup firewall or DNS configurations to access applications in a cluster.Deploy and Access the Kubernetes DashboardDeploy the web UI (Kubernetes Dashboard) and access it.Accessing ClustersConfigure Access to Multiple ClustersUse Port Forwarding to Access Applications in a ClusterUse a Service to Access an Application in a ClusterConnect a Frontend to a Backend Using ServicesCreate an External Load BalancerList All Container Images Running in a ClusterSet up Ingress on Minikube with the NGINX Ingress ControllerCommunicate Between Containers in the Same Pod Using a Shared VolumeConfigure DNS for a ClusterAccess Services Running on Clusters", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/", "id": "k8s_00264"}
{"instruction": "Provide a tutorial on using a service to expose your app", "response": "Using a Service to Expose Your AppObjectivesLearn about a Service in Kubernetes.Understand how labels and selectors relate to a Service.Expose an application outside a Kubernetes cluster.Overview of Kubernetes ServicesKubernetes Pods are mortal. Pods have a lifecycle. When a worker node dies, the Pods running on the Node are also lost. A Replicaset might then dynamically drive the cluster back to the desired state via the creation of new Pods to keep your application running. As another example, consider an image-processing backend with 3 replicas. Those replicas are exchangeable; the front-end system should not care about backend replicas or even if a Pod is lost and recreated. That said, each Pod in a Kubernetes cluster has a unique IP address, even Pods on the same Node, so there needs to be a way of automatically reconciling changes among Pods so that your applications continue to function.A Kubernetes Service is an abstraction layer which defines a logical set of Pods and enables external traffic exposure, load balancing and service discovery for those Pods.A Service in Kubernetes is an abstraction which defines a logical set of Pods and a policy by which to access them. Services enable a loose coupling between dependent Pods. A Service is defined using YAML or JSON, like all Kubernetes object manifests. The set of Pods targeted by a Service is usually determined by a label selector (see below for why you might want a Service without including a selector in the spec).Although each Pod has a unique IP address, those IPs are not exposed outside the cluster without a Service. Services allow your applications to receive traffic. Services can be exposed in different ways by specifying a type in the spec of the Service:ClusterIP (default) - Exposes the Service on an internal IP in the cluster. This type makes the Service only reachable from within the cluster.NodePort - Exposes the Service on the same port of each selected Node in the cluster using NAT. Makes a Service accessible from outside the cluster using NodeIP:NodePort. Superset of ClusterIP.LoadBalancer - Creates an external load balancer in the current cloud (if supported) and assigns a fixed, external IP to the Service. Superset of NodePort.ExternalName - Maps the Service to the contents of the externalName field (e.g. foo.bar.example.com), by returning a CNAME record with its value. No proxying of any kind is set up. This type requires v1.7 or higher of kube-dns, or CoreDNS version 0.0.8 or higher.More information about the different types of Services can be found in the Using Source IP tutorial. Also see Connecting Applications with Services.Additionally, note that there are some use cases with Services that involve not defining a selector in the spec. A Service created without selector will also not create the corresponding Endpoints object. This allows users to manually map a Service to specific endpoints. Another possibility why there may be no selector is you are strictly using type: ExternalName.Services and LabelsA Service routes traffic across a set of Pods. Services are the abstraction that allows pods to die and replicate in Kubernetes without impacting your application. Discovery and routing among dependent Pods (such as the frontend and backend components in an application) are handled by Kubernetes Services.Services match a set of Pods using labels and selectors, a grouping primitive that allows logical operation on objects in Kubernetes. Labels are key/value pairs attached to objects and can be used in any number of ways:Designate objects for development, test, and productionEmbed version tagsClassify an object using tagsLabels can be attached to objects at creation time or later on. They can be modified at any time. Let's expose our application now using a Service and apply some labels.Step 1: Creating a new ServiceLet’s verify that our application is running. We’ll use the kubectl get command and look for existing Pods:kubectl get pods If no Pods are ", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\nUsing a Service to Expose Your App | We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3210"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3211"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\nUsing a Service to Expose Your App | Let’s use this label to query our list of Pods. We’ll use the kubectl get pods command with -l as a parameter, followed by the label values:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3212"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | You can do the same to list the existing Services:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3213"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl get services -l app=kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | Get the name of the Pod and store it in the POD_NAME environment variable:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3214"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl label pods \"$POD_NAME\" version=v1\n```\n\nUsing a Service to Expose Your App | This will apply a new label to our Pod (we pinned the application version to the Pod), and we can check it with the describe pod command:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3215"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods \"$POD_NAME\"\n```\n\nUsing a Service to Expose Your App | We see here that the label is attached now to our Pod. And we can query now the list of pods using the new label:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3216"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l version=v1\n```\n\nUsing a Service to Expose Your App | And we see the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3217"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | Confirm that the Service is gone:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3218"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- curl http://localhost:8080\n```\n\nUsing a Service to Expose Your App | We see here that the application is up. This is because the Deployment is managing the application. To shut down the application, you would need to delete the Deployment as well.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3219"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\nUsing a Service to Expose Your App | We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3220"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3221"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\nUsing a Service to Expose Your App | Let’s use this label to query our list of Pods. We’ll use the kubectl get pods command with -l as a parameter, followed by the label values:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3222"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | You can do the same to list the existing Services:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3223"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl get services -l app=kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | Get the name of the Pod and store it in the POD_NAME environment variable:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3224"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl label pods \"$POD_NAME\" version=v1\n```\n\nUsing a Service to Expose Your App | This will apply a new label to our Pod (we pinned the application version to the Pod), and we can check it with the describe pod command:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3225"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods \"$POD_NAME\"\n```\n\nUsing a Service to Expose Your App | We see here that the label is attached now to our Pod. And we can query now the list of pods using the new label:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3226"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l version=v1\n```\n\nUsing a Service to Expose Your App | And we see the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3227"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=kubernetes-bootcamp\n```\n\nUsing a Service to Expose Your App | Confirm that the Service is gone:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3228"}
{"instruction": "Write a bash example for using a service to expose your app", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- curl http://localhost:8080\n```\n\nUsing a Service to Expose Your App | We see here that the application is up. This is because the Deployment is managing the application. To shut down the application, you would need to delete the Deployment as well.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/", "id": "k8s_00265_code_3229"}
{"instruction": "How do you assign pod-level cpu and memory resources in Kubernetes?", "response": "Assign Pod-level CPU and memory resourcesFEATURE STATE: Kubernetes v1.34 [beta] (enabled by default: true)This page shows how to specify CPU and memory resources for a Pod at pod-level in addition to container-level resource specifications. A Kubernetes node allocates resources to a pod based on the pod's resource requests. These requests can be defined at the pod level or individually for containers within the pod. When both are present, the pod-level requests take precedence.Similarly, a pod's resource usage is restricted by limits, which can also be set at the pod-level or individually for containers within the pod. Again, pod-level limits are prioritized when both are present. This allows for flexible resource management, enabling you to control resource allocation at both the pod and container levels.In order to specify the resources at pod-level, it is required to enable PodLevelResources feature gate.For Pod Level Resources:Priority: When both pod-level and container-level resources are specified, pod-level resources take precedence.QoS: Pod-level resources take precedence in influencing the QoS class of the pod.OOM Score: The OOM score adjustment calculation considers both pod-level and container-level resources.Compatibility: Pod-level resources are designed to be compatible with existing features.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.34.To check the version, enter kubectl version.The PodLevelResources feature gate must be enabled for your control plane and for all nodes in your cluster.LimitationsFor Kubernetes 1.34, resizing pod-level resources has the following limitations:Resource Types: Only CPU, memory and hugepages resources can be specified at pod-level.Operating System: Pod-level resources are not supported for Windows pods.Resource Managers: The Topology Manager, Memory Manager and CPU Manager do not align pods and containers based on pod-level resources as these resource managers don't currently support pod-level resources.In-Place Resize: In-place resize of pod-level resources is not supported. Modifying the pod-level resource limits or requests on a pod result in a field.Forbidden error. The error message explicitly states, \"pods with pod-level resources cannot be resized.\"Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace pod-resources-example Create a pod with memory requests and limits at pod-levelTo specify memory requests for a Pod at pod-level, include the resources.requests.memory field in the Pod spec manifest. To specify a memory limit, include resources.limits.memory.In this exercise, you create a Pod that has one Container. The Pod has a memory request of 100 MiB and a memory limit of 200 MiB. Here's the configuration file for the Pod:pods/resource/pod-level-memory-request-limit.yaml apiVersion: v1 kind: Pod metadata: name: memory-demo namespace: pod-resources-example spec: resources: requests: memory: \"100Mi\" limits: memory: \"200Mi\" containers: - name: memory-demo-ctr image: nginx command: [\"stress\"] args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"] The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/resource/pod-level-memory-request-limit.yaml --namespace=pod-resources-example Verify that the Pod is running:kubectl get pod memory-demo --namespa", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | To specify memory requests for a Pod at pod-level, include the resources.requests.memory field in the Pod spec manifest. To specify a memory limit, include resources.limits.memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3231"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3232"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-memory-request-limit.yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3233"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3234"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3235"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3236"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3237"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-cpu-request-limit.yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3238"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3239"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3240"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3241"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nAssign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3242"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-resources.yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3243"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod-resources-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3244"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that one container in the Pod has a memory request of 50 MiB and a CPU request of 0.5 cores, with a memory limit of 100 MiB and a CPU limit of 0.5 cores. The Pod itself has a memory r", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3245"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3246"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3247"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\n...\nspec: \n  containers:    \n  ...\n  resources:\n    requests:\n      memory: 100Mi\n    limits:\n      memory: 200Mi\n...\n```\n\nAssign Pod-level CPU and memory resources | Run kubectl top to fetch the metrics for the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3248"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3249"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  ...\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: 500m\n```\n\nAssign Pod-level CPU and memory resources | Use kubectl top to fetch the metrics for the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3250"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nAssign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3251"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n  name: pod-resources-demo-ctr-1\n  resources:\n      requests:\n        cpu: 500m\n        memory: 50Mi\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  ...\n  name: pod-resources-demo-ctr-2\n  resources: {}  \nresources:\n  limits:\n      cpu: 1\n      memory: 200Mi\n    requests:\n      cpu: 1\n      memory: 100Mi\n...\n```\n\nAssign Pod-level CPU and memory resources | Since pod-level requests and limits are specified, the request guarantees for both containers in the pod will be equal 1 core or CPU and 100Mi of memory. Additionally, both containers together won't b", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3252"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | To specify memory requests for a Pod at pod-level, include the resources.requests.memory field in the Pod spec manifest. To specify a memory limit, include resources.limits.memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3253"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-memory-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3254"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3255"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-memory-request-limit.yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3256"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3257"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3258"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3259"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-cpu-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3260"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3261"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-cpu-request-limit.yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3262"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3263"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3264"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3265"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nAssign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3266"}
{"instruction": "Write a yaml example for assign pod-level cpu and memory resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\nAssign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3267"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-resources.yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3268"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod-resources-demo --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3269"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | The output shows that one container in the Pod has a memory request of 50 MiB and a CPU request of 0.5 cores, with a memory limit of 100 MiB and a CPU limit of 0.5 cores. The Pod itself has a memory r", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3270"}
{"instruction": "Write a bash example for assign pod-level cpu and memory resources", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace pod-resources-example\n```\n\nAssign Pod-level CPU and memory resources | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pod-level-resources/", "id": "k8s_00266_code_3271"}
{"instruction": "How do you use an image volume with a pod in Kubernetes?", "response": "Use an Image Volume With a PodFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: false)This page shows how to configure a pod using image volumes. This allows you to mount content from OCI registries inside containers.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.31.To check the version, enter kubectl version.The container runtime needs to support the image volumes featureYou need to exec commands in the hostYou need to be able to exec into podsYou need to enable the ImageVolume feature gateRun a Pod that uses an image volumeAn image volume for a pod is enabled by setting the volumes.[*].image field of .spec to a valid reference and consuming it in the volumeMounts of the container. For example:pods/image-volumes.yaml apiVersion: v1 kind: Pod metadata: name: image-volume spec: containers: - name: shell command: [\"sleep\", \"infinity\"] image: debian volumeMounts: - name: volume mountPath: /volume volumes: - name: volume image: reference: quay.io/crio/artifact:v2 pullPolicy: IfNotPresent Create the pod on your cluster:kubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml Attach to the container:kubectl attach -it image-volume bash Check the content of a file in the volume:cat /volume/dir/file The output is similar to:1 You can also check another file in a different path:cat /volume/file The output is similar to:2 Use subPath (or subPathExpr)It is possible to utilize subPath or subPathExpr from Kubernetes v1.33 when using the image volume feature.pods/image-volumes-subpath.yaml apiVersion: v1 kind: Pod metadata: name: image-volume spec: containers: - name: shell command: [\"sleep\", \"infinity\"] image: debian volumeMounts: - name: volume mountPath: /volume subPath: dir volumes: - name: volume image: reference: quay.io/crio/artifact:v2 pullPolicy: IfNotPresent Create the pod on your cluster:kubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml Attach to the container:kubectl attach -it image-volume bash Check the content of the file from the dir sub path in the volume:cat /volume/file The output is similar to:1 Further readingimage volumes", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3273"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml\n```\n\nUse an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3274"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\nUse an Image Volume With a Pod | Check the content of a file in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3275"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3276"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml\n```\n\nUse an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3277"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\nUse an Image Volume With a Pod | Check the content of the file from the dir sub path in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3278"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3279"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3280"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3281"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3282"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml\n```\n\nUse an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3283"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\nUse an Image Volume With a Pod | Check the content of a file in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3284"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes-subpath.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3285"}
{"instruction": "Write a yaml example for use an image volume with a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nUse an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3286"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml\n```\n\nUse an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3287"}
{"instruction": "Write a bash example for use an image volume with a pod", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\nUse an Image Volume With a Pod | Check the content of the file from the dir sub path in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/", "id": "k8s_00267_code_3288"}
{"instruction": "What is the reference documentation for podtemplate?", "response": "PodTemplatePodTemplate describes a template for creating copies of a predefined pod.apiVersion: v1import \"k8s.io/api/core/v1\"PodTemplatePodTemplate describes a template for creating copies of a predefined pod.apiVersion: v1kind: PodTemplatemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatatemplate (PodTemplateSpec)Template defines the pods that will be created from this pod template. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusPodTemplateSpecPodTemplateSpec describes the data a pod should have when created from a templatemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (PodSpec)Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusPodTemplateListPodTemplateList is a list of PodTemplates.apiVersion: v1kind: PodTemplateListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems ([]PodTemplate), requiredList of pod templatesOperationsget read the specified PodTemplateHTTP RequestGET /api/v1/namespaces/{namespace}/podtemplates/{name}Parametersname (in path): string, requiredname of the PodTemplatenamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (PodTemplate): OK401: Unauthorizedlist list or watch objects of kind PodTemplateHTTP RequestGET /api/v1/namespaces/{namespace}/podtemplatesParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (PodTemplateList): OK401: Unauthorizedlist list or watch objects of kind PodTemplateHTTP RequestGET /api/v1/podtemplatesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (PodTemplateList): OK401: Unauthorizedcreate create a PodTemplateHTTP RequestPOST /api/v1/namespaces/{namespace}/podtemplatesParametersnamespace (in path): string, requirednamespacebody: PodTemplate, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (PodTemplate): OK201 (PodTemplate): Created202 (PodTemplate): Accepted401: Unauthorizedupdate replace the specified PodTemplateHTTP RequestPUT /api/v1/namespaces/{namespace}/podtemplates/{name}Parametersname (in path): string, requiredname of the PodTemplatenamespace (in path): string, requirednamespacebody: PodTemplate, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (PodTemplate): OK201 (PodTemplate): Created401: Unauthorizedpatch partially update the specified PodTemplateHTTP RequestPATCH /api/v1/namespaces/{namespace}/podtemplates/{name}Parametersname (in path): string, requiredname of the PodTemplatename", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-template-v1/", "id": "k8s_00268"}
{"instruction": "Explain the Kubernetes concept: Kubernetes Self-Healing", "response": "Kubernetes Self-HealingKubernetes is designed with self-healing capabilities that help maintain the health and availability of workloads. It automatically replaces failed containers, reschedules workloads when nodes become unavailable, and ensures that the desired state of the system is maintained.Self-Healing capabilitiesContainer-level restarts: If a container inside a Pod fails, Kubernetes restarts it based on the restartPolicy.Replica replacement: If a Pod in a Deployment or StatefulSet fails, Kubernetes creates a replacement Pod to maintain the specified number of replicas. If a Pod fails that is part of a DaemonSet fails, the control plane creates a replacement Pod to run on the same node.Persistent storage recovery: If a node is running a Pod with a PersistentVolume (PV) attached, and the node fails, Kubernetes can reattach the volume to a new Pod on a different node.Load balancing for Services: If a Pod behind a Service fails, Kubernetes automatically removes it from the Service's endpoints to route traffic only to healthy Pods.Here are some of the key components that provide Kubernetes self-healing:kubelet: Ensures that containers are running, and restarts those that fail.ReplicaSet, StatefulSet and DaemonSet controller: Maintains the desired number of Pod replicas.PersistentVolume controller: Manages volume attachment and detachment for stateful workloads.ConsiderationsStorage Failures: If a persistent volume becomes unavailable, recovery steps may be required.Application Errors: Kubernetes can restart containers, but underlying application issues must be addressed separately.What's nextRead more about PodsLearn about Kubernetes ControllersExplore PersistentVolumesRead about node autoscaling. Node autoscaling also provides automatic healing if or when nodes fail in your cluster.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/self-healing/", "id": "k8s_00269"}
{"instruction": "Explain the Kubernetes concept: Recommended Labels", "response": "Recommended LabelsYou can visualize and manage Kubernetes objects with more tools than kubectl and the dashboard. A common set of labels allows tools to work interoperably, describing objects in a common manner that all tools can understand.In addition to supporting tooling, the recommended labels describe applications in a way that can be queried.The metadata is organized around the concept of an application. Kubernetes is not a platform as a service (PaaS) and doesn't have or enforce a formal notion of an application. Instead, applications are informal and described with metadata. The definition of what an application contains is loose.Note:These are recommended labels. They make it easier to manage applications but aren't required for any core tooling.Shared labels and annotations share a common prefix: app.kubernetes.io. Labels without a prefix are private to users. The shared prefix ensures that shared labels do not interfere with custom user labels.LabelsIn order to take full advantage of using these labels, they should be applied on every resource object.KeyDescriptionExampleTypeapp.kubernetes.io/nameThe name of the applicationmysqlstringapp.kubernetes.io/instanceA unique name identifying the instance of an applicationmysql-abcxyzstringapp.kubernetes.io/versionThe current version of the application (e.g., a SemVer 1.0, revision hash, etc.)5.7.21stringapp.kubernetes.io/componentThe component within the architecturedatabasestringapp.kubernetes.io/part-ofThe name of a higher level application this one is part ofwordpressstringapp.kubernetes.io/managed-byThe tool being used to manage the operation of an applicationHelmstringTo illustrate these labels in action, consider the following StatefulSet object:# This is an excerpt apiVersion: apps/v1 kind: StatefulSet metadata: labels: app.kubernetes.io/name: mysql app.kubernetes.io/instance: mysql-abcxyz app.kubernetes.io/version: \"5.7.21\" app.kubernetes.io/component: database app.kubernetes.io/part-of: wordpress app.kubernetes.io/managed-by: Helm Applications And Instances Of ApplicationsAn application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are different installations of WordPress.The name of an application and the instance name are recorded separately. For example, WordPress has a app.kubernetes.io/name of wordpress while it has an instance name, represented as app.kubernetes.io/instance with a value of wordpress-abcxyz. This enables the application and instance of the application to be identifiable. Every instance of an application must have a unique name.ExamplesTo illustrate different ways to use these labels the following examples have varying complexity.A Simple Stateless ServiceConsider the case for a simple stateless service deployed using Deployment and Service objects. The following two snippets represent how the labels could be used in their simplest form.The Deployment is used to oversee the pods running the application itself.apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/name: myservice app.kubernetes.io/instance: myservice-abcxyz ... The Service is used to expose the application.apiVersion: v1 kind: Service metadata: labels: app.kubernetes.io/name: myservice app.kubernetes.io/instance: myservice-abcxyz ... Web Application With A DatabaseConsider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy this application.The start to the following Deployment is used for WordPress:apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/name: wordpress app.kubernetes.io/instance: wordpress-abcxyz app.kubernetes.io/version: \"4.9.4\" app.kubernetes.io/managed-by: Helm app.kubernetes.io/component: server app.kubernetes.io/part-of: wordpress ... The Service is use", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\nRecommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3292"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\nRecommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3293"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\nRecommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3294"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3295"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3296"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3297"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3298"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\nRecommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3299"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\nRecommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3300"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\nRecommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3301"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3302"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3303"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3304"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3305"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\nRecommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3306"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\nRecommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3307"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\nRecommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3308"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3309"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3310"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3311"}
{"instruction": "Write a yaml example for recommended labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\nRecommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/", "id": "k8s_00270_code_3312"}
{"instruction": "How do you administer a cluster in Kubernetes?", "response": "Administer a ClusterLearn common tasks for administering a cluster.Administration with kubeadmOverprovision Node Capacity For A ClusterMigrating from dockershimGenerate Certificates ManuallyManage Memory, CPU, and API ResourcesInstall a Network Policy ProviderAccess Clusters Using the Kubernetes APIAdvertise Extended Resources for a NodeAutoscale the DNS Service in a ClusterChange the Access Mode of a PersistentVolume to ReadWriteOncePodChange the default StorageClassSwitching from Polling to CRI Event-based Updates to Container StatusChange the Reclaim Policy of a PersistentVolumeCloud Controller Manager AdministrationConfigure a kubelet image credential providerConfigure Quotas for API ObjectsControl CPU Management Policies on the NodeControl Topology Management Policies on a nodeCustomizing DNS ServiceDebugging DNS ResolutionDeclare Network PolicyDeveloping Cloud Controller ManagerEnable Or Disable A Kubernetes APIEncrypting Confidential Data at RestDecrypt Confidential Data that is Already Encrypted at RestGuaranteed Scheduling For Critical Add-On PodsIP Masquerade Agent User GuideLimit Storage ConsumptionMigrate Replicated Control Plane To Use Cloud Controller ManagerOperating etcd clusters for KubernetesReserve Compute Resources for System DaemonsRunning Kubernetes Node Components as a Non-root UserSafely Drain a NodeSecuring a ClusterSet Kubelet Parameters Via A Configuration FileShare a Cluster with NamespacesUpgrade A ClusterUse Cascading Deletion in a ClusterUsing a KMS provider for data encryptionUsing CoreDNS for Service DiscoveryUsing NodeLocal DNSCache in Kubernetes ClustersUsing sysctls in a Kubernetes ClusterUtilizing the NUMA-aware Memory ManagerVerify Signed Kubernetes Artifacts", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/", "id": "k8s_00271"}
{"instruction": "Explain considerations for large clusters in Kubernetes", "response": "Considerations for large clustersA cluster is a set of nodes (physical or virtual machines) running Kubernetes agents, managed by the control plane. Kubernetes v1.34 supports clusters with up to 5,000 nodes. More specifically, Kubernetes is designed to accommodate configurations that meet all of the following criteria:No more than 110 pods per nodeNo more than 5,000 nodesNo more than 150,000 total podsNo more than 300,000 total containersYou can scale your cluster by adding or removing nodes. The way you do this depends on how your cluster is deployed.Cloud provider resource quotasTo avoid running into cloud provider quota issues, when creating a cluster with many nodes, consider:Requesting a quota increase for cloud resources such as:Computer instancesCPUsStorage volumesIn-use IP addressesPacket filtering rule setsNumber of load balancersNetwork subnetsLog streamsGating the cluster scaling actions to bring up new nodes in batches, with a pause between batches, because some cloud providers rate limit the creation of new instances.Control plane componentsFor a large cluster, you need a control plane with sufficient compute and other resources.Typically you would run one or two control plane instances per failure zone, scaling those instances vertically first and then scaling horizontally after reaching the point of falling returns to (vertical) scale.You should run at least one instance per failure zone to provide fault-tolerance. Kubernetes nodes do not automatically steer traffic towards control-plane endpoints that are in the same failure zone; however, your cloud provider might have its own mechanisms to do this.For example, using a managed load balancer, you configure the load balancer to send traffic that originates from the kubelet and Pods in failure zone A, and direct that traffic only to the control plane hosts that are also in zone A. If a single control-plane host or endpoint failure zone A goes offline, that means that all the control-plane traffic for nodes in zone A is now being sent between zones. Running multiple control plane hosts in each zone makes that outcome less likely.etcd storageTo improve performance of large clusters, you can store Event objects in a separate dedicated etcd instance.When creating a cluster, you can (using custom tooling):start and configure additional etcd instanceconfigure the API server to use it for storing eventsSee Operating etcd clusters for Kubernetes and Set up a High Availability etcd cluster with kubeadm for details on configuring and managing etcd for a large cluster.Addon resourcesKubernetes resource limits help to minimize the impact of memory leaks and other ways that pods and containers can impact on other components. These resource limits apply to addon resources just as they apply to application workloads.For example, you can set CPU and memory limits for a logging component: ... containers: - name: fluentd-cloud-logging image: fluent/fluentd-kubernetes-daemonset:v1 resources: limits: cpu: 100m memory: 200Mi Addons' default limits are typically based on data collected from experience running each addon on small or medium Kubernetes clusters. When running on large clusters, addons often consume more of some resources than their default limits. If a large cluster is deployed without adjusting these values, the addon(s) may continuously get killed because they keep hitting the memory limit. Alternatively, the addon may run but with poor performance due to CPU time slice restrictions.To avoid running into cluster addon resource issues, when creating a cluster with many nodes, consider the following:Some addons scale vertically - there is one replica of the addon for the cluster or serving a whole failure zone. For these addons, increase requests and limits as you scale out your cluster.Many addons scale horizontally - you add capacity by running more pods - but with a very large cluster you may also need to raise CPU or memory limits slightly. The Vertical Pod Autoscaler", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/best-practices/cluster-large/", "id": "k8s_00272"}
{"instruction": "Write a yaml example for considerations for large clusters", "response": "Here's a yaml example:\n\n```yaml\n...\n  containers:\n  - name: fluentd-cloud-logging\n    image: fluent/fluentd-kubernetes-daemonset:v1\n    resources:\n      limits:\n        cpu: 100m\n        memory: 200Mi\n```\n\nConsiderations for large clusters | Addons' default limits are typically based on data collected from experience running each addon on small or medium Kubernetes clusters. When running on large clusters, addons often consume more of som", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/best-practices/cluster-large/", "id": "k8s_00272_code_3315"}
{"instruction": "Explain the Kubernetes concept: User Namespaces", "response": "User NamespacesFEATURE STATE: Kubernetes v1.30 [beta]This page explains how user namespaces are used in Kubernetes pods. A user namespace isolates the user running inside the container from the one in the host.A process running as root in a container can run as a different (non-root) user in the host; in other words, the process has full privileges for operations inside the user namespace, but is unprivileged for operations outside the namespace.You can use this feature to reduce the damage a compromised container can do to the host or other pods in the same node. There are several security vulnerabilities rated either HIGH or CRITICAL that were not exploitable when user namespaces is active. It is expected user namespace will mitigate some future vulnerabilities too.Before you beginNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.This is a Linux-only feature and support is needed in Linux for idmap mounts on the filesystems used. This means:On the node, the filesystem you use for /var/lib/kubelet/pods/, or the custom directory you configure for this, needs idmap mount support.All the filesystems used in the pod's volumes must support idmap mounts.In practice this means you need at least Linux 6.3, as tmpfs started supporting idmap mounts in that version. This is usually needed as several Kubernetes features use tmpfs (the service account token that is mounted by default uses a tmpfs, Secrets use a tmpfs, etc.)Some popular filesystems that support idmap mounts in Linux 6.3 are: btrfs, ext4, xfs, fat, tmpfs, overlayfs.In addition, the container runtime and its underlying OCI runtime must support user namespaces. The following OCI runtimes offer support:crun version 1.9 or greater (it's recommend version 1.13+).runc version 1.2 or greaterNote:Some OCI runtimes do not include the support needed for using user namespaces in Linux pods. If you use a managed Kubernetes, or have downloaded it from packages and set it up, it's possible that nodes in your cluster use a runtime that doesn't include this support.To use user namespaces with Kubernetes, you also need to use a CRI container runtime to use this feature with Kubernetes pods:containerd: version 2.0 (and later) supports user namespaces for containers.CRI-O: version 1.25 (and later) supports user namespaces for containers.You can see the status of user namespaces support in cri-dockerd tracked in an issue on GitHub.IntroductionUser namespaces is a Linux feature that allows to map users in the container to different users in the host. Furthermore, the capabilities granted to a pod in a user namespace are valid only in the namespace and void outside of it.A pod can opt-in to use user namespaces by setting the pod.spec.hostUsers field to false.The kubelet will pick host UIDs/GIDs a pod is mapped to, and will do so in a way to guarantee that no two pods on the same node use the same mapping.The runAsUser, runAsGroup, fsGroup, etc. fields in the pod.spec always refer to the user inside the container. These users will be used for volume mounts (specified in pod.spec.volumes) and therefore the host UID/GID will not have any effect on writes/reads from volumes the pod can mount. In other words, the inodes created/read in volumes mounted by the pod will be the same as if the pod wasn't using user namespaces.This way, a pod can easily enable and disable user namespaces (without affecting its volume's file ownerships) and can also share volumes with pods without user namespaces by just setting the appropriate users inside the container (RunAsUser, RunAsGroup, fsGroup, etc.). This applies to any volume the pod can mount, including hostPath (if the pod is allowed to mount hostPath volumes).By default, the valid UIDs/GIDs when this feature is e", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/user-namespaces/", "id": "k8s_00273"}
{"instruction": "Write a yaml example for user namespaces", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\nUser Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/user-namespaces/", "id": "k8s_00273_code_3317"}
{"instruction": "Write a yaml example for user namespaces", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\nUser Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/user-namespaces/", "id": "k8s_00273_code_3318"}
{"instruction": "Write a yaml example for user namespaces", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\nUser Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/user-namespaces/", "id": "k8s_00273_code_3319"}
{"instruction": "Explain the Kubernetes concept: Security For Windows Nodes", "response": "Security For Windows NodesThis page describes security considerations and best practices specific to the Windows operating system.Protection for Secret data on nodesOn Windows, data from Secrets are written out in clear text onto the node's local storage (as compared to using tmpfs / in-memory filesystems on Linux). As a cluster operator, you should take both of the following additional measures:Use file ACLs to secure the Secrets' file location.Apply volume-level encryption using BitLocker.Container usersRunAsUsername can be specified for Windows Pods or containers to execute the container processes as specific user. This is roughly equivalent to RunAsUser.Windows containers offer two default user accounts, ContainerUser and ContainerAdministrator. The differences between these two user accounts are covered in When to use ContainerAdmin and ContainerUser user accounts within Microsoft's Secure Windows containers documentation.Local users can be added to container images during the container build process.Note:Nano Server based images run as ContainerUser by defaultServer Core based images run as ContainerAdministrator by defaultWindows containers can also run as Active Directory identities by utilizing Group Managed Service AccountsPod-level security isolationLinux-specific pod security context mechanisms (such as SELinux, AppArmor, Seccomp, or custom POSIX capabilities) are not supported on Windows nodes.Privileged containers are not supported on Windows. Instead HostProcess containers can be used on Windows to perform many of the tasks performed by privileged containers on Linux.", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/windows-security/", "id": "k8s_00274"}
{"instruction": "How do you troubleshooting cni plugin-related errors in Kubernetes?", "response": "Troubleshooting CNI plugin-related errorsTo avoid CNI plugin-related errors, verify that you are using or upgrading to a container runtime that has been tested to work correctly with your version of Kubernetes.About the \"Incompatible CNI versions\" and \"Failed to destroy network for sandbox\" errorsService issues exist for pod CNI network setup and tear down in containerd v1.6.0-v1.6.3 when the CNI plugins have not been upgraded and/or the CNI config version is not declared in the CNI config files. The containerd team reports, \"these issues are resolved in containerd v1.6.4.\"With containerd v1.6.0-v1.6.3, if you do not upgrade the CNI plugins and/or declare the CNI config version, you might encounter the following \"Incompatible CNI versions\" or \"Failed to destroy network for sandbox\" error conditions.Incompatible CNI versions errorIf the version of your CNI plugin does not correctly match the plugin version in the config because the config version is later than the plugin version, the containerd log will likely show an error message on startup of a pod similar to:incompatible CNI versions; config is \\\"1.0.0\\\", plugin supports [\\\"0.1.0\\\" \\\"0.2.0\\\" \\\"0.3.0\\\" \\\"0.3.1\\\" \\\"0.4.0\\\"]\" To fix this issue, update your CNI plugins and CNI config files.Failed to destroy network for sandbox errorIf the version of the plugin is missing in the CNI plugin config, the pod may run. However, stopping the pod generates an error similar to:ERROR[2022-04-26T00:43:24.518165483Z] StopPodSandbox for \"b\" failed error=\"failed to destroy network for sandbox \\\"bbc85f891eaf060c5a879e27bba9b6b06450210161dfdecfbb2732959fb6500a\\\": invalid version \\\"\\\": the version is empty\" This error leaves the pod in the not-ready state with a network namespace still attached. To recover from this problem, edit the CNI config file to add the missing version information. The next attempt to stop the pod should be successful.Updating your CNI plugins and CNI config filesIf you're using containerd v1.6.0-v1.6.3 and encountered \"Incompatible CNI versions\" or \"Failed to destroy network for sandbox\" errors, consider updating your CNI plugins and editing the CNI config files.Here's an overview of the typical steps for each node:Safely drain and cordon the node.After stopping your container runtime and kubelet services, perform the following upgrade operations:If you're running CNI plugins, upgrade them to the latest version.If you're using non-CNI plugins, replace them with CNI plugins. Use the latest version of the plugins.Update the plugin configuration file to specify or match a version of the CNI specification that the plugin supports, as shown in the following \"An example containerd configuration file\" section.For containerd, ensure that you have installed the latest version (v1.0.0 or later) of the CNI loopback plugin.Upgrade node components (for example, the kubelet) to Kubernetes v1.24Upgrade to or install the most current version of the container runtime.Bring the node back into your cluster by restarting your container runtime and kubelet. Uncordon the node (kubectl uncordon <nodename>).An example containerd configuration fileThe following example shows a configuration for containerd runtime v1.6.x, which supports a recent version of the CNI specification (v1.0.0).Please see the documentation from your plugin and networking provider for further instructions on configuring your system.On Kubernetes, containerd runtime adds a loopback interface, lo, to pods as a default behavior. The containerd runtime configures the loopback interface via a CNI plugin, loopback. The loopback plugin is distributed as part of the containerd release packages that have the cni designation. containerd v1.6.0 and later includes a CNI v1.0.0-compatible loopback plugin as well as other default CNI plugins. The configuration for the loopback plugin is done internally by containerd, and is set to use CNI v1.0.0. This also means that the version of the loopback plugin must be v1.0.0 or later when this", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/troubleshooting-cni-plugin-related-errors/", "id": "k8s_00275"}
{"instruction": "Write a bash example for troubleshooting cni plugin-related errors", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <nodename>\n```\n\nTroubleshooting CNI plugin-related errors | The following example shows a configuration for containerd runtime v1.6.x, which supports a recent version of the CNI specification (v1.0.0).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/troubleshooting-cni-plugin-related-errors/", "id": "k8s_00275_code_3322"}
{"instruction": "Write a bash example for troubleshooting cni plugin-related errors", "response": "Here's a bash example:\n\n```bash\ncat << EOF | tee /etc/cni/net.d/10-containerd-net.conflist\n{\n \"cniVersion\": \"1.0.0\",\n \"name\": \"containerd-net\",\n \"plugins\": [\n   {\n     \"type\": \"bridge\",\n     \"bridge\": \"cni0\",\n     \"isGateway\": true,\n     \"ipMasq\": true,\n     \"promiscMode\": true,\n     \"ipam\": {\n       \"type\": \"host-local\",\n       \"ranges\": [\n         [{\n           \"subnet\": \"10.88.0.0/16\"\n         }],\n         [{\n           \"subnet\": \"2001:db8:4860::/64\"\n         }]\n       ],\n       \"routes\": [\n         { \"dst\": \"0.0.0.0/0\" },\n         { \"dst\": \"::/0\" }\n       ]\n     }\n   },\n   {\n     \"type\": \"portmap\",\n     \"capabilities\": {\"portMappings\": true},\n     \"externalSetMarkChain\": \"KUBE-MARK-MASQ\"\n   }\n ]\n}\nEOF\n```\n\nTroubleshooting CNI plugin-related errors | Update the IP address ranges in the preceding example with ones that are based on your use case and network addressing plan.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/troubleshooting-cni-plugin-related-errors/", "id": "k8s_00275_code_3323"}
{"instruction": "How do you indexed job for parallel processing with static work assignment in Kubernetes?", "response": "Indexed Job for Parallel Processing with Static Work AssignmentFEATURE STATE: Kubernetes v1.24 [stable]In this example, you will run a Kubernetes Job that uses multiple parallel worker processes. Each worker is a different container running in its own Pod. The Pods have an index number that the control plane sets automatically, which allows each Pod to identify which part of the overall task to work on.The pod index is available in the annotation batch.kubernetes.io/job-completion-index as a string representing its decimal value. In order for the containerized task process to obtain this index, you can publish the value of the annotation using the downward API mechanism. For convenience, the control plane automatically sets the downward API to expose the index in the JOB_COMPLETION_INDEX environment variable.Here is an overview of the steps in this example:Define a Job manifest using indexed completion. The downward API allows you to pass the pod index annotation as an environment variable or file to the container.Start an Indexed Job based on that manifest.Before you beginYou should already be familiar with the basic, non-parallel, use of Job.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.21.To check the version, enter kubectl version.Choose an approachTo access the work item from the worker program, you have a few options:Read the JOB_COMPLETION_INDEX environment variable. The Job controller automatically links this variable to the annotation containing the completion index.Read a file that contains the completion index.Assuming that you can't modify the program, you can wrap it with a script that reads the index using any of the methods above and converts it into something that the program can use as input.For this example, imagine that you chose option 3 and you want to run the rev utility. This program accepts a file as an argument and prints its content reversed.rev data.txt You'll use the rev tool from the busybox container image.As this is only an example, each Pod only does a tiny piece of work (reversing a short string). In a real workload you might, for example, create a Job that represents the task of producing 60 seconds of video based on scene data. Each work item in the video rendering Job would be to render a particular frame of that video clip. Indexed completion would mean that each Pod in the Job knows which frame to render and publish, by counting frames from the start of the clip.Define an Indexed JobHere is a sample Job manifest that uses Indexed completion mode:application/job/indexed-job.yaml apiVersion: batch/v1 kind: Job metadata: name: 'indexed-job' spec: completions: 5 parallelism: 3 completionMode: Indexed template: spec: restartPolicy: Never initContainers: - name: 'input' image: 'docker.io/library/bash' command: - \"bash\" - \"-c\" - | items=(foo bar baz qux xyz) echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt volumeMounts: - mountPath: /input name: input containers: - name: 'worker' image: 'docker.io/library/busybox' command: - \"rev\" - \"/input/data.txt\" volumeMounts: - mountPath: /input name: input volumes: - name: input emptyDir: {} In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a file that is shared with the container running the worker through an emptyDir volume. Optionally, you can define your own environment variable through the downward API to publish the index to containers. You can also choose to load a list o", "category": "tasks", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3325"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3326"}
{"instruction": "Write a bash example for indexed job for parallel processing with static work assignment", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/indexed-job\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3327"}
{"instruction": "Write a bash example for indexed job for parallel processing with static work assignment", "response": "Here's a bash example:\n\n```bash\nkubectl logs indexed-job-fdhq5 # Change this to match the name of a Pod from that Job\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3328"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3329"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3330"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napplication/job/indexed-job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3331"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3332"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napplication/job/indexed-job-vol.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3333"}
{"instruction": "Write a yaml example for indexed job for parallel processing with static work assignment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3334"}
{"instruction": "Write a bash example for indexed job for parallel processing with static work assignment", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/indexed-job\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3335"}
{"instruction": "Write a bash example for indexed job for parallel processing with static work assignment", "response": "Here's a bash example:\n\n```bash\nkubectl logs indexed-job-fdhq5 # Change this to match the name of a Pod from that Job\n```\n\nIndexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/indexed-parallel-processing-static/", "id": "k8s_00276_code_3336"}
{"instruction": "Explain the Kubernetes concept: Pod Security Admission", "response": "Pod Security AdmissionAn overview of the Pod Security Admission Controller, which can enforce the Pod Security Standards.FEATURE STATE: Kubernetes v1.25 [stable]The Kubernetes Pod Security Standards define different isolation levels for Pods. These standards let you define how you want to restrict the behavior of pods in a clear, consistent fashion.Kubernetes offers a built-in Pod Security admission controller to enforce the Pod Security Standards. Pod security restrictions are applied at the namespace level when pods are created.Built-in Pod Security admission enforcementThis page is part of the documentation for Kubernetes v1.34. If you are running a different version of Kubernetes, consult the documentation for that release.Pod Security levelsPod Security admission places requirements on a Pod's Security Context and other related fields according to the three levels defined by the Pod Security Standards: privileged, baseline, and restricted. Refer to the Pod Security Standards page for an in-depth look at those requirements.Pod Security Admission labels for namespacesOnce the feature is enabled or the webhook is installed, you can configure namespaces to define the admission control mode you want to use for pod security in each namespace. Kubernetes defines a set of labels that you can set to define which of the predefined Pod Security Standard levels you want to use for a namespace. The label you select defines what action the control plane takes if a potential violation is detected:Pod Security Admission modesModeDescriptionenforcePolicy violations will cause the pod to be rejected.auditPolicy violations will trigger the addition of an audit annotation to the event recorded in the audit log, but are otherwise allowed.warnPolicy violations will trigger a user-facing warning, but are otherwise allowed.A namespace can configure any or all modes, or even set a different level for different modes.For each mode, there are two labels that determine the policy used:# The per-mode level label indicates which policy level to apply for the mode. # # MODE must be one of `enforce`, `audit`, or `warn`. # LEVEL must be one of `privileged`, `baseline`, or `restricted`. pod-security.kubernetes.io/<MODE>: <LEVEL> # Optional: per-mode version label that can be used to pin the policy to the # version that shipped with a given Kubernetes minor version (for example v1.34). # # MODE must be one of `enforce`, `audit`, or `warn`. # VERSION must be a valid Kubernetes minor version, or `latest`. pod-security.kubernetes.io/<MODE>-version: <VERSION> Check out Enforce Pod Security Standards with Namespace Labels to see example usage.Workload resources and Pod templatesPods are often created indirectly, by creating a workload object such as a Deployment or Job. The workload object defines a Pod template and a controller for the workload resource creates Pods based on that template. To help catch violations early, both the audit and warning modes are applied to the workload resources. However, enforce mode is not applied to workload resources, only to the resulting pod objects.ExemptionsYou can define exemptions from pod security enforcement in order to allow the creation of pods that would have otherwise been prohibited due to the policy associated with a given namespace. Exemptions can be statically configured in the Admission Controller configuration.Exemptions must be explicitly enumerated. Requests meeting exemption criteria are ignored by the Admission Controller (all enforce, audit and warn behaviors are skipped). Exemption dimensions include:Usernames: requests from users with an exempt authenticated (or impersonated) username are ignored.RuntimeClassNames: pods and workload resources specifying an exempt runtime class name are ignored.Namespaces: pods and workload resources in an exempt namespace are ignored.Caution:Most pods are created by a controller in response to a workload resource, meaning that exempting an end user will only exempt them", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/security/pod-security-admission/", "id": "k8s_00277"}
{"instruction": "Write a yaml example for pod security admission", "response": "Here's a yaml example:\n\n```yaml\n# The per-mode level label indicates which policy level to apply for the mode.\n#\n# MODE must be one of `enforce`, `audit`, or `warn`.\n# LEVEL must be one of `privileged`, `baseline`, or `restricted`.\npod-security.kubernetes.io/<MODE>: <LEVEL>\n\n# Optional: per-mode version label that can be used to pin the policy to the\n# version that shipped with a given Kubernetes minor version (for example v1.34).\n#\n# MODE must be one of `enforce`, `audit`, or `warn`.\n# VERSION must be a valid Kubernetes minor version, or `latest`.\npod-security.kubernetes.io/<MODE>-version: <VERSION>\n```\n\nPod Security Admission | Check out Enforce Pod Security Standards with Namespace Labels to see example usage.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/security/pod-security-admission/", "id": "k8s_00277_code_3338"}
{"instruction": "What is the reference documentation for csidriver?", "response": "CSIDriverCSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster.apiVersion: storage.k8s.io/v1import \"k8s.io/api/storage/v1\"CSIDriverCSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster. Kubernetes attach detach controller uses this object to determine whether attach is required. Kubelet uses this object to determine whether pod information needs to be passed on mount. CSIDriver objects are non-namespaced.apiVersion: storage.k8s.io/v1kind: CSIDrivermetadata (ObjectMeta)Standard object metadata. metadata.Name indicates the name of the CSI driver that this object refers to; it MUST be the same name returned by the CSI GetPluginName() call for that driver. The driver name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (CSIDriverSpec), requiredspec represents the specification of the CSI Driver.CSIDriverSpecCSIDriverSpec is the specification of a CSIDriver.attachRequired (boolean)attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called.This field is immutable.fsGroupPolicy (string)fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details.This field was immutable in Kubernetes < 1.29 and now is mutable.Defaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.nodeAllocatableUpdatePeriodSeconds (int64)nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled.This field is mutable.podInfoOnMount (boolean)podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false.The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext.The following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" if the volume is an ephemeral inline volume defined by a CSIVolumeSource, otherwise \"false\"\"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only require", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/csi-driver-v1/", "id": "k8s_00278"}
{"instruction": "Write a yaml example for csidriver", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\nCSIDriver | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/csi-driver-v1/", "id": "k8s_00278_code_3340"}
{"instruction": "How do you use a socks5 proxy to access the kubernetes api in Kubernetes?", "response": "Use a SOCKS5 Proxy to Access the Kubernetes APIFEATURE STATE: Kubernetes v1.24 [stable]This page shows how to use a SOCKS5 proxy to access the API of a remote Kubernetes cluster. This is useful when the cluster you want to access does not expose its API directly on the public internet.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.24.To check the version, enter kubectl version.You need SSH client software (the ssh tool), and an SSH service running on the remote server. You must be able to log in to the SSH service on the remote server.Task contextNote:This example tunnels traffic using SSH, with the SSH client and server acting as a SOCKS proxy. You can instead use any other kind of SOCKS5 proxies.Figure 1 represents what you're going to achieve in this task.You have a client computer, referred to as local in the steps ahead, from where you're going to create requests to talk to the Kubernetes API.The Kubernetes server/API is hosted on a remote server.You will use SSH client and server software to create a secure SOCKS5 tunnel between the local and the remote server. The HTTPS traffic between the client and the Kubernetes API will flow over the SOCKS5 tunnel, which is itself tunnelled over SSH.graph LR; subgraph local[Local client machine] client([client])-. localtraffic .-> local_ssh[Local SSHSOCKS5 proxy]; end local_ssh[SSHSOCKS5proxy]-- SSH Tunnel -->sshd subgraph remote[Remote server] sshd[SSHserver]-- local traffic -->service1; end client([client])-. proxied HTTPs trafficgoing through the proxy .->service1[Kubernetes API]; classDef plain fill:#ddd,stroke:#fff,stroke-width:4px,color:#000; classDef k8s fill:#326ce5,stroke:#fff,stroke-width:4px,color:#fff; classDef cluster fill:#fff,stroke:#bbb,stroke-width:2px,color:#326ce5; class ingress,service1,service2,pod1,pod2,pod3,pod4 k8s; class client plain; class cluster cluster;JavaScript must be enabled to view this contentFigure 1. SOCKS5 tutorial componentsUsing ssh to create a SOCKS5 proxyThe following command starts a SOCKS5 proxy between your client machine and the remote SOCKS server:# The SSH tunnel continues running in the foreground after you run this ssh -D 1080 -q -N username@kubernetes-remote-server.example The SOCKS5 proxy lets you connect to your cluster's API server based on the following configuration:-D 1080: opens a SOCKS proxy on local port :1080.-q: quiet mode. Causes most warning and diagnostic messages to be suppressed.-N: Do not execute a remote command. Useful for just forwarding ports.username@kubernetes-remote-server.example: the remote SSH server behind which the Kubernetes cluster is running (eg: a bastion host).Client configurationTo access the Kubernetes API server through the proxy you must instruct kubectl to send queries through the SOCKS proxy we created earlier. Do this by either setting the appropriate environment variable, or via the proxy-url attribute in the kubeconfig file. Using an environment variable:export HTTPS_PROXY=socks5://localhost:1080 To always use this setting on a specific kubectl context, specify the proxy-url attribute in the relevant cluster entry within the ~/.kube/config file. For example:apiVersion: v1 clusters: - cluster: certificate-authority-data: LRMEMMW2 # shortened for readability server: https://<API_SERVER_IP_ADDRESS>:6443 # the \"Kubernetes API\" server, in other words the IP address of kubernetes-remote-server.example proxy-url: socks5://localhost:1080 # the \"SSH SOCKS5 proxy\" in the diagram above name: default contexts: - context: cluster: default user: default name: de", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/socks5-proxy-access-api/", "id": "k8s_00279"}
{"instruction": "Write a yaml example for use a socks5 proxy to access the kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: LRMEMMW2 # shortened for readability \n    server: https://<API_SERVER_IP_ADDRESS>:6443  # the \"Kubernetes API\" server, in other words the IP address of kubernetes-remote-server.example\n    proxy-url: socks5://localhost:1080   # the \"SSH SOCKS5 proxy\" in the diagram above\n  name: default\ncontexts:\n- context:\n    cluster: default\n    user: default\n  name: default\ncurrent-context: default\nkind: Config\npreferences: {}\nusers:\n- name: default\n  user:\n    client-certificate-data: LS0tLS1CR== # shortened for readability\n    client-key-data: LS0tLS1CRUdJT=      # shortened for readability\n```\n\nUse a SOCKS5 Proxy to Access the Kubernetes API | Once you have created the tunnel via the ssh command mentioned earlier, and defined either the environment variable or the proxy-url attribute, you can interact with your cluster through that proxy. F", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/socks5-proxy-access-api/", "id": "k8s_00279_code_3342"}
{"instruction": "Write a yaml example for use a socks5 proxy to access the kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: LRMEMMW2 # shortened for readability \n    server: https://<API_SERVER_IP_ADDRESS>:6443  # the \"Kubernetes API\" server, in other words the IP address of kubernetes-remote-server.example\n    proxy-url: socks5://localhost:1080   # the \"SSH SOCKS5 proxy\" in the diagram above\n  name: default\ncontexts:\n- context:\n    cluster: default\n    user: default\n  name: default\ncurrent-context: default\nkind: Config\npreferences: {}\nusers:\n- name: default\n  user:\n    client-certificate-data: LS0tLS1CR== # shortened for readability\n    client-key-data: LS0tLS1CRUdJT=      # shortened for readability\n```\n\nUse a SOCKS5 Proxy to Access the Kubernetes API | Once you have created the tunnel via the ssh command mentioned earlier, and defined either the environment variable or the proxy-url attribute, you can interact with your cluster through that proxy. F", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/socks5-proxy-access-api/", "id": "k8s_00279_code_3343"}
{"instruction": "Write a yaml example for use a socks5 proxy to access the kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: LRMEMMW2 # shortened for readability \n    server: https://<API_SERVER_IP_ADDRESS>:6443  # the \"Kubernetes API\" server, in other words the IP address of kubernetes-remote-server.example\n    proxy-url: socks5://localhost:1080   # the \"SSH SOCKS5 proxy\" in the diagram above\n  name: default\ncontexts:\n- context:\n    cluster: default\n    user: default\n  name: default\ncurrent-context: default\nkind: Config\npreferences: {}\nusers:\n- name: default\n  user:\n    client-certificate-data: LS0tLS1CR== # shortened for readability\n    client-key-data: LS0tLS1CRUdJT=      # shortened for readability\n```\n\nUse a SOCKS5 Proxy to Access the Kubernetes API | Once you have created the tunnel via the ssh command mentioned earlier, and defined either the environment variable or the proxy-url attribute, you can interact with your cluster through that proxy. F", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/socks5-proxy-access-api/", "id": "k8s_00279_code_3344"}
{"instruction": "What is the reference documentation for authorization resources?", "response": "Authorization ResourcesLocalSubjectAccessReviewLocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace.SelfSubjectAccessReviewSelfSubjectAccessReview checks whether or the current user can perform an action.SelfSubjectRulesReviewSelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.SubjectAccessReviewSubjectAccessReview checks whether or not a user or group can perform an action.ClusterRoleClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.ClusterRoleBindingClusterRoleBinding references a ClusterRole, but not contain it.RoleRole is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.RoleBindingRoleBinding references a role, but does not contain it.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/", "id": "k8s_00280"}
{"instruction": "What is the reference documentation for resourcequota?", "response": "ResourceQuotaResourceQuota sets aggregate quota restrictions enforced per namespace.apiVersion: v1import \"k8s.io/api/core/v1\"ResourceQuotaResourceQuota sets aggregate quota restrictions enforced per namespaceapiVersion: v1kind: ResourceQuotametadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (ResourceQuotaSpec)Spec defines the desired quota. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (ResourceQuotaStatus)Status defines the actual enforced quota and its current usage. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusResourceQuotaSpecResourceQuotaSpec defines the desired hard limits to enforce for Quota.hard (map[string]Quantity)hard is the set of desired hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/scopeSelector (ScopeSelector)scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota but expressed using ScopeSelectorOperator in combination with possible values. For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched.A scope selector represents the AND of the selectors represented by the scoped-resource selector requirements.scopeSelector.matchExpressions ([]ScopedResourceSelectorRequirement)Atomic: will be replaced during a mergeA list of scope selector requirements by scope of the resources.A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator that relates the scope name and values.scopeSelector.matchExpressions.operator (string), requiredRepresents a scope's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist.scopeSelector.matchExpressions.scopeName (string), requiredThe name of the scope that the selector applies to.scopeSelector.matchExpressions.values ([]string)Atomic: will be replaced during a mergeAn array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.scopes ([]string)Atomic: will be replaced during a mergeA collection of filters that must match each object tracked by a quota. If not specified, the quota matches all objects.ResourceQuotaStatusResourceQuotaStatus defines the enforced hard limits and observed use.hard (map[string]Quantity)Hard is the set of enforced hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/used (map[string]Quantity)Used is the current observed total usage of the resource in the namespace.ResourceQuotaListResourceQuotaList is a list of ResourceQuota items.apiVersion: v1kind: ResourceQuotaListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems ([]ResourceQuota), requiredItems is a list of ResourceQuota objects. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/Operationsget read the specified ResourceQuotaHTTP RequestGET /api/v1/namespaces/{namespace}/resourcequotas/{name}Parametersname (in path): string, requiredname of the ResourceQuotanamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (ResourceQuota): OK401: Unauthorizedget read status of the specified ResourceQuotaHTTP RequestGET /api/v1/namespaces/{namespace}/resourcequotas/{name}/statusParametersname (in path): string, requiredname of the ResourceQuotanamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (ResourceQuota): OK401: Unauthorizedlist list or watch objects of kind ResourceQuotaHTTP RequestGET /api/v1/namespaces/{namespace}/resourcequotasParametersnamespace (in path): string, req", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/resource-quota-v1/", "id": "k8s_00281"}
{"instruction": "How do you debug pods in Kubernetes?", "response": "Debug PodsThis guide is to help users debug applications that are deployed into Kubernetes and not behaving correctly. This is not a guide for people who want to debug their cluster. For that you should check out this guide.Diagnosing the problemThe first step in troubleshooting is triage. What is the problem? Is it your Pods, your Replication Controller or your Service?Debugging PodsDebugging Replication ControllersDebugging ServicesDebugging PodsThe first step in debugging a Pod is taking a look at it. Check the current state of the Pod and recent events with the following command:kubectl describe pods ${POD_NAME} Look at the state of the containers in the pod. Are they all Running? Have there been recent restarts?Continue debugging depending on the state of the pods.My pod stays pendingIf a Pod is stuck in Pending it means that it can not be scheduled onto a node. Generally this is because there are insufficient resources of one type or another that prevent scheduling. Look at the output of the kubectl describe ... command above. There should be messages from the scheduler about why it can not schedule your pod. Reasons include:You don't have enough resources: You may have exhausted the supply of CPU or Memory in your cluster, in this case you need to delete Pods, adjust resource requests, or add new nodes to your cluster. See Compute Resources document for more information.You are using hostPort: When you bind a Pod to a hostPort there are a limited number of places that pod can be scheduled. In most cases, hostPort is unnecessary, try using a Service object to expose your Pod. If you do require hostPort then you can only schedule as many Pods as there are nodes in your Kubernetes cluster.My pod stays waitingIf a Pod is stuck in the Waiting state, then it has been scheduled to a worker node, but it can't run on that machine. Again, the information from kubectl describe ... should be informative. The most common cause of Waiting pods is a failure to pull the image. There are three things to check:Make sure that you have the name of the image correct.Have you pushed the image to the registry?Try to manually pull the image to see if the image can be pulled. For example, if you use Docker on your PC, run docker pull <image>.My pod stays terminatingIf a Pod is stuck in the Terminating state, it means that a deletion has been issued for the Pod, but the control plane is unable to delete the Pod object.This typically happens if the Pod has a finalizer and there is an admission webhook installed in the cluster that prevents the control plane from removing the finalizer.To identify this scenario, check if your cluster has any ValidatingWebhookConfiguration or MutatingWebhookConfiguration that target UPDATE operations for pods resources.If the webhook is provided by a third-party:Make sure you are using the latest version.Disable the webhook for UPDATE operations.Report an issue with the corresponding provider.If you are the author of the webhook:For a mutating webhook, make sure it never changes immutable fields on UPDATE operations. For example, changes to containers are usually not allowed.For a validating webhook, make sure that your validation policies only apply to new changes. In other words, you should allow Pods with existing violations to pass validation. This allows Pods that were created before the validating webhook was installed to continue running.My pod is crashing or otherwise unhealthyOnce your pod has been scheduled, the methods described in Debug Running Pods are available for debugging.My pod is running but not doing what I told it to doIf your pod is not behaving as you expected, it may be that there was an error in your pod description (e.g. mypod.yaml file on your local machine), and that the error was silently ignored when you created the pod. Often a section of the pod description is nested incorrectly, or a key name is typed incorrectly, and so the key is ignored. For example, if you misspelled command as ", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods ${POD_NAME}\n```\n\nDebug Pods | Look at the state of the containers in the pod. Are they all Running? Have there been recent restarts?", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3348"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=${SERVICE_NAME}\n```\n\nDebug Pods | Make sure that the endpoints in the EndpointSlices match up with the number of pods that you expect to be members of your service. For example, if your Service is for an nginx container with 3 replica", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3349"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=name=nginx,type=frontend\n```\n\nDebug Pods | to list pods that match this selector. Verify that the list matches the Pods that you expect to provide your Service. Verify that the pod's containerPort matches up with the Service's targetPort", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3350"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply --validate -f mypod.yaml\n```\n\nDebug Pods | The next thing to check is whether the pod on the apiserver matches the pod you meant to create (e.g. in a yaml file on your local machine). For example, run kubectl get pods/mypod -o yaml > mypod-on-", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3351"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/mypod -o yaml > mypod-on-apiserver.yaml\n```\n\nDebug Pods | Replication controllers are fairly straightforward. They can either create Pods or they can't. If they can't create pods, then please refer to the instructions above to debug your pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3352"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe rc ${CONTROLLER_NAME}\n```\n\nDebug Pods | Services provide load balancing across a set of pods. There are several common problems that can make Services not work properly. The following instructions should help debug Service problems.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3353"}
{"instruction": "Write a yaml example for debug pods", "response": "Here's a yaml example:\n\n```yaml\n...\nspec:\n  - selector:\n     name: nginx\n     type: frontend\n```\n\nDebug Pods | You can use:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3354"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods ${POD_NAME}\n```\n\nDebug Pods | Look at the state of the containers in the pod. Are they all Running? Have there been recent restarts?", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3355"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=${SERVICE_NAME}\n```\n\nDebug Pods | Make sure that the endpoints in the EndpointSlices match up with the number of pods that you expect to be members of your service. For example, if your Service is for an nginx container with 3 replica", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3356"}
{"instruction": "Write a bash example for debug pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=name=nginx,type=frontend\n```\n\nDebug Pods | to list pods that match this selector. Verify that the list matches the Pods that you expect to provide your Service. Verify that the pod's containerPort matches up with the Service's targetPort", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-pods/", "id": "k8s_00282_code_3357"}
{"instruction": "Explain the Kubernetes concept: Assigning Pods to Nodes", "response": "Assigning Pods to NodesYou can constrain a Pod so that it is restricted to run on particular node(s), or to prefer to run on particular nodes. There are several ways to do this and the recommended approaches all use label selectors to facilitate the selection. Often, you do not need to set any such constraints; the scheduler will automatically do a reasonable placement (for example, spreading your Pods across nodes so as not place Pods on a node with insufficient free resources). However, there are some circumstances where you may want to control which node the Pod deploys to, for example, to ensure that a Pod ends up on a node with an SSD attached to it, or to co-locate Pods from two different services that communicate a lot into the same availability zone.You can use any of the following methods to choose where Kubernetes schedules specific Pods:nodeSelector field matching against node labelsAffinity and anti-affinitynodeName fieldPod topology spread constraintsNode labelsLike many other Kubernetes objects, nodes have labels. You can attach labels manually. Kubernetes also populates a standard set of labels on all nodes in a cluster.Note:The value of these labels is cloud provider specific and is not guaranteed to be reliable. For example, the value of kubernetes.io/hostname may be the same as the node name in some environments and a different value in other environments.Node isolation/restrictionAdding labels to nodes allows you to target Pods for scheduling on specific nodes or groups of nodes. You can use this functionality to ensure that specific Pods only run on nodes with certain isolation, security, or regulatory properties.If you use labels for node isolation, choose label keys that the kubelet cannot modify. This prevents a compromised node from setting those labels on itself so that the scheduler schedules workloads onto the compromised node.The NodeRestriction admission plugin prevents the kubelet from setting or modifying labels with a node-restriction.kubernetes.io/ prefix.To make use of that label prefix for node isolation:Ensure you are using the Node authorizer and have enabled the NodeRestriction admission plugin.Add labels with the node-restriction.kubernetes.io/ prefix to your nodes, and use those labels in your node selectors. For example, example.com.node-restriction.kubernetes.io/fips=true or example.com.node-restriction.kubernetes.io/pci-dss=true.nodeSelectornodeSelector is the simplest recommended form of node selection constraint. You can add the nodeSelector field to your Pod specification and specify the node labels you want the target node to have. Kubernetes only schedules the Pod onto nodes that have each of the labels you specify.See Assign Pods to Nodes for more information.Affinity and anti-affinitynodeSelector is the simplest way to constrain Pods to nodes with specific labels. Affinity and anti-affinity expand the types of constraints you can define. Some of the benefits of affinity and anti-affinity include:The affinity/anti-affinity language is more expressive. nodeSelector only selects nodes with all the specified labels. Affinity/anti-affinity gives you more control over the selection logic.You can indicate that a rule is soft or preferred, so that the scheduler still schedules the Pod even if it can't find a matching node.You can constrain a Pod using labels on other Pods running on the node (or other topological domain), instead of just node labels, which allows you to define rules for which Pods can be co-located on a node.The affinity feature consists of two types of affinity:Node affinity functions like the nodeSelector field but is more expressive and allows you to specify soft rules.Inter-pod affinity/anti-affinity allows you to constrain Pods against labels on other Pods.Node affinityNode affinity is conceptually similar to nodeSelector, allowing you to constrain which nodes your Pod can be scheduled on based on node labels. There are two types of node affinity:requiredDuringSch", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3359"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3360"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: foo-scheduler\n    pluginConfig:\n      - name: NodeAffinity\n        args:\n          addedAffinity:\n            requiredDuringSchedulingIgnoredDuringExecution:\n              nodeSelectorTerms:\n              - matchExpressions:\n                - key: scheduler-profile\n                  operator: In\n                  values:\n                  - foo\n```\n\nAssigning Pods to Nodes | The addedAffinity is applied to all Pods that set .spec.schedulerName to foo-scheduler, in addition to the NodeAffinity specified in the PodSpec. That is, in order to match the Pod, nodes need to sati", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3361"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3362"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: application-server\n...\nspec:\n  template:\n    spec:\n      affinity:\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - database\n            topologyKey: topology.kubernetes.io/zone\n            # Only Pods from a given rollout are taken into consideration when calculating pod affinity.\n            # If you update the Deployment, the replacement Pods follow their own affinity rules\n            # (if there are any defined in the new Pod template)\n            matchLabelKeys:\n            - pod-template-hash\n```\n\nAssigning Pods to Nodes | The mismatchLabelKeys field is a beta-level field and is enabled by default in Kubernetes 1.34. When you want to disable it, you have to disable it explicitly via the MatchLabelKeysInPodAffinity featu", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3363"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    # Assume that all relevant Pods have a \"tenant\" label set\n    tenant: tenant-a\n...\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant land on the correct node pool\n      - matchLabelKeys:\n          - tenant\n        topologyKey: node-pool\n    podAntiAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant can't schedule to nodes used for another tenant\n      - mismatchLabelKeys:\n        - tenant # whatever the value of the \"tenant\" label for this Pod, prevent\n                 # scheduling to nodes in any pool where any Pod from a different\n                 # tenant is running.\n        labelSelector:\n          # We have to have the labelSelector which selects only Pods with the tenant label,\n          # otherwise this Pod would have anti-affinity against Pods from daemonsets as well, for example,\n          # which aren't supposed to have the tenant label.\n          matchExpressions:\n          - key: tenant\n            operator: Exists\n        topologyKey: node-pool\n```\n\nAssigning Pods to Nodes | Inter-pod affinity and anti-affinity can be even more useful when they are used with higher level collections such as ReplicaSets, StatefulSets, Deployments, etc. These rules allow you to configure th", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3364"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-cache\nspec:\n  selector:\n    matchLabels:\n      app: store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: redis-server\n        image: redis:3.2-alpine\n```\n\nAssigning Pods to Nodes | The following example Deployment for the web servers creates replicas with the label app=web-store. The Pod affinity rule tells the scheduler to place each replica on a node that has a Pod with the la", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3365"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: web-server\nspec:\n  selector:\n    matchLabels:\n      app: web-store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: web-store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - web-store\n            topologyKey: \"kubernetes.io/hostname\"\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: web-app\n        image: nginx:1.16-alpine\n```\n\nAssigning Pods to Nodes | Creating the two preceding Deployments results in the following cluster layout, where each web server is co-located with a cache, on three separate nodes.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3366"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n  nodeName: kube-01\n```\n\nAssigning Pods to Nodes | The above Pod will only run on the node kube-01.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3367"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n...\nstatus:\n  nominatedNodeName: kube-01\n```\n\nAssigning Pods to Nodes | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, or among any other topology domains that you define. You", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3368"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3369"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3370"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: foo-scheduler\n    pluginConfig:\n      - name: NodeAffinity\n        args:\n          addedAffinity:\n            requiredDuringSchedulingIgnoredDuringExecution:\n              nodeSelectorTerms:\n              - matchExpressions:\n                - key: scheduler-profile\n                  operator: In\n                  values:\n                  - foo\n```\n\nAssigning Pods to Nodes | The addedAffinity is applied to all Pods that set .spec.schedulerName to foo-scheduler, in addition to the NodeAffinity specified in the PodSpec. That is, in order to match the Pod, nodes need to sati", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3371"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3372"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: application-server\n...\nspec:\n  template:\n    spec:\n      affinity:\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - database\n            topologyKey: topology.kubernetes.io/zone\n            # Only Pods from a given rollout are taken into consideration when calculating pod affinity.\n            # If you update the Deployment, the replacement Pods follow their own affinity rules\n            # (if there are any defined in the new Pod template)\n            matchLabelKeys:\n            - pod-template-hash\n```\n\nAssigning Pods to Nodes | The mismatchLabelKeys field is a beta-level field and is enabled by default in Kubernetes 1.34. When you want to disable it, you have to disable it explicitly via the MatchLabelKeysInPodAffinity featu", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3373"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    # Assume that all relevant Pods have a \"tenant\" label set\n    tenant: tenant-a\n...\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant land on the correct node pool\n      - matchLabelKeys:\n          - tenant\n        topologyKey: node-pool\n    podAntiAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant can't schedule to nodes used for another tenant\n      - mismatchLabelKeys:\n        - tenant # whatever the value of the \"tenant\" label for this Pod, prevent\n                 # scheduling to nodes in any pool where any Pod from a different\n                 # tenant is running.\n        labelSelector:\n          # We have to have the labelSelector which selects only Pods with the tenant label,\n          # otherwise this Pod would have anti-affinity against Pods from daemonsets as well, for example,\n          # which aren't supposed to have the tenant label.\n          matchExpressions:\n          - key: tenant\n            operator: Exists\n        topologyKey: node-pool\n```\n\nAssigning Pods to Nodes | Inter-pod affinity and anti-affinity can be even more useful when they are used with higher level collections such as ReplicaSets, StatefulSets, Deployments, etc. These rules allow you to configure th", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3374"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-cache\nspec:\n  selector:\n    matchLabels:\n      app: store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: redis-server\n        image: redis:3.2-alpine\n```\n\nAssigning Pods to Nodes | The following example Deployment for the web servers creates replicas with the label app=web-store. The Pod affinity rule tells the scheduler to place each replica on a node that has a Pod with the la", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3375"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: web-server\nspec:\n  selector:\n    matchLabels:\n      app: web-store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: web-store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - web-store\n            topologyKey: \"kubernetes.io/hostname\"\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: web-app\n        image: nginx:1.16-alpine\n```\n\nAssigning Pods to Nodes | Creating the two preceding Deployments results in the following cluster layout, where each web server is co-located with a cache, on three separate nodes.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3376"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n  nodeName: kube-01\n```\n\nAssigning Pods to Nodes | The above Pod will only run on the node kube-01.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3377"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n...\nstatus:\n  nominatedNodeName: kube-01\n```\n\nAssigning Pods to Nodes | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, or among any other topology domains that you define. You", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3378"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-node-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3379"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3380"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-affinity-preferred-weight.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3381"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3382"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: foo-scheduler\n    pluginConfig:\n      - name: NodeAffinity\n        args:\n          addedAffinity:\n            requiredDuringSchedulingIgnoredDuringExecution:\n              nodeSelectorTerms:\n              - matchExpressions:\n                - key: scheduler-profile\n                  operator: In\n                  values:\n                  - foo\n```\n\nAssigning Pods to Nodes | The addedAffinity is applied to all Pods that set .spec.schedulerName to foo-scheduler, in addition to the NodeAffinity specified in the PodSpec. That is, in order to match the Pod, nodes need to sati", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3383"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-pod-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3384"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\nAssigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3385"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: application-server\n...\nspec:\n  template:\n    spec:\n      affinity:\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - database\n            topologyKey: topology.kubernetes.io/zone\n            # Only Pods from a given rollout are taken into consideration when calculating pod affinity.\n            # If you update the Deployment, the replacement Pods follow their own affinity rules\n            # (if there are any defined in the new Pod template)\n            matchLabelKeys:\n            - pod-template-hash\n```\n\nAssigning Pods to Nodes | The mismatchLabelKeys field is a beta-level field and is enabled by default in Kubernetes 1.34. When you want to disable it, you have to disable it explicitly via the MatchLabelKeysInPodAffinity featu", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3386"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    # Assume that all relevant Pods have a \"tenant\" label set\n    tenant: tenant-a\n...\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant land on the correct node pool\n      - matchLabelKeys:\n          - tenant\n        topologyKey: node-pool\n    podAntiAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant can't schedule to nodes used for another tenant\n      - mismatchLabelKeys:\n        - tenant # whatever the value of the \"tenant\" label for this Pod, prevent\n                 # scheduling to nodes in any pool where any Pod from a different\n                 # tenant is running.\n        labelSelector:\n          # We have to have the labelSelector which selects only Pods with the tenant label,\n          # otherwise this Pod would have anti-affinity against Pods from daemonsets as well, for example,\n          # which aren't supposed to have the tenant label.\n          matchExpressions:\n          - key: tenant\n            operator: Exists\n        topologyKey: node-pool\n```\n\nAssigning Pods to Nodes | Inter-pod affinity and anti-affinity can be even more useful when they are used with higher level collections such as ReplicaSets, StatefulSets, Deployments, etc. These rules allow you to configure th", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3387"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-cache\nspec:\n  selector:\n    matchLabels:\n      app: store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: redis-server\n        image: redis:3.2-alpine\n```\n\nAssigning Pods to Nodes | The following example Deployment for the web servers creates replicas with the label app=web-store. The Pod affinity rule tells the scheduler to place each replica on a node that has a Pod with the la", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3388"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: web-server\nspec:\n  selector:\n    matchLabels:\n      app: web-store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: web-store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - web-store\n            topologyKey: \"kubernetes.io/hostname\"\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: web-app\n        image: nginx:1.16-alpine\n```\n\nAssigning Pods to Nodes | Creating the two preceding Deployments results in the following cluster layout, where each web server is co-located with a cache, on three separate nodes.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3389"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n  nodeName: kube-01\n```\n\nAssigning Pods to Nodes | The above Pod will only run on the node kube-01.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3390"}
{"instruction": "Write a yaml example for assigning pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n...\nstatus:\n  nominatedNodeName: kube-01\n```\n\nAssigning Pods to Nodes | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, or among any other topology domains that you define. You", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/", "id": "k8s_00283_code_3391"}
{"instruction": "Explain the Kubernetes concept: Init Containers", "response": "Init ContainersThis page provides an overview of init containers: specialized containers that run before app containers in a Pod. Init containers can contain utilities or setup scripts not present in an app image.You can specify init containers in the Pod specification alongside the containers array (which describes app containers).In Kubernetes, a sidecar container is a container that starts before the main application container and continues to run. This document is about init containers: containers that run to completion during Pod initialization.Understanding init containersA Pod can have multiple containers running apps within it, but it can also have one or more init containers, which are run before the app containers are started.Init containers are exactly like regular containers, except:Init containers always run to completion.Each init container must complete successfully before the next one starts.If a Pod's init container fails, the kubelet repeatedly restarts that init container until it succeeds. However, if the Pod has a restartPolicy of Never, and an init container fails during startup of that Pod, Kubernetes treats the overall Pod as failed.To specify an init container for a Pod, add the initContainers field into the Pod specification, as an array of container items (similar to the app containers field and its contents). See Container in the API reference for more details.The status of the init containers is returned in .status.initContainerStatuses field as an array of the container statuses (similar to the .status.containerStatuses field).Differences from regular containersInit containers support all the fields and features of app containers, including resource limits, volumes, and security settings. However, the resource requests and limits for an init container are handled differently, as documented in Resource sharing within containers.Regular init containers (in other words: excluding sidecar containers) do not support the lifecycle, livenessProbe, readinessProbe, or startupProbe fields. Init containers must run to completion before the Pod can be ready; sidecar containers continue running during a Pod's lifetime, and do support some probes. See sidecar container for further details about sidecar containers.If you specify multiple init containers for a Pod, kubelet runs each init container sequentially. Each init container must succeed before the next can run. When all of the init containers have run to completion, kubelet initializes the application containers for the Pod and runs them as usual.Differences from sidecar containersInit containers run and complete their tasks before the main application container starts. Unlike sidecar containers, init containers are not continuously running alongside the main containers.Init containers run to completion sequentially, and the main container does not start until all the init containers have successfully completed.init containers do not support lifecycle, livenessProbe, readinessProbe, or startupProbe whereas sidecar containers support all these probes to control their lifecycle.Init containers share the same resources (CPU, memory, network) with the main application containers but do not interact directly with them. They can, however, use shared volumes for data exchange.Using init containersBecause init containers have separate images from app containers, they have some advantages for start-up related code:Init containers can contain utilities or custom code for setup that are not present in an app image. For example, there is no need to make an image FROM another image just to use a tool like sed, awk, python, or dig during setup.The application image builder and deployer roles can work independently without the need to jointly build a single app image.Init containers can run with a different view of the filesystem than app containers in the same Pod. Consequently, they can be given access to Secrets that app containers cannot access.Because init container", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284"}
{"instruction": "Write a yaml example for init containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\nInit Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3393"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3394"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3395"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3396"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl logs myapp-pod -c init-myservice # Inspect the first init container\nkubectl logs myapp-pod -c init-mydb      # Inspect the second init container\n```\n\nInit Containers | At this point, those init containers will be waiting to discover Services named mydb and myservice.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3397"}
{"instruction": "Write a yaml example for init containers", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\nInit Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3398"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f services.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3399"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3400"}
{"instruction": "Write a yaml example for init containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\nInit Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3401"}
{"instruction": "Write a yaml example for init containers", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\nInit Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3402"}
{"instruction": "Write a yaml example for init containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\nInit Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3403"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3404"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3405"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3406"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl logs myapp-pod -c init-myservice # Inspect the first init container\nkubectl logs myapp-pod -c init-mydb      # Inspect the second init container\n```\n\nInit Containers | At this point, those init containers will be waiting to discover Services named mydb and myservice.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3407"}
{"instruction": "Write a yaml example for init containers", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\nInit Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3408"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f services.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3409"}
{"instruction": "Write a bash example for init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\nInit Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", "id": "k8s_00284_code_3410"}
{"instruction": "How do you run a stateless application using a deployment in Kubernetes?", "response": "Run a Stateless Application Using a DeploymentThis page shows how to run an application using a Kubernetes Deployment object.ObjectivesCreate an nginx deployment.Use kubectl to list information about the deployment.Update the deployment.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.9.To check the version, enter kubectl version.Creating and exploring an nginx deploymentYou can run an application by creating a Kubernetes Deployment object, and you can describe a Deployment in a YAML file. For example, this YAML file describes a Deployment that runs the nginx:1.14.2 Docker image:application/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Create a Deployment based on the YAML file:kubectl apply -f https://k8s.io/examples/application/deployment.yaml Display information about the Deployment:kubectl describe deployment nginx-deployment The output is similar to this:Name: nginx-deployment Namespace: default CreationTimestamp: Tue, 30 Aug 2016 18:11:37 -0700 Labels: app=nginx Annotations: deployment.kubernetes.io/revision=1 Selector: app=nginx Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge Pod Template: Labels: app=nginx Containers: nginx: Image: nginx:1.14.2 Port: 80/TCP Environment: <none> Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: nginx-deployment-1771418926 (2/2 replicas created) No events. List the Pods created by the deployment:kubectl get pods -l app=nginx The output is similar to this:NAME READY STATUS RESTARTS AGE nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h nginx-deployment-1771418926-r18az 1/1 Running 0 16h Display information about a Pod:kubectl describe pod <pod-name> where <pod-name> is the name of one of your Pods.Updating the deploymentYou can update the deployment by applying a new YAML file. This YAML file specifies that the deployment should be updated to use nginx 1.16.1.application/deployment-update.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1 ports: - containerPort: 80 Apply the new YAML file:kubectl apply -f https://k8s.io/examples/application/deployment-update.yaml Watch the deployment create pods with new names and delete the old pods:kubectl get pods -l app=nginx Scaling the application by increasing the replica countYou can increase the number of Pods in your Deployment by applying a new YAML file. This YAML file sets replicas to 4, which specifies that the Deployment should have four Pods:application/deployment-scale.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 4 # Update the replicas from 2 to 4 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.16.1 ports: - containerPort: 80 Apply the new YAML file:kubectl apply -f https://k8s.io/examples/application/deployment-scale.yaml Verify that the", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3412"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\nRun a Stateless Application Using a Deployment | Display information about the Deployment:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3413"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\nRun a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3414"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nRun a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3415"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\nRun a Stateless Application Using a Deployment | where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3416"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3417"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-update.yaml\n```\n\nRun a Stateless Application Using a Deployment | Watch the deployment create pods with new names and delete the old pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3418"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nRun a Stateless Application Using a Deployment | You can increase the number of Pods in your Deployment by applying a new YAML file. This YAML file sets replicas to 4, which specifies that the Deployment should have four Pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3419"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3420"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-scale.yaml\n```\n\nRun a Stateless Application Using a Deployment | Verify that the Deployment has four Pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3421"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nRun a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3422"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment\n```\n\nRun a Stateless Application Using a Deployment | The preferred way to create a replicated application is to use a Deployment, which in turn uses a ReplicaSet. Before the Deployment and ReplicaSet were added to Kubernetes, replicated applications wer", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3423"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3424"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3425"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3426"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3427"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3428"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\nRun a Stateless Application Using a Deployment | Display information about the Deployment:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3429"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\nRun a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3430"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nRun a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3431"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\nRun a Stateless Application Using a Deployment | where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3432"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-update.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3433"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3434"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-update.yaml\n```\n\nRun a Stateless Application Using a Deployment | Watch the deployment create pods with new names and delete the old pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3435"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nRun a Stateless Application Using a Deployment | You can increase the number of Pods in your Deployment by applying a new YAML file. This YAML file sets replicas to 4, which specifies that the Deployment should have four Pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3436"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-scale.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3437"}
{"instruction": "Write a yaml example for run a stateless application using a deployment", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\nRun a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3438"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-scale.yaml\n```\n\nRun a Stateless Application Using a Deployment | Verify that the Deployment has four Pods:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3439"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nRun a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3440"}
{"instruction": "Write a bash example for run a stateless application using a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment\n```\n\nRun a Stateless Application Using a Deployment | The preferred way to create a replicated application is to use a Deployment, which in turn uses a ReplicaSet. Before the Deployment and ReplicaSet were added to Kubernetes, replicated applications wer", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/", "id": "k8s_00285_code_3441"}
{"instruction": "How do you job with pod-to-pod communication in Kubernetes?", "response": "Job with Pod-to-Pod CommunicationIn this example, you will run a Job in Indexed completion mode configured such that the pods created by the Job can communicate with each other using pod hostnames rather than pod IP addresses.Pods within a Job might need to communicate among themselves. The user workload running in each pod could query the Kubernetes API server to learn the IPs of the other Pods, but it's much simpler to rely on Kubernetes' built-in DNS resolution.Jobs in Indexed completion mode automatically set the pods' hostname to be in the format of ${jobName}-${completionIndex}. You can use this format to deterministically build pod hostnames and enable pod communication without needing to create a client connection to the Kubernetes control plane to obtain pod hostnames/IPs via API requests.This configuration is useful for use cases where pod networking is required but you don't want to depend on a network connection with the Kubernetes API server.Before you beginYou should already be familiar with the basic use of Job.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.21.To check the version, enter kubectl version.Note:If you are using minikube or a similar tool, you may need to take extra steps to ensure you have DNS.Starting a Job with pod-to-pod communicationTo enable pod-to-pod communication using pod hostnames in a Job, you must do the following:Set up a headless Service with a valid label selector for the pods created by your Job. The headless service must be in the same namespace as the Job. One easy way to do this is to use the job-name: <your-job-name> selector, since the job-name label will be automatically added by Kubernetes. This configuration will trigger the DNS system to create records of the hostnames of the pods running your Job.Configure the headless service as subdomain service for the Job pods by including the following value in your Job template spec:subdomain: <headless-svc-name> ExampleBelow is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.Note:In the Bash script executed on each pod in the example below, the pod hostnames can be prefixed by the namespace as well if the pod needs to be reached from outside the namespace.apiVersion: v1 kind: Service metadata: name: headless-svc spec: clusterIP: None # clusterIP must be None to create a headless service selector: job-name: example-job # must match Job name --- apiVersion: batch/v1 kind: Job metadata: name: example-job spec: completions: 3 parallelism: 3 completionMode: Indexed template: spec: subdomain: headless-svc # has to match Service name restartPolicy: Never containers: - name: example-workload image: bash:latest command: - bash - -c - | for i in 0 1 2 do gotStatus=\"-1\" wantStatus=\"0\" while [ $gotStatus -ne $wantStatus ] do ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1 gotStatus=$? if [ $gotStatus -ne $wantStatus ]; then echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\" sleep 1 fi done echo \"Successfully pinged pod: example-job-${i}.headless-svc\" done After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:kubectl logs example-job-0-qws42 Failed to ping pod example-job-0.headless-svc, retrying in 1 second... Successfully pinged pod: example-job-0.headless-svc Successfully pinged pod: example-job-1.headless-svc Successfully pinged pod: example-job-2.hea", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/job-with-pod-to-pod-communication/", "id": "k8s_00286"}
{"instruction": "Write a yaml example for job with pod-to-pod communication", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\nJob with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/job-with-pod-to-pod-communication/", "id": "k8s_00286_code_3443"}
{"instruction": "Write a bash example for job with pod-to-pod communication", "response": "Here's a bash example:\n\n```bash\nkubectl logs example-job-0-qws42\n```\n\nJob with Pod-to-Pod Communication |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/job-with-pod-to-pod-communication/", "id": "k8s_00286_code_3444"}
{"instruction": "Write a yaml example for job with pod-to-pod communication", "response": "Here's a yaml example:\n\n```yaml\nsubdomain: <headless-svc-name>\n```\n\nJob with Pod-to-Pod Communication | Below is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/job-with-pod-to-pod-communication/", "id": "k8s_00286_code_3445"}
{"instruction": "Write a yaml example for job with pod-to-pod communication", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\nJob with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/job-with-pod-to-pod-communication/", "id": "k8s_00286_code_3446"}
{"instruction": "Write a yaml example for job with pod-to-pod communication", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\nJob with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/job-with-pod-to-pod-communication/", "id": "k8s_00286_code_3447"}
{"instruction": "Write a bash example for job with pod-to-pod communication", "response": "Here's a bash example:\n\n```bash\nkubectl logs example-job-0-qws42\n```\n\nJob with Pod-to-Pod Communication |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/job-with-pod-to-pod-communication/", "id": "k8s_00286_code_3448"}
{"instruction": "What is the reference documentation for kubectl delete?", "response": "kubectl deleteSynopsisDelete resources by file names, stdin, resources and names, or by resources and label selector.JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a subset of resources support graceful deletion. In absence of the support, the --grace-period flag is ignored.IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods, the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.After a CustomResourceDefinition is deleted, invalidation of discovery cache may take up to 6 hours. If you don't want to wait, you might want to run \"kubectl api-resources\" to refresh the discovery cache.kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)]) Examples # Delete a pod using the type and name specified in pod.json kubectl delete -f ./pod.json # Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml kubectl delete -k dir # Delete resources from all files that end with '.json' kubectl delete -f '*.json' # Delete a pod based on the type and name in the JSON passed into stdin cat pod.json | kubectl delete -f - # Delete pods and services with same names \"baz\" and \"foo\" kubectl delete pod,service baz foo # Delete pods and services with label name=myLabel kubectl delete pods,services -l name=myLabel # Delete a pod with minimal delay kubectl delete pod foo --now # Force delete a pod on a dead node kubectl delete pod foo --force # Delete all pods kubectl delete pods --all # Delete all pods only if the user confirms the deletion kubectl delete pods --all --interactive Options--allDelete all resources, in the namespace of the specified resource types.-A, --all-namespacesIf present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.--cascade string[=\"background\"] Default: \"background\"Must be \"background\", \"orphan\", or \"foreground\". Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_delete/", "id": "k8s_00287"}
{"instruction": "Write a bash example for kubectl delete", "response": "Here's a bash example:\n\n```bash\nkubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])\n```\n\nkubectl delete | Delete all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_delete/", "id": "k8s_00287_code_3450"}
{"instruction": "Write a bash example for kubectl delete", "response": "Here's a bash example:\n\n```bash\nkubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])\n```\n\nkubectl delete | Delete all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_delete/", "id": "k8s_00287_code_3451"}
{"instruction": "Explain the Kubernetes concept: Guide for Running Windows Containers in Kubernetes", "response": "Guide for Running Windows Containers in KubernetesThis page provides a walkthrough for some steps you can follow to run Windows containers using Kubernetes. The page also highlights some Windows specific functionality within Kubernetes.It is important to note that creating and deploying services and workloads on Kubernetes behaves in much the same way for Linux and Windows containers. The kubectl commands to interface with the cluster are identical. The examples in this page are provided to jumpstart your experience with Windows containers.ObjectivesConfigure an example deployment to run Windows containers on a Windows node.Before you beginYou should already have access to a Kubernetes cluster that includes a worker node running Windows Server.Getting Started: Deploying a Windows workloadThe example YAML file below deploys a simple webserver application running inside a Windows container.Create a manifest named win-webserver.yaml with the contents below:--- apiVersion: v1 kind: Service metadata: name: win-webserver labels: app: win-webserver spec: ports: # the port that this service should serve on - port: 80 targetPort: 80 selector: app: win-webserver type: NodePort --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: win-webserver name: win-webserver spec: replicas: 2 selector: matchLabels: app: win-webserver template: metadata: labels: app: win-webserver name: win-webserver spec: containers: - name: windowswebserver image: mcr.microsoft.com/windows/servercore:ltsc2019 command: - powershell.exe - -command - \"<#code used from https://gist.github.com/19WAS85/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ; ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus) } ; \" nodeSelector: kubernetes.io/os: windows Note:Port mapping is also supported, but for simplicity this example exposes port 80 of the container directly to the Service.Check that all nodes are healthy:kubectl get nodes Deploy the service and watch for pod updates:kubectl apply -f win-webserver.yaml kubectl get pods -o wide -w When the service is deployed correctly both Pods are marked as Ready. To exit the watch command, press Ctrl+C.Check that the deployment succeeded. To verify:Several pods listed from the Linux control plane node, use kubectl get podsNode-to-pod communication across the network, curl port 80 of your pod IPs from the Linux control plane node to check for a web server responsePod-to-pod communication, ping between pods (and across hosts, if you have more than one Windows node) using kubectl execService-to-pod communication, curl the virtual service IP (seen under kubectl get services) from the Linux control plane node and from individual podsService discovery, curl the service name with the Kubernetes default DNS suffixInbound connectivity, curl the NodePort from the Linux control plane node or machines outside of the clusterOutbound connecti", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: win-webserver\n  labels:\n    app: win-webserver\nspec:\n  ports:\n    # the port that this service should serve on\n    - port: 80\n      targetPort: 80\n  selector:\n    app: win-webserver\n  type: NodePort\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: win-webserver\n  name: win-webserver\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: win-webserver\n  template:\n    metadata:\n      labels:\n        app: win-webserver\n      name: win-webserver\n    spec:\n     containers:\n      - name: windowswebserver\n        image: mcr.microsoft.com/windows/servercore:ltsc2019\n        command:\n        - powershell.exe\n        - -command\n        - \"<#code used from https://gist.github.com/19WAS85/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ;  ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus)  } ; \"\n     nodeSelector:\n      kubernetes.io/os: windows\n```\n\nGuide for Running Windows Containers in Kubernetes | Check that all nodes are healthy:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3453"}
{"instruction": "Write a bash example for guide for running windows containers in kubernetes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f win-webserver.yaml\nkubectl get pods -o wide -w\n```\n\nGuide for Running Windows Containers in Kubernetes | When the service is deployed correctly both Pods are marked as Ready. To exit the watch command, press Ctrl+C.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3454"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: windows-2019\nhandler: example-container-runtime-handler\nscheduling:\n  nodeSelector:\n    kubernetes.io/os: 'windows'\n    kubernetes.io/arch: 'amd64'\n    node.kubernetes.io/windows-build: '10.0.17763'\n  tolerations:\n  - effect: NoSchedule\n    key: os\n    operator: Equal\n    value: \"windows\"\n```\n\nGuide for Running Windows Containers in Kubernetes | Run kubectl create -f runtimeClasses.yml using as a cluster administrator", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3455"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: iis-2019\n  labels:\n    app: iis-2019\nspec:\n  replicas: 1\n  template:\n    metadata:\n      name: iis-2019\n      labels:\n        app: iis-2019\n    spec:\n      runtimeClassName: windows-2019\n      containers:\n      - name: iis\n        image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        resources:\n          limits:\n            cpu: 1\n            memory: 800Mi\n          requests:\n            cpu: .1\n            memory: 300Mi\n        ports:\n          - containerPort: 80\n selector:\n    matchLabels:\n      app: iis-2019\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: iis\nspec:\n  type: LoadBalancer\n  ports:\n  - protocol: TCP\n    port: 80\n  selector:\n    app: iis-2019\n```\n\nGuide for Running Windows Containers in Kubernetes |", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3456"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: win-webserver\n  labels:\n    app: win-webserver\nspec:\n  ports:\n    # the port that this service should serve on\n    - port: 80\n      targetPort: 80\n  selector:\n    app: win-webserver\n  type: NodePort\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: win-webserver\n  name: win-webserver\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: win-webserver\n  template:\n    metadata:\n      labels:\n        app: win-webserver\n      name: win-webserver\n    spec:\n     containers:\n      - name: windowswebserver\n        image: mcr.microsoft.com/windows/servercore:ltsc2019\n        command:\n        - powershell.exe\n        - -command\n        - \"<#code used from https://gist.github.com/19WAS85/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ;  ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus)  } ; \"\n     nodeSelector:\n      kubernetes.io/os: windows\n```\n\nGuide for Running Windows Containers in Kubernetes | Check that all nodes are healthy:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3457"}
{"instruction": "Write a bash example for guide for running windows containers in kubernetes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f win-webserver.yaml\nkubectl get pods -o wide -w\n```\n\nGuide for Running Windows Containers in Kubernetes | When the service is deployed correctly both Pods are marked as Ready. To exit the watch command, press Ctrl+C.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3458"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\nnodeSelector:\n    kubernetes.io/os: windows\n    node.kubernetes.io/windows-build: '10.0.17763'\ntolerations:\n    - key: \"os\"\n      operator: \"Equal\"\n      value: \"windows\"\n      effect: \"NoSchedule\"\n```\n\nGuide for Running Windows Containers in Kubernetes | The Windows Server version used by each pod must match that of the node. If you want to use multiple Windows Server versions in the same cluster, then you should set additional node labels and nodeSel", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3459"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: windows-2019\nhandler: example-container-runtime-handler\nscheduling:\n  nodeSelector:\n    kubernetes.io/os: 'windows'\n    kubernetes.io/arch: 'amd64'\n    node.kubernetes.io/windows-build: '10.0.17763'\n  tolerations:\n  - effect: NoSchedule\n    key: os\n    operator: Equal\n    value: \"windows\"\n```\n\nGuide for Running Windows Containers in Kubernetes | Run kubectl create -f runtimeClasses.yml using as a cluster administrator", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3460"}
{"instruction": "Write a bash example for guide for running windows containers in kubernetes", "response": "Here's a bash example:\n\n```bash\nkubectl create -f runtimeClasses.yml\n```\n\nGuide for Running Windows Containers in Kubernetes | Add runtimeClassName: windows-2019 as appropriate to Pod specs", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3461"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: iis-2019\n  labels:\n    app: iis-2019\nspec:\n  replicas: 1\n  template:\n    metadata:\n      name: iis-2019\n      labels:\n        app: iis-2019\n    spec:\n      runtimeClassName: windows-2019\n      containers:\n      - name: iis\n        image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        resources:\n          limits:\n            cpu: 1\n            memory: 800Mi\n          requests:\n            cpu: .1\n            memory: 300Mi\n        ports:\n          - containerPort: 80\n selector:\n    matchLabels:\n      app: iis-2019\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: iis\nspec:\n  type: LoadBalancer\n  ports:\n  - protocol: TCP\n    port: 80\n  selector:\n    app: iis-2019\n```\n\nGuide for Running Windows Containers in Kubernetes |", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3462"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: win-webserver\n  labels:\n    app: win-webserver\nspec:\n  ports:\n    # the port that this service should serve on\n    - port: 80\n      targetPort: 80\n  selector:\n    app: win-webserver\n  type: NodePort\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: win-webserver\n  name: win-webserver\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: win-webserver\n  template:\n    metadata:\n      labels:\n        app: win-webserver\n      name: win-webserver\n    spec:\n     containers:\n      - name: windowswebserver\n        image: mcr.microsoft.com/windows/servercore:ltsc2019\n        command:\n        - powershell.exe\n        - -command\n        - \"<#code used from https://gist.github.com/19WAS85/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ;  ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus)  } ; \"\n     nodeSelector:\n      kubernetes.io/os: windows\n```\n\nGuide for Running Windows Containers in Kubernetes | Check that all nodes are healthy:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3463"}
{"instruction": "Write a bash example for guide for running windows containers in kubernetes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f win-webserver.yaml\nkubectl get pods -o wide -w\n```\n\nGuide for Running Windows Containers in Kubernetes | When the service is deployed correctly both Pods are marked as Ready. To exit the watch command, press Ctrl+C.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3464"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: windows-2019\nhandler: example-container-runtime-handler\nscheduling:\n  nodeSelector:\n    kubernetes.io/os: 'windows'\n    kubernetes.io/arch: 'amd64'\n    node.kubernetes.io/windows-build: '10.0.17763'\n  tolerations:\n  - effect: NoSchedule\n    key: os\n    operator: Equal\n    value: \"windows\"\n```\n\nGuide for Running Windows Containers in Kubernetes | Run kubectl create -f runtimeClasses.yml using as a cluster administrator", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3465"}
{"instruction": "Write a yaml example for guide for running windows containers in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: iis-2019\n  labels:\n    app: iis-2019\nspec:\n  replicas: 1\n  template:\n    metadata:\n      name: iis-2019\n      labels:\n        app: iis-2019\n    spec:\n      runtimeClassName: windows-2019\n      containers:\n      - name: iis\n        image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        resources:\n          limits:\n            cpu: 1\n            memory: 800Mi\n          requests:\n            cpu: .1\n            memory: 300Mi\n        ports:\n          - containerPort: 80\n selector:\n    matchLabels:\n      app: iis-2019\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: iis\nspec:\n  type: LoadBalancer\n  ports:\n  - protocol: TCP\n    port: 80\n  selector:\n    app: iis-2019\n```\n\nGuide for Running Windows Containers in Kubernetes |", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/user-guide/", "id": "k8s_00288_code_3466"}
{"instruction": "How do you reserve compute resources for system daemons in Kubernetes?", "response": "Reserve Compute Resources for System DaemonsKubernetes nodes can be scheduled to Capacity. Pods can consume all the available capacity on a node by default. This is an issue because nodes typically run quite a few system daemons that power the OS and Kubernetes itself. Unless resources are set aside for these system daemons, pods and system daemons compete for resources and lead to resource starvation issues on the node.The kubelet exposes a feature named 'Node Allocatable' that helps to reserve compute resources for system daemons. Kubernetes recommends cluster administrators to configure 'Node Allocatable' based on their workload density on each node.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou can configure below kubelet configuration settings using the kubelet configuration file.Node Allocatable'Allocatable' on a Kubernetes node is defined as the amount of compute resources that are available for pods. The scheduler does not over-subscribe 'Allocatable'. 'CPU', 'memory' and 'ephemeral-storage' are supported as of now.Node Allocatable is exposed as part of v1.Node object in the API and as part of kubectl describe node in the CLI.Resources can be reserved for two categories of system daemons in the kubelet.Enabling QoS and Pod level cgroupsTo properly enforce node allocatable constraints on the node, you must enable the new cgroup hierarchy via the cgroupsPerQOS setting. This setting is enabled by default. When enabled, the kubelet will parent all end-user pods under a cgroup hierarchy managed by the kubelet.Configuring a cgroup driverThe kubelet supports manipulation of the cgroup hierarchy on the host using a cgroup driver. The driver is configured via the cgroupDriver setting.The supported values are the following:cgroupfs is the default driver that performs direct manipulation of the cgroup filesystem on the host in order to manage cgroup sandboxes.systemd is an alternative driver that manages cgroup sandboxes using transient slices for resources that are supported by that init system.Depending on the configuration of the associated container runtime, operators may have to choose a particular cgroup driver to ensure proper system behavior. For example, if operators use the systemd cgroup driver provided by the containerd runtime, the kubelet must be configured to use the systemd cgroup driver.Kube ReservedKubeletConfiguration Setting: kubeReserved: {}. Example value {cpu: 100m, memory: 100Mi, ephemeral-storage: 1Gi, pid=1000}KubeletConfiguration Setting: kubeReservedCgroup: \"\"kubeReserved is meant to capture resource reservation for kubernetes system daemons like the kubelet, container runtime, etc. It is not meant to reserve resources for system daemons that are run as pods. kubeReserved is typically a function of pod density on the nodes.In addition to cpu, memory, and ephemeral-storage, pid may be specified to reserve the specified number of process IDs for kubernetes system daemons.To optionally enforce kubeReserved on kubernetes system daemons, specify the parent control group for kube daemons as the value for kubeReservedCgroup setting, and add kube-reserved to enforceNodeAllocatable.It is recommended that the kubernetes system daemons are placed under a top level control group (runtime.slice on systemd machines for example). Each system daemon should ideally run within its own child control group. Refer to the design proposal for more details on recommended control group hierarchy.Note that Kubelet does not create kubeReservedCgroup if it doesn't exist. The kubelet will fail to start if an invalid cgroup is specified. With ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/", "id": "k8s_00289"}
{"instruction": "Write a bash example for reserve compute resources for system daemons", "response": "Here's a bash example:\n\n```bash\nkubectl describe node\n```\n\nReserve Compute Resources for System Daemons | Resources can be reserved for two categories of system daemons in the kubelet.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/", "id": "k8s_00289_code_3468"}
{"instruction": "What is the reference documentation for kubeadm join?", "response": "kubeadm joinThis command initializes a new Kubernetes node and joins it to the existing cluster.Run this on any machine you wish to join an existing clusterSynopsisWhen joining a kubeadm initialized cluster, we need to establish bidirectional trust. This is split into discovery (having the Node trust the Kubernetes Control Plane) and TLS bootstrap (having the Kubernetes Control Plane trust the Node).There are 2 main schemes for discovery. The first is to use a shared token along with the IP address of the API server. The second is to provide a file - a subset of the standard kubeconfig file. The discovery/kubeconfig file supports token, client-go authentication plugins (\"exec\"), \"tokenFile\", and \"authProvider\". This file can be a local file or downloaded via an HTTPS URL. The forms are kubeadm join --discovery-token abcdef.1234567890abcdef 1.2.3.4:6443, kubeadm join --discovery-file path/to/file.conf, or kubeadm join --discovery-file https://url/file.conf. Only one form can be used. If the discovery information is loaded from a URL, HTTPS must be used. Also, in that case the host installed CA bundle is used to verify the connection.If you use a shared token for discovery, you should also pass the --discovery-token-ca-cert-hash flag to validate the public key of the root certificate authority (CA) presented by the Kubernetes Control Plane. The value of this flag is specified as \"<hash-type>:<hex-encoded-value>\", where the supported hash type is \"sha256\". The hash is calculated over the bytes of the Subject Public Key Info (SPKI) object (as in RFC7469). This value is available in the output of \"kubeadm init\" or can be calculated using standard tools. The --discovery-token-ca-cert-hash flag may be repeated multiple times to allow more than one public key.If you cannot know the CA public key hash ahead of time, you can pass the --discovery-token-unsafe-skip-ca-verification flag to disable this verification. This weakens the kubeadm security model since other nodes can potentially impersonate the Kubernetes Control Plane.The TLS bootstrap mechanism is also driven via a shared token. This is used to temporarily authenticate with the Kubernetes Control Plane to submit a certificate signing request (CSR) for a locally created key pair. By default, kubeadm will set up the Kubernetes Control Plane to automatically approve these signing requests. This token is passed in with the --tls-bootstrap-token abcdef.1234567890abcdef flag.Often times the same token is used for both parts. In this case, the --token flag can be used instead of specifying each token individually.The \"join [api-server-endpoint]\" command executes the following phases:preflight Run join pre-flight checks control-plane-prepare Prepare the machine for serving a control plane /download-certs Download certificates shared among control-plane nodes from the kubeadm-certs Secret /certs Generate the certificates for the new control plane components /kubeconfig Generate the kubeconfig for the new control plane components /control-plane Generate the manifests for the new control plane components kubelet-start Write kubelet settings, certificates and (re)start the kubelet control-plane-join Join a machine as a control plane instance /etcd Add a new local etcd member /mark-control-plane Mark a node as a control-plane wait-control-plane Wait for the control plane to start kubeadm join [api-server-endpoint] [flags] Options--apiserver-advertise-address stringIf the node should host a new control plane instance, the IP address the API Server will advertise it's listening on. If not set the default network interface will be used.--apiserver-bind-port int32 Default: 6443If the node should host a new control plane instance, the port for the API Server to bind to.--certificate-key stringUse this key to decrypt the certificate secrets uploaded by init. The certificate key is a hex encoded string that is an AES key of size 32 bytes.--config stringPath to a kubeadm configuration file.--contro", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl delete clusterrolebinding kubeadm:node-autoapprove-bootstrap\n```\n\nkubeadm join | After that, kubeadm join will block until the admin has manually approved the CSR in flight:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3470"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve node-csr-c69HXe7aYcqkS1bKmH4faEnHAWxn6i2bHZ2mD04jZyQ\n```\n\nkubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3471"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public get cm cluster-info -o jsonpath='{.data.kubeconfig}' | tee cluster-info.yaml\n```\n\nkubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3472"}
{"instruction": "Write a yaml example for kubeadm join", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority-data: <ca-cert>\n    server: https://<ip>:<port>\n  name: \"\"\ncontexts: []\ncurrent-context: \"\"\npreferences: {}\nusers: []\n```\n\nkubeadm join | Use the cluster-info.yaml file as an argument to kubeadm join --discovery-file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3473"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public delete rolebinding kubeadm:bootstrap-signer-clusterinfo\n```\n\nkubeadm join | These commands should be run after kubeadm init but before kubeadm join.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3474"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\nkubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3475"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\nkubeadm join | In order to achieve the joining flow using the token as the only piece of validation information, a ConfigMap with some data needed for validation of the control-plane node's identity is exposed publi", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3476"}
{"instruction": "Write a yaml example for kubeadm join", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority-data: <ca-cert>\n    server: https://<ip>:<port>\n  name: \"\"\ncontexts: []\ncurrent-context: \"\"\npreferences: {}\nusers: []\n```\n\nkubeadm join | Use the cluster-info.yaml file as an argument to kubeadm join --discovery-file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3477"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl delete clusterrolebinding kubeadm:node-autoapprove-bootstrap\n```\n\nkubeadm join | After that, kubeadm join will block until the admin has manually approved the CSR in flight:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3478"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve node-csr-c69HXe7aYcqkS1bKmH4faEnHAWxn6i2bHZ2mD04jZyQ\n```\n\nkubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3479"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public get cm cluster-info -o jsonpath='{.data.kubeconfig}' | tee cluster-info.yaml\n```\n\nkubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3480"}
{"instruction": "Write a yaml example for kubeadm join", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority-data: <ca-cert>\n    server: https://<ip>:<port>\n  name: \"\"\ncontexts: []\ncurrent-context: \"\"\npreferences: {}\nusers: []\n```\n\nkubeadm join | Use the cluster-info.yaml file as an argument to kubeadm join --discovery-file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3481"}
{"instruction": "Write a bash example for kubeadm join", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public delete rolebinding kubeadm:bootstrap-signer-clusterinfo\n```\n\nkubeadm join | These commands should be run after kubeadm init but before kubeadm join.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/", "id": "k8s_00290_code_3482"}
{"instruction": "Explain submitting case studies in Kubernetes", "response": "Submitting case studiesCase studies highlight how organizations are using Kubernetes to solve real-world problems. The Kubernetes marketing team and members of the CNCF collaborate with you on all case studies.Case studies require extensive review before they're approved.Submit a case studyHave a look at the source for the existing case studies.Refer to the case study guidelines and submit your request as outlined in the guidelines.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/new-content/case-studies/", "id": "k8s_00291"}
{"instruction": "Explain localizing kubernetes documentation in Kubernetes", "response": "Localizing Kubernetes documentationThis page shows you how to localize the docs for a different language.Contribute to an existing localizationYou can help add or improve the content of an existing localization. In Kubernetes Slack, you can find a channel for each localization. There is also a general SIG Docs Localizations Slack channel where you can say hello.Note:For extra details on how to contribute to a specific localization, look for a localized version of this page.Find your two-letter language codeFirst, consult the ISO 639-1 standard to find your localization's two-letter language code. For example, the two-letter code for Korean is ko.Some languages use a lowercase version of the country code as defined by the ISO-3166 along with their language codes. For example, the Brazilian Portuguese language code is pt-br.Fork and clone the repoFirst, create your own fork of the kubernetes/website repository.Then, clone your fork and cd into it:git clone https://github.com/<username>/website cd website The website content directory includes subdirectories for each language. The localization you want to help out with is inside content/<two-letter-code>.Suggest changesCreate or update your chosen localized page based on the English original. See localize content for more details.If you notice a technical inaccuracy or other problem with the upstream (English) documentation, you should fix the upstream documentation first and then repeat the equivalent fix by updating the localization you're working on.Limit changes in a pull requests to a single localization. Reviewing pull requests that change content in multiple localizations is problematic.Follow Suggesting Content Improvements to propose changes to that localization. The process is similar to proposing changes to the upstream (English) content.Start a new localizationIf you want the Kubernetes documentation localized into a new language, here's what you need to do.Because contributors can't approve their own pull requests, you need at least two contributors to begin a localization.All localization teams must be self-sufficient. The Kubernetes website is happy to host your work, but it's up to you to translate it and keep existing localized content current.You'll need to know the two-letter language code for your language. Consult the ISO 639-1 standard to find your localization's two-letter language code. For example, the two-letter code for Korean is ko.If the language you are starting a localization for is spoken in various places with significant differences between the variants, it might make sense to combine the lowercased ISO-3166 country code with the language two-letter code. For example, Brazilian Portuguese is localized as pt-br.When you start a new localization, you must localize all the minimum required content before the Kubernetes project can publish your changes to the live website.SIG Docs can help you work on a separate branch so that you can incrementally work towards that goal.Find communityLet Kubernetes SIG Docs know you're interested in creating a localization! Join the SIG Docs Slack channel and the SIG Docs Localizations Slack channel. Other localization teams are happy to help you get started and answer your questions.Please also consider participating in the SIG Docs Localization Subgroup meeting. The mission of the SIG Docs localization subgroup is to work across the SIG Docs localization teams to collaborate on defining and documenting the processes for creating localized contribution guides. In addition, the SIG Docs localization subgroup looks for opportunities to create and share common tools across localization teams and identify new requirements for the SIG Docs Leadership team. If you have questions about this meeting, please inquire on the SIG Docs Localizations Slack channel.You can also create a Slack channel for your localization in the kubernetes/community repository. For an example of adding a Slack channel, see the PR for adding a cha", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/localization/", "id": "k8s_00292"}
{"instruction": "Write a yaml example for localizing kubernetes documentation", "response": "Here's a yaml example:\n\n```yaml\n# See the OWNERS docs at https://go.k8s.io/owners\n\n# This is the localization project for Spanish.\n# Teams and members are visible at https://github.com/orgs/kubernetes/teams.\n\nreviewers:\n- sig-docs-es-reviews\n\napprovers:\n- sig-docs-es-owners\n\nlabels:\n- area/localization\n- language/es\n```\n\nLocalizing Kubernetes documentation | After adding the language-specific OWNERS file, update the root OWNERS_ALIASES file with the new Kubernetes teams for the localization, sig-docs-**-owners and sig-docs-**-reviews.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/localization/", "id": "k8s_00292_code_3485"}
{"instruction": "Write a bash example for localizing kubernetes documentation", "response": "Here's a bash example:\n\n```bash\nmkdir -p i18n/de\ncp i18n/en/en.toml i18n/de/de.toml\n```\n\nLocalizing Kubernetes documentation | Revise the comments at the top of the file to suit your localization, then translate the value of each string. For example, this is the German-language placeholder text for the search form:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/localization/", "id": "k8s_00292_code_3486"}
{"instruction": "How do you access clusters using the kubernetes api in Kubernetes?", "response": "Access Clusters Using the Kubernetes APIThis page shows how to access clusters using the Kubernetes API.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Accessing the Kubernetes APIAccessing for the first time with kubectlWhen accessing the Kubernetes API for the first time, use the Kubernetes command-line tool, kubectl.To access a cluster, you need to know the location of the cluster and have credentials to access it. Typically, this is automatically set-up when you work through a Getting started guide, or someone else set up the cluster and provided you with credentials and a location.Check the location and credentials that kubectl knows about with this command:kubectl config view Many of the examples provide an introduction to using kubectl. Complete documentation is found in the kubectl manual.Directly accessing the REST APIkubectl handles locating and authenticating to the API server. If you want to directly access the REST API with an http client like curl or wget, or a browser, there are multiple ways you can locate and authenticate against the API server:Run kubectl in proxy mode (recommended). This method is recommended, since it uses the stored API server location and verifies the identity of the API server using a self-signed certificate. No man-in-the-middle (MITM) attack is possible using this method.Alternatively, you can provide the location and credentials directly to the http client. This works with client code that is confused by proxies. To protect against man in the middle attacks, you'll need to import a root cert into your browser.Using the Go or Python client libraries provides accessing kubectl in proxy mode.Using kubectl proxyThe following command runs kubectl in a mode where it acts as a reverse proxy. It handles locating the API server and authenticating.Run it like this:kubectl proxy --port=8080 & See kubectl proxy for more details.Then you can explore the API with curl, wget, or a browser, like so:curl http://localhost:8080/api/ The output is similar to this:{ \"versions\": [ \"v1\" ], \"serverAddressByClientCIDRs\": [ { \"clientCIDR\": \"0.0.0.0/0\", \"serverAddress\": \"10.0.1.149:443\" } ] } Without kubectl proxyIt is possible to avoid using kubectl proxy by passing an authentication token directly to the API server, like this:Using grep/cut approach:# Check all possible clusters, as your .KUBECONFIG may have multiple contexts: kubectl config view -o jsonpath='{\"Cluster name\\tServer\\n\"}{range .clusters[*]}{.name}{\"\\t\"}{.cluster.server}{\"\\n\"}{end}' # Select name of cluster you want to interact with from above output: export CLUSTER_NAME=\"some_server_name\" # Point to the API server referring the cluster name APISERVER=$(kubectl config view -o jsonpath=\"{.clusters[?(@.name==\\\"$CLUSTER_NAME\\\")].cluster.server}\") # Create a secret to hold a token for the default service account kubectl apply -f - <<EOF apiVersion: v1 kind: Secret metadata: name: default-token annotations: kubernetes.io/service-account.name: default type: kubernetes.io/service-account-token EOF # Wait for the token controller to populate the secret with a token: while ! kubectl describe secret default-token | grep -E '^token' >/dev/null; do echo \"waiting for token...\" >&2 sleep 1 done # Get the token value TOKEN=$(kubectl get secret default-token -o jsonpath='{.data.token}' | base64 --decode) # Explore the API with TOKEN curl -X GET $APISERVER/api --header \"Authorization: Bearer $TOKEN\" --insecure The output is similar to this:{ \"kind\": \"APIVersions\", \"versions\": [ \"v1\" ], \"serverAddressByClientCIDRs\": [ { \"clientCIDR\": \"0", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/", "id": "k8s_00293"}
{"instruction": "Write a bash example for access clusters using the kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080 &\n```\n\nAccess Clusters Using the Kubernetes API | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/", "id": "k8s_00293_code_3488"}
{"instruction": "Write a yaml example for access clusters using the kubernetes api", "response": "Here's a yaml example:\n\n```yaml\n# Check all possible clusters, as your .KUBECONFIG may have multiple contexts:\nkubectl config view -o jsonpath='{\"Cluster name\\tServer\\n\"}{range .clusters[*]}{.name}{\"\\t\"}{.cluster.server}{\"\\n\"}{end}'\n\n# Select name of cluster you want to interact with from above output:\nexport CLUSTER_NAME=\"some_server_name\"\n\n# Point to the API server referring the cluster name\nAPISERVER=$(kubectl config view -o jsonpath=\"{.clusters[?(@.name==\\\"$CLUSTER_NAME\\\")].cluster.server}\")\n\n# Create a secret to hold a token for the default service account\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n\n# Wait for the token controller to populate the secret with a token:\nwhile ! kubectl describe secret default-token | grep -E '^token' >/dev/null; do\n  echo \"waiting for token...\" >&2\n  sleep 1\ndone\n\n# Get the token value\nTOKEN=$(kubectl get secret default-token -o jsonpath='{.data.token}' | base64 --decode)\n\n# Explore the API with TOKEN\ncurl -X GET $APISERVER/api --header \"Authorization: Bearer $TOKEN\" --insecure\n```\n\nAccess Clusters Using the Kubernetes API | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/", "id": "k8s_00293_code_3489"}
{"instruction": "Write a bash example for access clusters using the kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080 &\n```\n\nAccess Clusters Using the Kubernetes API | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/", "id": "k8s_00293_code_3490"}
{"instruction": "Write a yaml example for access clusters using the kubernetes api", "response": "Here's a yaml example:\n\n```yaml\n# Check all possible clusters, as your .KUBECONFIG may have multiple contexts:\nkubectl config view -o jsonpath='{\"Cluster name\\tServer\\n\"}{range .clusters[*]}{.name}{\"\\t\"}{.cluster.server}{\"\\n\"}{end}'\n\n# Select name of cluster you want to interact with from above output:\nexport CLUSTER_NAME=\"some_server_name\"\n\n# Point to the API server referring the cluster name\nAPISERVER=$(kubectl config view -o jsonpath=\"{.clusters[?(@.name==\\\"$CLUSTER_NAME\\\")].cluster.server}\")\n\n# Create a secret to hold a token for the default service account\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n\n# Wait for the token controller to populate the secret with a token:\nwhile ! kubectl describe secret default-token | grep -E '^token' >/dev/null; do\n  echo \"waiting for token...\" >&2\n  sleep 1\ndone\n\n# Get the token value\nTOKEN=$(kubectl get secret default-token -o jsonpath='{.data.token}' | base64 --decode)\n\n# Explore the API with TOKEN\ncurl -X GET $APISERVER/api --header \"Authorization: Bearer $TOKEN\" --insecure\n```\n\nAccess Clusters Using the Kubernetes API | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/", "id": "k8s_00293_code_3491"}
{"instruction": "How do you configure certificate rotation for the kubelet in Kubernetes?", "response": "Configure Certificate Rotation for the KubeletThis page shows how to enable and configure certificate rotation for the kubelet.FEATURE STATE: Kubernetes v1.19 [stable]Before you beginKubernetes version 1.8.0 or later is requiredOverviewThe kubelet uses certificates for authenticating to the Kubernetes API. By default, these certificates are issued with one year expiration so that they do not need to be renewed too frequently.Kubernetes contains kubelet certificate rotation, that will automatically generate a new key and request a new certificate from the Kubernetes API as the current certificate approaches expiration. Once the new certificate is available, it will be used for authenticating connections to the Kubernetes API.Enabling client certificate rotationThe kubelet process accepts an argument --rotate-certificates that controls if the kubelet will automatically request a new certificate as the expiration of the certificate currently in use approaches.The kube-controller-manager process accepts an argument --cluster-signing-duration (--experimental-cluster-signing-duration prior to 1.19) that controls how long certificates will be issued for.Understanding the certificate rotation configurationWhen a kubelet starts up, if it is configured to bootstrap (using the --bootstrap-kubeconfig flag), it will use its initial certificate to connect to the Kubernetes API and issue a certificate signing request. You can view the status of certificate signing requests using:kubectl get csr Initially a certificate signing request from the kubelet on a node will have a status of Pending. If the certificate signing requests meets specific criteria, it will be auto approved by the controller manager, then it will have a status of Approved. Next, the controller manager will sign a certificate, issued for the duration specified by the --cluster-signing-duration parameter, and the signed certificate will be attached to the certificate signing request.The kubelet will retrieve the signed certificate from the Kubernetes API and write that to disk, in the location specified by --cert-dir. Then the kubelet will use the new certificate to connect to the Kubernetes API.As the expiration of the signed certificate approaches, the kubelet will automatically issue a new certificate signing request, using the Kubernetes API. This can happen at any point between 30% and 10% of the time remaining on the certificate. Again, the controller manager will automatically approve the certificate request and attach a signed certificate to the certificate signing request. The kubelet will retrieve the new signed certificate from the Kubernetes API and write that to disk. Then it will update the connections it has to the Kubernetes API to reconnect using the new certificate.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/tls/certificate-rotation/", "id": "k8s_00294"}
{"instruction": "What is the reference documentation for workload resources?", "response": "Workload ResourcesPodPod is a collection of containers that can run on a host.BindingBinding ties one object to another; for example, a pod is bound to a node by a scheduler.PodTemplatePodTemplate describes a template for creating copies of a predefined pod.ReplicationControllerReplicationController represents the configuration of a replication controller.ReplicaSetReplicaSet ensures that a specified number of pod replicas are running at any given time.DeploymentDeployment enables declarative updates for Pods and ReplicaSets.StatefulSetStatefulSet represents a set of pods with consistent identities.ControllerRevisionControllerRevision implements an immutable snapshot of state data.DaemonSetDaemonSet represents the configuration of a daemon set.JobJob represents the configuration of a single job.CronJobCronJob represents the configuration of a single cron job.HorizontalPodAutoscalerconfiguration of a horizontal pod autoscaler.HorizontalPodAutoscalerHorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified.PriorityClassPriorityClass defines mapping from a priority class name to the priority integer value.DeviceTaintRule v1alpha3DeviceTaintRule adds one taint to all devices which match the selector.ResourceClaimResourceClaim describes a request for access to resources in the cluster, for use by workloads.ResourceClaimTemplateResourceClaimTemplate is used to produce ResourceClaim objects.ResourceSliceResourceSlice represents one or more resources in a pool of similar resources, managed by a common driver.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/", "id": "k8s_00295"}
{"instruction": "What is the reference documentation for rolebinding?", "response": "RoleBindingRoleBinding references a role, but does not contain it.apiVersion: rbac.authorization.k8s.io/v1import \"k8s.io/api/rbac/v1\"RoleBindingRoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace.apiVersion: rbac.authorization.k8s.io/v1kind: RoleBindingmetadata (ObjectMeta)Standard object's metadata.roleRef (RoleRef), requiredRoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.RoleRef contains information that points to the role being usedroleRef.apiGroup (string), requiredAPIGroup is the group for the resource being referencedroleRef.kind (string), requiredKind is the type of resource being referencedroleRef.name (string), requiredName is the name of resource being referencedsubjects ([]Subject)Atomic: will be replaced during a mergeSubjects holds references to the objects the role applies to.Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.subjects.kind (string), requiredKind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.subjects.name (string), requiredName of the object being referenced.subjects.apiGroup (string)APIGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.subjects.namespace (string)Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.RoleBindingListRoleBindingList is a collection of RoleBindingsapiVersion: rbac.authorization.k8s.io/v1kind: RoleBindingListmetadata (ListMeta)Standard object's metadata.items ([]RoleBinding), requiredItems is a list of RoleBindingsOperationsget read the specified RoleBindingHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}Parametersname (in path): string, requiredname of the RoleBindingnamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (RoleBinding): OK401: Unauthorizedlist list or watch objects of kind RoleBindingHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindingsParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (RoleBindingList): OK401: Unauthorizedlist list or watch objects of kind RoleBindingHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/rolebindingsParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (RoleBindingList): O", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/role-binding-v1/", "id": "k8s_00296"}
{"instruction": "Write a yaml example for rolebinding", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\nRoleBinding | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/role-binding-v1/", "id": "k8s_00296_code_3495"}
{"instruction": "How do you set up dra in a cluster in Kubernetes?", "response": "Set Up DRA in a ClusterFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)This page shows you how to configure dynamic resource allocation (DRA) in a Kubernetes cluster by enabling API groups and configuring classes of devices. These instructions are for cluster administrators.About DRAA Kubernetes feature that lets you request and share resources among Pods. These resources are often attached devices like hardware accelerators.With DRA, device drivers and cluster admins define device classes that are available to claim in workloads. Kubernetes allocates matching devices to specific claims and places the corresponding Pods on nodes that can access the allocated devices.Ensure that you're familiar with how DRA works and with DRA terminology like DeviceClasses, ResourceClaims, and ResourceClaimTemplates. For details, see Dynamic Resource Allocation (DRA).Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be version v1.34.To check the version, enter kubectl version.Directly or indirectly attach devices to your cluster. To avoid potential issues with drivers, wait until you set up the DRA feature for your cluster before you install drivers.Optional: enable legacy DRA API groupsDRA graduated to stable in Kubernetes 1.34 and is enabled by default. Some older DRA drivers or workloads might still need the v1beta1 API from Kubernetes 1.30 or v1beta2 from Kubernetes 1.32. If and only if support for those is desired, then enable the following API groups:* `resource.k8s.io/v1beta1` * `resource.k8s.io/v1beta2` For more information, see Enabling or disabling API groups.Verify that DRA is enabledTo verify that the cluster is configured correctly, try to list DeviceClasses:kubectl get deviceclasses If the component configuration was correct, the output is similar to the following:No resources found If DRA isn't correctly configured, the output of the preceding command is similar to the following:error: the server doesn't have a resource type \"deviceclasses\" Try the following troubleshooting steps:Reconfigure and restart the kube-apiserver component.If the complete .spec.resourceClaims field gets removed from Pods, or if Pods get scheduled without considering the ResourceClaims, then verify that the DynamicResourceAllocation feature gate is not turned off for kube-apiserver, kube-controller-manager, kube-scheduler or the kubelet.Install device driversAfter you enable DRA for your cluster, you can install the drivers for your attached devices. For instructions, check the documentation of your device owner or the project that maintains the device drivers. The drivers that you install must be compatible with DRA.To verify that your installed drivers are working as expected, list ResourceSlices in your cluster:kubectl get resourceslices The output is similar to the following:NAME NODE DRIVER POOL AGE cluster-1-device-pool-1-driver.example.com-lqx8x cluster-1-node-1 driver.example.com cluster-1-device-pool-1-r1gc 7s cluster-1-device-pool-2-driver.example.com-29t7b cluster-1-node-2 driver.example.com cluster-1-device-pool-2-446z 8s Try the following troubleshooting steps:Check the health of the DRA driver and look for error messages about publishing ResourceSlices in its log output. The vendor of the driver may have further instructions about installation and troubleshooting.Create DeviceClassesYou can define categories of devices that your application operators can claim in workloads by creating DeviceClasses. Some device driver providers might also instruct you to create DeviceClasses during driver installation.The Resource", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\nSet Up DRA in a Cluster | If the component configuration was correct, the output is similar to the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3497"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\nSet Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3498"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslice <resourceslice-name> -o yaml\n```\n\nSet Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3499"}
{"instruction": "Write a yaml example for set up dra in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\nSet Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3500"}
{"instruction": "Write a yaml example for set up dra in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\nSet Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3501"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\nSet Up DRA in a Cluster | To delete the DeviceClass that you created in this task, run the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3502"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\nSet Up DRA in a Cluster |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3503"}
{"instruction": "Write a yaml example for set up dra in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\nSet Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3504"}
{"instruction": "Write a yaml example for set up dra in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\nSet Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3505"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\nSet Up DRA in a Cluster | If the component configuration was correct, the output is similar to the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3506"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\nSet Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3507"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslice <resourceslice-name> -o yaml\n```\n\nSet Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3508"}
{"instruction": "Write a yaml example for set up dra in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\nSet Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3509"}
{"instruction": "Write a yaml example for set up dra in a cluster", "response": "Here's a yaml example:\n\n```yaml\ndra/deviceclass.yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\nSet Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3510"}
{"instruction": "Write a yaml example for set up dra in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\nSet Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3511"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\nSet Up DRA in a Cluster | To delete the DeviceClass that you created in this task, run the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3512"}
{"instruction": "Write a bash example for set up dra in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\nSet Up DRA in a Cluster |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/set-up-dra-cluster/", "id": "k8s_00297_code_3513"}
{"instruction": "Explain the Kubernetes concept: CSI Volume Cloning", "response": "CSI Volume CloningThis document describes the concept of cloning existing CSI Volumes in Kubernetes. Familiarity with Volumes is suggested.IntroductionThe CSI Volume Cloning feature adds support for specifying existing PVCs in the dataSource field to indicate a user would like to clone a Volume.A Clone is defined as a duplicate of an existing Kubernetes Volume that can be consumed as any standard Volume would be. The only difference is that upon provisioning, rather than creating a \"new\" empty Volume, the back end device creates an exact duplicate of the specified Volume.The implementation of cloning, from the perspective of the Kubernetes API, adds the ability to specify an existing PVC as a dataSource during new PVC creation. The source PVC must be bound and available (not in use).Users need to be aware of the following when using this feature:Cloning support (VolumePVCDataSource) is only available for CSI drivers.Cloning support is only available for dynamic provisioners.CSI drivers may or may not have implemented the volume cloning functionality.You can only clone a PVC when it exists in the same namespace as the destination PVC (source and destination must be in the same namespace).Cloning is supported with a different Storage Class.Destination volume can be the same or a different storage class as the source.Default storage class can be used and storageClassName omitted in the spec.Cloning can only be performed between two volumes that use the same VolumeMode setting (if you request a block mode volume, the source MUST also be block mode)ProvisioningClones are provisioned like any other PVC with the exception of adding a dataSource that references an existing PVC in the same namespace.apiVersion: v1 kind: PersistentVolumeClaim metadata: name: clone-of-pvc-1 namespace: myns spec: accessModes: - ReadWriteOnce storageClassName: cloning resources: requests: storage: 5Gi dataSource: kind: PersistentVolumeClaim name: pvc-1 Note:You must specify a capacity value for spec.resources.requests.storage, and the value you specify must be the same or larger than the capacity of the source volume.The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.UsageUpon availability of the new PVC, the cloned PVC is consumed the same as other PVC. It's also expected at this point that the newly created PVC is an independent object. It can be consumed, cloned, snapshotted, or deleted independently and without consideration for it's original dataSource PVC. This also implies that the source is not linked in any way to the newly created clone, it may also be modified or deleted without affecting the newly created clone.", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-pvc-datasource/", "id": "k8s_00298"}
{"instruction": "Write a yaml example for csi volume cloning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\nCSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-pvc-datasource/", "id": "k8s_00298_code_3515"}
{"instruction": "Write a yaml example for csi volume cloning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\nCSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-pvc-datasource/", "id": "k8s_00298_code_3516"}
{"instruction": "Write a yaml example for csi volume cloning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\nCSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-pvc-datasource/", "id": "k8s_00298_code_3517"}
{"instruction": "What is the reference documentation for objectfieldselector?", "response": "ObjectFieldSelectorObjectFieldSelector selects an APIVersioned field of an object.import \"k8s.io/api/core/v1\"ObjectFieldSelector selects an APIVersioned field of an object.fieldPath (string), requiredPath of the field to select in the specified API version.apiVersion (string)Version of the schema the FieldPath is written in terms of, defaults to \"v1\".This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-field-selector/", "id": "k8s_00299"}
{"instruction": "What is the reference documentation for kubeadm alpha?", "response": "kubeadm alphaCaution:kubeadm alpha provides a preview of a set of features made available for gathering", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-alpha/", "id": "k8s_00300"}
{"instruction": "Explain the Kubernetes concept: Hardening Guide - Scheduler Configuration", "response": "Hardening Guide - Scheduler ConfigurationInformation about how to make the Kubernetes scheduler more secure.The Kubernetes scheduler is one of the critical components of the control plane.This document covers how to improve the security posture of the Scheduler.A misconfigured scheduler can have security implications. Such a scheduler can target specific nodes and evict the workloads or applications that are sharing the node and its resources. This can aid an attacker with a Yo-Yo attack: an attack on a vulnerable autoscaler.kube-scheduler configurationScheduler authentication & authorization command line optionsWhen setting up authentication configuration, it should be made sure that kube-scheduler's authentication remains consistent with kube-api-server's authentication. If any request has missing authentication headers, the authentication should happen through the kube-api-server allowing all authentication to be consistent in the cluster.authentication-kubeconfig: Make sure to provide a proper kubeconfig so that the scheduler can retrieve authentication configuration options from the API Server. This kubeconfig file should be protected with strict file permissions.authentication-tolerate-lookup-failure: Set this to false to make sure the scheduler always looks up its authentication configuration from the API server.authentication-skip-lookup: Set this to false to make sure the scheduler always looks up its authentication configuration from the API server.authorization-always-allow-paths: These paths should respond with data that is appropriate for anonymous authorization. Defaults to /healthz,/readyz,/livez.profiling: Set to false to disable the profiling endpoints which are provide debugging information but which should not be enabled on production clusters as they present a risk of denial of service or information leakage. The --profiling argument is deprecated and can now be provided through the KubeScheduler DebuggingConfiguration. Profiling can be disabled through the kube-scheduler config by setting enableProfiling to false.requestheader-client-ca-file: Avoid passing this argument.Scheduler networking command line optionsbind-address: In most cases, the kube-scheduler does not need to be externally accessible. Setting the bind address to localhost is a secure practice.permit-address-sharing: Set this to false to disable connection sharing through SO_REUSEADDR. SO_REUSEADDR can lead to reuse of terminated connections that are in TIME_WAIT state.permit-port-sharing: Default false. Use the default unless you are confident you understand the security implications.Scheduler TLS command line optionstls-cipher-suites: Always provide a list of preferred cipher suites. This ensures encryption never happens with insecure cipher suites.Scheduling configurations for custom schedulersWhen using custom schedulers based on the Kubernetes scheduling code, cluster administrators need to be careful with plugins that use the queueSort, prefilter, filter, or permit extension points. These extension points control various stages of a scheduling process, and the wrong configuration can impact the kube-scheduler's behavior in your cluster.Key considerationsExactly one plugin that uses the queueSort extension point can be enabled at a time. Any plugins that use queueSort should be scrutinized.Plugins that implement the prefilter or filter extension point can potentially mark all nodes as unschedulable. This can bring scheduling of new pods to a halt.Plugins that implement the permit extension point can prevent or delay the binding of a Pod. Such plugins should be thoroughly reviewed by the cluster administrator.When using a plugin that is not one of the default plugins, consider disabling the queueSort, filter and permit extension points as follows:apiVersion: kubescheduler.config.k8s.io/v1 kind: KubeSchedulerConfiguration profiles: - schedulerName: my-scheduler plugins: # Disable specific plugins for different extension points # You can di", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/security/hardening-guide/scheduler/", "id": "k8s_00301"}
{"instruction": "Write a yaml example for hardening guide - scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\nHardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/security/hardening-guide/scheduler/", "id": "k8s_00301_code_3521"}
{"instruction": "Write a yaml example for hardening guide - scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\nHardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/security/hardening-guide/scheduler/", "id": "k8s_00301_code_3522"}
{"instruction": "Write a yaml example for hardening guide - scheduler configuration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\nHardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/security/hardening-guide/scheduler/", "id": "k8s_00301_code_3523"}
{"instruction": "Provide a tutorial on configuring redis using a configmap", "response": "Configuring Redis using a ConfigMapThis page provides a real world example of how to configure Redis using a ConfigMap and builds upon the Configure a Pod to Use a ConfigMap task.ObjectivesCreate a ConfigMap with Redis configuration valuesCreate a Redis Pod that mounts and uses the created ConfigMapVerify that the configuration was correctly applied.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.The example shown on this page works with kubectl 1.14 and above.Understand Configure a Pod to Use a ConfigMap.Real World Example: Configuring Redis using a ConfigMapFollow the steps below to configure a Redis cache using data stored in a ConfigMap.First create a ConfigMap with an empty configuration block:cat <<EOF >./example-redis-config.yaml apiVersion: v1 kind: ConfigMap metadata: name: example-redis-config data: redis-config: \"\" EOF Apply the ConfigMap created above, along with a Redis pod manifest:kubectl apply -f example-redis-config.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml Examine the contents of the Redis pod manifest and note the following:A volume named config is created by spec.volumes[1]The key and path under spec.volumes[1].configMap.items[0] exposes the redis-config key from the example-redis-config ConfigMap as a file named redis.conf on the config volume.The config volume is then mounted at /redis-master by spec.containers[0].volumeMounts[1].This has the net effect of exposing the data in data.redis-config from the example-redis-config ConfigMap above as /redis-master/redis.conf inside the Pod.pods/config/redis-pod.yaml apiVersion: v1 kind: Pod metadata: name: redis spec: containers: - name: redis image: redis:8.0.2 command: - redis-server - \"/redis-master/redis.conf\" env: - name: MASTER value: \"true\" ports: - containerPort: 6379 resources: limits: cpu: \"0.1\" volumeMounts: - mountPath: /redis-master-data name: data - mountPath: /redis-master name: config volumes: - name: data emptyDir: {} - name: config configMap: name: example-redis-config items: - key: redis-config path: redis.conf Examine the created objects:kubectl get pod/redis configmap/example-redis-config You should see the following output:NAME READY STATUS RESTARTS AGE pod/redis 1/1 Running 0 8s NAME DATA AGE configmap/example-redis-config 1 14s Recall that we left redis-config key in the example-redis-config ConfigMap blank:kubectl describe configmap/example-redis-config You should see an empty redis-config key:Name: example-redis-config Namespace: default Labels: <none> Annotations: <none> Data ==== redis-config: Use kubectl exec to enter the pod and run the redis-cli tool to check the current configuration:kubectl exec -it redis -- redis-cli Check maxmemory:127.0.0.1:6379> CONFIG GET maxmemory It should show the default value of 0:1) \"maxmemory\" 2) \"0\" Similarly, check maxmemory-policy:127.0.0.1:6379> CONFIG GET maxmemory-policy Which should also yield its default value of noeviction:1) \"maxmemory-policy\" 2) \"noeviction\" Now let's add some configuration values to the example-redis-config ConfigMap:pods/config/example-redis-config.yaml apiVersion: v1 kind: ConfigMap metadata: name: example-redis-config data: redis-config: | maxmemory 2mb maxmemory-policy allkeys-lru Apply the updated ConfigMap:kubectl apply -f example-redis-config.yaml Confirm that the ConfigMap was updated:kubectl describe configmap/example-redis-config You should see the configuration values we just added:Name: example-redis-config Namespace: default Labels: <none> Annotations", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF >./example-redis-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: \"\"\nEOF\n```\n\nConfiguring Redis using a ConfigMap | Apply the ConfigMap created above, along with a Redis pod manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3525"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\nConfiguring Redis using a ConfigMap | Examine the contents of the Redis pod manifest and note the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3526"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\nConfiguring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3527"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/redis configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3528"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap | You should see an empty redis-config key:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3529"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\nConfiguring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3530"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\nConfiguring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3531"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\n```\n\nConfiguring Redis using a ConfigMap | Confirm that the ConfigMap was updated:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3532"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap | You should see the configuration values we just added:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3533"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\nConfiguring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3534"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\nConfiguring Redis using a ConfigMap | Now re-check the configuration values one last time:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3535"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\nConfiguring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3536"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/redis configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3537"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\nConfiguring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3538"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\nConfiguring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3539"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF >./example-redis-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: \"\"\nEOF\n```\n\nConfiguring Redis using a ConfigMap | Apply the ConfigMap created above, along with a Redis pod manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3540"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\nConfiguring Redis using a ConfigMap | Examine the contents of the Redis pod manifest and note the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3541"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/config/redis-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\nConfiguring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3542"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\nConfiguring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3543"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/redis configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3544"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap | You should see an empty redis-config key:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3545"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\nConfiguring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3546"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/config/example-redis-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\nConfiguring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3547"}
{"instruction": "Write a yaml example for configuring redis using a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\nConfiguring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3548"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\n```\n\nConfiguring Redis using a ConfigMap | Confirm that the ConfigMap was updated:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3549"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap | You should see the configuration values we just added:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3550"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\nConfiguring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3551"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\nConfiguring Redis using a ConfigMap | Now re-check the configuration values one last time:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3552"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\nConfiguring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3553"}
{"instruction": "Write a bash example for configuring redis using a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/redis configmap/example-redis-config\n```\n\nConfiguring Redis using a ConfigMap |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/configure-redis-using-configmap/", "id": "k8s_00302_code_3554"}
{"instruction": "What is the reference documentation for kubectl create priorityclass?", "response": "kubectl create priorityclassSynopsisCreate a priority class with the specified name, value, globalDefault and description.kubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none] Examples # Create a priority class named high-priority kubectl create priorityclass high-priority --value=1000 --description=\"high priority\" # Create a priority class named default-priority that is considered as the global default priority kubectl create priorityclass default-priority --value=1000 --global-default=true --description=\"default priority\" # Create a priority class named high-priority that cannot preempt pods with lower priority kubectl create priorityclass high-priority --value=1000 --description=\"high priority\" --preemption-policy=\"Never\" Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--description stringdescription is an arbitrary string that usually provides guidelines on when this priority class should be used.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--global-defaultglobal-default specifies whether this PriorityClass should be considered as the default priority.-h, --helphelp for priorityclass-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--preemption-policy string Default: \"PreemptLowerPriority\"preemption-policy is the policy for preempting pods with lower priority.--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.--value int32the value of this priority class.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_priorityclass/", "id": "k8s_00303"}
{"instruction": "Write a bash example for kubectl create priorityclass", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]\n```\n\nkubectl create priorityclass | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_priorityclass/", "id": "k8s_00303_code_3556"}
{"instruction": "Write a bash example for kubectl create priorityclass", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]\n```\n\nkubectl create priorityclass | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_priorityclass/", "id": "k8s_00303_code_3557"}
{"instruction": "What is the reference documentation for kubectl rollout undo?", "response": "kubectl rollout undoSynopsisRoll back to a previous rollout.kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags] Examples # Roll back to the previous deployment kubectl rollout undo deployment/abc # Roll back to daemonset revision 3 kubectl rollout undo daemonset/abc --to-revision=3 # Roll back to the previous deployment with dry-run kubectl rollout undo --dry-run=server deployment/abc Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for undo-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--to-revision intThe revision to rollback to. Default to 0 (last revision).Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory back", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_undo/", "id": "k8s_00304"}
{"instruction": "Write a bash example for kubectl rollout undo", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]\n```\n\nkubectl rollout undo | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_undo/", "id": "k8s_00304_code_3559"}
{"instruction": "Write a bash example for kubectl rollout undo", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]\n```\n\nkubectl rollout undo | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_undo/", "id": "k8s_00304_code_3560"}
{"instruction": "Explain the Kubernetes concept: Node Autoscaling", "response": "Node AutoscalingAutomatically provision and consolidate the Nodes in your cluster to adapt to demand and optimize cost.In order to run workloads in your cluster, you need Nodes. Nodes in your cluster can be autoscaled - dynamically provisioned, or consolidated to provide needed capacity while optimizing cost. Autoscaling is performed by Node autoscalers.Node provisioningIf there are Pods in a cluster that can't be scheduled on existing Nodes, new Nodes can be automatically added to the cluster—provisioned—to accommodate the Pods. This is especially useful if the number of Pods changes over time, for example as a result of combining horizontal workload with Node autoscaling.Autoscalers provision the Nodes by creating and deleting cloud provider resources backing them. Most commonly, the resources backing the Nodes are Virtual Machines.The main goal of provisioning is to make all Pods schedulable. This goal is not always attainable because of various limitations, including reaching configured provisioning limits, provisioning configuration not being compatible with a particular set of pods, or the lack of cloud provider capacity. While provisioning, Node autoscalers often try to achieve additional goals (for example minimizing the cost of the provisioned Nodes or balancing the number of Nodes between failure domains).There are two main inputs to a Node autoscaler when determining Nodes to provision—Pod scheduling constraints, and Node constraints imposed by autoscaler configuration.Autoscaler configuration may also include other Node provisioning triggers (for example the number of Nodes falling below a configured minimum limit).Note:Provisioning was formerly known as scale-up in Cluster Autoscaler.Pod scheduling constraintsPods can express scheduling constraints to impose limitations on the kind of Nodes they can be scheduled on. Node autoscalers take these constraints into account to ensure that the pending Pods can be scheduled on the provisioned Nodes.The most common kind of scheduling constraints are the resource requests specified by Pod containers. Autoscalers will make sure that the provisioned Nodes have enough resources to satisfy the requests. However, they don't directly take into account the real resource usage of the Pods after they start running. In order to autoscale Nodes based on actual workload resource usage, you can combine horizontal workload autoscaling with Node autoscaling.Other common Pod scheduling constraints include Node affinity, inter-Pod affinity, or a requirement for a particular storage volume.Node constraints imposed by autoscaler configurationThe specifics of the provisioned Nodes (for example the amount of resources, the presence of a given label) depend on autoscaler configuration. Autoscalers can either choose them from a pre-defined set of Node configurations, or use auto-provisioning.Auto-provisioningNode auto-provisioning is a mode of provisioning in which a user doesn't have to fully configure the specifics of the Nodes that can be provisioned. Instead, the autoscaler dynamically chooses the Node configuration based on the pending Pods it's reacting to, as well as pre-configured constraints (for example, the minimum amount of resources or the need for a given label).Node consolidationThe main consideration when running a cluster is ensuring that all schedulable pods are running, whilst keeping the cost of the cluster as low as possible. To achieve this, the Pods' resource requests should utilize as much of the Nodes' resources as possible. From this perspective, the overall Node utilization in a cluster can be used as a proxy for how cost-effective the cluster is.Note:Correctly setting the resource requests of your Pods is as important to the overall cost-effectiveness of a cluster as optimizing Node utilization. Combining Node autoscaling with vertical workload autoscaling can help you achieve this.Nodes in your cluster can be automatically consolidated in order to improve the overall ", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/node-autoscaling/", "id": "k8s_00305"}
{"instruction": "Provide a tutorial on viewing pods and nodes", "response": "Viewing Pods and NodesObjectivesLearn about Kubernetes Pods.Learn about Kubernetes Nodes.Troubleshoot deployed applications.Kubernetes PodsA Pod is a group of one or more application containers (such as Docker) and includes shared storage (volumes), IP address and information about how to run them.When you created a Deployment in Module 2, Kubernetes created a Pod to host your application instance. A Pod is a Kubernetes abstraction that represents a group of one or more application containers (such as Docker), and some shared resources for those containers. Those resources include:Shared storage, as VolumesNetworking, as a unique cluster IP addressInformation about how to run each container, such as the container image version or specific ports to useA Pod models an application-specific \"logical host\" and can contain different application containers which are relatively tightly coupled. For example, a Pod might include both the container with your Node.js app as well as a different container that feeds the data to be published by the Node.js webserver. The containers in a Pod share an IP Address and port space, are always co-located and co-scheduled, and run in a shared context on the same Node.Pods are the atomic unit on the Kubernetes platform. When we create a Deployment on Kubernetes, that Deployment creates Pods with containers inside them (as opposed to creating containers directly). Each Pod is tied to the Node where it is scheduled, and remains there until termination (according to restart policy) or deletion. In case of a Node failure, identical Pods are scheduled on other available Nodes in the cluster.Pods overviewContainers should only be scheduled together in a single Pod if they are tightly coupled and need to share resources such as disk.NodesA Pod always runs on a Node. A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine, depending on the cluster. Each Node is managed by the control plane. A Node can have multiple pods, and the Kubernetes control plane automatically handles scheduling the pods across the Nodes in the cluster. The control plane's automatic scheduling takes into account the available resources on each Node.Every Kubernetes Node runs at least:Kubelet, a process responsible for communication between the Kubernetes control plane and the Node; it manages the Pods and the containers running on a machine.A container runtime (like Docker) responsible for pulling the container image from a registry, unpacking the container, and running the application.Nodes overviewTroubleshooting with kubectlIn Module 2, you used the kubectl command-line interface. You'll continue to use it in Module 3 to get information about deployed applications and their environments. The most common operations can be done with the following kubectl subcommands:kubectl get - list resourceskubectl describe - show detailed information about a resourcekubectl logs - print the logs from a container in a podkubectl exec - execute a command on a container in a podYou can use these commands to see when applications were deployed, what their current statuses are, where they are running and what their configurations are.Now that we know more about our cluster components and the command line, let's explore our application.Check application configurationLet's verify that the application we deployed in the previous scenario is running. We'll use the kubectl get command and look for existing Pods:kubectl get pods If no pods are running, please wait a couple of seconds and list the Pods again. You can continue once you see one Pod running.Next, to view what containers are inside that Pod and what images are used to build those containers we run the kubectl describe pods command:kubectl describe pods We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.The output of the describe subcommand is extensive and covers some concepts that ", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306"}
{"instruction": "Write a bash example for viewing pods and nodes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nViewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306_code_3563"}
{"instruction": "Write a bash example for viewing pods and nodes", "response": "Here's a bash example:\n\n```bash\nkubectl exec \"$POD_NAME\" -- env\n```\n\nViewing Pods and Nodes | Again, it's worth mentioning that the name of the container itself can be omitted since we only have a single container in the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306_code_3564"}
{"instruction": "Write a bash example for viewing pods and nodes", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- bash\n```\n\nViewing Pods and Nodes | We have now an open console on the container where we run our NodeJS application. The source code of the app is in the server.js file:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306_code_3565"}
{"instruction": "Write a bash example for viewing pods and nodes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nViewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306_code_3566"}
{"instruction": "Write a bash example for viewing pods and nodes", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nViewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306_code_3567"}
{"instruction": "Write a bash example for viewing pods and nodes", "response": "Here's a bash example:\n\n```bash\nkubectl exec \"$POD_NAME\" -- env\n```\n\nViewing Pods and Nodes | Again, it's worth mentioning that the name of the container itself can be omitted since we only have a single container in the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306_code_3568"}
{"instruction": "Write a bash example for viewing pods and nodes", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- bash\n```\n\nViewing Pods and Nodes | We have now an open console on the container where we run our NodeJS application. The source code of the app is in the server.js file:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/", "id": "k8s_00306_code_3569"}
{"instruction": "What is the reference documentation for mutatingwebhookconfiguration?", "response": "MutatingWebhookConfigurationMutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.apiVersion: admissionregistration.k8s.io/v1import \"k8s.io/api/admissionregistration/v1\"MutatingWebhookConfigurationMutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.apiVersion: admissionregistration.k8s.io/v1kind: MutatingWebhookConfigurationmetadata (ObjectMeta)Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.webhooks ([]MutatingWebhook)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeWebhooks is a list of webhooks and the affected resources and operations.MutatingWebhook describes an admission webhook and the resources and operations it applies to.webhooks.admissionReviewVersions ([]string), requiredAtomic: will be replaced during a mergeAdmissionReviewVersions is an ordered list of preferred AdmissionReview versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.webhooks.clientConfig (WebhookClientConfig), requiredClientConfig defines how to communicate with the hook. RequiredWebhookClientConfig contains the information to make a TLS connection with the webhookwebhooks.clientConfig.caBundle ([]byte)caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.webhooks.clientConfig.service (ServiceReference)service is a reference to the service for this webhook. Either service or url must be specified.If the webhook is running within the cluster, then you should use service.ServiceReference holds a reference to Service.legacy.k8s.iowebhooks.clientConfig.service.name (string), requiredname is the name of the service. Requiredwebhooks.clientConfig.service.namespace (string), requirednamespace is the namespace of the service. Requiredwebhooks.clientConfig.service.path (string)path is an optional URL path which will be sent in any request to this service.webhooks.clientConfig.service.port (int32)If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. port should be a valid port number (1-65535, inclusive).webhooks.clientConfig.url (string)url gives the location of the webhook, in standard URL form (scheme://host:port/path). Exactly one of url or service must be specified.The host should not refer to a service running in the cluster; use the service field instead. The host might be resolved via external DNS in some apiservers (e.g., kube-apiserver cannot resolve in-cluster DNS as that would be a layering violation). host may also be an IP address.Please note that using localhost or 127.0.0.1 as a host is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.The scheme must be \"https\"; the URL must begin with \"https://\".A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.webhooks.name (string), requiredThe name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubern", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/mutating-webhook-configuration-v1/", "id": "k8s_00307"}
{"instruction": "Write a yaml example for mutatingwebhookconfiguration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\nMutatingWebhookConfiguration | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/mutating-webhook-configuration-v1/", "id": "k8s_00307_code_3571"}
{"instruction": "What is the reference documentation for kubectl?", "response": "kubectlSynopsiskubectl controls the Kubernetes cluster manager.Find more information at: https://kubernetes.io/docs/reference/kubectl/kubectl [flags] Options--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server-h, --helphelp for kubectl--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl annotate - Update the annotations on a resourcekubectl api-resources - Print the supported API resources on the serverkubectl api-versions - Print the supported API versions on the server, in the form of \"group/version\"kubectl apply - Apply a configuration to a resource by file name or stdinkubectl attach - Attach to a running containerkubectl auth - Inspect authorizationkubectl autoscale - Auto-scale a deployment, replica set, stateful set, or replication controllerkubectl certificate - Modify certificate resourceskubectl cluster-info - Display cluster informationkubectl completion - Output shell completion code for the specified shell (bash, zsh, fish, or powershell)kubectl config - Modify kubeconfig fileskubectl cordon - Mark node as unschedulablekubectl cp - Copy files and directories to and from containerskubectl ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl/", "id": "k8s_00308"}
{"instruction": "Explain the Kubernetes concept: Cluster Administration", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Cluster AdministrationLower-level detail relevant to creating or administering a Kubernetes cluster.1: Node Shutdowns2: Swap memory management3: Node Autoscaling4: Certificates5: Cluster Networking6: Admission Webhook Good Practices7: Good practices for Dynamic Resource Allocation as a Cluster Admin8: Logging Architecture9: Compatibility Version For Kubernetes Control Plane Components10: Metrics For Kubernetes System Components11: Metrics for Kubernetes Object States12: System Logs13: Traces For Kubernetes System Components14: Proxies in Kubernetes15: API Priority and Fairness16: Installing Addons17: Coordinated Leader ElectionThe cluster administration overview is for anyone creating or administering a Kubernetes cluster. It assumes some familiarity with core Kubernetes concepts.Planning a clusterSee the guides in Setup for examples of how to plan, set up, and configure Kubernetes clusters. The solutions listed in this article are called distros.Note:Not all distros are actively maintained. Choose distros which have been tested with a recent version of Kubernetes.Before choosing a guide, here are some considerations:Do you want to try out Kubernetes on your computer, or do you want to build a high-availability, multi-node cluster? Choose distros best suited for your needs.Will you be using a hosted Kubernetes cluster, such as Google Kubernetes Engine, or hosting your own cluster?Will your cluster be on-premises, or in the cloud (IaaS)? Kubernetes does not directly support hybrid clusters. Instead, you can set up multiple clusters.If you are configuring Kubernetes on-premises, consider which networking model fits best.Will you be running Kubernetes on \"bare metal\" hardware or on virtual machines (VMs)?Do you want to run a cluster, or do you expect to do active development of Kubernetes project code? If the latter, choose an actively-developed distro. Some distros only use binary releases, but offer a greater variety of choices.Familiarize yourself with the components needed to run a cluster.Managing a clusterLearn how to manage nodes.Read about Node autoscaling.Learn how to set up and manage the resource quota for shared clusters.Securing a clusterGenerate Certificates describes the steps to generate certificates using different tool chains.Kubernetes Container Environment describes the environment for Kubelet managed containers on a Kubernetes node.Controlling Access to the Kubernetes API describes how Kubernetes implements access control for its own API.Authenticating explains authentication in Kubernetes, including the various authentication options.Authorization is separate from authentication, and controls how HTTP calls are handled.Using Admission Controllers explains plug-ins which intercepts requests to the Kubernetes API server after authentication and authorization.Admission Webhook Good Practices provides good practices and considerations when designing mutating admission webhooks and validating admission webhooks.Using Sysctls in a Kubernetes Cluster describes to an administrator how to use the sysctl command-line tool to set kernel parameters .Auditing describes how to interact with Kubernetes' audit logs.Securing the kubeletControl Plane-Node communicationTLS bootstrappingKubelet authentication/authorizationOptional Cluster ServicesDNS Integration describes how to resolve a DNS name directly to a Kubernetes service.Logging and Monitoring Cluster Activity explains how logging in Kubernetes works and how to implement it.1 - Node ShutdownsIn a Kubernetes cluster, a node can be shut down in a planned graceful way or unexpectedly because of reasons such as a power outage or something else external. A node shutdown could lead to workload failure if the node is not drained before the shutdown. A node shutdown can be either graceful or non-graceful.Graceful node shutdownThe kubelet attempts to detect node sy", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3574"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -n kube-system --show-swap\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3575"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o go-template='{{range .items}}{{.metadata.name}}: {{if .status.nodeInfo.swap.capacity}}{{.status.nodeInfo.swap.capacity}}{{else}}<unknown>{{end}}{{\"\\n\"}}{{end}}'\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3576"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o jsonpath='{range .items[?(@.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap)]}{.metadata.name}{\"\\t\"}{.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap}{\"\\n\"}{end}'\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3577"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get mutatingwebhookconfigurations\n```\n\n6 - Admission Webhook Good Practices | The output lists any mutating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3578"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get validatingwebhookconfigurations\n```\n\n6 - Admission Webhook Good Practices | The output lists any validating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3579"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3580"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod.yaml\n```\n\n8 - Logging Architecture | The output is:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3581"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter -c count\n```\n\n8 - Logging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3582"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3583"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod-err.yaml\n```\n\n8 - Logging Architecture | To fetch only the stderr log stream, you can run:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3584"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/namespaces/default/pods/counter-err/log?stream=Stderr\"\n```\n\n8 - Logging Architecture | See the kubectl logs documentation for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3585"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3586"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3587"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-1\n```\n\n8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3588"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-2\n```\n\n8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3589"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3590"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n8 - Logging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3591"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\n10 - Metrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3592"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/<insert-node-name-here>/proxy/logs/?query=/<insert-log-file-name-here>\"\n```\n\n12 - System Logs | The kubelet uses heuristics to retrieve logs. This helps if you are not aware whether a given system service is writing logs to the operating system's native logger like journald or to a log file in /", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3593"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\n13 - Traces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3594"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\n13 - Traces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3595"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3596"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3597"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\nshutdownGracePeriodByPodPriority:\n  - priority: 100000\n    shutdownGracePeriodSeconds: 10\n  - priority: 10000\n    shutdownGracePeriodSeconds: 180\n  - priority: 1000\n    shutdownGracePeriodSeconds: 120\n  - priority: 0\n    shutdownGracePeriodSeconds: 60\n```\n\n1 - Node Shutdowns | The above table implies that any pod with priority value >= 100000 will get just 10 seconds to shut down, any pod with value >= 10000 and < 100000 will get 180 seconds to shut down, any pod with value", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3598"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl top --show-swap\n```\n\n2 - Swap memory management | Querying metrics is valuable, but somewhat cumbersome, as these metrics are designed to be used by software rather than humans. In order to consume this data in a more user-friendly way, the kubectl t", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3599"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3600"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3601"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3602"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous\n```\n\n8 - Logging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3603"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3604"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3605"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3606"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3607"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n8 - Logging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3608"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\n10 - Metrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3609"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\n\"metric1,label2\": \"v1,v2,v3\"\n\"metric2,label1\": \"v1,v2,v3\"\n```\n\n10 - Metrics For Kubernetes System Components | Additionally, the cardinality_enforcement_unexpected_categorizations_total meta-metric records the count of unexpected categorizations during cardinality enforcement, that is, whenever a label value i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3610"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\ngroups:\n- name: Pod state\n  rules:\n  - alert: PodsBlockedInTerminatingState\n    expr: count(kube_pod_deletion_timestamp) by (namespace, pod) * count(kube_pod_status_reason{reason=\"NodeLost\"} == 0) by (namespace, pod) > 0\n    for: 5m\n    labels:\n      severity: page\n    annotations:\n      summary: Pod {{$labels.namespace}}/{{$labels.pod}} blocked in Terminating state.\n```\n\n11 - Metrics for Kubernetes Object States | System component logs record events happening in cluster, which can be very useful for debugging. You can configure log verbosity to see more or less detail. Logs can be as coarse-grained as showing e", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3611"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\nreceivers:\n  otlp:\n    protocols:\n      grpc:\nexporters:\n  # Replace this exporter with the exporter for your backend\n  exporters:\n    debug:\n      verbosity: detailed\nservice:\n  pipelines:\n    traces:\n      receivers: [otlp]\n      exporters: [debug]\n```\n\n13 - Traces For Kubernetes System Components | To directly emit traces to a backend without utilizing a collector, specify the endpoint field in the Kubernetes tracing configuration file with the desired trace backend address. This method negates", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3612"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\n13 - Traces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3613"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\n13 - Traces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3614"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3615"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3616"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3617"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -n kube-system --show-swap\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3618"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o go-template='{{range .items}}{{.metadata.name}}: {{if .status.nodeInfo.swap.capacity}}{{.status.nodeInfo.swap.capacity}}{{else}}<unknown>{{end}}{{\"\\n\"}}{{end}}'\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3619"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o jsonpath='{range .items[?(@.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap)]}{.metadata.name}{\"\\t\"}{.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap}{\"\\n\"}{end}'\n```\n\n2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3620"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get mutatingwebhookconfigurations\n```\n\n6 - Admission Webhook Good Practices | The output lists any mutating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3621"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get validatingwebhookconfigurations\n```\n\n6 - Admission Webhook Good Practices | The output lists any validating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3622"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\ndebug/counter-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3623"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3624"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod.yaml\n```\n\n8 - Logging Architecture | The output is:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3625"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter -c count\n```\n\n8 - Logging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3626"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\ndebug/counter-pod-err.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3627"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3628"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod-err.yaml\n```\n\n8 - Logging Architecture | To fetch only the stderr log stream, you can run:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3629"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/namespaces/default/pods/counter-err/log?stream=Stderr\"\n```\n\n8 - Logging Architecture | See the kubectl logs documentation for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3630"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3631"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3632"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod-streaming-sidecar.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3633"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3634"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-1\n```\n\n8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3635"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-2\n```\n\n8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3636"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/fluentd-sidecar-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3637"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3638"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod-agent-sidecar.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n8 - Logging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3639"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n8 - Logging Architecture |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3640"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\n10 - Metrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3641"}
{"instruction": "Write a bash example for cluster administration", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/<insert-node-name-here>/proxy/logs/?query=/<insert-log-file-name-here>\"\n```\n\n12 - System Logs | The kubelet uses heuristics to retrieve logs. This helps if you are not aware whether a given system service is writing logs to the operating system's native logger like journald or to a log file in /", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3642"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\n13 - Traces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3643"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\n13 - Traces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3644"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\npriority-and-fairness/health-for-strangers.yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3645"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3646"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\npriority-and-fairness/list-events-default-service-account.yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3647"}
{"instruction": "Write a yaml example for cluster administration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/_print/", "id": "k8s_00309_code_3648"}
{"instruction": "Explain the Kubernetes concept: Runtime Class", "response": "Runtime ClassFEATURE STATE: Kubernetes v1.20 [stable]This page describes the RuntimeClass resource and runtime selection mechanism.RuntimeClass is a feature for selecting the container runtime configuration. The container runtime configuration is used to run a Pod's containers.MotivationYou can set a different RuntimeClass between different Pods to provide a balance of performance versus security. For example, if part of your workload deserves a high level of information security assurance, you might choose to schedule those Pods so that they run in a container runtime that uses hardware virtualization. You'd then benefit from the extra isolation of the alternative runtime, at the expense of some additional overhead.You can also use RuntimeClass to run different Pods with the same container runtime but with different settings.SetupConfigure the CRI implementation on nodes (runtime dependent)Create the corresponding RuntimeClass resources1. Configure the CRI implementation on nodesThe configurations available through RuntimeClass are Container Runtime Interface (CRI) implementation dependent. See the corresponding documentation (below) for your CRI implementation for how to configure.Note:RuntimeClass assumes a homogeneous node configuration across the cluster by default (which means that all nodes are configured the same way with respect to container runtimes). To support heterogeneous node configurations, see Scheduling below.The configurations have a corresponding handler name, referenced by the RuntimeClass. The handler must be a valid DNS label name.2. Create the corresponding RuntimeClass resourcesThe configurations setup in step 1 should each have an associated handler name, which identifies the configuration. For each handler, create a corresponding RuntimeClass object.The RuntimeClass resource currently only has 2 significant fields: the RuntimeClass name (metadata.name) and the handler (handler). The object definition looks like this:# RuntimeClass is defined in the node.k8s.io API group apiVersion: node.k8s.io/v1 kind: RuntimeClass metadata: # The name the RuntimeClass will be referenced by. # RuntimeClass is a non-namespaced resource. name: myclass # The name of the corresponding CRI configuration handler: myconfiguration The name of a RuntimeClass object must be a valid DNS subdomain name.Note:It is recommended that RuntimeClass write operations (create/update/patch/delete) be restricted to the cluster administrator. This is typically the default. See Authorization Overview for more details.UsageOnce RuntimeClasses are configured for the cluster, you can specify a runtimeClassName in the Pod spec to use it. For example:apiVersion: v1 kind: Pod metadata: name: mypod spec: runtimeClassName: myclass # ... This will instruct the kubelet to use the named RuntimeClass to run this pod. If the named RuntimeClass does not exist, or the CRI cannot run the corresponding handler, the pod will enter the Failed terminal phase. Look for a corresponding event for an error message.If no runtimeClassName is specified, the default RuntimeHandler will be used, which is equivalent to the behavior when the RuntimeClass feature is disabled.CRI ConfigurationFor more details on setting up CRI runtimes, see CRI installation.containerdRuntime handlers are configured through containerd's configuration at /etc/containerd/config.toml. Valid handlers are configured under the runtimes section:[plugins.\"io.containerd.grpc.v1.cri\".containerd.runtimes.${HANDLER_NAME}] See containerd's config documentation for more details:CRI-ORuntime handlers are configured through CRI-O's configuration at /etc/crio/crio.conf. Valid handlers are configured under the crio.runtime table:[crio.runtime.runtimes.${HANDLER_NAME}] runtime_path = \"${PATH_TO_BINARY}\" See CRI-O's config documentation for more details.SchedulingFEATURE STATE: Kubernetes v1.16 [beta]By specifying the scheduling field for a RuntimeClass, you can set constraints to ensure that Pods running with ", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/runtime-class/", "id": "k8s_00310"}
{"instruction": "Write a yaml example for runtime class", "response": "Here's a yaml example:\n\n```yaml\n# RuntimeClass is defined in the node.k8s.io API group\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  # The name the RuntimeClass will be referenced by.\n  # RuntimeClass is a non-namespaced resource.\n  name: myclass \n# The name of the corresponding CRI configuration\nhandler: myconfiguration\n```\n\nRuntime Class | The name of a RuntimeClass object must be a valid DNS subdomain name.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/runtime-class/", "id": "k8s_00310_code_3650"}
{"instruction": "Write a yaml example for runtime class", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  runtimeClassName: myclass\n  # ...\n```\n\nRuntime Class | This will instruct the kubelet to use the named RuntimeClass to run this pod. If the named RuntimeClass does not exist, or the CRI cannot run the corresponding handler, the pod will enter the Failed t", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/runtime-class/", "id": "k8s_00310_code_3651"}
{"instruction": "Write a yaml example for runtime class", "response": "Here's a yaml example:\n\n```yaml\n# RuntimeClass is defined in the node.k8s.io API group\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  # The name the RuntimeClass will be referenced by.\n  # RuntimeClass is a non-namespaced resource.\n  name: myclass \n# The name of the corresponding CRI configuration\nhandler: myconfiguration\n```\n\nRuntime Class | The name of a RuntimeClass object must be a valid DNS subdomain name.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/runtime-class/", "id": "k8s_00310_code_3652"}
{"instruction": "Write a yaml example for runtime class", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  runtimeClassName: myclass\n  # ...\n```\n\nRuntime Class | This will instruct the kubelet to use the named RuntimeClass to run this pod. If the named RuntimeClass does not exist, or the CRI cannot run the corresponding handler, the pod will enter the Failed t", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/runtime-class/", "id": "k8s_00310_code_3653"}
{"instruction": "Write a yaml example for runtime class", "response": "Here's a yaml example:\n\n```yaml\n# RuntimeClass is defined in the node.k8s.io API group\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  # The name the RuntimeClass will be referenced by.\n  # RuntimeClass is a non-namespaced resource.\n  name: myclass \n# The name of the corresponding CRI configuration\nhandler: myconfiguration\n```\n\nRuntime Class | The name of a RuntimeClass object must be a valid DNS subdomain name.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/runtime-class/", "id": "k8s_00310_code_3654"}
{"instruction": "Write a yaml example for runtime class", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  runtimeClassName: myclass\n  # ...\n```\n\nRuntime Class | This will instruct the kubelet to use the named RuntimeClass to run this pod. If the named RuntimeClass does not exist, or the CRI cannot run the corresponding handler, the pod will enter the Failed t", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/runtime-class/", "id": "k8s_00310_code_3655"}
{"instruction": "How do you manage memory, cpu, and api resources in Kubernetes?", "response": "Manage Memory, CPU, and API ResourcesConfigure Default Memory Requests and Limits for a NamespaceDefine a default memory resource limit for a namespace, so that every new Pod in that namespace has a memory resource limit configured.Configure Default CPU Requests and Limits for a NamespaceDefine a default CPU resource limits for a namespace, so that every new Pod in that namespace has a CPU resource limit configured.Configure Minimum and Maximum Memory Constraints for a NamespaceDefine a range of valid memory resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.Configure Minimum and Maximum CPU Constraints for a NamespaceDefine a range of valid CPU resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.Configure Memory and CPU Quotas for a NamespaceDefine overall memory and CPU resource limits for a namespace.Configure a Pod Quota for a NamespaceRestrict how many Pods you can create within a namespace.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/", "id": "k8s_00311"}
{"instruction": "Explain the Kubernetes concept: Disruptions", "response": "DisruptionsThis guide is for application owners who want to build highly available applications, and thus need to understand what types of disruptions can happen to Pods.It is also for cluster administrators who want to perform automated cluster actions, like upgrading and autoscaling clusters.Voluntary and involuntary disruptionsPods do not disappear until someone (a person or a controller) destroys them, or there is an unavoidable hardware or system software error.We call these unavoidable cases involuntary disruptions to an application. Examples are:a hardware failure of the physical machine backing the nodecluster administrator deletes VM (instance) by mistakecloud provider or hypervisor failure makes VM disappeara kernel panicthe node disappears from the cluster due to cluster network partitioneviction of a pod due to the node being out-of-resources.Except for the out-of-resources condition, all these conditions should be familiar to most users; they are not specific to Kubernetes.We call other cases voluntary disruptions. These include both actions initiated by the application owner and those initiated by a Cluster Administrator. Typical application owner actions include:deleting the deployment or other controller that manages the podupdating a deployment's pod template causing a restartdirectly deleting a pod (e.g. by accident)Cluster administrator actions include:Draining a node for repair or upgrade.Draining a node from a cluster to scale the cluster down (learn about Node Autoscaling).Removing a pod from a node to permit something else to fit on that node.These actions might be taken directly by the cluster administrator, or by automation run by the cluster administrator, or by your cluster hosting provider.Ask your cluster administrator or consult your cloud provider or distribution documentation to determine if any sources of voluntary disruptions are enabled for your cluster. If none are enabled, you can skip creating Pod Disruption Budgets.Caution:Not all voluntary disruptions are constrained by Pod Disruption Budgets. For example, deleting deployments or pods bypasses Pod Disruption Budgets.Dealing with disruptionsHere are some ways to mitigate involuntary disruptions:Ensure your pod requests the resources it needs.Replicate your application if you need higher availability. (Learn about running replicated stateless and stateful applications.)For even higher availability when running replicated applications, spread applications across racks (using anti-affinity) or across zones (if using a multi-zone cluster.)The frequency of voluntary disruptions varies. On a basic Kubernetes cluster, there are no automated voluntary disruptions (only user-triggered ones). However, your cluster administrator or hosting provider may run some additional services which cause voluntary disruptions. For example, rolling out node software updates can cause voluntary disruptions. Also, some implementations of cluster (node) autoscaling may cause voluntary disruptions to defragment and compact nodes. Your cluster administrator or hosting provider should have documented what level of voluntary disruptions, if any, to expect. Certain configuration options, such as using PriorityClasses in your pod spec can also cause voluntary (and involuntary) disruptions.Pod disruption budgetsFEATURE STATE: Kubernetes v1.21 [stable]Kubernetes offers features to help you run highly available applications even when you introduce frequent voluntary disruptions.As an application owner, you can create a PodDisruptionBudget (PDB) for each application. A PDB limits the number of Pods of a replicated application that are down simultaneously from voluntary disruptions. For example, a quorum-based application would like to ensure that the number of replicas running is never brought below the number needed for a quorum. A web front end might want to ensure that the number of replicas serving load never falls below a certain percentage of the total.Cluster managers", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/disruptions/", "id": "k8s_00312"}
{"instruction": "Provide a tutorial on using minikube to create a cluster", "response": "Using Minikube to Create a ClusterObjectivesLearn what a Kubernetes cluster is.Learn what Minikube is.Start a Kubernetes cluster on your computer.Kubernetes ClustersKubernetes is a production-grade, open-source platform that orchestrates the placement (scheduling) and execution of application containers within and across computer clusters.Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit. The abstractions in Kubernetes allow you to deploy containerized applications to a cluster without tying them specifically to individual machines. To make use of this new model of deployment, applications need to be packaged in a way that decouples them from individual hosts: they need to be containerized. Containerized applications are more flexible and available than in past deployment models, where applications were installed directly onto specific machines as packages deeply integrated into the host. Kubernetes automates the distribution and scheduling of application containers across a cluster in a more efficient way. Kubernetes is an open-source platform and is production-ready.A Kubernetes cluster consists of two types of resources:The Control Plane coordinates the clusterNodes are the workers that run applicationsCluster DiagramThe Control Plane is responsible for managing the cluster. The Control Plane coordinates all activities in your cluster, such as scheduling applications, maintaining applications' desired state, scaling applications, and rolling out new updates.Control Planes manage the cluster and the nodes that are used to host the running applications.A node is a VM or a physical computer that serves as a worker machine in a Kubernetes cluster. Each node has a Kubelet, which is an agent for managing the node and communicating with the Kubernetes control plane. The node should also have tools for handling container operations, such as containerd or CRI-O. A Kubernetes cluster that handles production traffic should have a minimum of three nodes because if one node goes down, both an etcd member and a control plane instance are lost, and redundancy is compromised. You can mitigate this risk by adding more control plane nodes.When you deploy applications on Kubernetes, you tell the control plane to start the application containers. The control plane schedules the containers to run on the cluster's nodes. Node-level components, such as the kubelet, communicate with the control plane using the Kubernetes API, which the control plane exposes. End users can also use the Kubernetes API directly to interact with the cluster.A Kubernetes cluster can be deployed on either physical or virtual machines. To get started with Kubernetes development, you can use Minikube. Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. Minikube is available for Linux, macOS, and Windows systems. The Minikube CLI provides basic bootstrapping operations for working with your cluster, including start, stop, status, and delete.What's nextTutorial Hello Minikube.Learn more about Cluster Architecture.", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro/", "id": "k8s_00313"}
{"instruction": "What is the reference documentation for well-known labels, annotations and taints?", "response": "Well-Known Labels, Annotations and TaintsKubernetes reserves all labels, annotations and taints in the kubernetes.io and k8s.io namespaces.This document serves both as a reference to the values and as a coordination point for assigning values.Labels, annotations and taints used on API objectsapf.kubernetes.io/autoupdate-specType: AnnotationExample: apf.kubernetes.io/autoupdate-spec: \"true\"Used on: FlowSchema and PriorityLevelConfiguration ObjectsIf this annotation is set to true on a FlowSchema or PriorityLevelConfiguration, the spec for that object is managed by the kube-apiserver. If the API server does not recognize an APF object, and you annotate it for automatic update, the API server deletes the entire object. Otherwise, the API server does not manage the object spec. For more details, read Maintenance of the Mandatory and Suggested Configuration Objects.app.kubernetes.io/componentType: LabelExample: app.kubernetes.io/component: \"database\"Used on: All Objects (typically used on workload resources).The component within the application architecture.One of the recommended labels.app.kubernetes.io/created-by (deprecated)Type: LabelExample: app.kubernetes.io/created-by: \"controller-manager\"Used on: All Objects (typically used on workload resources).The controller/user who created this resource.Note:Starting from v1.9, this label is deprecated.app.kubernetes.io/instanceType: LabelExample: app.kubernetes.io/instance: \"mysql-abcxyz\"Used on: All Objects (typically used on workload resources).A unique name identifying the instance of an application. To assign a non-unique name, use app.kubernetes.io/name.One of the recommended labels.app.kubernetes.io/managed-byType: LabelExample: app.kubernetes.io/managed-by: \"helm\"Used on: All Objects (typically used on workload resources).The tool being used to manage the operation of an application.One of the recommended labels.app.kubernetes.io/nameType: LabelExample: app.kubernetes.io/name: \"mysql\"Used on: All Objects (typically used on workload resources).The name of the application.One of the recommended labels.app.kubernetes.io/part-ofType: LabelExample: app.kubernetes.io/part-of: \"wordpress\"Used on: All Objects (typically used on workload resources).The name of a higher-level application this object is part of.One of the recommended labels.app.kubernetes.io/versionType: LabelExample: app.kubernetes.io/version: \"5.7.21\"Used on: All Objects (typically used on workload resources).The current version of the application.Common forms of values include:semantic versionthe Git revision hash for the source code.One of the recommended labels.applyset.kubernetes.io/additional-namespaces (alpha)Type: AnnotationExample: applyset.kubernetes.io/additional-namespaces: \"namespace1,namespace2\"Used on: Objects being used as ApplySet parents.Use of this annotation is Alpha. For Kubernetes version 1.34, you can use this annotation on Secrets, ConfigMaps, or custom resources if the CustomResourceDefinition defining them has the applyset.kubernetes.io/is-parent-type label.Part of the specification used to implement ApplySet-based pruning in kubectl. This annotation is applied to the parent object used to track an ApplySet to extend the scope of the ApplySet beyond the parent object's own namespace (if any). The value is a comma-separated list of the names of namespaces other than the parent's namespace in which objects are found.applyset.kubernetes.io/contains-group-kinds (alpha)Type: AnnotationExample: applyset.kubernetes.io/contains-group-kinds: \"certificates.cert-manager.io,configmaps,deployments.apps,secrets,services\"Used on: Objects being used as ApplySet parents.Use of this annotation is Alpha. For Kubernetes version 1.34, you can use this annotation on Secrets, ConfigMaps, or custom resources if the CustomResourceDefinition defining them has the applyset.kubernetes.io/is-parent-type label.Part of the specification used to implement ApplySet-based pruning in kubectl. This annotation is applied to the par", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <node-name> node.kubernetes.io/exclude-from-external-load-balancers=true\n```\n\nWell-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3660"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration: >\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"example\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"matchLabels\":{\"app.kubernetes.io/name\":foo}},\"template\":{\"metadata\":{\"labels\":{\"app.kubernetes.io/name\":\"foo\"}},\"spec\":{\"containers\":[{\"image\":\"container-registry.example/foo-bar:1.42\",\"name\":\"foo-bar\",\"ports\":[{\"containerPort\":42}]}]}}}}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: all objects", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3661"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes <node-name> node-role.kubernetes.io/control-plane:NoSchedule-\n```\n\nWell-Known Labels, Annotations and Taints | Type: Taint", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3662"}
{"instruction": "Write a yaml example for well-known labels, annotations and taints", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/filter-result: >-\n      {\"node-282x7\":{\"AzureDiskLimits\":\"passed\",\"EBSLimits\":\"passed\",\"GCEPDLimits\":\"passed\",\"InterPodAffinity\":\"passed\",\"NodeAffinity\":\"passed\",\"NodeName\":\"passed\",\"NodePorts\":\"passed\",\"NodeResourcesFit\":\"passed\",\"NodeUnschedulable\":\"passed\",\"NodeVolumeLimits\":\"passed\",\"PodTopologySpread\":\"passed\",\"TaintToleration\":\"passed\",\"VolumeBinding\":\"passed\",\"VolumeRestrictions\":\"passed\",\"VolumeZone\":\"passed\"},\"node-gp9t4\":{\"AzureDiskLimits\":\"passed\",\"EBSLimits\":\"passed\",\"GCEPDLimits\":\"passed\",\"InterPodAffinity\":\"passed\",\"NodeAffinity\":\"passed\",\"NodeName\":\"passed\",\"NodePorts\":\"passed\",\"NodeResourcesFit\":\"passed\",\"NodeUnschedulable\":\"passed\",\"NodeVolumeLimits\":\"passed\",\"PodTopologySpread\":\"passed\",\"TaintToleration\":\"passed\",\"VolumeBinding\":\"passed\",\"VolumeRestrictions\":\"passed\",\"VolumeZone\":\"passed\"}}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3663"}
{"instruction": "Write a yaml example for well-known labels, annotations and taints", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/finalscore-result: >-\n      {\"node-282x7\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"200\",\"TaintToleration\":\"300\",\"VolumeBinding\":\"0\"},\"node-gp9t4\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"200\",\"TaintToleration\":\"300\",\"VolumeBinding\":\"0\"}}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3664"}
{"instruction": "Write a yaml example for well-known labels, annotations and taints", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/prefilter-result-status: >-\n      {\"InterPodAffinity\":\"success\",\"NodeAffinity\":\"success\",\"NodePorts\":\"success\",\"NodeResourcesFit\":\"success\",\"PodTopologySpread\":\"success\",\"VolumeBinding\":\"success\",\"VolumeRestrictions\":\"success\"}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3665"}
{"instruction": "Write a yaml example for well-known labels, annotations and taints", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/prescore-result: >-\n      {\"InterPodAffinity\":\"success\",\"NodeAffinity\":\"success\",\"NodeNumber\":\"success\",\"PodTopologySpread\":\"success\",\"TaintToleration\":\"success\"}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3666"}
{"instruction": "Write a yaml example for well-known labels, annotations and taints", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/score-result: >-\n      {\"node-282x7\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"0\",\"TaintToleration\":\"0\",\"VolumeBinding\":\"0\"},\"node-gp9t4\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"0\",\"TaintToleration\":\"0\",\"VolumeBinding\":\"0\"}}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3667"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/default-container: \"front-end-app\"\n```\n\nWell-Known Labels, Annotations and Taints | The value of the annotation is the container name that is default for this Pod. For example, kubectl logs or kubectl exec without -c or --container flag will use this default container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3668"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/default-logs-container: \"front-end-app\"\n```\n\nWell-Known Labels, Annotations and Taints | The value of the annotation is the container name that is the default logging container for this Pod. For example, kubectl logs without -c or --container flag will use this default container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3669"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/default-container\n```\n\nWell-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3670"}
{"instruction": "Write a yaml example for well-known labels, annotations and taints", "response": "Here's a yaml example:\n\n```yaml\nkubectl.kubernetes.io/last-applied-configuration: >\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"example\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"matchLabels\":{\"app.kubernetes.io/name\":foo}},\"template\":{\"metadata\":{\"labels\":{\"app.kubernetes.io/name\":\"foo\"}},\"spec\":{\"containers\":[{\"image\":\"container-registry.example/foo-bar:1.42\",\"name\":\"foo-bar\",\"ports\":[{\"containerPort\":42}]}]}}}}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: all objects", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3671"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/restartedAt: \"2024-06-21T17:27:41Z\"\n```\n\nWell-Known Labels, Annotations and Taints | Used on: Deployment, ReplicaSet, StatefulSet, DaemonSet, Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3672"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart <RESOURCE>\n```\n\nWell-Known Labels, Annotations and Taints | You should not assume that this annotation represents the date / time of the most recent update; a separate change could have been made since the last manually triggered rollout.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3673"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile\n```\n\nWell-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3674"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <node-name> node.kubernetes.io/exclude-from-external-load-balancers=true\n```\n\nWell-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3675"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration: >\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"example\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"matchLabels\":{\"app.kubernetes.io/name\":foo}},\"template\":{\"metadata\":{\"labels\":{\"app.kubernetes.io/name\":\"foo\"}},\"spec\":{\"containers\":[{\"image\":\"container-registry.example/foo-bar:1.42\",\"name\":\"foo-bar\",\"ports\":[{\"containerPort\":42}]}]}}}}\n```\n\nWell-Known Labels, Annotations and Taints | Used on: all objects", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3676"}
{"instruction": "Write a bash example for well-known labels, annotations and taints", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes <node-name> node-role.kubernetes.io/control-plane:NoSchedule-\n```\n\nWell-Known Labels, Annotations and Taints | Type: Taint", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/labels-annotations-taints/", "id": "k8s_00314_code_3677"}
{"instruction": "What is the reference documentation for kubectl create service externalname?", "response": "kubectl create service externalnameSynopsisCreate an ExternalName service with the specified name.ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference services that exist off platform, on other clusters, or locally.kubectl create service externalname NAME --external-name external.name [--dry-run=server|client|none] Examples # Create a new ExternalName service named my-ns kubectl create service externalname my-ns --external-name bar.com Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--external-name stringExternal name of service--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for externalname-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--tcp stringsPort pairs can be specified as '<port>:<targetPort>'.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreat", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_externalname/", "id": "k8s_00315"}
{"instruction": "Write a bash example for kubectl create service externalname", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname NAME --external-name external.name [--dry-run=server|client|none]\n```\n\nkubectl create service externalname | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_externalname/", "id": "k8s_00315_code_3679"}
{"instruction": "Write a bash example for kubectl create service externalname", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname NAME --external-name external.name [--dry-run=server|client|none]\n```\n\nkubectl create service externalname | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_externalname/", "id": "k8s_00315_code_3680"}
{"instruction": "How do you upgrading windows nodes in Kubernetes?", "response": "Upgrading Windows nodesFEATURE STATE: Kubernetes v1.18 [beta]This page explains how to upgrade a Windows node created with kubeadm.Before you beginYou need to have shell access to all the nodes, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts.Your Kubernetes server must be at or later than version 1.17.To check the version, enter kubectl version.Familiarize yourself with the process for upgrading the rest of your kubeadm cluster. You will want to upgrade the control plane nodes before upgrading your Windows nodes.Upgrading worker nodesUpgrade kubeadmFrom the Windows node, upgrade kubeadm:# replace 1.34.0 with your desired version curl.exe -Lo <path-to-kubeadm.exe> \"https://dl.k8s.io/v1.34.0/bin/windows/amd64/kubeadm.exe\" Drain the nodeFrom a machine with access to the Kubernetes API, prepare the node for maintenance by marking it unschedulable and evicting the workloads:# replace <node-to-drain> with the name of your node you are draining kubectl drain <node-to-drain> --ignore-daemonsets You should see output similar to this:node/ip-172-31-85-18 cordoned node/ip-172-31-85-18 drained Upgrade the kubelet configurationFrom the Windows node, call the following command to sync new kubelet configuration:kubeadm upgrade node Upgrade kubelet and kube-proxyFrom the Windows node, upgrade and restart the kubelet:stop-service kubelet curl.exe -Lo <path-to-kubelet.exe> \"https://dl.k8s.io/v1.34.0/bin/windows/amd64/kubelet.exe\" restart-service kubelet From the Windows node, upgrade and restart the kube-proxy.stop-service kube-proxy curl.exe -Lo <path-to-kube-proxy.exe> \"https://dl.k8s.io/v1.34.0/bin/windows/amd64/kube-proxy.exe\" restart-service kube-proxy Note:If you are running kube-proxy in a HostProcess container within a Pod, and not as a Windows Service, you can upgrade kube-proxy by applying a newer version of your kube-proxy manifests.Uncordon the nodeFrom a machine with access to the Kubernetes API, bring the node back online by marking it schedulable:# replace <node-to-drain> with the name of your node kubectl uncordon <node-to-drain> What's nextSee how to Upgrade Linux nodes.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/upgrading-windows-nodes/", "id": "k8s_00316"}
{"instruction": "How do you kubernetes default service cidr reconfiguration in Kubernetes?", "response": "Kubernetes Default Service CIDR ReconfigurationFEATURE STATE: Kubernetes v1.33 [stable] (enabled by default: true)This document shares how to reconfigure the default Service IP range(s) assigned to a cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.33.To check the version, enter kubectl version.Kubernetes Default Service CIDR ReconfigurationThis document explains how to manage the Service IP address range within a Kubernetes cluster, which also influences the cluster's supported IP families for Services.The IP families available for Service ClusterIPs are determined by the --service-cluster-ip-range flag to kube-apiserver. For a better understanding of Service IP address allocation, refer to the Services IP address allocation tracking documentation.Since Kubernetes 1.33, the Service IP families configured for the cluster are reflected by the ServiceCIDR object named kubernetes. The kubernetes ServiceCIDR object is created by the first kube-apiserver instance that starts, based on its configured --service-cluster-ip-range flag. To ensure consistent cluster behavior, all kube-apiserver instances must be configured with the same --service-cluster-ip-range values, which must match the default kubernetes ServiceCIDR object.Kubernetes Service CIDR Reconfiguration CategoriesWe can categorize Service CIDR reconfiguration into the following scenarios:Extending the existing Service CIDRs: This can be done dynamically by adding new ServiceCIDR objects without the need of reconfiguration of the kube-apiserver. Please refer to the dedicated documentation on Extending Service IP Ranges.Single-to-dual-stack conversion preserving the primary service CIDR: This involves introducing a secondary IP family (IPv6 to an IPv4-only cluster, or IPv4 to an IPv6-only cluster) while keeping the original IP family as primary. This requires an update to the kube-apiserver configuration and a corresponding modification of various cluster components that need to handle this additional IP family. These components include, but are not limited to, kube-proxy, the CNI or network plugin, service mesh implementations, and DNS services.Dual-to-single conversion preserving the primary service CIDR: This involves removing the secondary IP family from a dual-stack cluster, reverting to a single IP family while retaining the original primary IP family. In addition to the reconfiguration of the components to match the new IP family, you might need to address Services that were explicitly configured to use the removed IP family.Anything that results in changing the primary service CIDR: Completely replacing the default ServiceCIDR is a complex operation. If the new ServiceCIDR does not overlap with the existing one, it will require renumbering all existing Services and changing the kubernetes.default service. The case where the primary IP family also changes is even more complicated, and may require to change multiple cluster components (kubelet, network plugins, etc.) to match the new primary IP family.Manual Operations for Replacing the Default Service CIDRReconfiguring the default Service CIDR necessitates manual steps performed by the cluster operator, administrator, or the software managing the cluster lifecycle. These typically include:Updating the kube-apiserver configuration: Modify the --service-cluster-ip-range flag with the new IP range(s).Reconfiguring the network components: This is a critical step and the specific procedure depends on the different networking components in use. It might involve updating confi", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/reconfigure-default-service-ip-ranges/", "id": "k8s_00317"}
{"instruction": "What is the reference documentation for serviceaccount?", "response": "ServiceAccountServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets.apiVersion: v1import \"k8s.io/api/core/v1\"ServiceAccountServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secretsapiVersion: v1kind: ServiceAccountmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataautomountServiceAccountToken (boolean)AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.imagePullSecrets ([]LocalObjectReference)Atomic: will be replaced during a mergeImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-podsecrets ([]ObjectReference)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeSecrets is a list of the secrets in the same namespace that pods running using this ServiceAccount are allowed to use. Pods are only limited to this list if this service account has a \"kubernetes.io/enforce-mountable-secrets\" annotation set to \"true\". The \"kubernetes.io/enforce-mountable-secrets\" annotation is deprecated since v1.32. Prefer separate namespaces to isolate access to mounted secrets. This field should not be used to find auto-generated service account token secrets for use outside of pods. Instead, tokens can be requested directly using the TokenRequest API, or service account token secrets can be manually created. More info: https://kubernetes.io/docs/concepts/configuration/secretServiceAccountListServiceAccountList is a list of ServiceAccount objectsapiVersion: v1kind: ServiceAccountListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems ([]ServiceAccount), requiredList of ServiceAccounts. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/Operationsget read the specified ServiceAccountHTTP RequestGET /api/v1/namespaces/{namespace}/serviceaccounts/{name}Parametersname (in path): string, requiredname of the ServiceAccountnamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (ServiceAccount): OK401: Unauthorizedlist list or watch objects of kind ServiceAccountHTTP RequestGET /api/v1/namespaces/{namespace}/serviceaccountsParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ServiceAccountList): OK401: Unauthorizedlist list or watch objects of kind ServiceAccountHTTP RequestGET /api/v1/serviceaccountsParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMat", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/service-account-v1/", "id": "k8s_00318"}
{"instruction": "What is the reference documentation for certificatesigningrequest?", "response": "CertificateSigningRequestCertificateSigningRequest objects provide a mechanism to obtain x509 certificates by submitting a certificate signing request, and having it asynchronously approved and issued.apiVersion: certificates.k8s.io/v1import \"k8s.io/api/certificates/v1\"CertificateSigningRequestCertificateSigningRequest objects provide a mechanism to obtain x509 certificates by submitting a certificate signing request, and having it asynchronously approved and issued.Kubelets use this API to obtain:client certificates to authenticate to kube-apiserver (with the \"kubernetes.io/kube-apiserver-client-kubelet\" signerName).serving certificates for TLS endpoints kube-apiserver can connect to securely (with the \"kubernetes.io/kubelet-serving\" signerName).This API can be used to request client certificates to authenticate to kube-apiserver (with the \"kubernetes.io/kube-apiserver-client\" signerName), or to obtain certificates from custom non-Kubernetes signers.apiVersion: certificates.k8s.io/v1kind: CertificateSigningRequestmetadata (ObjectMeta)spec (CertificateSigningRequestSpec), requiredspec contains the certificate request, and is immutable after creation. Only the request, signerName, expirationSeconds, and usages fields can be set on creation. Other fields are derived by Kubernetes and cannot be modified by users.status (CertificateSigningRequestStatus)status contains information about whether the request is approved or denied, and the certificate issued by the signer, or the failure condition indicating signer failure.CertificateSigningRequestSpecCertificateSigningRequestSpec contains the certificate request.request ([]byte), requiredAtomic: will be replaced during a mergerequest contains an x509 certificate signing request encoded in a \"CERTIFICATE REQUEST\" PEM block. When serialized as JSON or YAML, the data is additionally base64-encoded.signerName (string), requiredsignerName indicates the requested signer, and is a qualified name.List/watch requests for CertificateSigningRequests can filter on this field using a \"spec.signerName=NAME\" fieldSelector.Well-known Kubernetes signers are:\"kubernetes.io/kube-apiserver-client\": issues client certificates that can be used to authenticate to kube-apiserver. Requests for this signer are never auto-approved by kube-controller-manager, can be issued by the \"csrsigning\" controller in kube-controller-manager.\"kubernetes.io/kube-apiserver-client-kubelet\": issues client certificates that kubelets use to authenticate to kube-apiserver. Requests for this signer can be auto-approved by the \"csrapproving\" controller in kube-controller-manager, and can be issued by the \"csrsigning\" controller in kube-controller-manager.\"kubernetes.io/kubelet-serving\" issues serving certificates that kubelets use to serve TLS endpoints, which kube-apiserver can connect to securely. Requests for this signer are never auto-approved by kube-controller-manager, and can be issued by the \"csrsigning\" controller in kube-controller-manager.More details are available at https://k8s.io/docs/reference/access-authn-authz/certificate-signing-requests/#kubernetes-signersCustom signerNames can also be specified. The signer defines:Trust distribution: how trust (CA bundles) are distributed.Permitted subjects: and behavior when a disallowed subject is requested.Required, permitted, or forbidden x509 extensions in the request (including whether subjectAltNames are allowed, which types, restrictions on allowed values) and behavior when a disallowed extension is requested.Required, permitted, or forbidden key usages / extended key usages.Expiration/certificate lifetime: whether it is fixed by the signer, configurable by the admin.Whether or not requests for CA certificates are allowed.expirationSeconds (int32)expirationSeconds is the requested duration of validity of the issued certificate. The certificate signer may issue a certificate with a different validity duration so a client must check the delta between the notBefore and and ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/certificate-signing-request-v1/", "id": "k8s_00319"}
{"instruction": "Write a yaml example for certificatesigningrequest", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\n```\n\nCertificateSigningRequest | import \"k8s.io/api/certificates/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/certificate-signing-request-v1/", "id": "k8s_00319_code_3685"}
{"instruction": "How do you communicate between containers in the same pod using a shared volume in Kubernetes?", "response": "Communicate Between Containers in the Same Pod Using a Shared VolumeThis page shows how to use a Volume to communicate between two Containers running in the same Pod. See also how to allow processes to communicate by sharing process namespace between containers.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Creating a Pod that runs two ContainersIn this exercise, you create a Pod that runs two Containers. The two containers share a Volume that they can use to communicate. Here is the configuration file for the Pod:pods/two-container-pod.yaml apiVersion: v1 kind: Pod metadata: name: two-containers spec: restartPolicy: Never volumes: - name: shared-data emptyDir: {} containers: - name: nginx-container image: nginx volumeMounts: - name: shared-data mountPath: /usr/share/nginx/html - name: debian-container image: debian volumeMounts: - name: shared-data mountPath: /pod-data command: [\"/bin/sh\"] args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"] In the configuration file, you can see that the Pod has a Volume named shared-data.The first container listed in the configuration file runs an nginx server. The mount path for the shared Volume is /usr/share/nginx/html. The second container is based on the debian image, and has a mount path of /pod-data. The second container runs the following command and then terminates.echo Hello from the debian container > /pod-data/index.html Notice that the second container writes the index.html file in the root directory of the nginx server.Create the Pod and the two Containers:kubectl apply -f https://k8s.io/examples/pods/two-container-pod.yaml View information about the Pod and the Containers:kubectl get pod two-containers --output=yaml Here is a portion of the output:apiVersion: v1 kind: Pod metadata: ... name: two-containers namespace: default ... spec: ... containerStatuses: - containerID: docker://c1d8abd1 ... image: debian ... lastState: terminated: ... name: debian-container ... - containerID: docker://96c1ff2c5bb ... image: nginx ... name: nginx-container ... state: running: ... You can see that the debian Container has terminated, and the nginx Container is still running.Get a shell to nginx Container:kubectl exec -it two-containers -c nginx-container -- /bin/bash In your shell, verify that nginx is running:root@two-containers:/# apt-get update root@two-containers:/# apt-get install curl procps root@two-containers:/# ps aux The output is similar to this:USER PID ... STAT START TIME COMMAND root 1 ... Ss 21:12 0:00 nginx: master process nginx -g daemon off; Recall that the debian Container created the index.html file in the nginx root directory. Use curl to send a GET request to the nginx server:root@two-containers:/# curl localhost The output shows that nginx serves a web page written by the debian container:Hello from the debian container DiscussionThe primary reason that Pods can have multiple containers is to support helper applications that assist a primary application. Typical examples of helper applications are data pullers, data pushers, and proxies. Helper and primary applications often need to communicate with each other. Typically this is done through a shared filesystem, as shown in this exercise, or through the loopback network interface, localhost. An example of this pattern is a web server along with a helper program that polls a Git repository for new updates.The Volume in this exercise provides a way for Containers to communicate during the life of the Pod. If the Pod is deleted and recreated, any data stored in the shared", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320"}
{"instruction": "Write a yaml example for communicate between containers in the same pod using a shared volume", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3687"}
{"instruction": "Write a bash example for communicate between containers in the same pod using a shared volume", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/two-container-pod.yaml\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | View information about the Pod and the Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3688"}
{"instruction": "Write a bash example for communicate between containers in the same pod using a shared volume", "response": "Here's a bash example:\n\n```bash\nkubectl get pod two-containers --output=yaml\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | Here is a portion of the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3689"}
{"instruction": "Write a yaml example for communicate between containers in the same pod using a shared volume", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  ...\n  name: two-containers\n  namespace: default\n  ...\nspec:\n  ...\n  containerStatuses:\n\n  - containerID: docker://c1d8abd1 ...\n    image: debian\n    ...\n    lastState:\n      terminated:\n        ...\n    name: debian-container\n    ...\n\n  - containerID: docker://96c1ff2c5bb ...\n    image: nginx\n    ...\n    name: nginx-container\n    ...\n    state:\n      running:\n    ...\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | You can see that the debian Container has terminated, and the nginx Container is still running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3690"}
{"instruction": "Write a bash example for communicate between containers in the same pod using a shared volume", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it two-containers -c nginx-container -- /bin/bash\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | In your shell, verify that nginx is running:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3691"}
{"instruction": "Write a yaml example for communicate between containers in the same pod using a shared volume", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3692"}
{"instruction": "Write a bash example for communicate between containers in the same pod using a shared volume", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/two-container-pod.yaml\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | View information about the Pod and the Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3693"}
{"instruction": "Write a bash example for communicate between containers in the same pod using a shared volume", "response": "Here's a bash example:\n\n```bash\nkubectl get pod two-containers --output=yaml\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | Here is a portion of the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3694"}
{"instruction": "Write a yaml example for communicate between containers in the same pod using a shared volume", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  ...\n  name: two-containers\n  namespace: default\n  ...\nspec:\n  ...\n  containerStatuses:\n\n  - containerID: docker://c1d8abd1 ...\n    image: debian\n    ...\n    lastState:\n      terminated:\n        ...\n    name: debian-container\n    ...\n\n  - containerID: docker://96c1ff2c5bb ...\n    image: nginx\n    ...\n    name: nginx-container\n    ...\n    state:\n      running:\n    ...\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | You can see that the debian Container has terminated, and the nginx Container is still running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3695"}
{"instruction": "Write a bash example for communicate between containers in the same pod using a shared volume", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it two-containers -c nginx-container -- /bin/bash\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | In your shell, verify that nginx is running:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3696"}
{"instruction": "Write a yaml example for communicate between containers in the same pod using a shared volume", "response": "Here's a yaml example:\n\n```yaml\npods/two-container-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3697"}
{"instruction": "Write a yaml example for communicate between containers in the same pod using a shared volume", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\nCommunicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/", "id": "k8s_00320_code_3698"}
{"instruction": "What is the reference documentation for kubectl get?", "response": "kubectl getSynopsisDisplay one or many resources.Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results in the current namespace if you don't specify any namespace.By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resources.Use \"kubectl api-resources\" for a complete list of supported resources.kubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags] Examples # List all pods in ps output format kubectl get pods # List all pods in ps output format with more information (such as node name) kubectl get pods -o wide # List a single replication controller with specified NAME in ps output format kubectl get replicationcontroller web # List deployments in JSON output format, in the \"v1\" version of the \"apps\" API group kubectl get deployments.v1.apps -o json # List a single pod in JSON output format kubectl get -o json pod web-pod-13je7 # List a pod identified by type and name specified in \"pod.yaml\" in JSON output format kubectl get -f pod.yaml -o json # List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml kubectl get -k dir/ # Return only the phase value of the specified pod kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}} # List resource information in custom columns kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image # List all replication controllers and services together in ps output format kubectl get rc,services # List one or more resources by their type and names kubectl get rc/web service/frontend pods/web-pod-13je7 # List the 'status' subresource for a single pod kubectl get pod web-pod-13je7 --subresource status # List all deployments in namespace 'backend' kubectl get deployments.apps --namespace backend # List all pods existing in all namespaces kubectl get pods --all-namespaces Options-A, --all-namespacesIf present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--chunk-size int Default: 500Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for get--ignore-not-foundIf set to true, suppresses NotFound error for specific objects that do not exist. Using this flag with commands that query for collections of resources has no effect when no resources are found.-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-L, --label-columns stringsAccepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2...--no-headersWhen using the default or custom-column output format, don't print headers (default print headers).-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file, custom-columns, custom-columns-file, wide). See custom columns [https://kubernetes", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_get/", "id": "k8s_00321"}
{"instruction": "Write a bash example for kubectl get", "response": "Here's a bash example:\n\n```bash\nkubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]\n```\n\nkubectl get | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_get/", "id": "k8s_00321_code_3700"}
{"instruction": "Write a bash example for kubectl get", "response": "Here's a bash example:\n\n```bash\nkubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]\n```\n\nkubectl get | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_get/", "id": "k8s_00321_code_3701"}
{"instruction": "What is the reference documentation for kubernetes metrics (v1beta1)?", "response": "Kubernetes Metrics (v1beta1)Package v1beta1 is the v1beta1 version of the metrics API.Resource TypesNodeMetricsNodeMetricsListPodMetricsPodMetricsListNodeMetricsAppears in:NodeMetricsListNodeMetrics sets resource usage metrics of a node.FieldDescriptionapiVersionstringmetrics.k8s.io/v1beta1kindstringNodeMetricsmetadatameta/v1.ObjectMetaStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataRefer to the Kubernetes API documentation for the fields of the metadata field.timestamp [Required]meta/v1.TimeThe following fields define time interval from which metrics were collected from the interval [Timestamp-Window, Timestamp].window [Required]meta/v1.DurationNo description provided.usage [Required]core/v1.ResourceListThe memory usage is the memory working set.NodeMetricsListNodeMetricsList is a list of NodeMetrics.FieldDescriptionapiVersionstringmetrics.k8s.io/v1beta1kindstringNodeMetricsListmetadata [Required]meta/v1.ListMetaStandard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems [Required][]NodeMetricsList of node metrics.PodMetricsAppears in:PodMetricsListPodMetrics sets resource usage metrics of a pod.FieldDescriptionapiVersionstringmetrics.k8s.io/v1beta1kindstringPodMetricsmetadatameta/v1.ObjectMetaStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataRefer to the Kubernetes API documentation for the fields of the metadata field.timestamp [Required]meta/v1.TimeThe following fields define time interval from which metrics were collected from the interval [Timestamp-Window, Timestamp].window [Required]meta/v1.DurationNo description provided.containers [Required][]ContainerMetricsMetrics for all containers are collected within the same time window.PodMetricsListPodMetricsList is a list of PodMetrics.FieldDescriptionapiVersionstringmetrics.k8s.io/v1beta1kindstringPodMetricsListmetadata [Required]meta/v1.ListMetaStandard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems [Required][]PodMetricsList of pod metrics.ContainerMetricsAppears in:PodMetricsContainerMetrics sets resource usage metrics of a container.FieldDescriptionname [Required]stringContainer name corresponding to the one from pod.spec.containers.usage [Required]core/v1.ResourceListThe memory usage is the memory working set.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/external-api/metrics.v1beta1/", "id": "k8s_00322"}
{"instruction": "What is the reference documentation for kubectl set image?", "response": "kubectl set imageSynopsisUpdate existing container image(s) of resources.Possible resources include (case insensitive): pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs) kubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N Examples # Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox' kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1 # Update all deployments' and rc's nginx container's image to 'nginx:1.9.1' kubectl set image deployments,rc nginx=nginx:1.9.1 --all # Update image of all containers of daemonset abc to 'nginx:1.9.1' kubectl set image daemonset abc *=nginx:1.9.1 # Print result (in yaml format) of updating nginx container image from local file, without hitting the server kubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml Options--allSelect all resources, in the namespace of the specified resource types--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-set\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for image-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--localIf true, set image will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace s", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_image/", "id": "k8s_00323"}
{"instruction": "Write a bash example for kubectl set image", "response": "Here's a bash example:\n\n```bash\nkubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N\n```\n\nkubectl set image | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_image/", "id": "k8s_00323_code_3704"}
{"instruction": "Write a bash example for kubectl set image", "response": "Here's a bash example:\n\n```bash\nkubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N\n```\n\nkubectl set image | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_image/", "id": "k8s_00323_code_3705"}
{"instruction": "What is the reference documentation for kubectl usage conventions?", "response": "kubectl Usage ConventionsRecommended usage conventions for kubectl.Using kubectl in Reusable ScriptsFor a stable output in a script:Request one of the machine-oriented output forms, such as -o name, -o json, -o yaml, -o go-template, or -o jsonpath.Fully-qualify the version. For example, jobs.v1.batch/myjob. This will ensure that kubectl does not use its default version that can change over time.Don't rely on context, preferences, or other implicit states.SubresourcesYou can use the --subresource argument for kubectl subcommands such as get, patch, edit, apply and replace to fetch and update subresources for all resources that support them. In Kubernetes version 1.34, only the status, scale and resize subresources are supported.For kubectl edit, the scale subresource is not supported. If you use --subresource with kubectl edit and specify scale as the subresource, the command will error out.The API contract against a subresource is identical to a full resource. While updating the status subresource to a new value, keep in mind that the subresource could be potentially reconciled by a controller to a different value.Best Practiceskubectl runFor kubectl run to satisfy infrastructure as code:Tag the image with a version-specific tag and don't move that tag to a new version. For example, use :v1234, v1.2.3, r03062016-1-4, rather than :latest (For more information, see Best Practices for Configuration).Check in the script for an image that is heavily parameterized.Switch to configuration files checked into source control for features that are needed, but not expressible via kubectl run flags.You can use the --dry-run=client flag to preview the object that would be sent to your cluster, without really submitting it.kubectl applyYou can use kubectl apply to create or update resources. For more information about using kubectl apply to update resources, see Kubectl Book.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/conventions/", "id": "k8s_00324"}
{"instruction": "Explain the Kubernetes concept: Pod Topology Spread Constraints", "response": "Pod Topology Spread ConstraintsYou can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains. This can help to achieve high availability as well as efficient resource utilization.You can set cluster-level constraints as a default, or configure topology spread constraints for individual workloads.MotivationImagine that you have a cluster of up to twenty nodes, and you want to run a workload that automatically scales how many replicas it uses. There could be as few as two Pods or as many as fifteen. When there are only two Pods, you'd prefer not to have both of those Pods run on the same node: you would run the risk that a single node failure takes your workload offline.In addition to this basic usage, there are some advanced usage examples that enable your workloads to benefit on high availability and cluster utilization.As you scale up and run more Pods, a different concern becomes important. Imagine that you have three nodes running five Pods each. The nodes have enough capacity to run that many replicas; however, the clients that interact with this workload are split across three different datacenters (or infrastructure zones). Now you have less concern about a single node failure, but you notice that latency is higher than you'd like, and you are paying for network costs associated with sending network traffic between the different zones.You decide that under normal operation you'd prefer to have a similar number of replicas scheduled into each infrastructure zone, and you'd like the cluster to self-heal in the case that there is a problem.Pod topology spread constraints offer you a declarative way to configure that.topologySpreadConstraints fieldThe Pod API includes a field, spec.topologySpreadConstraints. The usage of this field looks like the following:--- apiVersion: v1 kind: Pod metadata: name: example-pod spec: # Configure a topology spread constraint topologySpreadConstraints: - maxSkew: <integer> minDomains: <integer> # optional topologyKey: <string> whenUnsatisfiable: <string> labelSelector: <object> matchLabelKeys: <list> # optional; beta since v1.27 nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26 nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26 ### other Pod fields go here You can read more about this field by running kubectl explain Pod.spec.topologySpreadConstraints or refer to the scheduling section of the API reference for Pod.Spread constraint definitionYou can define one or multiple topologySpreadConstraints entries to instruct the kube-scheduler how to place each incoming Pod in relation to the existing Pods across your cluster. Those fields are:maxSkew describes the degree to which Pods may be unevenly distributed. You must specify this field and the number must be greater than zero. Its semantics differ according to the value of whenUnsatisfiable:if you select whenUnsatisfiable: DoNotSchedule, then maxSkew defines the maximum permitted difference between the number of matching pods in the target topology and the global minimum (the minimum number of matching pods in an eligible domain or zero if the number of eligible domains is less than MinDomains). For example, if you have 3 zones with 2, 2 and 1 matching pods respectively, MaxSkew is set to 1 then the global minimum is 1.if you select whenUnsatisfiable: ScheduleAnyway, the scheduler gives higher precedence to topologies that would help reduce the skew.minDomains indicates a minimum number of eligible domains. This field is optional. A domain is a particular instance of a topology. An eligible domain is a domain whose nodes match the node selector.Note:Before Kubernetes v1.30, the minDomains field was only available if the MinDomainsInPodTopologySpread feature gate was enabled (default since v1.28). In older Kubernetes clusters it might be explicitly disabled or the field might not be available.The valu", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-pod\nspec:\n  # Configure a topology spread constraint\n  topologySpreadConstraints:\n    - maxSkew: <integer>\n      minDomains: <integer> # optional\n      topologyKey: <string>\n      whenUnsatisfiable: <string>\n      labelSelector: <object>\n      matchLabelKeys: <list> # optional; beta since v1.27\n      nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26\n      nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26\n  ### other Pod fields go here\n```\n\nPod Topology Spread Constraints | You can read more about this field by running kubectl explain Pod.spec.topologySpreadConstraints or refer to the scheduling section of the API reference for Pod.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3708"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3709"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3710"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3711"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints:\n            - maxSkew: 1\n              topologyKey: topology.kubernetes.io/zone\n              whenUnsatisfiable: ScheduleAnyway\n          defaultingType: List\n```\n\nPod Topology Spread Constraints | If you don't configure any cluster-level default constraints for pod topology spreading, then kube-scheduler acts as if you specified the following default topology constraints:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3712"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints: []\n          defaultingType: List\n```\n\nPod Topology Spread Constraints | In Kubernetes, inter-Pod affinity and anti-affinity control how Pods are scheduled in relation to one another - either more packed or more scattered.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3713"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-pod\nspec:\n  # Configure a topology spread constraint\n  topologySpreadConstraints:\n    - maxSkew: <integer>\n      minDomains: <integer> # optional\n      topologyKey: <string>\n      whenUnsatisfiable: <string>\n      labelSelector: <object>\n      matchLabelKeys: <list> # optional; beta since v1.27\n      nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26\n      nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26\n  ### other Pod fields go here\n```\n\nPod Topology Spread Constraints | You can read more about this field by running kubectl explain Pod.spec.topologySpreadConstraints or refer to the scheduling section of the API reference for Pod.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3714"}
{"instruction": "Write a bash example for pod topology spread constraints", "response": "Here's a bash example:\n\n```bash\nkubectl explain Pod.spec.topologySpreadConstraints\n```\n\nPod Topology Spread Constraints | You can define one or multiple topologySpreadConstraints entries to instruct the kube-scheduler how to place each incoming Pod in relation to the existing Pods across your cluster. Those fields are:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3715"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\ntopologySpreadConstraints:\n        - maxSkew: 1\n          topologyKey: kubernetes.io/hostname\n          whenUnsatisfiable: DoNotSchedule\n          labelSelector:\n            matchLabels:\n              app: foo\n          matchLabelKeys:\n            - pod-template-hash\n```\n\nPod Topology Spread Constraints | The matchLabelKeys field is a beta-level field and enabled by default in 1.27. You can disable it by disabling the MatchLabelKeysInPodTopologySpread feature gate.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3716"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nregion: us-east-1\n  zone: us-east-1a\n```\n\nPod Topology Spread Constraints | For brevity, this example doesn't use the well-known label keys topology.kubernetes.io/zone and topology.kubernetes.io/region. However, those registered label keys are nonetheless recommended rather t", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3717"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3718"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3719"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3720"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints:\n            - maxSkew: 1\n              topologyKey: topology.kubernetes.io/zone\n              whenUnsatisfiable: ScheduleAnyway\n          defaultingType: List\n```\n\nPod Topology Spread Constraints | If you don't configure any cluster-level default constraints for pod topology spreading, then kube-scheduler acts as if you specified the following default topology constraints:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3721"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\ndefaultConstraints:\n  - maxSkew: 3\n    topologyKey: \"kubernetes.io/hostname\"\n    whenUnsatisfiable: ScheduleAnyway\n  - maxSkew: 5\n    topologyKey: \"topology.kubernetes.io/zone\"\n    whenUnsatisfiable: ScheduleAnyway\n```\n\nPod Topology Spread Constraints | Also, the legacy SelectorSpread plugin, which provides an equivalent behavior, is disabled by default.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3722"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints: []\n          defaultingType: List\n```\n\nPod Topology Spread Constraints | In Kubernetes, inter-Pod affinity and anti-affinity control how Pods are scheduled in relation to one another - either more packed or more scattered.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3723"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-pod\nspec:\n  # Configure a topology spread constraint\n  topologySpreadConstraints:\n    - maxSkew: <integer>\n      minDomains: <integer> # optional\n      topologyKey: <string>\n      whenUnsatisfiable: <string>\n      labelSelector: <object>\n      matchLabelKeys: <list> # optional; beta since v1.27\n      nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26\n      nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26\n  ### other Pod fields go here\n```\n\nPod Topology Spread Constraints | You can read more about this field by running kubectl explain Pod.spec.topologySpreadConstraints or refer to the scheduling section of the API reference for Pod.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3724"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\npods/topology-spread-constraints/one-constraint.yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3725"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3726"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\npods/topology-spread-constraints/two-constraints.yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3727"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3728"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\npods/topology-spread-constraints/one-constraint-with-nodeaffinity.yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3729"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\nPod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3730"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints:\n            - maxSkew: 1\n              topologyKey: topology.kubernetes.io/zone\n              whenUnsatisfiable: ScheduleAnyway\n          defaultingType: List\n```\n\nPod Topology Spread Constraints | If you don't configure any cluster-level default constraints for pod topology spreading, then kube-scheduler acts as if you specified the following default topology constraints:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3731"}
{"instruction": "Write a yaml example for pod topology spread constraints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints: []\n          defaultingType: List\n```\n\nPod Topology Spread Constraints | In Kubernetes, inter-Pod affinity and anti-affinity control how Pods are scheduled in relation to one another - either more packed or more scattered.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/", "id": "k8s_00325_code_3732"}
{"instruction": "How do you romana for networkpolicy in Kubernetes?", "response": "Romana for NetworkPolicyThis page shows how to use Romana for NetworkPolicy.Before you beginComplete steps 1, 2, and 3 of the kubeadm getting started guide.Installing Romana with kubeadmFollow the containerized installation guide for kubeadm.Applying network policiesTo apply network policies use one of the following:Romana network policies.Example of Romana network policy.The NetworkPolicy API.What's nextOnce you have installed Romana, you can follow the Declare Network Policy to try out Kubernetes NetworkPolicy.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/romana-network-policy/", "id": "k8s_00326"}
{"instruction": "What is the reference documentation for deviceclass?", "response": "DeviceClassDeviceClass is a vendor- or admin-provided resource that contains device configuration and selectors.apiVersion: resource.k8s.io/v1import \"k8s.io/api/resource/v1\"DeviceClassDeviceClass is a vendor- or admin-provided resource that contains device configuration and selectors. It can be referenced in the device requests of a claim to apply these presets. Cluster scoped.This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.apiVersion: resource.k8s.io/v1kind: DeviceClassmetadata (ObjectMeta)Standard object metadataspec (DeviceClassSpec), requiredSpec defines what can be allocated and how to configure it.This is mutable. Consumers have to be prepared for classes changing at any time, either because they get updated or replaced. Claim allocations are done once based on whatever was set in classes at the time of allocation.Changing the spec automatically increments the metadata.generation number.DeviceClassSpecDeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it.config ([]DeviceClassConfiguration)Atomic: will be replaced during a mergeConfig defines configuration parameters that apply to each device that is claimed via this class. Some classes may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver.They are passed to the driver, but are not considered while allocating the claim.DeviceClassConfiguration is used in DeviceClass.config.opaque (OpaqueDeviceConfiguration)Opaque provides driver-specific configuration parameters.OpaqueDeviceConfiguration contains configuration parameters for a driver in a format defined by the driver vendor.config.opaque.driver (string), requiredDriver is used to determine which kubelet plugin needs to be passed these configuration parameters.An admission policy provided by the driver developer could use this to decide whether it needs to validate them.Must be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver.config.opaque.parameters (RawExtension), requiredParameters can contain arbitrary data. It is the responsibility of the driver developer to handle validation and versioning. Typically this includes self-identification and a version (\"kind\" + \"apiVersion\" for Kubernetes types), with conversion between different versions.The length of the raw data must be smaller or equal to 10 Ki.*RawExtension is used to hold extensions in external versions.To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.// Internal package:type MyAPIObject struct { runtime.TypeMeta json:\",inline\" MyPlugin runtime.Object json:\"myPlugin\" }type PluginA struct { AOption string json:\"aOption\" }// External package:type MyAPIObject struct { runtime.TypeMeta json:\",inline\" MyPlugin runtime.RawExtension json:\"myPlugin\" }type PluginA struct { AOption string json:\"aOption\" }// On the wire, the JSON will look something like this:{ \"kind\":\"MyAPIObject\", \"apiVersion\":\"v1\", \"myPlugin\": { \"kind\":\"PluginA\", \"aOption\":\"foo\", }, }So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)*extendedResourceName (string)ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/device-class-v1/", "id": "k8s_00327"}
{"instruction": "Write a yaml example for deviceclass", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\nDeviceClass | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/device-class-v1/", "id": "k8s_00327_code_3735"}
{"instruction": "Explain pr wranglers in Kubernetes", "response": "PR wranglersSIG Docs approvers take week-long shifts managing pull requests for the repository.This section covers the duties of a PR wrangler. For more information on giving good reviews, see Reviewing changes.DutiesEach day in a week-long shift as PR Wrangler:Review open pull requests for quality and adherence to the Style and Content guides.Start with the smallest PRs (size/XS) first, and end with the largest (size/XXL). Review as many PRs as you can.Make sure PR contributors sign the CLA.Use this script to remind contributors that haven't signed the CLA to do so.Provide", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/participate/pr-wranglers/", "id": "k8s_00328"}
{"instruction": "Explain the Kubernetes concept: Traces For Kubernetes System Components", "response": "Traces For Kubernetes System ComponentsFEATURE STATE: Kubernetes v1.27 [beta]System component traces record the latency of and relationships between operations in the cluster.Kubernetes components emit traces using the OpenTelemetry Protocol with the gRPC exporter and can be collected and routed to tracing backends using an OpenTelemetry Collector.Trace CollectionKubernetes components have built-in gRPC exporters for OTLP to export traces, either with an OpenTelemetry Collector, or without an OpenTelemetry Collector.For a complete guide to collecting traces and using the collector, see Getting Started with the OpenTelemetry Collector. However, there are a few things to note that are specific to Kubernetes components.By default, Kubernetes components export traces using the grpc exporter for OTLP on the IANA OpenTelemetry port, 4317. As an example, if the collector is running as a sidecar to a Kubernetes component, the following receiver configuration will collect spans and log them to standard output:receivers: otlp: protocols: grpc: exporters: # Replace this exporter with the exporter for your backend exporters: debug: verbosity: detailed service: pipelines: traces: receivers: [otlp] exporters: [debug] To directly emit traces to a backend without utilizing a collector, specify the endpoint field in the Kubernetes tracing configuration file with the desired trace backend address. This method negates the need for a collector and simplifies the overall structure.For trace backend header configuration, including authentication details, environment variables can be used with OTEL_EXPORTER_OTLP_HEADERS, see OTLP Exporter Configuration.Additionally, for trace resource attribute configuration such as Kubernetes cluster name, namespace, Pod name, etc., environment variables can also be used with OTEL_RESOURCE_ATTRIBUTES, see OTLP Kubernetes Resource.Component traceskube-apiserver tracesThe kube-apiserver generates spans for incoming HTTP requests, and for outgoing requests to webhooks, etcd, and re-entrant requests. It propagates the W3C Trace Context with outgoing requests but does not make use of the trace context attached to incoming requests, as the kube-apiserver is often a public endpoint.Enabling tracing in the kube-apiserverTo enable tracing, provide the kube-apiserver with a tracing configuration file with --tracing-config-file=<path-to-config>. This is an example config that records spans for 1 in 10000 requests, and uses the default OpenTelemetry endpoint:apiVersion: apiserver.config.k8s.io/v1 kind: TracingConfiguration # default value #endpoint: localhost:4317 samplingRatePerMillion: 100 For more information about the TracingConfiguration struct, see API server config API (v1).kubelet tracesFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)The kubelet CRI interface and authenticated http servers are instrumented to generate trace spans. As with the apiserver, the endpoint and sampling rate are configurable. Trace context propagation is also configured. A parent span's sampling decision is always respected. A provided tracing configuration sampling rate will apply to spans without a parent. Enabled without a configured endpoint, the default OpenTelemetry Collector receiver address of \"localhost:4317\" is set.Enabling tracing in the kubeletTo enable tracing, apply the tracing configuration. This is an example snippet of a kubelet config that records spans for 1 in 10000 requests, and uses the default OpenTelemetry endpoint:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration tracing: # default value #endpoint: localhost:4317 samplingRatePerMillion: 100 If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.The kubelet in Kubernetes v1.34 collects spans from the garbage collection, pod synchronization routine as well as every gRPC method. The kubelet propagates trace context with gRPC requests so that container runtimes with trace instrumenta", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329"}
{"instruction": "Write a yaml example for traces for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\nTraces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329_code_3738"}
{"instruction": "Write a yaml example for traces for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\nTraces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329_code_3739"}
{"instruction": "Write a yaml example for traces for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\nreceivers:\n  otlp:\n    protocols:\n      grpc:\nexporters:\n  # Replace this exporter with the exporter for your backend\n  exporters:\n    debug:\n      verbosity: detailed\nservice:\n  pipelines:\n    traces:\n      receivers: [otlp]\n      exporters: [debug]\n```\n\nTraces For Kubernetes System Components | To directly emit traces to a backend without utilizing a collector, specify the endpoint field in the Kubernetes tracing configuration file with the desired trace backend address. This method negates", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329_code_3740"}
{"instruction": "Write a yaml example for traces for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\nTraces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329_code_3741"}
{"instruction": "Write a yaml example for traces for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\nTraces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329_code_3742"}
{"instruction": "Write a yaml example for traces for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\nTraces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329_code_3743"}
{"instruction": "Write a yaml example for traces for kubernetes system components", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\nTraces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/system-traces/", "id": "k8s_00329_code_3744"}
{"instruction": "What is the reference documentation for kubectl plugin?", "response": "kubectl pluginSynopsisProvides utilities for interacting with plugins.Plugins provide extended functionality that is not part of the major command-line distribution. Please refer to the documentation and examples for more information about how write your own plugins.The easiest way to discover and install plugins is via the kubernetes sub-project krew: [krew.sigs.k8s.io]. To install krew, visit https://krew.sigs.k8s.io/docs/user-guide/setup/installkubectl plugin [flags] Examples # List all available plugins kubectl plugin list # List only binary names of available plugins without paths kubectl plugin list --name-only Options-h, --helphelp for pluginParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerkubectl plugin list - List all visible plugin executables on a user's PATHThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes pro", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_plugin/", "id": "k8s_00330"}
{"instruction": "Write a bash example for kubectl plugin", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags]\n```\n\nkubectl plugin | help for plugin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_plugin/", "id": "k8s_00330_code_3746"}
{"instruction": "Write a bash example for kubectl plugin", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags]\n```\n\nkubectl plugin | help for plugin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_plugin/", "id": "k8s_00330_code_3747"}
{"instruction": "Explain opening a pull request in Kubernetes", "response": "Opening a pull requestNote:Code developers: If you are documenting a new feature for an upcoming Kubernetes release, see Document a new feature.To contribute new content pages or improve existing content pages, open a pull request (PR). Make sure you follow all the requirements in the Before you begin section.If your change is small, or you're unfamiliar with git, read Changes using GitHub to learn how to edit a page.If your changes are large, read Work from a local fork to learn how to make changes locally on your computer.Changes using GitHubIf you're less experienced with git workflows, here's an easier method of opening a pull request. Figure 1 outlines the steps and the details follow.flowchart LR A([fa:fa-user NewContributor]) --- id1[(kubernetes/websiteGitHub)] subgraph tasks[Changes using GitHub] direction TB 0[ ] -.- 1[1.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/new-content/open-a-pr/", "id": "k8s_00331"}
{"instruction": "How do you expose pod information to containers through files in Kubernetes?", "response": "Expose Pod Information to Containers Through FilesThis page shows how a Pod can use a downwardAPI volume, to expose information about itself to containers running in the Pod. A downwardAPI volume can expose Pod fields and container fields.In Kubernetes, there are two ways to expose Pod and container fields to a running container:Environment variablesVolume files, as explained in this taskTogether, these two ways of exposing Pod and container fields are called the downward API.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesStore Pod fieldsIn this part of exercise, you create a Pod that has one container, and you project Pod-level fields into the running container as files. Here is the manifest for the Pod:pods/inject/dapi-volume.yaml apiVersion: v1 kind: Pod metadata: name: kubernetes-downwardapi-volume-example labels: zone: us-est-coast cluster: test-cluster1 rack: rack-22 annotations: build: two builder: john-doe spec: containers: - name: client-container image: registry.k8s.io/busybox:1.27.2 command: [\"sh\", \"-c\"] args: - while true; do if [[ -e /etc/podinfo/labels ]]; then echo -en '\\n\\n'; cat /etc/podinfo/labels; fi; if [[ -e /etc/podinfo/annotations ]]; then echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi; sleep 5; done; volumeMounts: - name: podinfo mountPath: /etc/podinfo volumes: - name: podinfo downwardAPI: items: - path: \"labels\" fieldRef: fieldPath: metadata.labels - path: \"annotations\" fieldRef: fieldPath: metadata.annotations In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.Look at the items array under downwardAPI. Each element of the array defines a downwardAPI volume. The first element specifies that the value of the Pod's metadata.labels field should be stored in a file named labels. The second element specifies that the value of the Pod's annotations field should be stored in a file named annotations.Note:The fields in this example are Pod fields. They are not fields of the container in the Pod.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume.yaml Verify that the container in the Pod is running:kubectl get pods View the container's logs:kubectl logs kubernetes-downwardapi-volume-example The output shows the contents of the labels file and the annotations file:cluster=\"test-cluster1\" rack=\"rack-22\" zone=\"us-est-coast\" build=\"two\" builder=\"john-doe\" Get a shell into the container that is running in your Pod:kubectl exec -it kubernetes-downwardapi-volume-example -- sh In your shell, view the labels file:/# cat /etc/podinfo/labels The output shows that all of the Pod's labels have been written to the labels file:cluster=\"test-cluster1\" rack=\"rack-22\" zone=\"us-est-coast\" Similarly, view the annotations file:/# cat /etc/podinfo/annotations View the files in the /etc/podinfo directory:/# ls -laR /etc/podinfo In the output, you can see that the labels and annotations files are in a temporary subdirectory: in this example, ..2982_06_02_21_47_53.299460680. In the /etc/podinfo directory, ..data is a symbolic link to the temporary subdirectory. Also in the /etc/podinfo directory, labels and annotations are symbolic links.drwxr-xr-x ... Feb 6 21:47 ..2982_06_02_21_47_53.299460680 lrwxrwxrwx ... Feb 6 21:47 ..data -> ..2982_06_02_21_47_53.299460680 lrwxrwxrwx ... Feb 6 21:47 annotations -> ..data/annotations lrwxrwxrwx ... Feb 6 21:47 labels -> ..data/labels /etc/..2982_06_02_21_47_53.299460680: total 8 -rw-r--r-- ... Feb 6 21:47 annotations -rw-r--r-- ... Feb 6 21:47 labels Using symbolic links enables dynamic atomic refresh of the meta", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3750"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume.yaml\n```\n\nExpose Pod Information to Containers Through Files | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3751"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl logs kubernetes-downwardapi-volume-example\n```\n\nExpose Pod Information to Containers Through Files | The output shows the contents of the labels file and the annotations file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3752"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example -- sh\n```\n\nExpose Pod Information to Containers Through Files | In your shell, view the labels file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3753"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3754"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume-resources.yaml\n```\n\nExpose Pod Information to Containers Through Files | Get a shell into the container that is running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3755"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example-2 -- sh\n```\n\nExpose Pod Information to Containers Through Files | In your shell, view the cpu_limit file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3756"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3757"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3758"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-volume.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3759"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3760"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume.yaml\n```\n\nExpose Pod Information to Containers Through Files | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3761"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl logs kubernetes-downwardapi-volume-example\n```\n\nExpose Pod Information to Containers Through Files | The output shows the contents of the labels file and the annotations file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3762"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example -- sh\n```\n\nExpose Pod Information to Containers Through Files | In your shell, view the labels file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3763"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-volume-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3764"}
{"instruction": "Write a yaml example for expose pod information to containers through files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\nExpose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3765"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume-resources.yaml\n```\n\nExpose Pod Information to Containers Through Files | Get a shell into the container that is running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3766"}
{"instruction": "Write a bash example for expose pod information to containers through files", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example-2 -- sh\n```\n\nExpose Pod Information to Containers Through Files | In your shell, view the cpu_limit file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/", "id": "k8s_00332_code_3767"}
{"instruction": "Explain the Kubernetes concept: Volume Snapshots", "response": "Volume SnapshotsIn Kubernetes, a VolumeSnapshot represents a snapshot of a volume on a storage system. This document assumes that you are already familiar with Kubernetes persistent volumes.IntroductionSimilar to how API resources PersistentVolume and PersistentVolumeClaim are used to provision volumes for users and administrators, VolumeSnapshotContent and VolumeSnapshot API resources are provided to create volume snapshots for users and administrators.A VolumeSnapshotContent is a snapshot taken from a volume in the cluster that has been provisioned by an administrator. It is a resource in the cluster just like a PersistentVolume is a cluster resource.A VolumeSnapshot is a request for snapshot of a volume by a user. It is similar to a PersistentVolumeClaim.VolumeSnapshotClass allows you to specify different attributes belonging to a VolumeSnapshot. These attributes may differ among snapshots taken from the same volume on the storage system and therefore cannot be expressed by using the same StorageClass of a PersistentVolumeClaim.Volume snapshots provide Kubernetes users with a standardized way to copy a volume's contents at a particular point in time without creating an entirely new volume. This functionality enables, for example, database administrators to backup databases before performing edit or delete modifications.Users need to be aware of the following when using this feature:API Objects VolumeSnapshot, VolumeSnapshotContent, and VolumeSnapshotClass are CRDs, not part of the core API.VolumeSnapshot support is only available for CSI drivers.As part of the deployment process of VolumeSnapshot, the Kubernetes team provides a snapshot controller to be deployed into the control plane, and a sidecar helper container called csi-snapshotter to be deployed together with the CSI driver. The snapshot controller watches VolumeSnapshot and VolumeSnapshotContent objects and is responsible for the creation and deletion of VolumeSnapshotContent object. The sidecar csi-snapshotter watches VolumeSnapshotContent objects and triggers CreateSnapshot and DeleteSnapshot operations against a CSI endpoint.There is also a validating webhook server which provides tightened validation on snapshot objects. This should be installed by the Kubernetes distros along with the snapshot controller and CRDs, not CSI drivers. It should be installed in all Kubernetes clusters that has the snapshot feature enabled.CSI drivers may or may not have implemented the volume snapshot functionality. The CSI drivers that have provided support for volume snapshot will likely use the csi-snapshotter. See CSI Driver documentation for details.The CRDs and snapshot controller installations are the responsibility of the Kubernetes distribution.For advanced use cases, such as creating group snapshots of multiple volumes, see the external CSI Volume Group Snapshot documentation.Lifecycle of a volume snapshot and volume snapshot contentVolumeSnapshotContents are resources in the cluster. VolumeSnapshots are requests for those resources. The interaction between VolumeSnapshotContents and VolumeSnapshots follow this lifecycle:Provisioning Volume SnapshotThere are two ways snapshots may be provisioned: pre-provisioned or dynamically provisioned.Pre-provisionedA cluster administrator creates a number of VolumeSnapshotContents. They carry the details of the real volume snapshot on the storage system which is available for use by cluster users. They exist in the Kubernetes API and are available for consumption.DynamicInstead of using a pre-existing snapshot, you can request that a snapshot to be dynamically taken from a PersistentVolumeClaim. The VolumeSnapshotClass specifies storage provider-specific parameters to use when taking a snapshot.BindingThe snapshot controller handles the binding of a VolumeSnapshot object with an appropriate VolumeSnapshotContent object, in both pre-provisioned and dynamically provisioned scenarios. The binding is a one-to-one mapping.In the case of p", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\nVolume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3769"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\nVolume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3770"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\nVolume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3771"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\nVolume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3772"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\nVolume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3773"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\nVolume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3774"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\nVolume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3775"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\nVolume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3776"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\nVolume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3777"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl get crd volumesnapshotcontent -o yaml\n```\n\nVolume Snapshots | If you want to allow users to create a PersistentVolumeClaim from an existing VolumeSnapshot, but with a different volume mode than the source, the annotation snapshot.storage.kubernetes.io/allow-volu", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3778"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\nVolume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3779"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\nVolume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3780"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\nVolume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3781"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\nVolume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3782"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\nVolume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3783"}
{"instruction": "Write a yaml example for volume snapshots", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\nVolume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volume-snapshots/", "id": "k8s_00333_code_3784"}
{"instruction": "Explain the Kubernetes concept: Policies", "response": "PoliciesManage security and best-practices with policies.Kubernetes policies are configurations that manage other configurations or runtime behaviors. Kubernetes offers various forms of policies, described below:Apply policies using API objectsSome API objects act as policies. Here are some examples:NetworkPolicies can be used to restrict ingress and egress traffic for a workload.LimitRanges manage resource allocation constraints across different object kinds.ResourceQuotas limit resource consumption for a namespace.Apply policies using admission controllersAn admission controller runs in the API server and can validate or mutate API requests. Some admission controllers act to apply policies. For example, the AlwaysPullImages admission controller modifies a new Pod to set the image pull policy to Always.Kubernetes has several built-in admission controllers that are configurable via the API server --enable-admission-plugins flag.Details on admission controllers, with the complete list of available admission controllers, are documented in a dedicated section:Admission ControllersApply policies using ValidatingAdmissionPolicyValidating admission policies allow configurable validation checks to be executed in the API server using the Common Expression Language (CEL). For example, a ValidatingAdmissionPolicy can be used to disallow use of the latest image tag.A ValidatingAdmissionPolicy operates on an API request and can be used to block, audit, and warn users about non-compliant configurations.Details on the ValidatingAdmissionPolicy API, with examples, are documented in a dedicated section:Validating Admission PolicyApply policies using dynamic admission controlDynamic admission controllers (or admission webhooks) run outside the API server as separate applications that register to receive webhooks requests to perform validation or mutation of API requests.Dynamic admission controllers can be used to apply policies on API requests and trigger other policy-based workflows. A dynamic admission controller can perform complex checks including those that require retrieval of other cluster resources and external data. For example, an image verification check can lookup data from OCI registries to validate the container image signatures and attestations.Details on dynamic admission control are documented in a dedicated section:Dynamic Admission ControlImplementationsNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Dynamic Admission Controllers that act as flexible policy engines are being developed in the Kubernetes ecosystem, such as:KubewardenKyvernoOPA GatekeeperPolarisApply policies using Kubelet configurationsKubernetes allows configuring the Kubelet on each worker node. Some Kubelet configurations act as policies:Process ID limits and reservations are used to limit and reserve allocatable PIDs.Node Resource Managers can manage compute, memory, and device resources for latency-critical and high-throughput workloads.Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/", "id": "k8s_00334"}
{"instruction": "Explain creating a cluster with kubeadm in Kubernetes", "response": "Creating a cluster with kubeadm Using kubeadm, you can create a minimum viable Kubernetes cluster that conforms to best practices. In fact, you can use kubeadm to set up a cluster that will pass the Kubernetes Conformance tests. kubeadm also supports other cluster lifecycle functions, such as bootstrap tokens and cluster upgrades.The kubeadm tool is good if you need:A simple way for you to try out Kubernetes, possibly for the first time.A way for existing users to automate setting up a cluster and test their application.A building block in other ecosystem and/or installer tools with a larger scope.You can install and use kubeadm on various machines: your laptop, a set of cloud servers, a Raspberry Pi, and more. Whether you're deploying into the cloud or on-premises, you can integrate kubeadm into provisioning systems such as Ansible or Terraform.Before you beginTo follow this guide, you need:One or more machines running a deb/rpm-compatible Linux OS; for example: Ubuntu or CentOS.2 GiB or more of RAM per machine--any less leaves little room for your apps.At least 2 CPUs on the machine that you use as a control-plane node.Full network connectivity among all machines in the cluster. You can use either a public or a private network.You also need to use a version of kubeadm that can deploy the version of Kubernetes that you want to use in your new cluster.Kubernetes' version and version skew support policy applies to kubeadm as well as to Kubernetes overall. Check that policy to learn about what versions of Kubernetes and kubeadm are supported. This page is written for Kubernetes v1.34.The kubeadm tool's overall feature state is General Availability (GA). Some sub-features are still under active development. The implementation of creating the cluster may change slightly as the tool evolves, but the overall implementation should be pretty stable.Note:Any commands under kubeadm alpha are, by definition, supported on an alpha level.ObjectivesInstall a single control-plane Kubernetes clusterInstall a Pod network on the cluster so that your Pods can talk to each otherInstructionsPreparing the hostsComponent installationInstall a container runtime and kubeadm on all the hosts. For detailed instructions and other prerequisites, see Installing kubeadm.Note:If you have already installed kubeadm, see the first two steps of the Upgrading Linux nodes document for instructions on how to upgrade kubeadm.When you upgrade, the kubelet restarts every few seconds as it waits in a crashloop for kubeadm to tell it what to do. This crashloop is expected and normal. After you initialize your control-plane, the kubelet runs normally.Network setupkubeadm similarly to other Kubernetes components tries to find a usable IP on the network interfaces associated with a default gateway on a host. Such an IP is then used for the advertising and/or listening performed by a component.To find out what this IP is on a Linux host you can use:ip route show # Look for a line starting with \"default via\" Note:If two or more default gateways are present on the host, a Kubernetes component will try to use the first one it encounters that has a suitable global unicast IP address. While making this choice, the exact ordering of gateways might vary between different operating systems and kernel versions.Kubernetes components do not accept custom network interface as an option, therefore a custom IP address must be passed as a flag to all components instances that need such a custom configuration.Note:If the host does not have a default gateway and if a custom IP address is not passed to a Kubernetes component, the component may exit with an error.To configure the API server advertise address for control plane nodes created with both init and join, the flag --apiserver-advertise-address can be used. Preferably, this option can be set in the kubeadm API as InitConfiguration.localAPIEndpoint and JoinConfiguration.controlPlane.localAPIEndpoint.For kubelets on all nodes, the --nod", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <add-on.yaml>\n```\n\nCreating a cluster with kubeadm | You can install only one Pod network per cluster.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3787"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes --all node-role.kubernetes.io/control-plane-\n```\n\nCreating a cluster with kubeadm | The output will look something like:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3788"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes --all node.kubernetes.io/exclude-from-external-load-balancers-\n```\n\nCreating a cluster with kubeadm | See Creating Highly Available Clusters with kubeadm for steps on creating a high availability kubeadm cluster by adding more control plane nodes.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3789"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node name> --delete-emptydir-data --force --ignore-daemonsets\n```\n\nCreating a cluster with kubeadm | Before removing the node, reset the state installed by kubeadm:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3790"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl delete node <node name>\n```\n\nCreating a cluster with kubeadm | If you wish to start over, run kubeadm init or kubeadm join with the appropriate arguments.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3791"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nmkdir -p $HOME/.kube\nsudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config\nsudo chown $(id -u):$(id -g) $HOME/.kube/config\n```\n\nCreating a cluster with kubeadm | Alternatively, if you are the root user, you can run:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3792"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nexport KUBECONFIG=/etc/kubernetes/admin.conf\n```\n\nCreating a cluster with kubeadm | The kubeconfig file admin.conf that kubeadm init generates contains a certificate with Subject: O = kubeadm:cluster-admins, CN = kubernetes-admin. The group kubeadm:cluster-admins is bound to the buil", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3793"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <add-on.yaml>\n```\n\nCreating a cluster with kubeadm | You can install only one Pod network per cluster.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3794"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces\n```\n\nCreating a cluster with kubeadm | If your network is not working or CoreDNS is not in the Running state, check out the troubleshooting guide for kubeadm.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3795"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes --all node-role.kubernetes.io/control-plane-\n```\n\nCreating a cluster with kubeadm | The output will look something like:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3796"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes --all node.kubernetes.io/exclude-from-external-load-balancers-\n```\n\nCreating a cluster with kubeadm | See Creating Highly Available Clusters with kubeadm for steps on creating a high availability kubeadm cluster by adding more control plane nodes.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3797"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nscp root@<control-plane-host>:/etc/kubernetes/admin.conf .\nkubectl --kubeconfig ./admin.conf get nodes\n```\n\nCreating a cluster with kubeadm | The example above assumes SSH access is enabled for root. If that is not the case, you can copy the admin.conf file to be accessible by some other user and scp using that other user instead.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3798"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl create (cluster)rolebinding\n```\n\nCreating a cluster with kubeadm | If you want to connect to the API Server from outside the cluster, you can use kubectl proxy:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3799"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nscp root@<control-plane-host>:/etc/kubernetes/admin.conf .\nkubectl --kubeconfig ./admin.conf proxy\n```\n\nCreating a cluster with kubeadm | You can now access the API Server locally at http://localhost:8001/api/v1", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3800"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster\n```\n\nCreating a cluster with kubeadm | However, if you want to deprovision your cluster more cleanly, you should first drain the node and make sure that the node is empty, then deconfigure the node.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3801"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node name> --delete-emptydir-data --force --ignore-daemonsets\n```\n\nCreating a cluster with kubeadm | Before removing the node, reset the state installed by kubeadm:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3802"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\niptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X\n```\n\nCreating a cluster with kubeadm | If you want to reset the IPVS tables, you must run the following command:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3803"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl delete node <node name>\n```\n\nCreating a cluster with kubeadm | If you wish to start over, run kubeadm init or kubeadm join with the appropriate arguments.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3804"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <add-on.yaml>\n```\n\nCreating a cluster with kubeadm | You can install only one Pod network per cluster.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3805"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes --all node-role.kubernetes.io/control-plane-\n```\n\nCreating a cluster with kubeadm | The output will look something like:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3806"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes --all node.kubernetes.io/exclude-from-external-load-balancers-\n```\n\nCreating a cluster with kubeadm | See Creating Highly Available Clusters with kubeadm for steps on creating a high availability kubeadm cluster by adding more control plane nodes.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3807"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node name> --delete-emptydir-data --force --ignore-daemonsets\n```\n\nCreating a cluster with kubeadm | Before removing the node, reset the state installed by kubeadm:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3808"}
{"instruction": "Write a bash example for creating a cluster with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl delete node <node name>\n```\n\nCreating a cluster with kubeadm | If you wish to start over, run kubeadm init or kubeadm join with the appropriate arguments.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/", "id": "k8s_00335_code_3809"}
{"instruction": "What is the reference documentation for kubectl attach?", "response": "kubectl attachSynopsisAttach to a process that is already running inside an existing container.kubectl attach (POD | TYPE/NAME) -c CONTAINER Examples # Get output from running pod mypod; use the 'kubectl.kubernetes.io/default-container' annotation # for selecting the container to be attached or the first container in the pod will be chosen kubectl attach mypod # Get output from ruby-container from pod mypod kubectl attach mypod -c ruby-container # Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client kubectl attach mypod -c ruby-container -i -t # Get output from the first pod of a replica set named nginx kubectl attach rs/nginx Options-c, --container stringContainer name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen-h, --helphelp for attach--pod-running-timeout duration Default: 1m0sThe length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running-q, --quietOnly print output from the remote session-i, --stdinPass stdin to the container-t, --ttyStdin is a TTYParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--vers", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_attach/", "id": "k8s_00336"}
{"instruction": "Write a bash example for kubectl attach", "response": "Here's a bash example:\n\n```bash\nkubectl attach (POD | TYPE/NAME) -c CONTAINER\n```\n\nkubectl attach | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_attach/", "id": "k8s_00336_code_3811"}
{"instruction": "Write a bash example for kubectl attach", "response": "Here's a bash example:\n\n```bash\nkubectl attach (POD | TYPE/NAME) -c CONTAINER\n```\n\nkubectl attach | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_attach/", "id": "k8s_00336_code_3812"}
{"instruction": "How do you configure pods and containers in Kubernetes?", "response": "Configure Pods and ContainersPerform common configuration tasks for Pods and containers.Assign Memory Resources to Containers and PodsAssign CPU Resources to Containers and PodsAssign Devices to Pods and ContainersAssign infrastructure resources to your Kubernetes workloads.Assign Pod-level CPU and memory resourcesConfigure GMSA for Windows Pods and containersResize CPU and Memory Resources assigned to ContainersConfigure RunAsUserName for Windows pods and containersCreate a Windows HostProcess PodConfigure Quality of Service for PodsAssign Extended Resources to a ContainerConfigure a Pod to Use a Volume for StorageConfigure a Pod to Use a PersistentVolume for StorageConfigure a Pod to Use a Projected Volume for StorageConfigure a Security Context for a Pod or ContainerConfigure Service Accounts for PodsPull an Image from a Private RegistryConfigure Liveness, Readiness and Startup ProbesAssign Pods to NodesAssign Pods to Nodes using Node AffinityConfigure Pod InitializationAttach Handlers to Container Lifecycle EventsConfigure a Pod to Use a ConfigMapShare Process Namespace between Containers in a PodUse a User Namespace With a PodUse an Image Volume With a PodCreate static PodsTranslate a Docker Compose File to Kubernetes ResourcesEnforce Pod Security Standards by Configuring the Built-in Admission ControllerEnforce Pod Security Standards with Namespace LabelsMigrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/", "id": "k8s_00337"}
{"instruction": "How do you handling retriable and non-retriable pod failures with pod failure policy in Kubernetes?", "response": "Handling retriable and non-retriable pod failures with Pod failure policyFEATURE STATE: Kubernetes v1.31 [stable] (enabled by default: true)This document shows you how to use the Pod failure policy, in combination with the default Pod backoff failure policy, to improve the control over the handling of container- or Pod-level failure within a Job.The definition of Pod failure policy may help you to:better utilize the computational resources by avoiding unnecessary Pod retries.avoid Job failures due to Pod disruptions (such preemption, API-initiated eviction or taint-based eviction).Before you beginYou should already be familiar with the basic use of Job.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.25.To check the version, enter kubectl version.Usage scenariosConsider the following usage scenarios for Jobs that define a Pod failure policy :Avoiding unnecessary Pod retriesIgnoring Pod disruptionsAvoiding unnecessary Pod retries based on custom Pod ConditionsAvoiding unnecessary Pod retries per indexUsing Pod failure policy to avoid unnecessary Pod retriesWith the following example, you can learn how to use Pod failure policy to avoid unnecessary Pod restarts when a Pod failure indicates a non-retriable software bug.Examine the following manifest:/controllers/job-pod-failure-policy-failjob.yaml apiVersion: batch/v1 kind: Job metadata: name: job-pod-failure-policy-failjob spec: completions: 8 parallelism: 2 template: spec: restartPolicy: Never containers: - name: main image: docker.io/library/bash:5 command: [\"bash\"] args: - -c - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42 backoffLimit: 6 podFailurePolicy: rules: - action: FailJob onExitCodes: containerName: main operator: In values: [42] Apply the manifest:kubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-failjob.yaml After around 30 seconds the entire Job should be terminated. Inspect the status of the Job by running:kubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml In the Job status, the following conditions display:FailureTarget condition: has a reason field set to PodFailurePolicy and a message field with more information about the termination, like Container main for pod default/job-pod-failure-policy-failjob-8ckj8 failed with exit code 42 matching FailJob rule at index 0. The Job controller adds this condition as soon as the Job is considered a failure. For details, see Termination of Job Pods.Failed condition: same reason and message as the FailureTarget condition. The Job controller adds this condition after all of the Job's Pods are terminated.For comparison, if the Pod failure policy was disabled it would take 6 retries of the Pod, taking at least 2 minutes.Clean upDelete the Job you created:kubectl delete jobs/job-pod-failure-policy-failjob The cluster automatically cleans up the Pods.Using Pod failure policy to ignore Pod disruptionsWith the following example, you can learn how to use Pod failure policy to ignore Pod disruptions from incrementing the Pod retry counter towards the .spec.backoffLimit limit.Caution:Timing is important for this example, so you may want to read the steps before execution. In order to trigger a Pod disruption it is important to drain the node while the Pod is running on it (within 90s since the Pod is scheduled).Examine the following manifest:/controllers/job-pod-failure-policy-ignore.yaml apiVersion: batch/v1 kind: Job metadata: name: job-pod-failure-policy-ignore spec: completions: 4 parallelism: 2 template: spec: ", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3815"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-failjob.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | After around 30 seconds the entire Job should be terminated. Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3816"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | In the Job status, the following conditions display:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3817"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-failjob\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3818"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3819"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-ignore.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Run this command to check the nodeName the Pod is scheduled to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3820"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl drain nodes/$nodeName --ignore-daemonsets --grace-period=0\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Inspect the .status.failed to check the counter for the Job is not incremented:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3821"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-ignore -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Uncordon the node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3822"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon nodes/$nodeName\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The Job resumes and succeeds.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3823"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-ignore\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3824"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3825"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-config-issue.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Note that, the image is misconfigured, as it does not exist.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3826"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3827"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod $podName --subresource=status --patch-file=patch.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | If applied successfully, you will get a notification like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3828"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods/$podName\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3829"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see a job Failed condition with the field reason equal PodFailurePolicy. Additionally, the message field contains a more detailed information about the Job termination, such as: Pod", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3830"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-config-issue\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3831"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3832"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-backoff-limit-per-index-failindex.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | After around 15 seconds, inspect the status of the Pods for the Job. You can do that by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3833"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3834"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see that the failedIndexes field shows \"0,1\", because both indexes failed. Because the index 1 was not retried the number of failed Pods, indicated by the status field \"failed\" equa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3835"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-backoff-limit-per-index-failindex\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3836"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3837"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3838"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3839"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\ncontainerStatuses:\n- image: non-existing-repo/non-existing-image:example\n   ...\n   state:\n   waiting:\n      message: Back-off pulling image \"non-existing-repo/non-existing-image:example\"\n      reason: ImagePullBackOff\n      ...\nphase: Pending\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Note that the pod remains in the Pending phase as it fails to pull the misconfigured image. This, in principle, could be a transient issue and the image could get pulled. However, in this case, the im", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3840"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3841"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-failjob.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3842"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3843"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-failjob.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | After around 30 seconds the entire Job should be terminated. Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3844"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | In the Job status, the following conditions display:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3845"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-failjob\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3846"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-ignore.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3847"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3848"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-ignore.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Run this command to check the nodeName the Pod is scheduled to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3849"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl drain nodes/$nodeName --ignore-daemonsets --grace-period=0\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Inspect the .status.failed to check the counter for the Job is not incremented:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3850"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-ignore -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Uncordon the node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3851"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon nodes/$nodeName\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The Job resumes and succeeds.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3852"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-ignore\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3853"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-config-issue.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3854"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3855"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-config-issue.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Note that, the image is misconfigured, as it does not exist.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3856"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3857"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod $podName --subresource=status --patch-file=patch.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | If applied successfully, you will get a notification like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3858"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods/$podName\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3859"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see a job Failed condition with the field reason equal PodFailurePolicy. Additionally, the message field contains a more detailed information about the Job termination, such as: Pod", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3860"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-config-issue\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3861"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-backoff-limit-per-index-failindex.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3862"}
{"instruction": "Write a yaml example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3863"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-backoff-limit-per-index-failindex.yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | After around 15 seconds, inspect the status of the Pods for the Job. You can do that by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3864"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3865"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see that the failedIndexes field shows \"0,1\", because both indexes failed. Because the index 1 was not retried the number of failed Pods, indicated by the status field \"failed\" equa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3866"}
{"instruction": "Write a bash example for handling retriable and non-retriable pod failures with pod failure policy", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-backoff-limit-per-index-failindex\n```\n\nHandling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/job/pod-failure-policy/", "id": "k8s_00338_code_3867"}
{"instruction": "What is the reference documentation for authenticating with bootstrap tokens?", "response": "Authenticating with Bootstrap TokensFEATURE STATE: Kubernetes v1.18 [stable]Bootstrap tokens are a simple bearer token that is meant to be used when creating new clusters or joining new nodes to an existing cluster. It was built to support kubeadm, but can be used in other contexts for users that wish to start clusters without kubeadm. It is also built to work, via RBAC policy, with the kubelet TLS Bootstrapping system.Bootstrap Tokens OverviewBootstrap Tokens are defined with a specific type (bootstrap.kubernetes.io/token) of secrets that lives in the kube-system namespace. These Secrets are then read by the Bootstrap Authenticator in the API Server. Expired tokens are removed with the TokenCleaner controller in the Controller Manager. The tokens are also used to create a signature for a specific ConfigMap used in a \"discovery\" process through a BootstrapSigner controller.Token FormatBootstrap Tokens take the form of abcdef.0123456789abcdef. More formally, they must match the regular expression [a-z0-9]{6}\\.[a-z0-9]{16}.The first part of the token is the \"Token ID\" and is considered public information. It is used when referring to a token without leaking the secret part used for authentication. The second part is the \"Token Secret\" and should only be shared with trusted parties.Enabling Bootstrap Token AuthenticationThe Bootstrap Token authenticator can be enabled using the following flag on the API server:--enable-bootstrap-token-auth When enabled, bootstrapping tokens can be used as bearer token credentials to authenticate requests against the API server.Authorization: Bearer 07401b.f395accd246ae52d Tokens authenticate as the username system:bootstrap:<token id> and are members of the group system:bootstrappers. Additional groups may be specified in the token's Secret.Expired tokens can be deleted automatically by enabling the tokencleaner controller on the controller manager.--controllers=*,tokencleaner Bootstrap Token Secret FormatEach valid token is backed by a secret in the kube-system namespace. You can find the full design doc here.Here is what the secret looks like.apiVersion: v1 kind: Secret metadata: # Name MUST be of form \"bootstrap-token-<token id>\" name: bootstrap-token-07401b namespace: kube-system # Type MUST be 'bootstrap.kubernetes.io/token' type: bootstrap.kubernetes.io/token stringData: # Human readable description. Optional. description: \"The default bootstrap token generated by 'kubeadm init'.\" # Token ID and secret. Required. token-id: 07401b token-secret: f395accd246ae52d # Expiration. Optional. expiration: 2017-03-10T03:22:11Z # Allowed usages. usage-bootstrap-authentication: \"true\" usage-bootstrap-signing: \"true\" # Extra groups to authenticate the token as. Must start with \"system:bootstrappers:\" auth-extra-groups: system:bootstrappers:worker,system:bootstrappers:ingress The type of the secret must be bootstrap.kubernetes.io/token and the name must be bootstrap-token-<token id>. It must also exist in the kube-system namespace.The usage-bootstrap-* members indicate what this secret is intended to be used for. A value must be set to true to be enabled.usage-bootstrap-authentication indicates that the token can be used to authenticate to the API server as a bearer token.usage-bootstrap-signing indicates that the token may be used to sign the cluster-info ConfigMap as described below.The expiration field controls the expiry of the token. Expired tokens are rejected when used for authentication and ignored during ConfigMap signing. The expiry value is encoded as an absolute UTC time using RFC3339. Enable the tokencleaner controller to automatically delete expired tokens.Token Management with kubeadmYou can use the kubeadm tool to manage tokens on a running cluster. See the kubeadm token docs for details.ConfigMap SigningIn addition to authentication, the tokens can be used to sign a ConfigMap. This is used early in a cluster bootstrap process before the client trusts the API server. The signed ConfigMap c", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/bootstrap-tokens/", "id": "k8s_00339"}
{"instruction": "Write a yaml example for authenticating with bootstrap tokens", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Name MUST be of form \"bootstrap-token-<token id>\"\n  name: bootstrap-token-07401b\n  namespace: kube-system\n\n# Type MUST be 'bootstrap.kubernetes.io/token'\ntype: bootstrap.kubernetes.io/token\nstringData:\n  # Human readable description. Optional.\n  description: \"The default bootstrap token generated by 'kubeadm init'.\"\n\n  # Token ID and secret. Required.\n  token-id: 07401b\n  token-secret: f395accd246ae52d\n\n  # Expiration. Optional.\n  expiration: 2017-03-10T03:22:11Z\n\n  # Allowed usages.\n  usage-bootstrap-authentication: \"true\"\n  usage-bootstrap-signing: \"true\"\n\n  # Extra groups to authenticate the token as. Must start with \"system:bootstrappers:\"\n  auth-extra-groups: system:bootstrappers:worker,system:bootstrappers:ingress\n```\n\nAuthenticating with Bootstrap Tokens | The type of the secret must be bootstrap.kubernetes.io/token and the name must be bootstrap-token-<token id>. It must also exist in the kube-system namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/bootstrap-tokens/", "id": "k8s_00339_code_3869"}
{"instruction": "Write a yaml example for authenticating with bootstrap tokens", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cluster-info\n  namespace: kube-public\ndata:\n  jws-kubeconfig-07401b: eyJhbGciOiJIUzI1NiIsImtpZCI6IjA3NDAxYiJ9..tYEfbo6zDNo40MQE07aZcQX2m3EB2rO3NuXtxVMYm9U\n  kubeconfig: |\n    apiVersion: v1\n    clusters:\n    - cluster:\n        certificate-authority-data: <really long certificate data>\n        server: https://10.138.0.2:6443\n      name: \"\"\n    contexts: []\n    current-context: \"\"\n    kind: Config\n    preferences: {}\n    users: []\n```\n\nAuthenticating with Bootstrap Tokens | The kubeconfig member of the ConfigMap is a config file with only the cluster information filled out. The key thing being communicated here is the certificate-authority-data. This may be expanded in t", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/bootstrap-tokens/", "id": "k8s_00339_code_3870"}
{"instruction": "Write a yaml example for authenticating with bootstrap tokens", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Name MUST be of form \"bootstrap-token-<token id>\"\n  name: bootstrap-token-07401b\n  namespace: kube-system\n\n# Type MUST be 'bootstrap.kubernetes.io/token'\ntype: bootstrap.kubernetes.io/token\nstringData:\n  # Human readable description. Optional.\n  description: \"The default bootstrap token generated by 'kubeadm init'.\"\n\n  # Token ID and secret. Required.\n  token-id: 07401b\n  token-secret: f395accd246ae52d\n\n  # Expiration. Optional.\n  expiration: 2017-03-10T03:22:11Z\n\n  # Allowed usages.\n  usage-bootstrap-authentication: \"true\"\n  usage-bootstrap-signing: \"true\"\n\n  # Extra groups to authenticate the token as. Must start with \"system:bootstrappers:\"\n  auth-extra-groups: system:bootstrappers:worker,system:bootstrappers:ingress\n```\n\nAuthenticating with Bootstrap Tokens | The type of the secret must be bootstrap.kubernetes.io/token and the name must be bootstrap-token-<token id>. It must also exist in the kube-system namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/bootstrap-tokens/", "id": "k8s_00339_code_3871"}
{"instruction": "Write a yaml example for authenticating with bootstrap tokens", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cluster-info\n  namespace: kube-public\ndata:\n  jws-kubeconfig-07401b: eyJhbGciOiJIUzI1NiIsImtpZCI6IjA3NDAxYiJ9..tYEfbo6zDNo40MQE07aZcQX2m3EB2rO3NuXtxVMYm9U\n  kubeconfig: |\n    apiVersion: v1\n    clusters:\n    - cluster:\n        certificate-authority-data: <really long certificate data>\n        server: https://10.138.0.2:6443\n      name: \"\"\n    contexts: []\n    current-context: \"\"\n    kind: Config\n    preferences: {}\n    users: []\n```\n\nAuthenticating with Bootstrap Tokens | The kubeconfig member of the ConfigMap is a config file with only the cluster information filled out. The key thing being communicated here is the certificate-authority-data. This may be expanded in t", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/bootstrap-tokens/", "id": "k8s_00339_code_3872"}
{"instruction": "Write a yaml example for authenticating with bootstrap tokens", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Name MUST be of form \"bootstrap-token-<token id>\"\n  name: bootstrap-token-07401b\n  namespace: kube-system\n\n# Type MUST be 'bootstrap.kubernetes.io/token'\ntype: bootstrap.kubernetes.io/token\nstringData:\n  # Human readable description. Optional.\n  description: \"The default bootstrap token generated by 'kubeadm init'.\"\n\n  # Token ID and secret. Required.\n  token-id: 07401b\n  token-secret: f395accd246ae52d\n\n  # Expiration. Optional.\n  expiration: 2017-03-10T03:22:11Z\n\n  # Allowed usages.\n  usage-bootstrap-authentication: \"true\"\n  usage-bootstrap-signing: \"true\"\n\n  # Extra groups to authenticate the token as. Must start with \"system:bootstrappers:\"\n  auth-extra-groups: system:bootstrappers:worker,system:bootstrappers:ingress\n```\n\nAuthenticating with Bootstrap Tokens | The type of the secret must be bootstrap.kubernetes.io/token and the name must be bootstrap-token-<token id>. It must also exist in the kube-system namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/bootstrap-tokens/", "id": "k8s_00339_code_3873"}
{"instruction": "Write a yaml example for authenticating with bootstrap tokens", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cluster-info\n  namespace: kube-public\ndata:\n  jws-kubeconfig-07401b: eyJhbGciOiJIUzI1NiIsImtpZCI6IjA3NDAxYiJ9..tYEfbo6zDNo40MQE07aZcQX2m3EB2rO3NuXtxVMYm9U\n  kubeconfig: |\n    apiVersion: v1\n    clusters:\n    - cluster:\n        certificate-authority-data: <really long certificate data>\n        server: https://10.138.0.2:6443\n      name: \"\"\n    contexts: []\n    current-context: \"\"\n    kind: Config\n    preferences: {}\n    users: []\n```\n\nAuthenticating with Bootstrap Tokens | The kubeconfig member of the ConfigMap is a config file with only the cluster information filled out. The key thing being communicated here is the certificate-authority-data. This may be expanded in t", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/bootstrap-tokens/", "id": "k8s_00339_code_3874"}
{"instruction": "Explain enforcing pod security standards in Kubernetes", "response": "Enforcing Pod Security StandardsThis page provides an overview of best practices when it comes to enforcing Pod Security Standards.Using the built-in Pod Security Admission ControllerFEATURE STATE: Kubernetes v1.25 [stable]The Pod Security Admission Controller intends to replace the deprecated PodSecurityPolicies.Configure all cluster namespacesNamespaces that lack any configuration at all should be considered significant gaps in your cluster security model. We recommend taking the time to analyze the types of workloads occurring in each namespace, and by referencing the Pod Security Standards, decide on an appropriate level for each of them. Unlabeled namespaces should only indicate that they've yet to be evaluated.In the scenario that all workloads in all namespaces have the same security requirements, we provide an example that illustrates how the PodSecurity labels can be applied in bulk.Embrace the principle of least privilegeIn an ideal world, every pod in every namespace would meet the requirements of the restricted policy. However, this is not possible nor practical, as some workloads will require elevated privileges for legitimate reasons.Namespaces allowing privileged workloads should establish and enforce appropriate access controls.For workloads running in those permissive namespaces, maintain documentation about their unique security requirements. If at all possible, consider how those requirements could be further constrained.Adopt a multi-mode strategyThe audit and warn modes of the Pod Security Standards admission controller make it easy to collect important security insights about your pods without breaking existing workloads.It is good practice to enable these modes for all namespaces, setting them to the desired level and version you would eventually like to enforce. The warnings and audit annotations generated in this phase can guide you toward that state. If you expect workload authors to make changes to fit within the desired level, enable the warn mode. If you expect to use audit logs to monitor/drive changes to fit within the desired level, enable the audit mode.When you have the enforce mode set to your desired value, these modes can still be useful in a few different ways:By setting warn to the same level as enforce, clients will receive warnings when attempting to create Pods (or resources that have Pod templates) that do not pass validation. This will help them update those resources to become compliant.In Namespaces that pin enforce to a specific non-latest version, setting the audit and warn modes to the same level as enforce, but to the latest version, gives visibility into settings that were allowed by previous versions but are not allowed per current best practices.Third-party alternativesNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Other alternatives for enforcing security profiles are being developed in the Kubernetes ecosystem:Kubewarden.Kyverno.OPA Gatekeeper.The decision to go with a built-in solution (e.g. PodSecurity admission controller) versus a third-party tool is entirely dependent on your own situation. When evaluating any solution, trust of your supply chain is crucial. Ultimately, using any of the aforementioned approaches will be better than doing nothing.Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/best-practices/enforcing-pod-security-standards/", "id": "k8s_00340"}
{"instruction": "Explain the Kubernetes concept: Admission Webhook Good Practices", "response": "Admission Webhook Good PracticesRecommendations for designing and deploying admission webhooks in Kubernetes.This page provides good practices and considerations when designing admission webhooks in Kubernetes. This information is intended for cluster operators who run admission webhook servers or third-party applications that modify or validate your API requests.Before reading this page, ensure that you're familiar with the following concepts:Admission controllersAdmission webhooksImportance of good webhook designAdmission control occurs when any create, update, or delete request is sent to the Kubernetes API. Admission controllers intercept requests that match specific criteria that you define. These requests are then sent to mutating admission webhooks or validating admission webhooks. These webhooks are often written to ensure that specific fields in object specifications exist or have specific allowed values.Webhooks are a powerful mechanism to extend the Kubernetes API. Badly-designed webhooks often result in workload disruptions because of how much control the webhooks have over objects in the cluster. Like other API extension mechanisms, webhooks are challenging to test at scale for compatibility with all of your workloads, other webhooks, add-ons, and plugins.Additionally, with every release, Kubernetes adds or modifies the API with new features, feature promotions to beta or stable status, and deprecations. Even stable Kubernetes APIs are likely to change. For example, the Pod API changed in v1.29 to add the Sidecar containers feature. While it's rare for a Kubernetes object to enter a broken state because of a new Kubernetes API, webhooks that worked as expected with earlier versions of an API might not be able to reconcile more recent changes to that API. This can result in unexpected behavior after you upgrade your clusters to newer versions.This page describes common webhook failure scenarios and how to avoid them by cautiously and thoughtfully designing and implementing your webhooks.Identify whether you use admission webhooksEven if you don't run your own admission webhooks, some third-party applications that you run in your clusters might use mutating or validating admission webhooks.To check whether your cluster has any mutating admission webhooks, run the following command:kubectl get mutatingwebhookconfigurations The output lists any mutating admission controllers in the cluster.To check whether your cluster has any validating admission webhooks, run the following command:kubectl get validatingwebhookconfigurations The output lists any validating admission controllers in the cluster.Choose an admission control mechanismKubernetes includes multiple admission control and policy enforcement options. Knowing when to use a specific option can help you to improve latency and performance, reduce management overhead, and avoid issues during version upgrades. The following table describes the mechanisms that let you mutate or validate resources during admission:Mutating and validating admission control in KubernetesMechanismDescriptionUse casesMutating admission webhookIntercept API requests before admission and modify as needed using custom logic.Make critical modifications that must happen before resource admission.Make complex modifications that require advanced logic, like calling external APIs.Mutating admission policyIntercept API requests before admission and modify as needed using Common Expression Language (CEL) expressions.Make critical modifications that must happen before resource admission.Make simple modifications, such as adjusting labels or replica counts.Validating admission webhookIntercept API requests before admission and validate against complex policy declarations.Validate critical configurations before resource admission.Enforce complex policy logic before admission.Validating admission policyIntercept API requests before admission and validate against CEL expressions.Validate critical configu", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/admission-webhooks-good-practices/", "id": "k8s_00341"}
{"instruction": "Write a bash example for admission webhook good practices", "response": "Here's a bash example:\n\n```bash\nkubectl get mutatingwebhookconfigurations\n```\n\nAdmission Webhook Good Practices | The output lists any mutating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/admission-webhooks-good-practices/", "id": "k8s_00341_code_3877"}
{"instruction": "Write a bash example for admission webhook good practices", "response": "Here's a bash example:\n\n```bash\nkubectl get validatingwebhookconfigurations\n```\n\nAdmission Webhook Good Practices | The output lists any validating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/admission-webhooks-good-practices/", "id": "k8s_00341_code_3878"}
{"instruction": "Write a bash example for admission webhook good practices", "response": "Here's a bash example:\n\n```bash\nkubectl get mutatingwebhookconfigurations\n```\n\nAdmission Webhook Good Practices | The output lists any mutating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/admission-webhooks-good-practices/", "id": "k8s_00341_code_3879"}
{"instruction": "Write a bash example for admission webhook good practices", "response": "Here's a bash example:\n\n```bash\nkubectl get validatingwebhookconfigurations\n```\n\nAdmission Webhook Good Practices | The output lists any validating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/admission-webhooks-good-practices/", "id": "k8s_00341_code_3880"}
{"instruction": "How do you ip masquerade agent user guide in Kubernetes?", "response": "IP Masquerade Agent User GuideThis page shows how to configure and enable the ip-masq-agent.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.IP Masquerade Agent User GuideThe ip-masq-agent configures iptables rules to hide a pod's IP address behind the cluster node's IP address. This is typically done when sending traffic to destinations outside the cluster's pod CIDR range.Key TermsNAT (Network Address Translation): Is a method of remapping one IP address to another by modifying either the source and/or destination address information in the IP header. Typically performed by a device doing IP routing.Masquerading: A form of NAT that is typically used to perform a many to one address translation, where multiple source IP addresses are masked behind a single address, which is typically the device doing the IP routing. In Kubernetes this is the Node's IP address.CIDR (Classless Inter-Domain Routing): Based on the variable-length subnet masking, allows specifying arbitrary-length prefixes. CIDR introduced a new method of representation for IP addresses, now commonly known as CIDR notation, in which an address or routing prefix is written with a suffix indicating the number of bits of the prefix, such as 192.168.2.0/24.Link Local: A link-local address is a network address that is valid only for communications within the network segment or the broadcast domain that the host is connected to. Link-local addresses for IPv4 are defined in the address block 169.254.0.0/16 in CIDR notation.The ip-masq-agent configures iptables rules to handle masquerading node/pod IP addresses when sending traffic to destinations outside the cluster node's IP and the Cluster IP range. This essentially hides pod IP addresses behind the cluster node's IP address. In some environments, traffic to \"external\" addresses must come from a known machine address. For example, in Google Cloud, any traffic to the internet must come from a VM's IP. When containers are used, as in Google Kubernetes Engine, the Pod IP will be rejected for egress. To avoid this, we must hide the Pod IP behind the VM's own IP address - generally known as \"masquerade\". By default, the agent is configured to treat the three private IP ranges specified by RFC 1918 as non-masquerade CIDR. These ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. The agent will also treat link-local (169.254.0.0/16) as a non-masquerade CIDR by default. The agent is configured to reload its configuration from the location /etc/config/ip-masq-agent every 60 seconds, which is also configurable.The agent configuration file must be written in YAML or JSON syntax, and may contain three optional keys:nonMasqueradeCIDRs: A list of strings in CIDR notation that specify the non-masquerade ranges.masqLinkLocal: A Boolean (true/false) which indicates whether to masquerade traffic to the link local prefix 169.254.0.0/16. False by default.resyncInterval: A time interval at which the agent attempts to reload config from disk. For example: '30s', where 's' means seconds, 'ms' means milliseconds.Traffic to 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 ranges will NOT be masqueraded. Any other traffic (assumed to be internet) will be masqueraded. An example of a local destination from a pod could be its Node's IP address as well as another node's address or one of the IP addresses in Cluster's IP range. Any other traffic will be masqueraded by default. The below entries show the default set of rules that are applied by the ip-masq-agent:iptables -t nat -L IP-MASQ-AGENT target prot opt source dest", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342"}
{"instruction": "Write a bash example for ip masquerade agent user guide", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/ip-masq-agent/master/ip-masq-agent.yaml\n```\n\nIP Masquerade Agent User Guide | You must also apply the appropriate node label to any nodes in your cluster that you want the agent to run on.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3882"}
{"instruction": "Write a bash example for ip masquerade agent user guide", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes my-node node.kubernetes.io/masq-agent-ds-ready=true\n```\n\nIP Masquerade Agent User Guide | More information can be found in the ip-masq-agent documentation here.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3883"}
{"instruction": "Write a bash example for ip masquerade agent user guide", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap ip-masq-agent --from-file=config --namespace=kube-system\n```\n\nIP Masquerade Agent User Guide | This will update a file located at /etc/config/ip-masq-agent which is periodically checked every resyncInterval and applied to the cluster node. After the resync interval has expired, you should see t", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3884"}
{"instruction": "Write a yaml example for ip masquerade agent user guide", "response": "Here's a yaml example:\n\n```yaml\nnonMasqueradeCIDRs:\n  - 10.0.0.0/8\nresyncInterval: 60s\n```\n\nIP Masquerade Agent User Guide | Run the following command to add the configmap to your cluster:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3885"}
{"instruction": "Write a yaml example for ip masquerade agent user guide", "response": "Here's a yaml example:\n\n```yaml\nnonMasqueradeCIDRs:\n  - 10.0.0.0/8\nresyncInterval: 60s\nmasqLinkLocal: true\n```\n\nIP Masquerade Agent User Guide |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3886"}
{"instruction": "Write a bash example for ip masquerade agent user guide", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/ip-masq-agent/master/ip-masq-agent.yaml\n```\n\nIP Masquerade Agent User Guide | You must also apply the appropriate node label to any nodes in your cluster that you want the agent to run on.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3887"}
{"instruction": "Write a bash example for ip masquerade agent user guide", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes my-node node.kubernetes.io/masq-agent-ds-ready=true\n```\n\nIP Masquerade Agent User Guide | More information can be found in the ip-masq-agent documentation here.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3888"}
{"instruction": "Write a bash example for ip masquerade agent user guide", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap ip-masq-agent --from-file=config --namespace=kube-system\n```\n\nIP Masquerade Agent User Guide | This will update a file located at /etc/config/ip-masq-agent which is periodically checked every resyncInterval and applied to the cluster node. After the resync interval has expired, you should see t", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/ip-masq-agent/", "id": "k8s_00342_code_3889"}
{"instruction": "What is the reference documentation for validatingadmissionpolicy?", "response": "ValidatingAdmissionPolicyValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.apiVersion: admissionregistration.k8s.io/v1import \"k8s.io/api/admissionregistration/v1\"ValidatingAdmissionPolicyValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.apiVersion: admissionregistration.k8s.io/v1kind: ValidatingAdmissionPolicymetadata (ObjectMeta)Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.spec (ValidatingAdmissionPolicySpec)Specification of the desired behavior of the ValidatingAdmissionPolicy.ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.spec.auditAnnotations ([]AuditAnnotation)Atomic: will be replaced during a mergeauditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required.AuditAnnotation describes how to produce an audit annotation for an API request.spec.auditAnnotations.key (string), requiredkey specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.The key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: \"{ValidatingAdmissionPolicy name}/{key}\".If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded.Required.spec.auditAnnotations.valueExpression (string), requiredvalueExpression represents the expression which is evaluated by CEL to produce an audit annotation value. The expression must evaluate to either a string or null value. If the expression evaluates to a string, the audit annotation is included with the string value. If the expression evaluates to null or empty string the audit annotation will be omitted. The valueExpression may be no longer than 5kb in length. If the result of the valueExpression is more than 10kb in length, it will be truncated to 10kb.If multiple ValidatingAdmissionPolicyBinding resources match an API request, then the valueExpression will be evaluated for each binding. All unique values produced by the valueExpressions will be joined together in a comma-separated list.Required.spec.failurePolicy (string)failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.A policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource.failurePolicy does not define how validations that evaluate to false are handled.When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced.Allowed values are Ignore or Fail. Defaults to Fail.spec.matchConditions ([]MatchCondition)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeMatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.If a parameter object is provided, it can be accessed via the params handle in the same manner as validation expressions.The", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/validating-admission-policy-v1/", "id": "k8s_00343"}
{"instruction": "Write a yaml example for validatingadmissionpolicy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\nValidatingAdmissionPolicy | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/validating-admission-policy-v1/", "id": "k8s_00343_code_3891"}
{"instruction": "What is the reference documentation for kubectl?", "response": "kubectlSynopsiskubectl controls the Kubernetes cluster manager.Find more information in Command line tool (kubectl).kubectl [flags] Options--add-dir-headerIf true, adds the file directory to the header of the log messages--alsologtostderrlog to standard error as well as files--as stringUsername to impersonate for the operation--as-group stringArrayGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--azure-container-registry-config stringPath to the file containing Azure container registry configuration information.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cloud-provider-gce-l7lb-src-cidrs cidrs Default: 130.211.0.0/22,35.191.0.0/16CIDRs opened in GCE firewall for L7 LB traffic proxy & health checks--cloud-provider-gce-lb-src-cidrs cidrs Default: 130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16CIDRs opened in GCE firewall for L4 LB traffic proxy & health checks--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--default-not-ready-toleration-seconds int Default: 300Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.--default-unreachable-toleration-seconds int Default: 300Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.-h, --helphelp for kubectl--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--log-backtrace-at traceLocation Default: :0when logging hits line file:N, emit a stack trace--log-dir stringIf non-empty, write log files in this directory--log-file stringIf non-empty, use this log file--log-file-max-size uint Default: 1800Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited.--log-flush-frequency duration Default: 5sMaximum number of seconds between log flushes--logtostderr Default: truelog to standard error instead of files--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--one-outputIf true, only write logs to their native severity level (vs also writing to each lower severity level)--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--skip-headersIf true, avoid header prefixes in the log messages--skip-log-headersIf true, avoid headers when opening log files--stderrthreshold severity Default: 2logs at or above this threshold go to stderr--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server-v, --v Levelnumber for the log level verbosity--version version[=true]Print version information and quit--vmodule moduleSpeccomma-separated list of pattern=N settings for file-filtered ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl/", "id": "k8s_00344"}
{"instruction": "How do you enforce pod security standards with namespace labels in Kubernetes?", "response": "Enforce Pod Security Standards with Namespace LabelsNamespaces can be labeled to enforce the Pod Security Standards. The three policies privileged, baseline and restricted broadly cover the security spectrum and are implemented by the Pod Security admission controller.Before you beginPod Security Admission was available by default in Kubernetes v1.23, as a beta. From version 1.25 onwards, Pod Security Admission is generally available.To check the version, enter kubectl version.Requiring the baseline Pod Security Standard with namespace labelsThis manifest defines a Namespace my-baseline-namespace that:Blocks any pods that don't satisfy the baseline policy requirements.Generates a user-facing warning and adds an audit annotation to any created pod that does not meet the restricted policy requirements.Pins the versions of the baseline and restricted policies to v1.34.apiVersion: v1 kind: Namespace metadata: name: my-baseline-namespace labels: pod-security.kubernetes.io/enforce: baseline pod-security.kubernetes.io/enforce-version: v1.34 # We are setting these to our _desired_ `enforce` level. pod-security.kubernetes.io/audit: restricted pod-security.kubernetes.io/audit-version: v1.34 pod-security.kubernetes.io/warn: restricted pod-security.kubernetes.io/warn-version: v1.34 Add labels to existing namespaces with kubectl labelNote:When an enforce policy (or version) label is added or changed, the admission plugin will test each pod in the namespace against the new policy. Violations are returned to the user as warnings.It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information about how the new policy would treat existing pods, without actually updating a policy.kubectl label --dry-run=server --overwrite ns --all \\ pod-security.kubernetes.io/enforce=baseline Applying to all namespacesIf you're just getting started with the Pod Security Standards, a suitable first step would be to configure all namespaces with audit annotations for a stricter level such as baseline:kubectl label --overwrite ns --all \\ pod-security.kubernetes.io/audit=baseline \\ pod-security.kubernetes.io/warn=baseline Note that this is not setting an enforce level, so that namespaces that haven't been explicitly evaluated can be distinguished. You can list namespaces without an explicitly set enforce level using this command:kubectl get namespaces --selector='!pod-security.kubernetes.io/enforce' Applying to a single namespaceYou can update a specific namespace as well. This command adds the enforce=restricted policy to my-existing-namespace, pinning the restricted policy version to v1.34.kubectl label --overwrite ns my-existing-namespace \\ pod-security.kubernetes.io/enforce=restricted \\ pod-security.kubernetes.io/enforce-version=v1.34", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345"}
{"instruction": "Write a yaml example for enforce pod security standards with namespace labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\nEnforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3894"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\n    pod-security.kubernetes.io/enforce=baseline\n```\n\nEnforce Pod Security Standards with Namespace Labels | If you're just getting started with the Pod Security Standards, a suitable first step would be to configure all namespaces with audit annotations for a stricter level such as baseline:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3895"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns --all \\\n  pod-security.kubernetes.io/audit=baseline \\\n  pod-security.kubernetes.io/warn=baseline\n```\n\nEnforce Pod Security Standards with Namespace Labels | Note that this is not setting an enforce level, so that namespaces that haven't been explicitly evaluated can be distinguished. You can list namespaces without an explicitly set enforce level using th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3896"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --selector='!pod-security.kubernetes.io/enforce'\n```\n\nEnforce Pod Security Standards with Namespace Labels | You can update a specific namespace as well. This command adds the enforce=restricted policy to my-existing-namespace, pinning the restricted policy version to v1.34.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3897"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns my-existing-namespace \\\n  pod-security.kubernetes.io/enforce=restricted \\\n  pod-security.kubernetes.io/enforce-version=v1.34\n```\n\nEnforce Pod Security Standards with Namespace Labels |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3898"}
{"instruction": "Write a yaml example for enforce pod security standards with namespace labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\nEnforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3899"}
{"instruction": "Write a yaml example for enforce pod security standards with namespace labels", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\nEnforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3900"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\n    pod-security.kubernetes.io/enforce=baseline\n```\n\nEnforce Pod Security Standards with Namespace Labels | If you're just getting started with the Pod Security Standards, a suitable first step would be to configure all namespaces with audit annotations for a stricter level such as baseline:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3901"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns --all \\\n  pod-security.kubernetes.io/audit=baseline \\\n  pod-security.kubernetes.io/warn=baseline\n```\n\nEnforce Pod Security Standards with Namespace Labels | Note that this is not setting an enforce level, so that namespaces that haven't been explicitly evaluated can be distinguished. You can list namespaces without an explicitly set enforce level using th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3902"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --selector='!pod-security.kubernetes.io/enforce'\n```\n\nEnforce Pod Security Standards with Namespace Labels | You can update a specific namespace as well. This command adds the enforce=restricted policy to my-existing-namespace, pinning the restricted policy version to v1.34.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3903"}
{"instruction": "Write a bash example for enforce pod security standards with namespace labels", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns my-existing-namespace \\\n  pod-security.kubernetes.io/enforce=restricted \\\n  pod-security.kubernetes.io/enforce-version=v1.34\n```\n\nEnforce Pod Security Standards with Namespace Labels |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/", "id": "k8s_00345_code_3904"}
{"instruction": "Explain the Kubernetes concept: Process ID Limits And Reservations", "response": "Process ID Limits And ReservationsFEATURE STATE: Kubernetes v1.20 [stable]Kubernetes allow you to limit the number of process IDs (PIDs) that a Pod can use. You can also reserve a number of allocatable PIDs for each node for use by the operating system and daemons (rather than by Pods).Process IDs (PIDs) are a fundamental resource on nodes. It is trivial to hit the task limit without hitting any other resource limits, which can then cause instability to a host machine.Cluster administrators require mechanisms to ensure that Pods running in the cluster cannot induce PID exhaustion that prevents host daemons (such as the kubelet or kube-proxy, and potentially also the container runtime) from running. In addition, it is important to ensure that PIDs are limited among Pods in order to ensure they have limited impact on other workloads on the same node.Note:On certain Linux installations, the operating system sets the PIDs limit to a low default, such as 32768. Consider raising the value of /proc/sys/kernel/pid_max.You can configure a kubelet to limit the number of PIDs a given Pod can consume. For example, if your node's host OS is set to use a maximum of 262144 PIDs and expect to host less than 250 Pods, one can give each Pod a budget of 1000 PIDs to prevent using up that node's overall number of available PIDs. If the admin wants to overcommit PIDs similar to CPU or memory, they may do so as well with some additional risks. Either way, a single Pod will not be able to bring the whole machine down. This kind of resource limiting helps to prevent simple fork bombs from affecting operation of an entire cluster.Per-Pod PID limiting allows administrators to protect one Pod from another, but does not ensure that all Pods scheduled onto that host are unable to impact the node overall. Per-Pod limiting also does not protect the node agents themselves from PID exhaustion.You can also reserve an amount of PIDs for node overhead, separate from the allocation to Pods. This is similar to how you can reserve CPU, memory, or other resources for use by the operating system and other facilities outside of Pods and their containers.PID limiting is an important sibling to compute resource requests and limits. However, you specify it in a different way: rather than defining a Pod's resource limit in the .spec for a Pod, you configure the limit as a setting on the kubelet. Pod-defined PID limits are not currently supported.Caution:This means that the limit that applies to a Pod may be different depending on where the Pod is scheduled. To make things simple, it's easiest if all Nodes use the same PID resource limits and reservations.Node PID limitsKubernetes allows you to reserve a number of process IDs for the system use. To configure the reservation, use the parameter pid=<number> in the --system-reserved and --kube-reserved command line options to the kubelet. The value you specified declares that the specified number of process IDs will be reserved for the system as a whole and for Kubernetes system daemons respectively.Pod PID limitsKubernetes allows you to limit the number of processes running in a Pod. You specify this limit at the node level, rather than configuring it as a resource limit for a particular Pod. Each Node can have a different PID limit.To configure the limit, you can specify the command line parameter --pod-max-pids to the kubelet, or set PodPidsLimit in the kubelet configuration file.PID based evictionYou can configure kubelet to start terminating a Pod when it is misbehaving and consuming abnormal amount of resources. This feature is called eviction. You can Configure Out of Resource Handling for various eviction signals. Use pid.available eviction signal to configure the threshold for number of PIDs used by Pod. You can set soft and hard eviction policies. However, even with the hard eviction policy, if the number of PIDs growing very fast, node can still get into unstable state by hitting the node PIDs limit. Eviction signa", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/pid-limiting/", "id": "k8s_00346"}
{"instruction": "What is the reference documentation for kubectl create clusterrolebinding?", "response": "kubectl create clusterrolebindingSynopsisCreate a cluster role binding for a particular cluster role.kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none] Examples # Create a cluster role binding for user1, user2, and group1 using the cluster-admin cluster role kubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1 Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--clusterrole stringClusterRole this ClusterRoleBinding should reference--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--group stringsGroups to bind to the clusterrole. The flag can be repeated to add multiple groups.-h, --helphelp for clusterrolebinding-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--serviceaccount stringsService accounts to bind to the clusterrole, in the format <namespace>:<name>. The flag can be repeated to add multiple service accounts.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--user stringsUsernames to bind to the clusterrole. The flag can be repeated to add multiple users.--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_clusterrolebinding/", "id": "k8s_00347"}
{"instruction": "Write a bash example for kubectl create clusterrolebinding", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\nkubectl create clusterrolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_clusterrolebinding/", "id": "k8s_00347_code_3907"}
{"instruction": "Write a bash example for kubectl create clusterrolebinding", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\nkubectl create clusterrolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_clusterrolebinding/", "id": "k8s_00347_code_3908"}
{"instruction": "Explain the Kubernetes concept: Mixed Version Proxy", "response": "Mixed Version ProxyFEATURE STATE: Kubernetes v1.28 [alpha] (enabled by default: false)Kubernetes 1.34 includes an alpha feature that lets an API Server proxy a resource requests to other peer API servers. This is useful when there are multiple API servers running different versions of Kubernetes in one cluster (for example, during a long-lived rollout to a new release of Kubernetes).This enables cluster administrators to configure highly available clusters that can be upgraded more safely, by directing resource requests (made during the upgrade) to the correct kube-apiserver. That proxying prevents users from seeing unexpected 404 Not Found errors that stem from the upgrade process.This mechanism is called the Mixed Version Proxy.Enabling the Mixed Version ProxyEnsure that UnknownVersionInteroperabilityProxy feature gate is enabled when you start the API Server:kube-apiserver \\ --feature-gates=UnknownVersionInteroperabilityProxy=true \\ # required command line arguments for this feature --peer-ca-file=<path to kube-apiserver CA cert> --proxy-client-cert-file=<path to aggregator proxy cert>, --proxy-client-key-file=<path to aggregator proxy key>, --requestheader-client-ca-file=<path to aggregator CA cert>, # requestheader-allowed-names can be set to blank to allow any Common Name --requestheader-allowed-names=<valid Common Names to verify proxy client cert against>, # optional flags for this feature --peer-advertise-ip=`IP of this kube-apiserver that should be used by peers to proxy requests` --peer-advertise-port=`port of this kube-apiserver that should be used by peers to proxy requests` # …and other flags as usual Proxy transport and authentication between API serversThe source kube-apiserver reuses the existing APIserver client authentication flags --proxy-client-cert-file and --proxy-client-key-file to present its identity that will be verified by its peer (the destination kube-apiserver). The destination API server verifies that peer connection based on the configuration you specify using the --requestheader-client-ca-file command line argument.To authenticate the destination server's serving certs, you must configure a certificate authority bundle by specifying the --peer-ca-file command line argument to the source API server.Configuration for peer API server connectivityTo set the network location of a kube-apiserver that peers will use to proxy requests, use the --peer-advertise-ip and --peer-advertise-port command line arguments to kube-apiserver or specify these fields in the API server configuration file. If these flags are unspecified, peers will use the value from either --advertise-address or --bind-address command line argument to the kube-apiserver. If those too, are unset, the host's default interface is used.Mixed version proxyingWhen you enable mixed version proxying, the aggregation layer loads a special filter that does the following:When a resource request reaches an API server that cannot serve that API (either because it is at a version pre-dating the introduction of the API or the API is turned off on the API server) the API server attempts to send the request to a peer API server that can serve the requested API. It does so by identifying API groups / versions / resources that the local server doesn't recognise, and tries to proxy those requests to a peer API server that is capable of handling the request.If the peer API server fails to respond, the source API server responds with 503 (\"Service Unavailable\") error.How it works under the hoodWhen an API Server receives a resource request, it first checks which API servers can serve the requested resource. This check happens using the internal StorageVersion API.If the resource is known to the API server that received the request (for example, GET /api/v1/pods/some-pod), the request is handled locally.If there is no internal StorageVersion object found for the requested resource (for example, GET /my-api/v1/my-resource) and the configured APIService spec", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/mixed-version-proxy/", "id": "k8s_00348"}
{"instruction": "How do you debugging dns resolution in Kubernetes?", "response": "Debugging DNS ResolutionThis page provides hints on diagnosing DNS problems.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour cluster must be configured to use the CoreDNS addon or its precursor, kube-dns.Your Kubernetes server must be at or later than version v1.6.To check the version, enter kubectl version.Create a simple Pod to use as a test environmentadmin/dns/dnsutils.yaml apiVersion: v1 kind: Pod metadata: name: dnsutils namespace: default spec: containers: - name: dnsutils image: registry.k8s.io/e2e-test-images/agnhost:2.39 imagePullPolicy: IfNotPresent restartPolicy: Always Note:This example creates a pod in the default namespace. DNS name resolution for services depends on the namespace of the pod. For more information, review DNS for Services and Pods.Use that manifest to create a Pod:kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml pod/dnsutils created …and verify its status:kubectl get pods dnsutils NAME READY STATUS RESTARTS AGE dnsutils 1/1 Running 0 <some-time> Once that Pod is running, you can exec nslookup in that environment. If you see something like the following, DNS is working correctly.kubectl exec -i -t dnsutils -- nslookup kubernetes.default Server: 10.0.0.10 Address 1: 10.0.0.10 Name: kubernetes.default Address 1: 10.0.0.1 If the nslookup command fails, check the following:Check the local DNS configuration firstTake a look inside the resolv.conf file. (See Customizing DNS Service and Known issues below for more information)kubectl exec -ti dnsutils -- cat /etc/resolv.conf Verify that the search path and name server are set up like the following (note that search path may vary for different cloud providers):search default.svc.cluster.local svc.cluster.local cluster.local google.internal c.gce_project_id.internal nameserver 10.0.0.10 options ndots:5 Errors such as the following indicate a problem with the CoreDNS (or kube-dns) add-on or with associated Services:kubectl exec -i -t dnsutils -- nslookup kubernetes.default Server: 10.0.0.10 Address 1: 10.0.0.10 nslookup: can't resolve 'kubernetes.default' orkubectl exec -i -t dnsutils -- nslookup kubernetes.default Server: 10.0.0.10 Address 1: 10.0.0.10 kube-dns.kube-system.svc.cluster.local nslookup: can't resolve 'kubernetes.default' Check if the DNS pod is runningUse the kubectl get pods command to verify that the DNS pod is running.kubectl get pods --namespace=kube-system -l k8s-app=kube-dns NAME READY STATUS RESTARTS AGE ... coredns-7b96bf9f76-5hsxb 1/1 Running 0 1h coredns-7b96bf9f76-mvmmt 1/1 Running 0 1h ... Note:The value for label k8s-app is kube-dns for both CoreDNS and kube-dns deployments.If you see that no CoreDNS Pod is running or that the Pod has failed/completed, the DNS add-on may not be deployed by default in your current environment and you will have to deploy it manually.Check for errors in the DNS podUse the kubectl logs command to see logs for the DNS containers.For CoreDNS:kubectl logs --namespace=kube-system -l k8s-app=kube-dns Here is an example of a healthy CoreDNS log:.:53 2018/08/15 14:37:17 [INFO] CoreDNS-1.2.2 2018/08/15 14:37:17 [INFO] linux/amd64, go1.10.3, 2e322f6 CoreDNS-1.2.2 linux/amd64, go1.10.3, 2e322f6 2018/08/15 14:37:17 [INFO] plugin/reload: Running configuration MD5 = 24e6c59e83ce706f07bcc82c31b1ea1c See if there are any suspicious or unexpected messages in the logs.Is DNS service up?Verify that the DNS service is up by using the kubectl get service command.kubectl get svc --namespace=kube-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ... kube-dns ClusterIP 10.0.0.10 <none> 53/UDP,53/TCP 1h ... Note:The se", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349"}
{"instruction": "Write a yaml example for debugging dns resolution", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\nDebugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3911"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml\n```\n\nDebugging DNS Resolution | …and verify its status:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3912"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dnsutils\n```\n\nDebugging DNS Resolution | Once that Pod is running, you can exec nslookup in that environment. If you see something like the following, DNS is working correctly.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3913"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\nDebugging DNS Resolution | If the nslookup command fails, check the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3914"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti dnsutils -- cat /etc/resolv.conf\n```\n\nDebugging DNS Resolution | Verify that the search path and name server are set up like the following (note that search path may vary for different cloud providers):", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3915"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\nDebugging DNS Resolution | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3916"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\nDebugging DNS Resolution | Use the kubectl get pods command to verify that the DNS pod is running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3917"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=kube-dns\n```\n\nDebugging DNS Resolution | If you see that no CoreDNS Pod is running or that the Pod has failed/completed, the DNS add-on may not be deployed by default in your current environment and you will have to deploy it manually.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3918"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl logs --namespace=kube-system -l k8s-app=kube-dns\n```\n\nDebugging DNS Resolution | Here is an example of a healthy CoreDNS log:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3919"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get svc --namespace=kube-system\n```\n\nDebugging DNS Resolution | If you have created the Service or in the case it should be created by default but it does not appear, see debugging Services for more information.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3920"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=kube-dns --namespace=kube-system\n```\n\nDebugging DNS Resolution | If you do not see the endpoints, see the endpoints section in the debugging Services documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3921"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system edit configmap coredns\n```\n\nDebugging DNS Resolution | Then add log in the Corefile section per the example below:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3922"}
{"instruction": "Write a yaml example for debugging dns resolution", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        log\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n          pods insecure\n          upstream\n          fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\nDebugging DNS Resolution | After saving the changes, it may take up to minute or two for Kubernetes to propagate these changes to the CoreDNS pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3923"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl describe clusterrole system:coredns -n kube-system\n```\n\nDebugging DNS Resolution | Expected output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3924"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:coredns -n kube-system\n```\n\nDebugging DNS Resolution | Example insertion of EndpointSlices permissions:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3925"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>\n```\n\nDebugging DNS Resolution | This query specifies the namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3926"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>.<namespace>\n```\n\nDebugging DNS Resolution | To learn more about name resolution, see DNS for Services and Pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3927"}
{"instruction": "Write a yaml example for debugging dns resolution", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\nDebugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3928"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice\n```\n\nDebugging DNS Resolution | If you do not see the endpoints, see the endpoints section in the debugging Services documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3929"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system edit configmap coredns\n```\n\nDebugging DNS Resolution | Then add log in the Corefile section per the example below:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3930"}
{"instruction": "Write a yaml example for debugging dns resolution", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        log\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n          pods insecure\n          upstream\n          fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\nDebugging DNS Resolution | After saving the changes, it may take up to minute or two for Kubernetes to propagate these changes to the CoreDNS pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3931"}
{"instruction": "Write a yaml example for debugging dns resolution", "response": "Here's a yaml example:\n\n```yaml\nadmin/dns/dnsutils.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\nDebugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3932"}
{"instruction": "Write a yaml example for debugging dns resolution", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\nDebugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3933"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml\n```\n\nDebugging DNS Resolution | …and verify its status:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3934"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dnsutils\n```\n\nDebugging DNS Resolution | Once that Pod is running, you can exec nslookup in that environment. If you see something like the following, DNS is working correctly.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3935"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\nDebugging DNS Resolution | If the nslookup command fails, check the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3936"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti dnsutils -- cat /etc/resolv.conf\n```\n\nDebugging DNS Resolution | Verify that the search path and name server are set up like the following (note that search path may vary for different cloud providers):", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3937"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\nDebugging DNS Resolution | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3938"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\nDebugging DNS Resolution | Use the kubectl get pods command to verify that the DNS pod is running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3939"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=kube-dns\n```\n\nDebugging DNS Resolution | If you see that no CoreDNS Pod is running or that the Pod has failed/completed, the DNS add-on may not be deployed by default in your current environment and you will have to deploy it manually.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3940"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl logs --namespace=kube-system -l k8s-app=kube-dns\n```\n\nDebugging DNS Resolution | Here is an example of a healthy CoreDNS log:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3941"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get svc --namespace=kube-system\n```\n\nDebugging DNS Resolution | If you have created the Service or in the case it should be created by default but it does not appear, see debugging Services for more information.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3942"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=kube-dns --namespace=kube-system\n```\n\nDebugging DNS Resolution | If you do not see the endpoints, see the endpoints section in the debugging Services documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3943"}
{"instruction": "Write a yaml example for debugging dns resolution", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        log\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n          pods insecure\n          upstream\n          fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\nDebugging DNS Resolution | After saving the changes, it may take up to minute or two for Kubernetes to propagate these changes to the CoreDNS pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3944"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl describe clusterrole system:coredns -n kube-system\n```\n\nDebugging DNS Resolution | Expected output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3945"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:coredns -n kube-system\n```\n\nDebugging DNS Resolution | Example insertion of EndpointSlices permissions:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3946"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>\n```\n\nDebugging DNS Resolution | This query specifies the namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3947"}
{"instruction": "Write a bash example for debugging dns resolution", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>.<namespace>\n```\n\nDebugging DNS Resolution | To learn more about name resolution, see DNS for Services and Pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/", "id": "k8s_00349_code_3948"}
{"instruction": "How do you adding entries to pod /etc/hosts with hostaliases in Kubernetes?", "response": "Adding entries to Pod /etc/hosts with HostAliasesAdding entries to a Pod's /etc/hosts file provides Pod-level override of hostname resolution when DNS and other options are not applicable. You can add these custom entries with the HostAliases field in PodSpec.The Kubernetes project recommends modifying DNS configuration using the hostAliases field (part of the .spec for a Pod), and not by using an init container or other means to edit /etc/hosts directly. Change made in other ways may be overwritten by the kubelet during Pod creation or restart.Default hosts file contentStart an Nginx Pod which is assigned a Pod IP:kubectl run nginx --image nginx pod/nginx created Examine a Pod IP:kubectl get pods --output=wide NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 The hosts file content would look like this:kubectl exec nginx -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.4 nginx By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.Adding additional entries with hostAliasesIn addition to the default boilerplate, you can add additional entries to the hosts file. For example: to resolve foo.local, bar.local to 127.0.0.1 and foo.remote, bar.remote to 10.1.2.3, you can configure HostAliases for a Pod under .spec.hostAliases:service/networking/hostaliases-pod.yaml apiVersion: v1 kind: Pod metadata: name: hostaliases-pod spec: restartPolicy: Never hostAliases: - ip: \"127.0.0.1\" hostnames: - \"foo.local\" - \"bar.local\" - ip: \"10.1.2.3\" hostnames: - \"foo.remote\" - \"bar.remote\" containers: - name: cat-hosts image: busybox:1.28 command: - cat args: - \"/etc/hosts\" You can start a Pod with that configuration by running:kubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml pod/hostaliases-pod created Examine a Pod's details to see its IPv4 address and its status:kubectl get pod --output=wide NAME READY STATUS RESTARTS AGE IP NODE hostaliases-pod 0/1 Completed 0 6s 10.200.0.5 worker0 The hosts file content looks like this:kubectl logs hostaliases-pod # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.5 hostaliases-pod # Entries added by HostAliases. 127.0.0.1 foo.local bar.local 10.1.2.3 foo.remote bar.remote with the additional entries specified at the bottom.Why does the kubelet manage the hosts file?The kubelet manages the hosts file for each container of the Pod to prevent the container runtime from modifying the file after the containers have already been started. Historically, Kubernetes always used Docker Engine as its container runtime, and Docker Engine would then modify the /etc/hosts file after each container had started.Current Kubernetes can use a variety of container runtimes; even so, the kubelet manages the hosts file within each container so that the outcome is as intended regardless of which container runtime you use.Caution:Avoid making manual changes to the hosts file inside a container.If you make manual changes to the hosts file, those changes are lost when the container exits.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image nginx\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | Examine a Pod IP:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3950"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | The hosts file content would look like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3951"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx -- cat /etc/hosts\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3952"}
{"instruction": "Write a yaml example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3953"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | Examine a Pod's details to see its IPv4 address and its status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3954"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl get pod --output=wide\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | The hosts file content looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3955"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl logs hostaliases-pod\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | with the additional entries specified at the bottom.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3956"}
{"instruction": "Write a yaml example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3957"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image nginx\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | Examine a Pod IP:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3958"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | The hosts file content would look like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3959"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx -- cat /etc/hosts\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3960"}
{"instruction": "Write a yaml example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/hostaliases-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3961"}
{"instruction": "Write a yaml example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3962"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | Examine a Pod's details to see its IPv4 address and its status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3963"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl get pod --output=wide\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | The hosts file content looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3964"}
{"instruction": "Write a bash example for adding entries to pod /etc/hosts with hostaliases", "response": "Here's a bash example:\n\n```bash\nkubectl logs hostaliases-pod\n```\n\nAdding entries to Pod /etc/hosts with HostAliases | with the additional entries specified at the bottom.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/", "id": "k8s_00350_code_3965"}
{"instruction": "Explain the Kubernetes concept: Kubernetes Object Management", "response": "Kubernetes Object ManagementThe kubectl command-line tool supports several different ways to create and manage Kubernetes objects. This document provides an overview of the different approaches. Read the Kubectl book for details of managing objects by Kubectl.Management techniquesWarning:A Kubernetes object should be managed using only one technique. Mixing and matching techniques for the same object results in undefined behavior.Management techniqueOperates onRecommended environmentSupported writersLearning curveImperative commandsLive objectsDevelopment projects1+LowestImperative object configurationIndividual filesProduction projects1ModerateDeclarative object configurationDirectories of filesProduction projects1+HighestImperative commandsWhen using imperative commands, a user operates directly on live objects in a cluster. The user provides operations to the kubectl command as arguments or flags.This is the recommended way to get started or to run a one-off task in a cluster. Because this technique operates directly on live objects, it provides no history of previous configurations.ExamplesRun an instance of the nginx container by creating a Deployment object:kubectl create deployment nginx --image nginx Trade-offsAdvantages compared to object configuration:Commands are expressed as a single action word.Commands require only a single step to make changes to the cluster.Disadvantages compared to object configuration:Commands do not integrate with change review processes.Commands do not provide an audit trail associated with changes.Commands do not provide a source of records except for what is live.Commands do not provide a template for creating new objects.Imperative object configurationIn imperative object configuration, the kubectl command specifies the operation (create, replace, etc.), optional flags and at least one file name. The file specified must contain a full definition of the object in YAML or JSON format.See the API reference for more details on object definitions.Warning:The imperative replace command replaces the existing spec with the newly provided one, dropping all changes to the object missing from the configuration file. This approach should not be used with resource types whose specs are updated independently of the configuration file. Services of type LoadBalancer, for example, have their externalIPs field updated independently from the configuration by the cluster.ExamplesCreate the objects defined in a configuration file:kubectl create -f nginx.yaml Delete the objects defined in two configuration files:kubectl delete -f nginx.yaml -f redis.yaml Update the objects defined in a configuration file by overwriting the live configuration:kubectl replace -f nginx.yaml Trade-offsAdvantages compared to imperative commands:Object configuration can be stored in a source control system such as Git.Object configuration can integrate with processes such as reviewing changes before push and audit trails.Object configuration provides a template for creating new objects.Disadvantages compared to imperative commands:Object configuration requires basic understanding of the object schema.Object configuration requires the additional step of writing a YAML file.Advantages compared to declarative object configuration:Imperative object configuration behavior is simpler and easier to understand.As of Kubernetes version 1.5, imperative object configuration is more mature.Disadvantages compared to declarative object configuration:Imperative object configuration works best on files, not directories.Updates to live objects must be reflected in configuration files, or they will be lost during the next replacement.Declarative object configurationWhen using declarative object configuration, a user operates on object configuration files stored locally, however the user does not define the operations to be taken on the files. Create, update, and delete operations are automatically detected per-object by kubectl. This enables working", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image nginx\n```\n\nKubernetes Object Management | Advantages compared to object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3967"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nginx.yaml\n```\n\nKubernetes Object Management | Delete the objects defined in two configuration files:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3968"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f nginx.yaml -f redis.yaml\n```\n\nKubernetes Object Management | Update the objects defined in a configuration file by overwriting the live configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3969"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f nginx.yaml\n```\n\nKubernetes Object Management | Advantages compared to imperative commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3970"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f configs/\nkubectl apply -f configs/\n```\n\nKubernetes Object Management | Recursively process directories:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3971"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl diff -R -f configs/\nkubectl apply -R -f configs/\n```\n\nKubernetes Object Management | Advantages compared to imperative object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3972"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image nginx\n```\n\nKubernetes Object Management | Advantages compared to object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3973"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nginx.yaml\n```\n\nKubernetes Object Management | Delete the objects defined in two configuration files:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3974"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f nginx.yaml -f redis.yaml\n```\n\nKubernetes Object Management | Update the objects defined in a configuration file by overwriting the live configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3975"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f nginx.yaml\n```\n\nKubernetes Object Management | Advantages compared to imperative commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3976"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f configs/\nkubectl apply -f configs/\n```\n\nKubernetes Object Management | Recursively process directories:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3977"}
{"instruction": "Write a bash example for kubernetes object management", "response": "Here's a bash example:\n\n```bash\nkubectl diff -R -f configs/\nkubectl apply -R -f configs/\n```\n\nKubernetes Object Management | Advantages compared to imperative object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/object-management/", "id": "k8s_00351_code_3978"}
{"instruction": "What is the reference documentation for kubectl api-versions?", "response": "kubectl api-versionsSynopsisPrint the supported API versions on the server, in the form of \"group/version\".kubectl api-versions Examples # Print the supported API versions kubectl api-versions Options-h, --helphelp for api-versionsParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_api-versions/", "id": "k8s_00352"}
{"instruction": "Explain the Kubernetes concept: Service Internal Traffic Policy", "response": "Service Internal Traffic PolicyIf two Pods in your cluster want to communicate, and both Pods are actually running on the same node, use Service Internal Traffic Policy to keep network traffic within that node. Avoiding a round trip via the cluster network can help with reliability, performance (network latency and throughput), or cost.FEATURE STATE: Kubernetes v1.26 [stable]Service Internal Traffic Policy enables internal traffic restrictions to only route internal traffic to endpoints within the node the traffic originated from. The \"internal\" traffic here refers to traffic originated from Pods in the current cluster. This can help to reduce costs and improve performance.Using Service Internal Traffic PolicyYou can enable the internal-only traffic policy for a Service, by setting its .spec.internalTrafficPolicy to Local. This tells kube-proxy to only use node local endpoints for cluster internal traffic.Note:For pods on nodes with no endpoints for a given Service, the Service behaves as if it has zero endpoints (for Pods on this node) even if the service does have endpoints on other nodes.The following example shows what a Service looks like when you set .spec.internalTrafficPolicy to Local:apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376 internalTrafficPolicy: Local How it worksThe kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or is not set, Kubernetes considers all endpoints.What's nextRead about Topology Aware RoutingRead about Service External Traffic PolicyFollow the Connecting Applications with Services tutorial", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/", "id": "k8s_00353"}
{"instruction": "Write a yaml example for service internal traffic policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\nService Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/", "id": "k8s_00353_code_3981"}
{"instruction": "Write a yaml example for service internal traffic policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\nService Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/", "id": "k8s_00353_code_3982"}
{"instruction": "Write a yaml example for service internal traffic policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\nService Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service-traffic-policy/", "id": "k8s_00353_code_3983"}
{"instruction": "What is the reference documentation for kubectl annotate?", "response": "kubectl annotateSynopsisUpdate the annotations on one or more resources.All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data.Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.Use \"kubectl api-resources\" for a complete list of supported resources.kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version] Examples # Update pod 'foo' with the annotation 'description' and the value 'my frontend' # If the same annotation is set multiple times, only the last value will be applied kubectl annotate pods foo description='my frontend' # Update a pod identified by type and name in \"pod.json\" kubectl annotate -f pod.json description='my frontend' # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value kubectl annotate --overwrite pods foo description='my frontend running nginx' # Update all pods in the namespace kubectl annotate pods --all description='my frontend running nginx' # Update pod 'foo' only if the resource is unchanged from version 1 kubectl annotate pods foo description='my frontend running nginx' --resource-version=1 # Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag kubectl annotate pods foo description- Options--allSelect all resources, in the namespace of the specified resource types.-A, --all-namespacesIf true, check the specified action in all namespaces.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-annotate\"Name of the manager used to track field ownership.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update the annotation-h, --helphelp for annotate-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--listIf true, display the annotations for a given resource.--localIf true, annotation will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--overwriteIf true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--resource-version stringIf non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_annotate/", "id": "k8s_00354"}
{"instruction": "Write a bash example for kubectl annotate", "response": "Here's a bash example:\n\n```bash\nkubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\nkubectl annotate | Select all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_annotate/", "id": "k8s_00354_code_3985"}
{"instruction": "Write a bash example for kubectl annotate", "response": "Here's a bash example:\n\n```bash\nkubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\nkubectl annotate | Select all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_annotate/", "id": "k8s_00354_code_3986"}
{"instruction": "What is the reference documentation for kubectl auth?", "response": "kubectl authSynopsisInspect authorization.kubectl auth [flags] Options-h, --helphelp for authParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerkubectl auth can-i - Check whether an action is allowedkubectl auth reconcile - Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objectskubectl auth whoami - Experimental: Check self subject attributesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/", "id": "k8s_00355"}
{"instruction": "How do you change the default storageclass in Kubernetes?", "response": "Change the default StorageClassThis page shows how to change the default Storage Class that is used to provision volumes for PersistentVolumeClaims that have no special requirements.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Why change the default storage class?Depending on the installation method, your Kubernetes cluster may be deployed with an existing StorageClass that is marked as default. This default StorageClass is then used to dynamically provision storage for PersistentVolumeClaims that do not require any specific storage class. See PersistentVolumeClaim documentation for details.The pre-installed default StorageClass may not fit well with your expected workload; for example, it might provision storage that is too expensive. If this is the case, you can either change the default StorageClass or disable it completely to avoid dynamic provisioning of storage.Deleting the default StorageClass may not work, as it may be re-created automatically by the addon manager running in your cluster. Please consult the docs for your installation for details about addon manager and how to disable individual addons.Changing the default StorageClassList the StorageClasses in your cluster:kubectl get storageclass The output is similar to this:NAME PROVISIONER AGE standard (default) kubernetes.io/gce-pd 1d gold kubernetes.io/gce-pd 1d The default StorageClass is marked by (default).Mark the default StorageClass as non-default:The default StorageClass has an annotation storageclass.kubernetes.io/is-default-class set to true. Any other value or absence of the annotation is interpreted as false.To mark a StorageClass as non-default, you need to change its value to false:kubectl patch storageclass standard -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"false\"}}}' where standard is the name of your chosen StorageClass.Mark a StorageClass as default:Similar to the previous step, you need to add/set the annotation storageclass.kubernetes.io/is-default-class=true.kubectl patch storageclass gold -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}' Please note you can have multiple StorageClass marked as default. If more than one StorageClass is marked as default, a PersistentVolumeClaim without an explicitly defined storageClassName will be created using the most recently created default StorageClass. When a PersistentVolumeClaim is created with a specified volumeName, it remains in a pending state if the static volume's storageClassName does not match the StorageClass on the PersistentVolumeClaim.Verify that your chosen StorageClass is default:kubectl get storageclass The output is similar to this:NAME PROVISIONER AGE standard kubernetes.io/gce-pd 1d gold (default) kubernetes.io/gce-pd 1d What's nextLearn more about PersistentVolumes.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\nChange the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3989"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass standard -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"false\"}}}'\n```\n\nChange the default StorageClass | where standard is the name of your chosen StorageClass.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3990"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass gold -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}'\n```\n\nChange the default StorageClass | Please note you can have multiple StorageClass marked as default. If more than one StorageClass is marked as default, a PersistentVolumeClaim without an explicitly defined storageClassName will be cre", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3991"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\nChange the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3992"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\nChange the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3993"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nNAME                 PROVISIONER               AGE\nstandard (default)   kubernetes.io/gce-pd      1d\ngold                 kubernetes.io/gce-pd      1d\n```\n\nChange the default StorageClass | The default StorageClass is marked by (default).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3994"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass standard -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"false\"}}}'\n```\n\nChange the default StorageClass | where standard is the name of your chosen StorageClass.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3995"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass gold -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}'\n```\n\nChange the default StorageClass | Please note you can have multiple StorageClass marked as default. If more than one StorageClass is marked as default, a PersistentVolumeClaim without an explicitly defined storageClassName will be cre", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3996"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\nChange the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3997"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nNAME             PROVISIONER               AGE\nstandard         kubernetes.io/gce-pd      1d\ngold (default)   kubernetes.io/gce-pd      1d\n```\n\nChange the default StorageClass |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3998"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\nChange the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_3999"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass standard -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"false\"}}}'\n```\n\nChange the default StorageClass | where standard is the name of your chosen StorageClass.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_4000"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass gold -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}'\n```\n\nChange the default StorageClass | Please note you can have multiple StorageClass marked as default. If more than one StorageClass is marked as default, a PersistentVolumeClaim without an explicitly defined storageClassName will be cre", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_4001"}
{"instruction": "Write a bash example for change the default storageclass", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\nChange the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/", "id": "k8s_00356_code_4002"}
{"instruction": "What is the reference documentation for kubectl create quota?", "response": "kubectl create quotaSynopsisCreate a resource quota with the specified name, hard limits, and optional scopes.kubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none] Examples # Create a new resource quota named my-quota kubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10 # Create a new resource quota named best-effort kubectl create quota best-effort --hard=pods=100 --scopes=BestEffort Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--hard stringA comma-delimited set of resource=quantity pairs that define a hard limit.-h, --helphelp for quota-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--scopes stringA comma-delimited set of quota scopes that must all match each object tracked by the quota.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_quota/", "id": "k8s_00357"}
{"instruction": "Write a bash example for kubectl create quota", "response": "Here's a bash example:\n\n```bash\nkubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]\n```\n\nkubectl create quota | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_quota/", "id": "k8s_00357_code_4004"}
{"instruction": "Write a bash example for kubectl create quota", "response": "Here's a bash example:\n\n```bash\nkubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]\n```\n\nkubectl create quota | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_quota/", "id": "k8s_00357_code_4005"}
{"instruction": "Explain the Kubernetes concept: Ephemeral Containers", "response": "Ephemeral ContainersFEATURE STATE: Kubernetes v1.25 [stable]This page provides an overview of ephemeral containers: a special type of container that runs temporarily in an existing Pod to accomplish user-initiated actions such as troubleshooting. You use ephemeral containers to inspect services rather than to build applications.Understanding ephemeral containersPods are the fundamental building block of Kubernetes applications. Since Pods are intended to be disposable and replaceable, you cannot add a container to a Pod once it has been created. Instead, you usually delete and replace Pods in a controlled fashion using deployments.Sometimes it's necessary to inspect the state of an existing Pod, however, for example to troubleshoot a hard-to-reproduce bug. In these cases you can run an ephemeral container in an existing Pod to inspect its state and run arbitrary commands.What is an ephemeral container?Ephemeral containers differ from other containers in that they lack guarantees for resources or execution, and they will never be automatically restarted, so they are not appropriate for building applications. Ephemeral containers are described using the same ContainerSpec as regular containers, but many fields are incompatible and disallowed for ephemeral containers.Ephemeral containers may not have ports, so fields such as ports, livenessProbe, readinessProbe are disallowed.Pod resource allocations are immutable, so setting resources is disallowed.For a complete list of allowed fields, see the EphemeralContainer reference documentation.Ephemeral containers are created using a special ephemeralcontainers handler in the API rather than by adding them directly to pod.spec, so it's not possible to add an ephemeral container using kubectl edit.Like regular containers, you may not change or remove an ephemeral container after you have added it to a Pod.Note:Ephemeral containers are not supported by static pods.Uses for ephemeral containersEphemeral containers are useful for interactive troubleshooting when kubectl exec is insufficient because a container has crashed or a container image doesn't include debugging utilities.In particular, distroless images enable you to deploy minimal container images that reduce attack surface and exposure to bugs and vulnerabilities. Since distroless images do not include a shell or any debugging utilities, it's difficult to troubleshoot distroless images using kubectl exec alone.When using ephemeral containers, it's helpful to enable process namespace sharing so you can view processes in other containers.What's nextLearn how to debug pods using ephemeral containers.", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/", "id": "k8s_00358"}
{"instruction": "Explain the Kubernetes concept: Pod Scheduling Readiness", "response": "Pod Scheduling ReadinessFEATURE STATE: Kubernetes v1.30 [stable]Pods were considered ready for scheduling once created. Kubernetes scheduler does its due diligence to find nodes to place all pending Pods. However, in a real-world case, some Pods may stay in a \"miss-essential-resources\" state for a long period. These Pods actually churn the scheduler (and downstream integrators like Cluster AutoScaler) in an unnecessary manner.By specifying/removing a Pod's .spec.schedulingGates, you can control when a Pod is ready to be considered for scheduling.Configuring Pod schedulingGatesThe schedulingGates field contains a list of strings, and each string literal is perceived as a criteria that Pod should be satisfied before considered schedulable. This field can be initialized only when a Pod is created (either by the client, or mutated during admission). After creation, each schedulingGate can be removed in arbitrary order, but addition of a new scheduling gate is disallowed.Figure. Pod SchedulingGatesUsage exampleTo mark a Pod not-ready for scheduling, you can create it with one or more scheduling gates like this:pods/pod-with-scheduling-gates.yaml apiVersion: v1 kind: Pod metadata: name: test-pod spec: schedulingGates: - name: example.com/foo - name: example.com/bar containers: - name: pause image: registry.k8s.io/pause:3.6 After the Pod's creation, you can check its state using:kubectl get pod test-pod The output reveals it's in SchedulingGated state:NAME READY STATUS RESTARTS AGE test-pod 0/1 SchedulingGated 0 7s You can also check its schedulingGates field by running:kubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}' The output is:[{\"name\":\"example.com/foo\"},{\"name\":\"example.com/bar\"}] To inform scheduler this Pod is ready for scheduling, you can remove its schedulingGates entirely by reapplying a modified manifest:pods/pod-without-scheduling-gates.yaml apiVersion: v1 kind: Pod metadata: name: test-pod spec: containers: - name: pause image: registry.k8s.io/pause:3.6 You can check if the schedulingGates is cleared by running:kubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}' The output is expected to be empty. And you can check its latest status by running:kubectl get pod test-pod -o wide Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get transited from previous SchedulingGated to Running:NAME READY STATUS RESTARTS AGE IP NODE test-pod 1/1 Running 0 15s 10.0.0.4 node-2 ObservabilityThe metric scheduler_pending_pods comes with a new label \"gated\" to distinguish whether a Pod has been tried scheduling but claimed as unschedulable, or explicitly marked as not ready for scheduling. You can use scheduler_pending_pods{queue=\"gated\"} to check the metric result.Mutable Pod scheduling directivesYou can mutate scheduling directives of Pods while they have scheduling gates, with certain constraints. At a high level, you can only tighten the scheduling directives of a Pod. In other words, the updated directives would cause the Pods to only be able to be scheduled on a subset of the nodes that it would previously match. More concretely, the rules for updating a Pod's scheduling directives are as follows:For .spec.nodeSelector, only additions are allowed. If absent, it will be allowed to be set.For spec.affinity.nodeAffinity, if nil, then setting anything is allowed.If NodeSelectorTerms was empty, it will be allowed to be set. If not empty, then only additions of NodeSelectorRequirements to matchExpressions or fieldExpressions are allowed, and no changes to existing matchExpressions and fieldExpressions will be allowed. This is because the terms in .requiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms, are ORed while the expressions in nodeSelectorTerms[].matchExpressions and nodeSelectorTerms[].fieldExpressions are ANDed.For .preferredDuringSchedulingIgnoredDuringExecution, all updates are allowed. This is because preferred terms are not authoritative, and so ", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4008"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod\n```\n\nPod Scheduling Readiness | The output reveals it's in SchedulingGated state:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4009"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\nPod Scheduling Readiness | The output is:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4010"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4011"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\nPod Scheduling Readiness | The output is expected to be empty. And you can check its latest status by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4012"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o wide\n```\n\nPod Scheduling Readiness | Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get transited from previous SchedulingGated to Running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4013"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4014"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod\n```\n\nPod Scheduling Readiness | The output reveals it's in SchedulingGated state:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4015"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\nPod Scheduling Readiness | The output is:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4016"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4017"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\nPod Scheduling Readiness | The output is expected to be empty. And you can check its latest status by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4018"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o wide\n```\n\nPod Scheduling Readiness | Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get transited from previous SchedulingGated to Running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4019"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-scheduling-gates.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4020"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4021"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod\n```\n\nPod Scheduling Readiness | The output reveals it's in SchedulingGated state:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4022"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\nPod Scheduling Readiness | The output is:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4023"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\npods/pod-without-scheduling-gates.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4024"}
{"instruction": "Write a yaml example for pod scheduling readiness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\nPod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4025"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\nPod Scheduling Readiness | The output is expected to be empty. And you can check its latest status by running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4026"}
{"instruction": "Write a bash example for pod scheduling readiness", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o wide\n```\n\nPod Scheduling Readiness | Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get transited from previous SchedulingGated to Running:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-scheduling-readiness/", "id": "k8s_00359_code_4027"}
{"instruction": "What is the reference documentation for csistoragecapacity?", "response": "CSIStorageCapacityCSIStorageCapacity stores the result of one CSI GetCapacity call.apiVersion: storage.k8s.io/v1import \"k8s.io/api/storage/v1\"CSIStorageCapacityCSIStorageCapacity stores the result of one CSI GetCapacity call. For a given StorageClass, this describes the available capacity in a particular topology segment. This can be used when considering where to instantiate new PersistentVolumes.For example this can express things like: - StorageClass \"standard\" has \"1234 GiB\" available in \"topology.kubernetes.io/zone=us-east1\" - StorageClass \"localssd\" has \"10 GiB\" available in \"kubernetes.io/hostname=knode-abc123\"The following three cases all imply that no capacity is available for a certain combination: - no object exists with suitable topology and storage class name - such an object exists, but the capacity is unset - such an object exists, but the capacity is zeroThe producer of these objects can decide which approach is more suitable.They are consumed by the kube-scheduler when a CSI driver opts into capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler compares the MaximumVolumeSize against the requested size of pending volumes to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back to a comparison against the less precise Capacity. If that is also unset, the scheduler assumes that capacity is insufficient and tries some other node.apiVersion: storage.k8s.io/v1kind: CSIStorageCapacitymetadata (ObjectMeta)Standard object's metadata. The name has no particular meaning. It must be a DNS subdomain (dots allowed, 253 characters). To ensure that there are no conflicts with other CSI drivers on the cluster, the recommendation is to use csisc-<uuid>, a generated name, or a reverse-domain name which ends with the unique CSI driver name.Objects are namespaced.More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatastorageClassName (string), requiredstorageClassName represents the name of the StorageClass that the reported capacity applies to. It must meet the same requirements as the name of a StorageClass object (non-empty, DNS subdomain). If that object no longer exists, the CSIStorageCapacity object is obsolete and should be removed by its creator. This field is immutable.capacity (Quantity)capacity is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields.The semantic is currently (CSI spec 1.2) defined as: The available capacity, in bytes, of the storage that can be used to provision volumes. If not set, that information is currently unavailable.maximumVolumeSize (Quantity)maximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse for a GetCapacityRequest with topology and parameters that match the previous fields.This is defined since CSI spec 1.4.0 as the largest size that may be used in a CreateVolumeRequest.capacity_range.required_bytes field to create a volume with the same parameters as those in GetCapacityRequest. The corresponding value in the Kubernetes API is ResourceRequirements.Requests in a volume claim.nodeTopology (LabelSelector)nodeTopology defines which nodes have access to the storage for which capacity was reported. If not set, the storage is not accessible from any node in the cluster. If empty, the storage is accessible from all nodes. This field is immutable.CSIStorageCapacityListCSIStorageCapacityList is a collection of CSIStorageCapacity objects.apiVersion: storage.k8s.io/v1kind: CSIStorageCapacityListmetadata (ListMeta)Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]CSIStorageCapacity), requireditems is the list of CSIStorageCapacity objects.Operationsget read the specified CSIStorageCapacityHTTP RequestGET /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}Parametersname (in path): s", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/csi-storage-capacity-v1/", "id": "k8s_00360"}
{"instruction": "Write a yaml example for csistoragecapacity", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\nCSIStorageCapacity | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/csi-storage-capacity-v1/", "id": "k8s_00360_code_4029"}
{"instruction": "How do you run a single-instance stateful application in Kubernetes?", "response": "Run a Single-Instance Stateful ApplicationThis page shows you how to run a single-instance stateful application in Kubernetes using a PersistentVolume and a Deployment. The application is MySQL.ObjectivesCreate a PersistentVolume referencing a disk in your environment.Create a MySQL Deployment.Expose MySQL to other pods in the cluster at a known DNS name.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.You need to either have a dynamic PersistentVolume provisioner with a default StorageClass, or statically provision PersistentVolumes yourself to satisfy the PersistentVolumeClaims used here.Deploy MySQLYou can run a stateful application by creating a Kubernetes Deployment and connecting it to an existing PersistentVolume using a PersistentVolumeClaim. For example, this YAML file describes a Deployment that runs MySQL and references the PersistentVolumeClaim. The file defines a volume mount for /var/lib/mysql, and then creates a PersistentVolumeClaim that looks for a 20G volume. This claim is satisfied by any existing volume that meets the requirements, or by a dynamic provisioner.Note: The password is defined in the config yaml, and this is insecure. See Kubernetes Secrets for a secure solution.application/mysql/mysql-deployment.yaml apiVersion: v1 kind: Service metadata: name: mysql spec: ports: - port: 3306 selector: app: mysql clusterIP: None --- apiVersion: apps/v1 kind: Deployment metadata: name: mysql spec: selector: matchLabels: app: mysql strategy: type: Recreate template: metadata: labels: app: mysql spec: containers: - image: mysql:9 name: mysql env: # Use secret in real usage - name: MYSQL_ROOT_PASSWORD value: password ports: - containerPort: 3306 name: mysql volumeMounts: - name: mysql-persistent-storage mountPath: /var/lib/mysql volumes: - name: mysql-persistent-storage persistentVolumeClaim: claimName: mysql-pv-claim application/mysql/mysql-pv.yaml apiVersion: v1 kind: PersistentVolume metadata: name: mysql-pv-volume labels: type: local spec: storageClassName: manual capacity: storage: 20Gi accessModes: - ReadWriteOnce hostPath: path: \"/mnt/data\" --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql-pv-claim spec: storageClassName: manual accessModes: - ReadWriteOnce resources: requests: storage: 20Gi Deploy the PV and PVC of the YAML file:kubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml Deploy the contents of the YAML file:kubectl apply -f https://k8s.io/examples/application/mysql/mysql-deployment.yaml Display information about the Deployment:kubectl describe deployment mysql The output is similar to this:Name: mysql Namespace: default CreationTimestamp: Tue, 01 Nov 2016 11:18:45 -0700 Labels: app=mysql Annotations: deployment.kubernetes.io/revision=1 Selector: app=mysql Replicas: 1 desired | 1 updated | 1 total | 0 available | 1 unavailable StrategyType: Recreate MinReadySeconds: 0 Pod Template: Labels: app=mysql Containers: mysql: Image: mysql:9 Port: 3306/TCP Environment: MYSQL_ROOT_PASSWORD: password Mounts: /var/lib/mysql from mysql-persistent-storage (rw) Volumes: mysql-persistent-storage: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: mysql-pv-claim ReadOnly: false Conditions: Type Status Reason ---- ------ ------ Available False MinimumReplicasUnavailable Progressing True ReplicaSetUpdated OldReplicaSets: <none> NewReplicaSet: mysql-63082529 (1/1 replicas created) Events: FirstSeen LastSeen Count From SubobjectPath Type Reason Message --------- -------- ----- ---- ------------- -------- ", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4031"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4032"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml\n```\n\nRun a Single-Instance Stateful Application | Deploy the contents of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4033"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-deployment.yaml\n```\n\nRun a Single-Instance Stateful Application | Display information about the Deployment:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4034"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment mysql\n```\n\nRun a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4035"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\nRun a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4036"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc mysql-pv-claim\n```\n\nRun a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4037"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run -it --rm --image=mysql:9 --restart=Never mysql-client -- mysql -h mysql -ppassword\n```\n\nRun a Single-Instance Stateful Application | This command creates a new Pod in the cluster running a MySQL client and connects it to the server through the Service. If it connects, you know your stateful MySQL database is up and running.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4038"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,svc mysql\nkubectl delete pvc mysql-pv-claim\nkubectl delete pv mysql-pv-volume\n```\n\nRun a Single-Instance Stateful Application | If you manually provisioned a PersistentVolume, you also need to manually delete it, as well as release the underlying resource. If you used a dynamic provisioner, it automatically deletes the Persist", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4039"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4040"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4041"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4042"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4043"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-pv.yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4044"}
{"instruction": "Write a yaml example for run a single-instance stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\nRun a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4045"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml\n```\n\nRun a Single-Instance Stateful Application | Deploy the contents of the YAML file:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4046"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-deployment.yaml\n```\n\nRun a Single-Instance Stateful Application | Display information about the Deployment:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4047"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment mysql\n```\n\nRun a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4048"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\nRun a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4049"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc mysql-pv-claim\n```\n\nRun a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4050"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run -it --rm --image=mysql:9 --restart=Never mysql-client -- mysql -h mysql -ppassword\n```\n\nRun a Single-Instance Stateful Application | This command creates a new Pod in the cluster running a MySQL client and connects it to the server through the Service. If it connects, you know your stateful MySQL database is up and running.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4051"}
{"instruction": "Write a bash example for run a single-instance stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,svc mysql\nkubectl delete pvc mysql-pv-claim\nkubectl delete pv mysql-pv-volume\n```\n\nRun a Single-Instance Stateful Application | If you manually provisioned a PersistentVolume, you also need to manually delete it, as well as release the underlying resource. If you used a dynamic provisioner, it automatically deletes the Persist", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/", "id": "k8s_00361_code_4052"}
{"instruction": "What is the reference documentation for node labels populated by the kubelet?", "response": "Node Labels Populated By The KubeletKubernetes nodes come pre-populated with a standard set of labels.You can also set your own labels on nodes, either through the kubelet configuration or using the Kubernetes API.Preset labelsThe preset labels that Kubernetes sets on nodes are:kubernetes.io/archkubernetes.io/hostnamekubernetes.io/osnode.kubernetes.io/instance-type (if known to the kubelet – Kubernetes may not have this information to set the label)topology.kubernetes.io/region (if known to the kubelet – Kubernetes may not have this information to set the label)topology.kubernetes.io/zone (if known to the kubelet – Kubernetes may not have this information to set the label)Note:The value of these labels is cloud provider specific and is not guaranteed to be reliable. For example, the value of kubernetes.io/hostname may be the same as the node name in some environments and a different value in other environments.What's nextSee Well-Known Labels, Annotations and Taints for a list of common labels.Learn how to add a label to a node.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/node-labels/", "id": "k8s_00362"}
{"instruction": "Explain the Kubernetes concept: Swap memory management", "response": "Swap memory managementKubernetes can be configured to use swap memory on a node, allowing the kernel to free up physical memory by swapping out pages to backing storage. This is useful for multiple use-cases. For example, nodes running workloads that can benefit from using swap, such as those that have large memory footprints but only access a portion of that memory at any given time. It also helps prevent Pods from being terminated during memory pressure spikes, shields nodes from system-level memory spikes that might compromise its stability, allows for more flexible memory management on the node, and much more.To learn about configuring swap in your cluster, read Configuring swap memory on Kubernetes nodes.Operating system supportLinux nodes support swap; you need to configure each node to enable it. By default, the kubelet will not start on a Linux node that has swap enabled.Windows nodes require swap space. By default, the kubelet does not start on a Windows node that has swap disabled.How does it work?There are a number of possible ways that one could envision swap use on a node. If kubelet is already running on a node, it would need to be restarted after swap is provisioned in order to identify it.When kubelet starts on a node in which swap is provisioned and available (with the failSwapOn: false configuration), kubelet will:Be able to start on this swap-enabled node.Direct the Container Runtime Interface (CRI) implementation, often referred to as the container runtime, to allocate zero swap memory to Kubernetes workloads by default.Swap configuration on a node is exposed to a cluster admin via the memorySwap in the KubeletConfiguration. As a cluster administrator, you can specify the node's behaviour in the presence of swap memory by setting memorySwap.swapBehavior.Swap behaviorsYou need to pick a swap behavior to use. Different nodes in your cluster can use different swap behaviors.The swap behaviors you can choose for Linux nodes are:NoSwap (default)Workloads running as Pods on this node do not and cannot use swap.LimitedSwapKubernetes workloads can utilize swap memory.Note:If you choose the NoSwap behavior, and you configure the kubelet to tolerate swap space (failSwapOn: false), then your workloads don't use any swap.However, processes outside of Kubernetes-managed containers, such as systemi services (and even the kubelet itself!) can utilize swap.You can read configuring swap memory on Kubernetes nodes to learn about enabling swap for your cluster.Container runtime integrationThe kubelet uses the container runtime API, and directs the container runtime to apply specific configuration (for example, in the cgroup v2 case, memory.swap.max) in a manner that will enable the desired swap configuration for a container. For runtimes that use control groups, or cgroups, the container runtime is then responsible for writing these settings to the container-level cgroup.Observability for swap useNode and container level metric statisticsKubelet now collects node and container level metric statistics, which can be accessed at the /metrics/resource (which is used mainly by monitoring tools like Prometheus) and /stats/summary (which is used mainly by Autoscalers) kubelet HTTP endpoints. This allows clients who can directly request the kubelet to monitor swap usage and remaining swap memory when using LimitedSwap. Additionally, a machine_swap_bytes metric has been added to cadvisor to show the total physical swap capacity of the machine. See this page for more info.For example, these /metrics/resource are supported:node_swap_usage_bytes: Current swap usage of the node in bytes.container_swap_usage_bytes: Current amount of the container swap usage in bytes.container_swap_limit_bytes: Current amount of the container swap limit in bytes.Using kubectl top --show-swapQuerying metrics is valuable, but somewhat cumbersome, as these metrics are designed to be used by software rather than humans. In order to consume this data in a more u", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4055"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -n kube-system --show-swap\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4056"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o go-template='{{range .items}}{{.metadata.name}}: {{if .status.nodeInfo.swap.capacity}}{{.status.nodeInfo.swap.capacity}}{{else}}<unknown>{{end}}{{\"\\n\"}}{{end}}'\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4057"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o jsonpath='{range .items[?(@.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap)]}{.metadata.name}{\"\\t\"}{.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap}{\"\\n\"}{end}'\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4058"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top --show-swap\n```\n\nSwap memory management | Querying metrics is valuable, but somewhat cumbersome, as these metrics are designed to be used by software rather than humans. In order to consume this data in a more user-friendly way, the kubectl t", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4059"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4060"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4061"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top --show-swap\n```\n\nSwap memory management | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4062"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4063"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -n kube-system --show-swap\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4064"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o go-template='{{range .items}}{{.metadata.name}}: {{if .status.nodeInfo.swap.capacity}}{{.status.nodeInfo.swap.capacity}}{{else}}<unknown>{{end}}{{\"\\n\"}}{{end}}'\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4065"}
{"instruction": "Write a bash example for swap memory management", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o jsonpath='{range .items[?(@.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap)]}{.metadata.name}{\"\\t\"}{.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap}{\"\\n\"}{end}'\n```\n\nSwap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/swap-memory-management/", "id": "k8s_00363_code_4066"}
{"instruction": "What is the reference documentation for kubectl config get-contexts?", "response": "kubectl config get-contextsSynopsisDisplay one or many contexts from the kubeconfig file.kubectl config get-contexts [(-o|--output=)name)] Examples # List all the contexts in your kubeconfig file kubectl config get-contexts # Describe one context in your kubeconfig file kubectl config get-contexts my-context Options-h, --helphelp for get-contexts--no-headersWhen using the default or custom-column output format, don't print headers (default print headers).-o, --output stringOutput format. One of: (name).Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-contexts/", "id": "k8s_00364"}
{"instruction": "Write a bash example for kubectl config get-contexts", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts [(-o|--output=)name)]\n```\n\nkubectl config get-contexts | help for get-contexts", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-contexts/", "id": "k8s_00364_code_4068"}
{"instruction": "Write a bash example for kubectl config get-contexts", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts [(-o|--output=)name)]\n```\n\nkubectl config get-contexts | help for get-contexts", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-contexts/", "id": "k8s_00364_code_4069"}
{"instruction": "What is the reference documentation for kubectl apply edit-last-applied?", "response": "kubectl apply edit-last-appliedSynopsisEdit the latest last-applied-configuration annotations of resources from the default editor.The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows. You can edit multiple objects, although changes are applied one at a time. The command accepts file names as well as command-line arguments, although the files you point to must be previously saved versions of resources.The default format is YAML. To edit in JSON, specify \"-o json\".The flag --windows-line-endings can be used to force Windows line endings, otherwise the default for your operating system will be used.In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version.kubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME) Examples # Edit the last-applied-configuration annotations by type/name in YAML kubectl apply edit-last-applied deployment/nginx # Edit the last-applied-configuration annotations by file in JSON kubectl apply edit-last-applied -f deploy.yaml -o json Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--field-manager string Default: \"kubectl-client-side-apply\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files to use to edit the resource-h, --helphelp for edit-last-applied-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.--windows-line-endingsDefaults to the line ending native to your platform.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfi", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_edit-last-applied/", "id": "k8s_00365"}
{"instruction": "Write a bash example for kubectl apply edit-last-applied", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME)\n```\n\nkubectl apply edit-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_edit-last-applied/", "id": "k8s_00365_code_4071"}
{"instruction": "Write a bash example for kubectl apply edit-last-applied", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME)\n```\n\nkubectl apply edit-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_edit-last-applied/", "id": "k8s_00365_code_4072"}
{"instruction": "Explain generating reference documentation for kubectl commands in Kubernetes", "response": "Generating Reference Documentation for kubectl CommandsThis page shows how to generate the kubectl command reference.Note:This topic shows how to generate reference documentation for kubectl commands like kubectl apply and kubectl taint. This topic does not show how to generate the kubectl options reference page. For instructions on how to generate the kubectl options reference page, see Generating Reference Pages for Kubernetes Components and Tools.Before you beginRequirements:You need a machine that is running Linux or macOS.You need to have these tools installed:Python v3.7.x+GitGolang version 1.13+Pip used to install PyYAMLPyYAML v5.1.2makegcc compiler/linkerDocker (Required only for kubectl command reference)Your PATH environment variable must include the required build tools, such as the Go binary and python.You need to know how to create a pull request to a GitHub repository. This involves creating your own fork of the repository. For more information, see Work from a local clone.Set up the local repositoriesCreate a local workspace and set your GOPATH:mkdir -p $HOME/<workspace> export GOPATH=$HOME/<workspace> Get a local clone of the following repositories:go get -u github.com/spf13/pflag go get -u github.com/spf13/cobra go get -u gopkg.in/yaml.v2 go get -u github.com/kubernetes-sigs/reference-docs If you don't already have the kubernetes/website repository, get it now:git clone https://github.com/<your-username>/website $GOPATH/src/github.com/<your-username>/website Get a clone of the kubernetes/kubernetes repository as k8s.io/kubernetes:git clone https://github.com/kubernetes/kubernetes $GOPATH/src/k8s.io/kubernetes Remove the spf13 package from $GOPATH/src/k8s.io/kubernetes/vendor/github.com:rm -rf $GOPATH/src/k8s.io/kubernetes/vendor/github.com/spf13 The kubernetes/kubernetes repository provides the kubectl and kustomize source code.Determine the base directory of your clone of the kubernetes/kubernetes repository. For example, if you followed the preceding step to get the repository, your base directory is $GOPATH/src/k8s.io/kubernetes. The remaining steps refer to your base directory as <k8s-base>.Determine the base directory of your clone of the kubernetes/website repository. For example, if you followed the preceding step to get the repository, your base directory is $GOPATH/src/github.com/<your-username>/website. The remaining steps refer to your base directory as <web-base>.Determine the base directory of your clone of the kubernetes-sigs/reference-docs repository. For example, if you followed the preceding step to get the repository, your base directory is $GOPATH/src/github.com/kubernetes-sigs/reference-docs. The remaining steps refer to your base directory as <rdocs-base>.In your local k8s.io/kubernetes repository, check out the branch of interest, and make sure it is up to date. For example, if you want to generate docs for Kubernetes 1.33.0, you could use these commands:cd <k8s-base> git checkout v1.33.0 git pull https://github.com/kubernetes/kubernetes 1.33.0 If you do not need to edit the kubectl source code, follow the instructions for Setting build variables.Edit the kubectl source codeThe kubectl command reference documentation is automatically generated from the kubectl source code. If you want to change the reference documentation, the first step is to change one or more comments in the kubectl source code. Make the change in your local kubernetes/kubernetes repository, and then submit a pull request to the master branch of github.com/kubernetes/kubernetes.PR 56673 is an example of a pull request that fixes a typo in the kubectl source code.Monitor your pull request, and respond to reviewer comments. Continue to monitor your pull request until it is merged into the target branch of the kubernetes/kubernetes repository.Cherry pick your change into a release branchYour change is now in the master branch, which is used for development of the next Kubernetes release. If you want your change to appear ", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/kubectl/", "id": "k8s_00366"}
{"instruction": "How do you generate certificates manually in Kubernetes?", "response": "Generate Certificates ManuallyWhen using client certificate authentication, you can generate certificates manually through easyrsa, openssl or cfssl.easyrsaeasyrsa can manually generate certificates for your cluster.Download, unpack, and initialize the patched version of easyrsa3.curl -LO https://dl.k8s.io/easy-rsa/easy-rsa.tar.gz tar xzf easy-rsa.tar.gz cd easy-rsa-master/easyrsa3 ./easyrsa init-pki Generate a new certificate authority (CA). --batch sets automatic mode; --req-cn specifies the Common Name (CN) for the CA's new root certificate../easyrsa --batch \"--req-cn=${MASTER_IP}@`date +%s`\" build-ca nopass Generate server certificate and key.The argument --subject-alt-name sets the possible IPs and DNS names the API server will be accessed with. The MASTER_CLUSTER_IP is usually the first IP from the service CIDR that is specified as the --service-cluster-ip-range argument for both the API server and the controller manager component. The argument --days is used to set the number of days after which the certificate expires. The sample below also assumes that you are using cluster.local as the default DNS domain name../easyrsa --subject-alt-name=\"IP:${MASTER_IP},\"\\ \"IP:${MASTER_CLUSTER_IP},\"\\ \"DNS:kubernetes,\"\\ \"DNS:kubernetes.default,\"\\ \"DNS:kubernetes.default.svc,\"\\ \"DNS:kubernetes.default.svc.cluster,\"\\ \"DNS:kubernetes.default.svc.cluster.local\" \\ --days=10000 \\ build-server-full server nopass Copy pki/ca.crt, pki/issued/server.crt, and pki/private/server.key to your directory.Fill in and add the following parameters into the API server start parameters:--client-ca-file=/yourdirectory/ca.crt --tls-cert-file=/yourdirectory/server.crt --tls-private-key-file=/yourdirectory/server.key opensslopenssl can manually generate certificates for your cluster.Generate a ca.key with 2048bit:openssl genrsa -out ca.key 2048 According to the ca.key generate a ca.crt (use -days to set the certificate effective time):openssl req -x509 -new -nodes -key ca.key -subj \"/CN=${MASTER_IP}\" -days 10000 -out ca.crt Generate a server.key with 2048bit:openssl genrsa -out server.key 2048 Create a config file for generating a Certificate Signing Request (CSR).Be sure to substitute the values marked with angle brackets (e.g. <MASTER_IP>) with real values before saving this to a file (e.g. csr.conf). Note that the value for MASTER_CLUSTER_IP is the service cluster IP for the API server as described in previous subsection. The sample below also assumes that you are using cluster.local as the default DNS domain name.[ req ] default_bits = 2048 prompt = no default_md = sha256 req_extensions = req_ext distinguished_name = dn [ dn ] C = <country> ST = <state> L = <city> O = <organization> OU = <organization unit> CN = <MASTER_IP> [ req_ext ] subjectAltName = @alt_names [ alt_names ] DNS.1 = kubernetes DNS.2 = kubernetes.default DNS.3 = kubernetes.default.svc DNS.4 = kubernetes.default.svc.cluster DNS.5 = kubernetes.default.svc.cluster.local IP.1 = <MASTER_IP> IP.2 = <MASTER_CLUSTER_IP> [ v3_ext ] authorityKeyIdentifier=keyid,issuer:always basicConstraints=CA:FALSE keyUsage=keyEncipherment,dataEncipherment extendedKeyUsage=serverAuth,clientAuth subjectAltName=@alt_names Generate the certificate signing request based on the config file:openssl req -new -key server.key -out server.csr -config csr.conf Generate the server certificate using the ca.key, ca.crt and server.csr:openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key \\ -CAcreateserial -out server.crt -days 10000 \\ -extensions v3_ext -extfile csr.conf -sha256 View the certificate signing request:openssl req -noout -text -in ./server.csr View the certificate:openssl x509 -noout -text -in ./server.crt Finally, add the same parameters into the API server start parameters.cfsslcfssl is another tool for certificate generation.Download, unpack and prepare the command line tools as shown below.Note that you may need to adapt the sample commands based on the hardware architecture and cfssl version you are usin", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/certificates/", "id": "k8s_00367"}
{"instruction": "How do you create static pods in Kubernetes?", "response": "Create static PodsStatic Pods are managed directly by the kubelet daemon on a specific node, without the API server observing them. Unlike Pods that are managed by the control plane (for example, a Deployment); instead, the kubelet watches each static Pod (and restarts it if it fails).Static Pods are always bound to one Kubelet on a specific node.The kubelet automatically tries to create a mirror Pod on the Kubernetes API server for each static Pod. This means that the Pods running on a node are visible on the API server, but cannot be controlled from there. The Pod names will be suffixed with the node hostname with a leading hyphen.Note:If you are running clustered Kubernetes and are using static Pods to run a Pod on every node, you should probably be using a DaemonSet instead.Note:The spec of a static Pod cannot refer to other API objects (e.g., ServiceAccount, ConfigMap, Secret, etc).Note:Static pods do not support ephemeral containers.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.This page assumes you're using CRI-O to run Pods, and that your nodes are running the Fedora operating system. Instructions for other distributions or Kubernetes installations may vary.Create a static podYou can configure a static Pod with either a file system hosted configuration file or a web hosted configuration file.Filesystem-hosted static Pod manifestManifests are standard Pod definitions in JSON or YAML format in a specific directory. Use the staticPodPath: <the directory> field in the kubelet configuration file, which periodically scans the directory and creates/deletes static Pods as YAML/JSON files appear/disappear there. Note that the kubelet will ignore files starting with dots when scanning the specified directory.For example, this is how to start a simple web server as a static Pod:Choose a node where you want to run the static Pod. In this example, it's my-node1.ssh my-node1 Choose a directory, say /etc/kubernetes/manifests and place a web server Pod definition there, for example /etc/kubernetes/manifests/static-web.yaml:# Run this command on the node where kubelet is running mkdir -p /etc/kubernetes/manifests/ cat <<EOF >/etc/kubernetes/manifests/static-web.yaml apiVersion: v1 kind: Pod metadata: name: static-web labels: role: myrole spec: containers: - name: web image: nginx ports: - name: web containerPort: 80 protocol: TCP EOF Configure the kubelet on that node to set a staticPodPath value in the kubelet configuration file.See Set Kubelet Parameters Via A Configuration File for more information.An alternative and deprecated method is to configure the kubelet on that node to look for static Pod manifests locally, using a command line argument. To use the deprecated approach, start the kubelet with the--pod-manifest-path=/etc/kubernetes/manifests/ argument.Restart the kubelet. On Fedora, you would run:# Run this command on the node where the kubelet is running systemctl restart kubelet Web-hosted static pod manifestKubelet periodically downloads a file specified by --manifest-url=<URL> argument and interprets it as a JSON/YAML file that contains Pod definitions. Similar to how filesystem-hosted manifests work, the kubelet refetches the manifest on a schedule. If there are changes to the list of static Pods, the kubelet applies them.To use this approach:Create a YAML file and store it on a web server so that you can pass the URL of that file to the kubelet.apiVersion: v1 kind: Pod metadata: name: static-web labels: role: myrole spec: containers: - name: web image: nginx ports: - name: web containerPort:", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368"}
{"instruction": "Write a yaml example for create static pods", "response": "Here's a yaml example:\n\n```yaml\n# Run this command on the node where kubelet is running\nmkdir -p /etc/kubernetes/manifests/\ncat <<EOF >/etc/kubernetes/manifests/static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\nCreate static Pods | Configure the kubelet on that node to set a staticPodPath value in the kubelet configuration file.See Set Kubelet Parameters Via A Configuration File for more information.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4076"}
{"instruction": "Write a yaml example for create static pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\nCreate static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4077"}
{"instruction": "Write a bash example for create static pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod static-web-my-node1\n```\n\nCreate static Pods | You can see that the Pod is still running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4078"}
{"instruction": "Write a yaml example for create static pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\nCreate static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4079"}
{"instruction": "Write a bash example for create static pods", "response": "Here's a bash example:\n\n```bash\ndocker.io/library/nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31\n```\n\nCreate static Pods | You can see the mirror Pod on the API server:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4080"}
{"instruction": "Write a yaml example for create static pods", "response": "Here's a yaml example:\n\n```yaml\n# Run this command on the node where kubelet is running\nmkdir -p /etc/kubernetes/manifests/\ncat <<EOF >/etc/kubernetes/manifests/static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\nCreate static Pods | Configure the kubelet on that node to set a staticPodPath value in the kubelet configuration file.See Set Kubelet Parameters Via A Configuration File for more information.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4081"}
{"instruction": "Write a yaml example for create static pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\nCreate static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4082"}
{"instruction": "Write a bash example for create static pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod static-web-my-node1\n```\n\nCreate static Pods | You can see that the Pod is still running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/", "id": "k8s_00368_code_4083"}
{"instruction": "Provide a tutorial on updating configuration via a configmap", "response": "Updating Configuration via a ConfigMapThis page provides a step-by-step example of updating configuration within a Pod via a ConfigMap and builds upon the Configure a Pod to Use a ConfigMap task.At the end of this tutorial, you will understand how to change the configuration for a running application.This tutorial uses the alpine and nginx images as examples.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou need to have the curl command-line tool for making HTTP requests from the terminal or command prompt. If you do not have curl available, you can install it. Check the documentation for your local operating system.ObjectivesUpdate configuration via a ConfigMap mounted as a VolumeUpdate environment variables of a Pod via a ConfigMapUpdate configuration via a ConfigMap in a multi-container PodUpdate configuration via a ConfigMap in a Pod possessing a Sidecar ContainerUpdate configuration via a ConfigMap mounted as a VolumeUse the kubectl create configmap command to create a ConfigMap from literal values:kubectl create configmap sport --from-literal=sport=football Below is an example of a Deployment manifest with the ConfigMap sport mounted as a volume into the Pod's only container.deployments/deployment-with-configmap-as-volume.yaml apiVersion: apps/v1 kind: Deployment metadata: name: configmap-volume labels: app.kubernetes.io/name: configmap-volume spec: replicas: 3 selector: matchLabels: app.kubernetes.io/name: configmap-volume template: metadata: labels: app.kubernetes.io/name: configmap-volume spec: containers: - name: alpine image: alpine:3 command: - /bin/sh - -c - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\"; sleep 10; done; ports: - containerPort: 80 volumeMounts: - name: config-volume mountPath: /etc/config volumes: - name: config-volume configMap: name: sportCreate the Deployment:kubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-volume.yaml Check the pods for this Deployment to ensure they are ready (matching by selector):kubectl get pods --selector=app.kubernetes.io/name=configmap-volume You should see an output similar to:NAME READY STATUS RESTARTS AGE configmap-volume-6b976dfdcf-qxvbm 1/1 Running 0 72s configmap-volume-6b976dfdcf-skpvm 1/1 Running 0 72s configmap-volume-6b976dfdcf-tbc6r 1/1 Running 0 72s On each node where one of these Pods is running, the kubelet fetches the data for that ConfigMap and translates it to files in a local volume. The kubelet then mounts that volume into the container, as specified in the Pod template. The code running in that container loads the information from the file and uses it to print a report to stdout. You can check this report by viewing the logs for one of the Pods in that Deployment:# Pick one Pod that belongs to the Deployment, and view its logs kubectl logs deployments/configmap-volume You should see an output similar to:Found 3 pods, using pod/configmap-volume-76d9c5678f-x5rgj Thu Jan 4 14:06:46 UTC 2024 My preferred sport is football Thu Jan 4 14:06:56 UTC 2024 My preferred sport is football Thu Jan 4 14:07:06 UTC 2024 My preferred sport is football Thu Jan 4 14:07:16 UTC 2024 My preferred sport is football Thu Jan 4 14:07:26 UTC 2024 My preferred sport is football Edit the ConfigMap:kubectl edit configmap sport In the editor that appears, change the value of key sport from football to cricket. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).Here's an example of how that manifest could look after you edit it:apiVersion: v1 data: sport: cricket kind: ConfigMap # You", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap sport --from-literal=sport=football\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the ConfigMap sport mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4085"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4086"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-volume.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4087"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4088"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap sport\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key sport from football to cricket. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4089"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  sport: cricket\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T14:05:06Z\"\n  name: sport\n  namespace: default\n  resourceVersion: \"1743935\"\n  uid: 024ee001-fe72-487e-872e-34d6464a8a23\n```\n\nUpdating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4090"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployments/configmap-volume --follow\n```\n\nUpdating Configuration via a ConfigMap | After few seconds, you should see the log output change as follows:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4091"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap fruits --from-literal=fruits=apples\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with an environment variable configured via the ConfigMap fruits.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4092"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4093"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-envvar.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4094"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4095"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4096"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap fruits\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key fruits from apples to mangoes. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4097"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  fruits: mangoes\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T16:04:19Z\"\n  name: fruits\n  namespace: default\n  resourceVersion: \"1749472\"\n```\n\nUpdating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4098"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4099"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | The rollout causes Kubernetes to make a new ReplicaSet for the Deployment; that means the existing Pods eventually terminate, and new ones are created. After few seconds, you should see an output simi", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4100"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=red\n```\n\nUpdating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with two containers. The two containers share an emptyDir volume that they use to communicate. The first container runs a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4101"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4102"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-two-containers.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4103"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-two-containers\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4104"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-two-containers --name=configmap-service --port=8080 --target-port=80\n```\n\nUpdating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4105"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key color from red to blue. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4106"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: blue\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-05T08:12:05Z\"\n  name: color\n  namespace: configmap\n  resourceVersion: \"1801272\"\n  uid: 80d33e4a-cbb4-4bc9-ba8c-544c68e425d6\n```\n\nUpdating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4107"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=blue\n```\n\nUpdating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with a main container and a sidecar container. The two containers share an emptyDir volume that they use to communicate.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4108"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4109"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-and-sidecar-container.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4110"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-sidecar-container\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4111"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-sidecar-container --name=configmap-sidecar-service --port=8081 --target-port=80\n```\n\nUpdating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4112"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key color from blue to green. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4113"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: green\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-02-17T12:20:30Z\"\n  name: color\n  namespace: default\n  resourceVersion: \"1054\"\n  uid: e40bb34c-58df-4280-8bea-6ed16edccfaa\n```\n\nUpdating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4114"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4115"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/immutable-configmap.yaml\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the Immutable ConfigMap company-name-20150801 mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4116"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4117"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-immutable-configmap-as-volume.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4118"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4119"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4120"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/new-immutable-configmap.yaml\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4121"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\nUpdating Configuration via a ConfigMap | You should see an output displaying both the old and new ConfigMaps:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4122"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment immutable-configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, update the existing volume definition to use the new ConfigMap.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4123"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | You should eventually see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4124"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Changes to a ConfigMap mounted as a Volume on a Pod are available seamlessly after the subsequent kubelet sync.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4125"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment configmap-volume configmap-env-var configmap-two-containers configmap-sidecar-container immutable-configmap-volume\nkubectl delete service configmap-service configmap-sidecar-service\nkubectl delete configmap sport fruits color company-name-20240312\n\nkubectl delete configmap company-name-20150801 # In case it was not handled during the task execution\n```\n\nUpdating Configuration via a ConfigMap |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4126"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the ConfigMap sport mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4127"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4128"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  sport: cricket\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T14:05:06Z\"\n  name: sport\n  namespace: default\n  resourceVersion: \"1743935\"\n  uid: 024ee001-fe72-487e-872e-34d6464a8a23\n```\n\nUpdating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4129"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with an environment variable configured via the ConfigMap fruits.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4130"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4131"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  fruits: mangoes\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T16:04:19Z\"\n  name: fruits\n  namespace: default\n  resourceVersion: \"1749472\"\n```\n\nUpdating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4132"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nUpdating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with two containers. The two containers share an emptyDir volume that they use to communicate. The first container runs a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4133"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4134"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: blue\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-05T08:12:05Z\"\n  name: color\n  namespace: configmap\n  resourceVersion: \"1801272\"\n  uid: 80d33e4a-cbb4-4bc9-ba8c-544c68e425d6\n```\n\nUpdating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4135"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nUpdating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with a main container and a sidecar container. The two containers share an emptyDir volume that they use to communicate.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4136"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4137"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: green\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-02-17T12:20:30Z\"\n  name: color\n  namespace: default\n  resourceVersion: \"1054\"\n  uid: e40bb34c-58df-4280-8bea-6ed16edccfaa\n```\n\nUpdating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4138"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4139"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4140"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4141"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\nvolumes:\n- configMap:\n    defaultMode: 420\n    name: company-name-20240312 # Update this field\n  name: config-volume\n```\n\nUpdating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4142"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap sport --from-literal=sport=football\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the ConfigMap sport mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4143"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-as-volume.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4144"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4145"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-volume.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4146"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4147"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap sport\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key sport from football to cricket. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4148"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  sport: cricket\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T14:05:06Z\"\n  name: sport\n  namespace: default\n  resourceVersion: \"1743935\"\n  uid: 024ee001-fe72-487e-872e-34d6464a8a23\n```\n\nUpdating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4149"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployments/configmap-volume --follow\n```\n\nUpdating Configuration via a ConfigMap | After few seconds, you should see the log output change as follows:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4150"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap fruits --from-literal=fruits=apples\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with an environment variable configured via the ConfigMap fruits.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4151"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-as-envvar.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4152"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4153"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-envvar.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4154"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4155"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4156"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap fruits\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key fruits from apples to mangoes. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4157"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  fruits: mangoes\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T16:04:19Z\"\n  name: fruits\n  namespace: default\n  resourceVersion: \"1749472\"\n```\n\nUpdating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4158"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4159"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\nUpdating Configuration via a ConfigMap | The rollout causes Kubernetes to make a new ReplicaSet for the Deployment; that means the existing Pods eventually terminate, and new ones are created. After few seconds, you should see an output simi", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4160"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=red\n```\n\nUpdating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with two containers. The two containers share an emptyDir volume that they use to communicate. The first container runs a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4161"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-two-containers.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4162"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4163"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-two-containers.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4164"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-two-containers\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4165"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-two-containers --name=configmap-service --port=8080 --target-port=80\n```\n\nUpdating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4166"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key color from red to blue. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4167"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: blue\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-05T08:12:05Z\"\n  name: color\n  namespace: configmap\n  resourceVersion: \"1801272\"\n  uid: 80d33e4a-cbb4-4bc9-ba8c-544c68e425d6\n```\n\nUpdating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4168"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=blue\n```\n\nUpdating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with a main container and a sidecar container. The two containers share an emptyDir volume that they use to communicate.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4169"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-and-sidecar-container.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4170"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4171"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-and-sidecar-container.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4172"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-sidecar-container\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4173"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-sidecar-container --name=configmap-sidecar-service --port=8081 --target-port=80\n```\n\nUpdating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4174"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, change the value of key color from blue to green. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4175"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: green\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-02-17T12:20:30Z\"\n  name: color\n  namespace: default\n  resourceVersion: \"1054\"\n  uid: e40bb34c-58df-4280-8bea-6ed16edccfaa\n```\n\nUpdating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4176"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/immutable-configmap.yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4177"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4178"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/immutable-configmap.yaml\n```\n\nUpdating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the Immutable ConfigMap company-name-20150801 mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4179"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-immutable-configmap-as-volume.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4180"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4181"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-immutable-configmap-as-volume.yaml\n```\n\nUpdating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4182"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4183"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/new-immutable-configmap.yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4184"}
{"instruction": "Write a yaml example for updating configuration via a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4185"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/new-immutable-configmap.yaml\n```\n\nUpdating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4186"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\nUpdating Configuration via a ConfigMap | You should see an output displaying both the old and new ConfigMaps:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4187"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment immutable-configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | In the editor that appears, update the existing volume definition to use the new ConfigMap.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4188"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\nUpdating Configuration via a ConfigMap | You should eventually see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4189"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap company-name-20150801\n```\n\nUpdating Configuration via a ConfigMap | Changes to a ConfigMap mounted as a Volume on a Pod are available seamlessly after the subsequent kubelet sync.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4190"}
{"instruction": "Write a bash example for updating configuration via a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment configmap-volume configmap-env-var configmap-two-containers configmap-sidecar-container immutable-configmap-volume\nkubectl delete service configmap-service configmap-sidecar-service\nkubectl delete configmap sport fruits color company-name-20240312\n\nkubectl delete configmap company-name-20150801 # In case it was not handled during the task execution\n```\n\nUpdating Configuration via a ConfigMap |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/updating-configuration-via-a-configmap/", "id": "k8s_00369_code_4191"}
{"instruction": "How do you use calico for networkpolicy in Kubernetes?", "response": "Use Calico for NetworkPolicyThis page shows a couple of quick ways to create a Calico cluster on Kubernetes.Before you beginDecide whether you want to deploy a cloud or local cluster.Creating a Calico cluster with Google Kubernetes Engine (GKE)Prerequisite: gcloud.To launch a GKE cluster with Calico, include the --enable-network-policy flag.Syntaxgcloud container clusters create [CLUSTER_NAME] --enable-network-policy Examplegcloud container clusters create my-calico-cluster --enable-network-policy To verify the deployment, use the following command.kubectl get pods --namespace=kube-system The Calico pods begin with calico. Check to make sure each one has a status of Running.Creating a local Calico cluster with kubeadmTo get a local single-host Calico cluster in fifteen minutes using kubeadm, refer to the Calico Quickstart.What's nextOnce your cluster is running, you can follow the Declare Network Policy to try out Kubernetes NetworkPolicy.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/calico-network-policy/", "id": "k8s_00370"}
{"instruction": "Write a bash example for use calico for networkpolicy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\nUse Calico for NetworkPolicy | The Calico pods begin with calico. Check to make sure each one has a status of Running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/calico-network-policy/", "id": "k8s_00370_code_4193"}
{"instruction": "Write a bash example for use calico for networkpolicy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\nUse Calico for NetworkPolicy | The Calico pods begin with calico. Check to make sure each one has a status of Running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/calico-network-policy/", "id": "k8s_00370_code_4194"}
{"instruction": "Explain the Kubernetes concept: IPv4/IPv6 dual-stack", "response": "IPv4/IPv6 dual-stackKubernetes lets you configure single-stack IPv4 networking, single-stack IPv6 networking, or dual stack networking with both network families active. This page explains how.FEATURE STATE: Kubernetes v1.23 [stable]IPv4/IPv6 dual-stack networking enables the allocation of both IPv4 and IPv6 addresses to Pods and Services.IPv4/IPv6 dual-stack networking is enabled by default for your Kubernetes cluster starting in 1.21, allowing the simultaneous assignment of both IPv4 and IPv6 addresses.Supported FeaturesIPv4/IPv6 dual-stack on your Kubernetes cluster provides the following features:Dual-stack Pod networking (a single IPv4 and IPv6 address assignment per Pod)IPv4 and IPv6 enabled ServicesPod off-cluster egress routing (eg. the Internet) via both IPv4 and IPv6 interfacesPrerequisitesThe following prerequisites are needed in order to utilize IPv4/IPv6 dual-stack Kubernetes clusters:Kubernetes 1.20 or laterFor information about using dual-stack services with earlier Kubernetes versions, refer to the documentation for that version of Kubernetes.Provider support for dual-stack networking (Cloud provider or otherwise must be able to provide Kubernetes nodes with routable IPv4/IPv6 network interfaces)A network plugin that supports dual-stack networking.Configure IPv4/IPv6 dual-stackTo configure IPv4/IPv6 dual-stack, set dual-stack cluster network assignments:kube-apiserver:--service-cluster-ip-range=<IPv4 CIDR>,<IPv6 CIDR>kube-controller-manager:--cluster-cidr=<IPv4 CIDR>,<IPv6 CIDR>--service-cluster-ip-range=<IPv4 CIDR>,<IPv6 CIDR>--node-cidr-mask-size-ipv4|--node-cidr-mask-size-ipv6 defaults to /24 for IPv4 and /64 for IPv6kube-proxy:--cluster-cidr=<IPv4 CIDR>,<IPv6 CIDR>kubelet:--node-ip=<IPv4 IP>,<IPv6 IP>This option is required for bare metal dual-stack nodes (nodes that do not define a cloud provider with the --cloud-provider flag). If you are using a cloud provider and choose to override the node IPs chosen by the cloud provider, set the --node-ip option.(The legacy built-in cloud providers do not support dual-stack --node-ip.)Note:An example of an IPv4 CIDR: 10.244.0.0/16 (though you would supply your own address range)An example of an IPv6 CIDR: fdXY:IJKL:MNOP:15::/64 (this shows the format but is not a valid address - see RFC 4193)ServicesYou can create Services which can use IPv4, IPv6, or both.The address family of a Service defaults to the address family of the first service cluster IP range (configured via the --service-cluster-ip-range flag to the kube-apiserver).When you define a Service you can optionally configure it as dual stack. To specify the behavior you want, you set the .spec.ipFamilyPolicy field to one of the following values:SingleStack: Single-stack service. The control plane allocates a cluster IP for the Service, using the first configured service cluster IP range.PreferDualStack: Allocates both IPv4 and IPv6 cluster IPs for the Service when dual-stack is enabled. If dual-stack is not enabled or supported, it falls back to single-stack behavior.RequireDualStack: Allocates Service .spec.clusterIPs from both IPv4 and IPv6 address ranges when dual-stack is enabled. If dual-stack is not enabled or supported, the Service API object creation fails.Selects the .spec.clusterIP from the list of .spec.clusterIPs based on the address family of the first element in the .spec.ipFamilies array.If you would like to define which IP family to use for single stack or define the order of IP families for dual-stack, you can choose the address families by setting an optional field, .spec.ipFamilies, on the Service.Note:The .spec.ipFamilies field is conditionally mutable: you can add or remove a secondary IP address family, but you cannot change the primary IP address family of an existing Service.You can set .spec.ipFamilies to any of the following array values:[\"IPv4\"][\"IPv6\"][\"IPv4\",\"IPv6\"] (dual stack)[\"IPv6\",\"IPv4\"] (dual stack)The first family you list is used for the legacy .spec.clusterIP field.Dual-", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4196"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4197"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4198"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4199"}
{"instruction": "Write a bash example for ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nIPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4200"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nIPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4201"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4202"}
{"instruction": "Write a bash example for ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nIPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4203"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\nIPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4204"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4205"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4206"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4207"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4208"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nIPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4209"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4210"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\nIPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4211"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ipFamilyPolicy: SingleStack\n```\n\nIPv4/IPv6 dual-stack | After:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4212"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ipFamilyPolicy: PreferDualStack\n```\n\nIPv4/IPv6 dual-stack | To change a Service from dual-stack to single-stack, change .spec.ipFamilyPolicy from PreferDualStack or RequireDualStack to SingleStack. When you change this Service from dual-stack to single-stack,", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4213"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4214"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4215"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4216"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4217"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-ipfamilies-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4218"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4219"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4220"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4221"}
{"instruction": "Write a bash example for ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nIPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4222"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nIPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4223"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4224"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nIPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4225"}
{"instruction": "Write a bash example for ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nIPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4226"}
{"instruction": "Write a yaml example for ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\nIPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/dual-stack/", "id": "k8s_00371_code_4227"}
{"instruction": "What is the reference documentation for persistentvolumeclaim?", "response": "PersistentVolumeClaimPersistentVolumeClaim is a user's request for and claim to a persistent volume.apiVersion: v1import \"k8s.io/api/core/v1\"PersistentVolumeClaimPersistentVolumeClaim is a user's request for and claim to a persistent volumeapiVersion: v1kind: PersistentVolumeClaimmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (PersistentVolumeClaimSpec)spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaimsstatus (PersistentVolumeClaimStatus)status represents the current information/status of a persistent volume claim. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaimsPersistentVolumeClaimSpecPersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributesaccessModes ([]string)Atomic: will be replaced during a mergeaccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1selector (LabelSelector)selector is a label query over volumes to consider for binding.resources (VolumeResourceRequirements)resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resourcesVolumeResourceRequirements describes the storage resource requirements for a volume.resources.limits (map[string]Quantity)Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/resources.requests (map[string]Quantity)Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/volumeName (string)volumeName is the binding reference to the PersistentVolume backing this claim.storageClassName (string)storageClassName is the name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1volumeMode (string)volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec.Beta leveldataSource (TypedLocalObjectReference)dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource.dataSourceRef (TypedObjectReference)dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, the", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-claim-v1/", "id": "k8s_00372"}
{"instruction": "Explain bootstrapping clusters with kubeadm in Kubernetes", "response": "Bootstrapping clusters with kubeadmInstalling kubeadmTroubleshooting kubeadmCreating a cluster with kubeadmCustomizing components with the kubeadm APIOptions for Highly Available TopologyCreating Highly Available Clusters with kubeadmSet up a High Availability etcd Cluster with kubeadmConfiguring each kubelet in your cluster using kubeadmDual-stack support with kubeadm", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/", "id": "k8s_00373"}
{"instruction": "Explain the Kubernetes concept: Jobs", "response": "JobsJobs represent one-off tasks that run to completion and then stop.A Job creates one or more Pods and will continue to retry execution of the Pods until a specified number of them successfully terminate. As pods successfully complete, the Job tracks the successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete. Deleting a Job will clean up the Pods it created. Suspending a Job will delete its active Pods until the Job is resumed again.A simple case is to create one Job object in order to reliably run one Pod to completion. The Job object will start a new Pod if the first Pod fails or is deleted (for example due to a node hardware failure or a node reboot).You can also use a Job to run multiple Pods in parallel.If you want to run a Job (either a single task, or several in parallel) on a schedule, see CronJob.Running an example JobHere is an example Job config. It computes π to 2000 places and prints it out. It takes around 10s to complete.controllers/job.yaml apiVersion: batch/v1 kind: Job metadata: name: pi spec: template: spec: containers: - name: pi image: perl:5.34.0 command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"] restartPolicy: Never backoffLimit: 4 You can run the example with this command:kubectl apply -f https://kubernetes.io/examples/controllers/job.yaml The output is similar to this:job.batch/pi created Check on the status of the Job with kubectl: Name: pi Namespace: default Selector: batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c Labels: batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c batch.kubernetes.io/job-name=pi ... Annotations: batch.kubernetes.io/job-tracking: \"\" Parallelism: 1 Completions: 1 Start Time: Mon, 02 Dec 2019 15:20:11 +0200 Completed At: Mon, 02 Dec 2019 15:21:16 +0200 Duration: 65s Pods Statuses: 0 Running / 1 Succeeded / 0 Failed Pod Template: Labels: batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c batch.kubernetes.io/job-name=pi Containers: pi: Image: perl:5.34.0 Port: <none> Host Port: <none> Command: perl -Mbignum=bpi -wle print bpi(2000) Environment: <none> Mounts: <none> Volumes: <none> Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal SuccessfulCreate 21s job-controller Created pod: pi-xf9p4 Normal Completed 18s job-controller Job completed apiVersion: batch/v1 kind: Job metadata: annotations: batch.kubernetes.io/job-tracking: \"\" ... creationTimestamp: \"2022-11-10T17:53:53Z\" generation: 1 labels: batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223 batch.kubernetes.io/job-name: pi name: pi namespace: default resourceVersion: \"4751\" uid: 204fb678-040b-497f-9266-35ffa8716d14 spec: backoffLimit: 4 completionMode: NonIndexed completions: 1 parallelism: 1 selector: matchLabels: batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223 suspend: false template: metadata: creationTimestamp: null labels: batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223 batch.kubernetes.io/job-name: pi spec: containers: - command: - perl - -Mbignum=bpi - -wle - print bpi(2000) image: perl:5.34.0 imagePullPolicy: IfNotPresent name: pi resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Never schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 status: active: 1 ready: 0 startTime: \"2022-11-10T17:53:57Z\" uncountedTerminatedPods: {} To view completed Pods of a Job, use kubectl get pods.To list all the Pods that belong to a Job in a machine readable form, you can use a command like this:pods=$(kubectl get pods --selector=batch.kubernetes.io/job-name=pi --output=jsonpath='{.items[*].metadata.name}') echo $pods The output is similar to this:pi-5rwd7 Here, the selector is the same as the selector for the Job. The --output=jsonpath option specifies an expression with the name from each Pod ", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\nJobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4231"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/job.yaml\n```\n\nJobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4232"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\nJobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4233"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\nJobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4234"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get -o yaml job job-backoff-limit-per-index-example\n```\n\nJobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4235"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\nJobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4236"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\nJobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4237"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\nJobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4238"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\nJobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4239"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get job myjob -o yaml\n```\n\nJobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4240"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\nJobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4241"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":true}}'\n```\n\nJobs | Resume a suspended Job:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4242"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":false}}'\n```\n\nJobs | The Job's status can be used to determine if a Job is suspended or has been suspended in the past:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4243"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\nJobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4244"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\nJobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4245"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/myjob\n```\n\nJobs | The last four events, particularly the \"Suspended\" and \"Resumed\" events, are directly a result of toggling the .spec.suspend field. In the time between these two events, we see that no Pods were creat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4246"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get job old -o yaml\n```\n\nJobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4247"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\nJobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4248"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\nJobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4249"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\nJobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4250"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\nJobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4251"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\nJobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4252"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\nJobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4253"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nName:           pi\nNamespace:      default\nSelector:       batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\nLabels:         batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\n                batch.kubernetes.io/job-name=pi\n                ...\nAnnotations:    batch.kubernetes.io/job-tracking: \"\"\nParallelism:    1\nCompletions:    1\nStart Time:     Mon, 02 Dec 2019 15:20:11 +0200\nCompleted At:   Mon, 02 Dec 2019 15:21:16 +0200\nDuration:       65s\nPods Statuses:  0 Running / 1 Succeeded / 0 Failed\nPod Template:\n  Labels:  batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\n           batch.kubernetes.io/job-name=pi\n  Containers:\n   pi:\n    Image:      perl:5.34.0\n    Port:       <none>\n    Host Port:  <none>\n    Command:\n      perl\n      -Mbignum=bpi\n      -wle\n      print bpi(2000)\n    Environment:  <none>\n    Mounts:       <none>\n  Volumes:        <none>\nEvents:\n  Type    Reason            Age   From            Message\n  ----    ------            ----  ----            -------\n  Normal  SuccessfulCreate  21s   job-controller  Created pod: pi-xf9p4\n  Normal  Completed         18s   job-controller  Job completed\n```\n\nJobs | apiVersion: batch/v1 kind: Job metadata: annotations: batch.kubernetes.io/job-tracking: \"\" ... creationTimestamp: \"2022-11-10T17:53:53Z\" generation: 1 labels: batch.kubernet", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4254"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\nJobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4255"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\nJobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4256"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n    completedIndexes: 1,3,5,7,9\n    failedIndexes: 0,2,4,6,8\n    succeeded: 5          # 1 succeeded pod for each of 5 succeeded indexes\n    failed: 10            # 2 failed pods (1 retry) for each of 5 failed indexes\n    conditions:\n    - message: Job has failed indexes\n      reason: FailedIndexes\n      status: \"True\"\n      type: FailureTarget\n    - message: Job has failed indexes\n      reason: FailedIndexes\n      status: \"True\"\n      type: Failed\n```\n\nJobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4257"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\nJobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4258"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\nJobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4259"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/pi\n```\n\nJobs | By default, a Job will run uninterrupted unless a Pod fails (restartPolicy=Never) or a Container exits in error (restartPolicy=OnFailure), at which point the Job defers to the .spec.backoffLimit descr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4260"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./job.yaml\n```\n\nJobs | By default, a Job will run uninterrupted unless a Pod fails (restartPolicy=Never) or a Container exits in error (restartPolicy=OnFailure), at which point the Job defers to the .spec.backoffLimit descr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4261"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\nJobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4262"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\nJobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4263"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\nJobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4264"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\nJobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4265"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/old --cascade=orphan\n```\n\nJobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4266"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\nJobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4267"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\nJobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4268"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\nJobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4269"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\nJobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4270"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\nJobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4271"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\nJobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4272"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/job.yaml\n```\n\nJobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4273"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\nJobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4274"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-backoff-limit-per-index-example.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\nJobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4275"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\nJobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4276"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get -o yaml job job-backoff-limit-per-index-example\n```\n\nJobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4277"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-example.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\nJobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4278"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\nJobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4279"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-success-policy.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\nJobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4280"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\nJobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4281"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\nJobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4282"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\nJobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4283"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get job myjob -o yaml\n```\n\nJobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4284"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\nJobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4285"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":true}}'\n```\n\nJobs | Resume a suspended Job:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4286"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":false}}'\n```\n\nJobs | The Job's status can be used to determine if a Job is suspended or has been suspended in the past:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4287"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\nJobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4288"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\nJobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4289"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/myjob\n```\n\nJobs | The last four events, particularly the \"Suspended\" and \"Resumed\" events, are directly a result of toggling the .spec.suspend field. In the time between these two events, we see that no Pods were creat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4290"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get job old -o yaml\n```\n\nJobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4291"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\nJobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4292"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\nJobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4293"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\nJobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4294"}
{"instruction": "Write a bash example for jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\nJobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4295"}
{"instruction": "Write a yaml example for jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\nJobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/job/", "id": "k8s_00374_code_4296"}
{"instruction": "What is the reference documentation for kubectl create poddisruptionbudget?", "response": "kubectl create poddisruptionbudgetSynopsisCreate a pod disruption budget with the specified name, selector, and desired minimum available pods.kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none] Examples # Create a pod disruption budget named my-pdb that will select all pods with the app=rails label # and require at least one of them being available at any point in time kubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1 # Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time kubectl create pdb my-pdb --selector=app=nginx --min-available=50% Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for poddisruptionbudget--max-unavailable stringThe maximum number or percentage of unavailable pods this budget requires.--min-available stringThe minimum number or percentage of available pods this budget requires.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--selector stringA label selector to use for this budget. Only equality-based selector requirements are supported.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_poddisruptionbudget/", "id": "k8s_00375"}
{"instruction": "Write a bash example for kubectl create poddisruptionbudget", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]\n```\n\nkubectl create poddisruptionbudget | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_poddisruptionbudget/", "id": "k8s_00375_code_4298"}
{"instruction": "Write a bash example for kubectl create poddisruptionbudget", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]\n```\n\nkubectl create poddisruptionbudget | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_poddisruptionbudget/", "id": "k8s_00375_code_4299"}
{"instruction": "How do you debug init containers in Kubernetes?", "response": "Debug Init ContainersThis page shows how to investigate problems related to the execution of Init Containers. The example command lines below refer to the Pod as <pod-name> and the Init Containers as <init-container-1> and <init-container-2>.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.You should be familiar with the basics of Init Containers.You should have Configured an Init Container.Checking the status of Init ContainersDisplay the status of your pod:kubectl get pod <pod-name> For example, a status of Init:1/2 indicates that one of two Init Containers has completed successfully:NAME READY STATUS RESTARTS AGE <pod-name> 0/1 Init:1/2 0 7s See Understanding Pod status for more examples of status values and their meanings.Getting details about Init ContainersView more detailed information about Init Container execution:kubectl describe pod <pod-name> For example, a Pod with two Init Containers might show the following:Init Containers: <init-container-1>: Container ID: ... ... State: Terminated Reason: Completed Exit Code: 0 Started: ... Finished: ... Ready: True Restart Count: 0 ... <init-container-2>: Container ID: ... ... State: Waiting Reason: CrashLoopBackOff Last State: Terminated Reason: Error Exit Code: 1 Started: ... Finished: ... Ready: False Restart Count: 3 ... You can also access the Init Container statuses programmatically by reading the status.initContainerStatuses field on the Pod Spec:kubectl get pod nginx --template '{{.status.initContainerStatuses}}' This command will return the same information as above in raw JSON.Accessing logs from Init ContainersPass the Init Container name along with the Pod name to access its logs.kubectl logs <pod-name> -c <init-container-2> Init Containers that run a shell script print commands as they're executed. For example, you can do this in Bash by running set -x at the beginning of the script.Understanding Pod statusA Pod status beginning with Init: summarizes the status of Init Container execution. The table below describes some example status values that you might see while debugging Init Containers.StatusMeaningInit:N/MThe Pod has M Init Containers, and N have completed so far.Init:ErrorAn Init Container has failed to execute.Init:CrashLoopBackOffAn Init Container has failed repeatedly.PendingThe Pod has not yet begun executing Init Containers.PodInitializing or RunningThe Pod has already finished executing Init Containers.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <pod-name>\n```\n\nDebug Init Containers | For example, a status of Init:1/2 indicates that one of two Init Containers has completed successfully:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4301"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\nDebug Init Containers | For example, a Pod with two Init Containers might show the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4302"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx --template '{{.status.initContainerStatuses}}'\n```\n\nDebug Init Containers | This command will return the same information as above in raw JSON.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4303"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl logs <pod-name> -c <init-container-2>\n```\n\nDebug Init Containers | Init Containers that run a shell script print commands as they're executed. For example, you can do this in Bash by running set -x at the beginning of the script.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4304"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <pod-name>\n```\n\nDebug Init Containers | For example, a status of Init:1/2 indicates that one of two Init Containers has completed successfully:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4305"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\nDebug Init Containers | For example, a Pod with two Init Containers might show the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4306"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx --template '{{.status.initContainerStatuses}}'\n```\n\nDebug Init Containers | This command will return the same information as above in raw JSON.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4307"}
{"instruction": "Write a bash example for debug init containers", "response": "Here's a bash example:\n\n```bash\nkubectl logs <pod-name> -c <init-container-2>\n```\n\nDebug Init Containers | Init Containers that run a shell script print commands as they're executed. For example, you can do this in Bash by running set -x at the beginning of the script.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-init-containers/", "id": "k8s_00376_code_4308"}
{"instruction": "Explain the Kubernetes concept: Service", "response": "ServiceExpose an application running in your cluster behind a single outward-facing endpoint, even when the workload is split across multiple backends.In Kubernetes, a Service is a method for exposing a network application that is running as one or more Pods in your cluster.A key aim of Services in Kubernetes is that you don't need to modify your existing application to use an unfamiliar service discovery mechanism. You can run code in Pods, whether this is a code designed for a cloud-native world, or an older app you've containerized. You use a Service to make that set of Pods available on the network so that clients can interact with it.If you use a Deployment to run your app, that Deployment can create and destroy Pods dynamically. From one moment to the", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\nService | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4310"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\nService | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4311"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\nService | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4312"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\nService | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4313"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\nService | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4314"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\nService | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4315"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\nService | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4316"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\nService | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4317"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\nService | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4318"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\nService | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4319"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\nService | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4320"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\nService | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4321"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\nService | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4322"}
{"instruction": "Write a bash example for service", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/<service-name> forwardedPort:servicePort\n```\n\nService | An ExternalName Service is a special case of Service that does not have selectors and uses DNS names instead. For more information, see the ExternalName section.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4323"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\nService | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4324"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\nService | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4325"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\nService | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4326"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    networking.gke.io/load-balancer-type: \"Internal\"\n```\n\nService | metadata: name: my-service annotations: service.beta.kubernetes.io/aws-load-balancer-internal: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4327"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/aws-load-balancer-internal: \"true\"\n```\n\nService | metadata: name: my-service annotations: service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4328"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"\n```\n\nService | metadata: name: my-service annotations: service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: \"private\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4329"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: \"private\"\n```\n\nService | metadata: name: my-service annotations: service.beta.kubernetes.io/openstack-internal-load-balancer: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4330"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/openstack-internal-load-balancer: \"true\"\n```\n\nService | metadata: name: my-service annotations: service.beta.kubernetes.io/cce-load-balancer-internal-vpc: \"true\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4331"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/cce-load-balancer-internal-vpc: \"true\"\n```\n\nService | metadata: annotations: service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxx", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4332"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  annotations:\n    service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxx\n```\n\nService | metadata: annotations: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: \"intranet\"", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4333"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  annotations:\n    service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: \"intranet\"\n```\n\nService | metadata: name: my-service annotations: service.beta.kubernetes.io/oci-load-balancer-internal: true", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4334"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/oci-load-balancer-internal: true\n```\n\nService | Services of type ExternalName map a Service to a DNS name, not to a typical selector such as my-service or cassandra. You specify these Services with the spec.externalName parameter.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4335"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\nService | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4336"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\nService | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4337"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\nservice/simple-service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\nService | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4338"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\nService | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4339"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\nService | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4340"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\nService | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4341"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\nService | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4342"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\nService | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4343"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\nService | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4344"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\nService | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4345"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\nService | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4346"}
{"instruction": "Write a yaml example for service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\nService | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/service/", "id": "k8s_00377_code_4347"}
{"instruction": "What is the reference documentation for kubectl config rename-context?", "response": "kubectl config rename-contextSynopsisRenames a context from the kubeconfig file.CONTEXT_NAME is the context name that you want to change.NEW_NAME is the new name you want to set.Note: If the context being renamed is the 'current-context', this field will also be updated.kubectl config rename-context CONTEXT_NAME NEW_NAME Examples # Rename the context 'old-name' to 'new-name' in your kubeconfig file kubectl config rename-context old-name new-name Options-h, --helphelp for rename-contextParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_rename-context/", "id": "k8s_00378"}
{"instruction": "Write a bash example for kubectl config rename-context", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context CONTEXT_NAME NEW_NAME\n```\n\nkubectl config rename-context | help for rename-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_rename-context/", "id": "k8s_00378_code_4349"}
{"instruction": "Write a bash example for kubectl config rename-context", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context CONTEXT_NAME NEW_NAME\n```\n\nkubectl config rename-context | help for rename-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_rename-context/", "id": "k8s_00378_code_4350"}
{"instruction": "What is the reference documentation for storageclass?", "response": "StorageClassStorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.apiVersion: storage.k8s.io/v1import \"k8s.io/api/storage/v1\"StorageClassStorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.apiVersion: storage.k8s.io/v1kind: StorageClassmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataprovisioner (string), requiredprovisioner indicates the type of the provisioner.allowVolumeExpansion (boolean)allowVolumeExpansion shows whether the storage class allow volume expand.allowedTopologies ([]TopologySelectorTerm)Atomic: will be replaced during a mergeallowedTopologies restrict the node topologies where volumes can be dynamically provisioned. Each volume plugin defines its own supported topology specifications. An empty TopologySelectorTerm list means there is no topology restriction. This field is only honored by servers that enable the VolumeScheduling feature.A topology selector term represents the result of label queries. A null or empty topology selector term matches no objects. The requirements of them are ANDed. It provides a subset of functionality as NodeSelectorTerm. This is an alpha feature and may change in the future.allowedTopologies.matchLabelExpressions ([]TopologySelectorLabelRequirement)Atomic: will be replaced during a mergeA list of topology selector requirements by labels.A topology selector requirement is a selector that matches given label. This is an alpha feature and may change in the future.allowedTopologies.matchLabelExpressions.key (string), requiredThe label key that the selector applies to.allowedTopologies.matchLabelExpressions.values ([]string), requiredAtomic: will be replaced during a mergeAn array of string values. One value must match the label to be selected. Each entry in Values is ORed.mountOptions ([]string)Atomic: will be replaced during a mergemountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. e.g. [\"ro\", \"soft\"]. Not validated - mount of the PVs will simply fail if one is invalid.parameters (map[string]string)parameters holds the parameters for the provisioner that should create volumes of this storage class.reclaimPolicy (string)reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. Defaults to Delete.volumeBindingMode (string)volumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is only honored by servers that enable the VolumeScheduling feature.StorageClassListStorageClassList is a collection of storage classes.apiVersion: storage.k8s.io/v1kind: StorageClassListmetadata (ListMeta)Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]StorageClass), requireditems is the list of StorageClassesOperationsget read the specified StorageClassHTTP RequestGET /apis/storage.k8s.io/v1/storageclasses/{name}Parametersname (in path): string, requiredname of the StorageClasspretty (in query): stringprettyResponse200 (StorageClass): OK401: Unauthorizedlist list or watch objects of kind StorageClassHTTP RequestGET /apis/storage.k8s.io/v1/storageclassesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertim", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/storage-class-v1/", "id": "k8s_00379"}
{"instruction": "Write a yaml example for storageclass", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\nStorageClass | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/storage-class-v1/", "id": "k8s_00379_code_4352"}
{"instruction": "What is the reference documentation for flowschema?", "response": "FlowSchemaFlowSchema defines the schema of a group of flows.apiVersion: flowcontrol.apiserver.k8s.io/v1import \"k8s.io/api/flowcontrol/v1\"FlowSchemaFlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a \"flow distinguisher\".apiVersion: flowcontrol.apiserver.k8s.io/v1kind: FlowSchemametadata (ObjectMeta)metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (FlowSchemaSpec)spec is the specification of the desired behavior of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (FlowSchemaStatus)status is the current status of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusFlowSchemaSpecFlowSchemaSpec describes how the FlowSchema's specification looks like.distinguisherMethod (FlowDistinguisherMethod)distinguisherMethod defines how to compute the flow distinguisher for requests that match this schema. nil specifies that the distinguisher is disabled and thus will always be the empty string.FlowDistinguisherMethod specifies the method of a flow distinguisher.distinguisherMethod.type (string), requiredtype is the type of flow distinguisher method The supported types are \"ByUser\" and \"ByNamespace\". Required.matchingPrecedence (int32)matchingPrecedence is used to choose among the FlowSchemas that match a given request. The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000]. Note that if the precedence is not specified, it will be set to 1000 as default.priorityLevelConfiguration (PriorityLevelConfigurationReference), requiredpriorityLevelConfiguration should reference a PriorityLevelConfiguration in the cluster. If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required.PriorityLevelConfigurationReference contains information that points to the \"request-priority\" being used.priorityLevelConfiguration.name (string), requiredname is the name of the priority level configuration being referenced Required.rules ([]PolicyRulesWithSubjects)Atomic: will be replaced during a mergerules describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema.PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request.rules.subjects ([]Subject), requiredAtomic: will be replaced during a mergesubjects is the list of normal user, serviceaccount, or group that this rule cares about. There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required.Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.rules.subjects.kind (string), requiredkind indicates which one of the other fields is non-empty. Requiredrules.subjects.group (GroupSubject)group matches based on user group name.GroupSubject holds detailed information for group-kind subject.rules.subjects.group.name (string), requiredname is the user group that matches, or \"*\" to match all user groups. Se", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/flow-schema-v1/", "id": "k8s_00380"}
{"instruction": "Write a yaml example for flowschema", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\n```\n\nFlowSchema | import \"k8s.io/api/flowcontrol/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/flow-schema-v1/", "id": "k8s_00380_code_4354"}
{"instruction": "How do you configure dns for a cluster in Kubernetes?", "response": "Configure DNS for a ClusterKubernetes offers a DNS cluster addon, which most of the supported environments enable by default. In Kubernetes version 1.11 and later, CoreDNS is recommended and is installed by default with kubeadm.For more information on how to configure CoreDNS for a Kubernetes cluster, see the Customizing DNS Service. An example demonstrating how to use Kubernetes DNS with kube-dns, see the Kubernetes DNS sample plugin.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/configure-dns-cluster/", "id": "k8s_00381"}
{"instruction": "Explain the Kubernetes concept: DaemonSet", "response": "DaemonSetA DaemonSet defines Pods that provide node-local facilities. These might be fundamental to the operation of your cluster, such as a networking helper tool, or be part of an add-on.A DaemonSet ensures that all (or some) Nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.Some typical uses of a DaemonSet are:running a cluster storage daemon on every noderunning a logs collection daemon on every noderunning a node monitoring daemon on every nodeIn a simple case, one DaemonSet, covering all nodes, would be used for each type of daemon. A more complex setup might use multiple DaemonSets for a single type of daemon, but with different flags and/or different memory and cpu requests for different hardware types.Writing a DaemonSet SpecCreate a DaemonSetYou can describe a DaemonSet in a YAML file. For example, the daemonset.yaml file below describes a DaemonSet that runs the fluentd-elasticsearch Docker image:controllers/daemonset.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: fluentd-elasticsearch namespace: kube-system labels: k8s-app: fluentd-logging spec: selector: matchLabels: name: fluentd-elasticsearch template: metadata: labels: name: fluentd-elasticsearch spec: tolerations: # these tolerations are to have the daemonset runnable on control plane nodes # remove them if your control plane nodes should not run pods - key: node-role.kubernetes.io/control-plane operator: Exists effect: NoSchedule - key: node-role.kubernetes.io/master operator: Exists effect: NoSchedule containers: - name: fluentd-elasticsearch image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1 resources: limits: memory: 200Mi requests: cpu: 100m memory: 200Mi volumeMounts: - name: varlog mountPath: /var/log # it may be desirable to set a high priority class to ensure that a DaemonSet Pod # preempts running Pods # priorityClassName: important terminationGracePeriodSeconds: 30 volumes: - name: varlog hostPath: path: /var/log Create a DaemonSet based on the YAML file:kubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml Required FieldsAs with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object management using kubectl.The name of a DaemonSet object must be a valid DNS subdomain name.A DaemonSet also needs a .spec section.Pod TemplateThe .spec.template is one of the required fields in .spec.The .spec.template is a pod template. It has exactly the same schema as a Pod, except it is nested and does not have an apiVersion or kind.In addition to required fields for a Pod, a Pod template in a DaemonSet has to specify appropriate labels (see pod selector).A Pod Template in a DaemonSet must have a RestartPolicy equal to Always, or be unspecified, which defaults to Always.Pod SelectorThe .spec.selector field is a pod selector. It works the same as the .spec.selector of a Job.You must specify a pod selector that matches the labels of the .spec.template. Also, once a DaemonSet is created, its .spec.selector can not be mutated. Mutating the pod selector can lead to the unintentional orphaning of Pods, and it was found to be confusing to users.The .spec.selector is an object consisting of two fields:matchLabels - works the same as the .spec.selector of a ReplicationController.matchExpressions - allows to build more sophisticated selectors by specifying key, list of values and an operator that relates the key and values.When the two are specified the result is ANDed.The .spec.selector must match the .spec.template.metadata.labels. Config with these two not matching will be rejected by the API.Running Pods on select NodesIf you specify a .spec.template.spec.nodeSelector, then the DaemonSet controller will create Pods on nodes which match that node selector.", "category": "concepts", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382_code_4357"}
{"instruction": "Write a bash example for daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\nDaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382_code_4358"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382_code_4359"}
{"instruction": "Write a bash example for daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\nDaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382_code_4360"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\nnodeAffinity:\n  requiredDuringSchedulingIgnoredDuringExecution:\n    nodeSelectorTerms:\n    - matchFields:\n      - key: metadata.name\n        operator: In\n        values:\n        - target-host-name\n```\n\nDaemonSet | The DaemonSet controller automatically adds a set of tolerations to DaemonSet Pods:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382_code_4361"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382_code_4362"}
{"instruction": "Write a yaml example for daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\nDaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/daemonset", "id": "k8s_00382_code_4363"}
{"instruction": "What is the reference documentation for nodeselectorrequirement?", "response": "NodeSelectorRequirementA node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.import \"k8s.io/api/core/v1\"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.key (string), requiredThe label key that the selector applies to.operator (string), requiredRepresents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.values ([]string)Atomic: will be replaced during a mergeAn array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/node-selector-requirement/", "id": "k8s_00383"}
{"instruction": "What is the reference documentation for kubectl create cronjob?", "response": "kubectl create cronjobSynopsisCreate a cron job with the specified name.kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags] Examples # Create a cron job kubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" # Create a cron job with a command kubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" -- date Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for cronjob--image stringImage name to run.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--restart stringjob's restart policy. supported values: OnFailure, Never--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--schedule stringA schedule in the Cron format the job should be run with.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_cronjob/", "id": "k8s_00384"}
{"instruction": "Write a bash example for kubectl create cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]\n```\n\nkubectl create cronjob | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_cronjob/", "id": "k8s_00384_code_4366"}
{"instruction": "Write a bash example for kubectl create cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]\n```\n\nkubectl create cronjob | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_cronjob/", "id": "k8s_00384_code_4367"}
{"instruction": "Explain the Kubernetes concept: Coordinated Leader Election", "response": "Coordinated Leader ElectionFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: false)Kubernetes 1.34 includes a beta feature that allows control plane components to deterministically select a leader via coordinated leader election. This is useful to satisfy Kubernetes version skew constraints during cluster upgrades. Currently, the only builtin selection strategy is OldestEmulationVersion, preferring the leader with the lowest emulation version, followed by binary version, followed by creation timestamp.Enabling coordinated leader electionEnsure that CoordinatedLeaderElection feature gate is enabled when you start the API Server: and that the coordination.k8s.io/v1beta1 API group is enabled.This can be done by setting flags --feature-gates=\"CoordinatedLeaderElection=true\" and --runtime-config=\"coordination.k8s.io/v1beta1=true\".Component configurationProvided that you have enabled the CoordinatedLeaderElection feature gate andhave the coordination.k8s.io/v1beta1 API group enabled, compatible control planecomponents automatically use the LeaseCandidate and Lease APIs to elect a leaderas needed.For Kubernetes 1.34, two control plane components(kube-controller-manager and kube-scheduler) automatically use coordinatedleader election when the feature gate and API group are enabled.", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/coordinated-leader-election/", "id": "k8s_00385"}
{"instruction": "How do you configure a pod to use a projected volume for storage in Kubernetes?", "response": "Configure a Pod to Use a Projected Volume for StorageThis page shows how to use a projected Volume to mount several existing volume sources into the same directory. Currently, secret, configMap, downwardAPI, and serviceAccountToken volumes can be projected.Note:serviceAccountToken is not a volume type.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Configure a projected volume for a podIn this exercise, you create username and password Secrets from local files. You then create a Pod that runs one container, using a projected Volume to mount the Secrets into the same shared directory.Here is the configuration file for the Pod:pods/storage/projected.yaml apiVersion: v1 kind: Pod metadata: name: test-projected-volume spec: containers: - name: test-projected-volume image: busybox:1.28 args: - sleep - \"86400\" volumeMounts: - name: all-in-one mountPath: \"/projected-volume\" readOnly: true volumes: - name: all-in-one projected: sources: - secret: name: user - secret: name: pass Create the Secrets:# Create files containing the username and password: echo -n \"admin\" > ./username.txt echo -n \"1f2d1e2e67df\" > ./password.txt # Package these files into secrets: kubectl create secret generic user --from-file=./username.txt kubectl create secret generic pass --from-file=./password.txt Create the Pod:kubectl apply -f https://k8s.io/examples/pods/storage/projected.yaml Verify that the Pod's container is running, and then watch for changes to the Pod:kubectl get --watch pod test-projected-volume The output looks like this:NAME READY STATUS RESTARTS AGE test-projected-volume 1/1 Running 0 14s In another terminal, get a shell to the running container:kubectl exec -it test-projected-volume -- /bin/sh In your shell, verify that the projected-volume directory contains your projected sources:ls /projected-volume/ Clean upDelete the Pod and the Secrets:kubectl delete pod test-projected-volume kubectl delete secret user pass What's nextLearn more about projected volumes.Read the all-in-one volume design document.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386"}
{"instruction": "Write a yaml example for configure a pod to use a projected volume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4370"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/projected.yaml\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | Verify that the Pod's container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4371"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get --watch pod test-projected-volume\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4372"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test-projected-volume -- /bin/sh\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | In your shell, verify that the projected-volume directory contains your projected sources:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4373"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test-projected-volume\nkubectl delete secret user pass\n```\n\nConfigure a Pod to Use a Projected Volume for Storage |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4374"}
{"instruction": "Write a yaml example for configure a pod to use a projected volume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4375"}
{"instruction": "Write a yaml example for configure a pod to use a projected volume for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4376"}
{"instruction": "Write a yaml example for configure a pod to use a projected volume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4377"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/projected.yaml\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | Verify that the Pod's container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4378"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get --watch pod test-projected-volume\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4379"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test-projected-volume -- /bin/sh\n```\n\nConfigure a Pod to Use a Projected Volume for Storage | In your shell, verify that the projected-volume directory contains your projected sources:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4380"}
{"instruction": "Write a bash example for configure a pod to use a projected volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test-projected-volume\nkubectl delete secret user pass\n```\n\nConfigure a Pod to Use a Projected Volume for Storage |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-projected-volume-storage/", "id": "k8s_00386_code_4381"}
{"instruction": "Explain the Kubernetes concept: Node-specific Volume Limits", "response": "Node-specific Volume LimitsThis page describes the maximum number of volumes that can be attached to a Node for various cloud providers.Cloud providers like Google, Amazon, and Microsoft typically have a limit on how many volumes can be attached to a Node. It is important for Kubernetes to respect those limits. Otherwise, Pods scheduled on a Node could get stuck waiting for volumes to attach.Kubernetes default limitsThe Kubernetes scheduler has default limits on the number of volumes that can be attached to a Node:Cloud serviceMaximum volumes per NodeAmazon Elastic Block Store (EBS)39Google Persistent Disk16Microsoft Azure Disk Storage16Dynamic volume limitsFEATURE STATE: Kubernetes v1.17 [stable]Dynamic volume limits are supported for following volume types.Amazon EBSGoogle Persistent DiskAzure DiskCSIFor volumes managed by in-tree volume plugins, Kubernetes automatically determines the Node type and enforces the appropriate maximum number of volumes for the node. For example:On Google Compute Engine, up to 127 volumes can be attached to a node, depending on the node type.For Amazon EBS disks on M5,C5,R5,T3 and Z1D instance types, Kubernetes allows only 25 volumes to be attached to a Node. For other instance types on Amazon Elastic Compute Cloud (EC2), Kubernetes allows 39 volumes to be attached to a Node.On Azure, up to 64 disks can be attached to a node, depending on the node type. For more details, refer to Sizes for virtual machines in Azure.If a CSI storage driver advertises a maximum number of volumes for a Node (using NodeGetInfo), the kube-scheduler honors that limit. Refer to the CSI specifications for details.For volumes managed by in-tree plugins that have been migrated to a CSI driver, the maximum number of volumes will be the one reported by the CSI driver.Mutable CSI Node Allocatable CountFEATURE STATE: Kubernetes v1.34 [beta] (enabled by default: false)CSI drivers can dynamically adjust the maximum number of volumes that can be attached to a Node at runtime. This enhances scheduling accuracy and reduces pod scheduling failures due to changes in resource availability.To use this feature, you must enable the MutableCSINodeAllocatableCount feature gate on the following components:kube-apiserverkubeletPeriodic UpdatesWhen enabled, CSI drivers can request periodic updates to their volume limits by setting the nodeAllocatableUpdatePeriodSeconds field in the CSIDriver specification. For example:apiVersion: storage.k8s.io/v1 kind: CSIDriver metadata: name: hostpath.csi.k8s.io spec: nodeAllocatableUpdatePeriodSeconds: 60 Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSeconds. The minimum allowed value for this field is 10 seconds.If a volume attachment operation fails with a ResourceExhausted error (gRPC code 8), Kubernetes triggers an immediate update to the allocatable volume count for that Node. Additionally, kubelet marks affected pods as Failed, allowing their controllers to handle recreation. This prevents pods from getting stuck indefinitely in the ContainerCreating state.", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-limits/", "id": "k8s_00387"}
{"instruction": "Write a yaml example for node-specific volume limits", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\nNode-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-limits/", "id": "k8s_00387_code_4383"}
{"instruction": "Write a yaml example for node-specific volume limits", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\nNode-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-limits/", "id": "k8s_00387_code_4384"}
{"instruction": "Write a yaml example for node-specific volume limits", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\nNode-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-limits/", "id": "k8s_00387_code_4385"}
{"instruction": "How do you configure the aggregation layer in Kubernetes?", "response": "Configure the Aggregation LayerConfiguring the aggregation layer allows the Kubernetes apiserver to be extended with additional APIs, which are not part of the core Kubernetes APIs.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Note:There are a few setup requirements for getting the aggregation layer working in your environment to support mutual TLS auth between the proxy and extension apiservers. Kubernetes and the kube-apiserver have multiple CAs, so make sure that the proxy is signed by the aggregation layer CA and not by something else, like the Kubernetes general CA.Caution:Reusing the same CA for different client types can negatively impact the cluster's ability to function. For more information, see CA Reusage and Conflicts.Authentication FlowUnlike Custom Resource Definitions (CRDs), the Aggregation API involves another server - your Extension apiserver - in addition to the standard Kubernetes apiserver. The Kubernetes apiserver will need to communicate with your extension apiserver, and your extension apiserver will need to communicate with the Kubernetes apiserver. In order for this communication to be secured, the Kubernetes apiserver uses x509 certificates to authenticate itself to the extension apiserver.This section describes how the authentication and authorization flows work, and how to configure them.The high-level flow is as follows:Kubernetes apiserver: authenticate the requesting user and authorize their rights to the requested API path.Kubernetes apiserver: proxy the request to the extension apiserverExtension apiserver: authenticate the request from the Kubernetes apiserverExtension apiserver: authorize the request from the original userExtension apiserver: executeThe rest of this section describes these steps in detail.The flow can be seen in the following diagram.The source for the above swimlanes can be found in the source of this document.Kubernetes Apiserver Authentication and AuthorizationA request to an API path that is served by an extension apiserver begins the same way as all API requests: communication to the Kubernetes apiserver. This path already has been registered with the Kubernetes apiserver by the extension apiserver.The user communicates with the Kubernetes apiserver, requesting access to the path. The Kubernetes apiserver uses standard authentication and authorization configured with the Kubernetes apiserver to authenticate the user and authorize access to the specific path.For an overview of authenticating to a Kubernetes cluster, see \"Authenticating to a Cluster\". For an overview of authorization of access to Kubernetes cluster resources, see \"Authorization Overview\".Everything to this point has been standard Kubernetes API requests, authentication and authorization.The Kubernetes apiserver now is prepared to send the request to the extension apiserver.Kubernetes Apiserver Proxies the RequestThe Kubernetes apiserver now will send, or proxy, the request to the extension apiserver that registered to handle the request. In order to do so, it needs to know several things:How should the Kubernetes apiserver authenticate to the extension apiserver, informing the extension apiserver that the request, which comes over the network, is coming from a valid Kubernetes apiserver?How should the Kubernetes apiserver inform the extension apiserver of the username and group for which the original request was authenticated?In order to provide for these two, you must configure the Kubernetes apiserver using several flags.Kubernetes Apiserver Client AuthenticationThe Kubernet", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/", "id": "k8s_00388"}
{"instruction": "Write a yaml example for configure the aggregation layer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\nmetadata:\n  name: <name of the registration object>\nspec:\n  group: <API group name this extension apiserver hosts>\n  version: <API version this extension apiserver hosts>\n  groupPriorityMinimum: <priority this APIService for this group, see API documentation>\n  versionPriority: <prioritizes ordering of this version within a group, see API documentation>\n  service:\n    namespace: <namespace of the extension apiserver service>\n    name: <name of the extension apiserver service>\n  caBundle: <pem encoded ca cert that signs the server cert used by the webhook>\n```\n\nConfigure the Aggregation Layer | The name of an APIService object must be a valid path segment name.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/", "id": "k8s_00388_code_4387"}
{"instruction": "Write a yaml example for configure the aggregation layer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\n...\nspec:\n  ...\n  service:\n    namespace: my-service-namespace\n    name: my-service-name\n    port: 1234\n  caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nConfigure the Aggregation Layer |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/", "id": "k8s_00388_code_4388"}
{"instruction": "Write a yaml example for configure the aggregation layer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\nmetadata:\n  name: <name of the registration object>\nspec:\n  group: <API group name this extension apiserver hosts>\n  version: <API version this extension apiserver hosts>\n  groupPriorityMinimum: <priority this APIService for this group, see API documentation>\n  versionPriority: <prioritizes ordering of this version within a group, see API documentation>\n  service:\n    namespace: <namespace of the extension apiserver service>\n    name: <name of the extension apiserver service>\n  caBundle: <pem encoded ca cert that signs the server cert used by the webhook>\n```\n\nConfigure the Aggregation Layer | The name of an APIService object must be a valid path segment name.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/", "id": "k8s_00388_code_4389"}
{"instruction": "Write a yaml example for configure the aggregation layer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\n...\nspec:\n  ...\n  service:\n    namespace: my-service-namespace\n    name: my-service-name\n    port: 1234\n  caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nConfigure the Aggregation Layer |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/", "id": "k8s_00388_code_4390"}
{"instruction": "Write a yaml example for configure the aggregation layer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\nmetadata:\n  name: <name of the registration object>\nspec:\n  group: <API group name this extension apiserver hosts>\n  version: <API version this extension apiserver hosts>\n  groupPriorityMinimum: <priority this APIService for this group, see API documentation>\n  versionPriority: <prioritizes ordering of this version within a group, see API documentation>\n  service:\n    namespace: <namespace of the extension apiserver service>\n    name: <name of the extension apiserver service>\n  caBundle: <pem encoded ca cert that signs the server cert used by the webhook>\n```\n\nConfigure the Aggregation Layer | The name of an APIService object must be a valid path segment name.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/", "id": "k8s_00388_code_4391"}
{"instruction": "Write a yaml example for configure the aggregation layer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\n...\nspec:\n  ...\n  service:\n    namespace: my-service-namespace\n    name: my-service-name\n    port: 1234\n  caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nConfigure the Aggregation Layer |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/configure-aggregation-layer/", "id": "k8s_00388_code_4392"}
{"instruction": "What is the reference documentation for getting started?", "response": "Kubectl Reference Docs GETTING STARTEDcreateclusterroleclusterrolebindingconfigmapcronjobdeploymentingressjobnamespacepoddisruptionbudgetpriorityclassquotarolerolebindingsecretsecret docker-registrysecret genericsecret tlsserviceservice clusteripservice externalnameservice loadbalancerservice nodeportserviceaccountgetrunexposedeleteAPP MANAGEMENTapplyedit-last-appliedset-last-appliedview-last-appliedannotateautoscaledebugdiffeditkustomizelabelpatchreplacerollouthistorypauserestartresumestatusundoscalesetenvimageresourcesselectorserviceaccountsubjectwaitWORKING WITH APPSattachauthcan-ireconcilecpdescribeexeclogsport-forwardproxytopnodepodCLUSTER MANAGEMENTapi-versionscertificateapprovedenycluster-infodumpcordondraintaintuncordonKUBECTL SETTINGS AND USAGEalphaapi-resourcescompletionconfigcurrent-contextdelete-clusterdelete-contextdelete-userget-clustersget-contextsget-usersrename-contextsetset-clusterset-contextset-credentialsunsetuse-contextviewexplainoptionspluginlistversionCopyright 2020 The Kubernetes Authors. example GETTING STARTED This section contains the most basic commands for getting a workload running on your cluster. run will start running 1 or more instances of a container image on your cluster. expose will load balance traffic across the running instances, and can create a HA proxy for accessing the containers from outside the cluster. Once your workloads are running, you can use the commands in the WORKING WITH APPS section to inspect them. create Create a pod using the data in pod.json kubectl create -f ./pod.json Create a pod based on the JSON passed into stdin cat pod.json | kubectl create -f - Edit the data in docker-registry.yaml in JSON then create the resource using the edited data kubectl create -f docker-registry.yaml --edit -o json Create a resource from a file or from stdin. JSON and YAML formats are accepted. Usage $ kubectl create -f FILENAME Flags Name Shorthand Default Usage allow-missing-template-keys true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. dry-run none Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. edit false Edit the API resource before creating field-manager kubectl-create Name of the manager used to track field ownership. filename f [] Filename, directory, or URL to files to use to create the resource kustomize k Process the kustomization directory. This flag can't be used together with -f or -R. output o Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. raw Raw URI to POST to the server. Uses the transport specified by the kubeconfig file. record false Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. recursive R false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. selector l Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) show-managed-fields false If true, keep the managedFields when printing objects in JSON or YAML format. template Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. validate true If true, use a schema to validate the input before sending it windows-line-endings ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./pod.json\n```\n\ncreate | Create a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4394"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f docker-registry.yaml --edit -o json\n```\n\ncreate | Create a resource from a file or from stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4395"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\ncreate | Create a cluster role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4396"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a cluster role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4397"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a cluster role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4398"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a cluster role name \"foo\" with NonResourceURL specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4399"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\ncreate | Create a cluster role name \"monitoring\" with AggregationRule specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4400"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\ncreate | Create a cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4401"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a cluster role binding for a particular cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4402"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config with specified keys instead of file basenames on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4403"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt\n```\n\ncreate | Create a new config map named my-config with key1=config1 and key2=config2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4404"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2\n```\n\ncreate | Create a new config map named my-config from the key=value pairs in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4405"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4406"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-env-file=path/to/bar.env\n```\n\ncreate | Create a config map based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4407"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\"\n```\n\ncreate | Create a cron job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4408"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" -- date\n```\n\ncreate | Create a cron job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4409"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox\n```\n\ncreate | Create a deployment with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4410"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox -- date\n```\n\ncreate | Create a deployment named my-dep that runs the nginx image with 3 replicas", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4411"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=nginx --replicas=3\n```\n\ncreate | Create a deployment named my-dep that runs the busybox image and expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4412"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox --port=5701\n```\n\ncreate | Create a deployment with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4413"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress simple --rule=\"foo.com/bar=svc1:8080,tls=my-cert\"\n```\n\ncreate | Create a catch all ingress of \"/path\" pointing to service svc:port and Ingress Class as \"otheringress\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4414"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress catch-all --class=otheringress --rule=\"/path=svc:port\"\n```\n\ncreate | Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4415"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress annotated --class=default --rule=\"foo.com/bar=svc:port\" \\\n--annotation ingress.annotation1=foo \\\n--annotation ingress.annotation2=bla\n```\n\ncreate | Create an ingress with the same host and multiple paths", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4416"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress multipath --class=default \\\n--rule=\"foo.com/=svc:port\" \\\n--rule=\"foo.com/admin/=svcadmin:portadmin\"\n```\n\ncreate | Create an ingress with multiple hosts and the pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4417"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingress1 --class=default \\\n--rule=\"foo.com/path*=svc:8080\" \\\n--rule=\"bar.com/admin*=svc2:http\"\n```\n\ncreate | Create an ingress with TLS enabled using the default ingress certificate and different path types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4418"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingtls --class=default \\\n--rule=\"foo.com/=svc:https,tls\" \\\n--rule=\"foo.com/path/subpath*=othersvc:8080\"\n```\n\ncreate | Create an ingress with TLS enabled using a specific secret and pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4419"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingsecret --class=default \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with a default backend", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4420"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingdefault --class=default \\\n--default-backend=defaultsvc:http \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4421"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox\n```\n\ncreate | Create a job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4422"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox -- date\n```\n\ncreate | Create a job from a cron job named \"a-cronjob\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4423"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job test-job --from=cronjob/a-cronjob\n```\n\ncreate | Create a job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4424"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace my-namespace\n```\n\ncreate | Create a namespace with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4425"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1\n```\n\ncreate | Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4426"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create pdb my-pdb --selector=app=nginx --min-available=50%\n```\n\ncreate | Create a pod disruption budget with the specified name, selector, and desired minimum available pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4427"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\"\n```\n\ncreate | Create a priority class named default-priority that is considered as the global default priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4428"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass default-priority --value=1000 --global-default=true --description=\"default priority\"\n```\n\ncreate | Create a priority class named high-priority that cannot preempt pods with lower priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4429"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\" --preemption-policy=\"Never\"\n```\n\ncreate | Create a priority class with the specified name, value, globalDefault and description.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4430"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10\n```\n\ncreate | Create a new resource quota named best-effort", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4431"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota best-effort --hard=pods=100 --scopes=BestEffort\n```\n\ncreate | Create a resource quota with the specified name, hard limits, and optional scopes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4432"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\ncreate | Create a role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4433"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4434"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4435"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a role with single rule.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4436"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a role binding for a particular role or cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4437"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL\n```\n\ncreate | Create a new secret named my-secret from ~/.docker/config.json", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4438"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json\n```\n\ncreate | Create a new secret for use with Docker registries.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4439"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=path/to/bar\n```\n\ncreate | Create a new secret named my-secret with specified keys instead of names on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4440"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub\n```\n\ncreate | Create a new secret named my-secret with key1=supersecret and key2=topsecret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4441"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret\n```\n\ncreate | Create a new secret named my-secret using a combination of a file and a literal", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4442"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret\n```\n\ncreate | Create a new secret named my-secret from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4443"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-env-file=path/to/bar.env\n```\n\ncreate | Create a secret based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4444"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key\n```\n\ncreate | Create a TLS secret from the given public/private key pair.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4445"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --tcp=5678:8080\n```\n\ncreate | Create a new ClusterIP service named my-cs (in headless mode)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4446"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --clusterip=\"None\"\n```\n\ncreate | Create a ClusterIP service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4447"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname my-ns --external-name bar.com\n```\n\ncreate | Create an ExternalName service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4448"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer my-lbs --tcp=5678:8080\n```\n\ncreate | Create a LoadBalancer service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4449"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport my-ns --tcp=5678:8080\n```\n\ncreate | Create a NodePort service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4450"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount my-service-account\n```\n\ncreate | Create a service account with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4451"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nget | List a single replication controller with specified NAME in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4452"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get replicationcontroller web\n```\n\nget | List deployments in JSON output format, in the \"v1\" version of the \"apps\" API group", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4453"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments.v1.apps -o json\n```\n\nget | List a single pod in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4454"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o json pod web-pod-13je7\n```\n\nget | List a pod identified by type and name specified in \"pod.yaml\" in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4455"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -f pod.yaml -o json\n```\n\nget | List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4456"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}\n```\n\nget | List resource information in custom columns", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4457"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image\n```\n\nget | List all replication controllers and services together in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4458"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc,services\n```\n\nget | List one or more resources by their type and names", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4459"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc/web service/frontend pods/web-pod-13je7\n```\n\nget | Display one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4460"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx\n```\n\nrun | Start a hazelcast pod and let the container expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4461"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --port=5701\n```\n\nrun | Start a hazelcast pod and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4462"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --env=\"DNS_DOMAIN=cluster\" --env=\"POD_NAMESPACE=default\"\n```\n\nrun | Start a hazelcast pod and set labels \"app=hazelcast\" and \"env=prod\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4463"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --labels=\"app=hazelcast,env=prod\"\n```\n\nrun | Dry run; print the corresponding API objects without creating them", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4464"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --dry-run=client\n```\n\nrun | Start a nginx pod, but overload the spec with a partial set of values parsed from JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4465"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\": \"v1\", \"spec\": { ... } }'\n```\n\nrun | Start a busybox pod and keep it in the foreground, don't restart it if it exits", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4466"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run -i -t busybox --image=busybox --restart=Never\n```\n\nrun | Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4467"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>\n```\n\nrun | Start the nginx pod using a different command and custom arguments", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4468"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>\n```\n\nrun | Create and run a particular image in a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4469"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4470"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose -f nginx-controller.yaml --port=80 --target-port=8000\n```\n\nexpose | Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4471"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod valid-pod --port=444 --name=frontend\n```\n\nexpose | Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4472"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https\n```\n\nexpose | Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4473"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream\n```\n\nexpose | Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4474"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rs nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4475"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80 --target-port=8000\n```\n\nexpose | Expose a resource as a new Kubernetes service.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4476"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json\n```\n\ndelete | Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4477"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -k dir\n```\n\ndelete | Delete a pod based on the type and name in the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4478"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod,service baz foo\n```\n\ndelete | Delete pods and services with label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4479"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods,services -l name=myLabel\n```\n\ndelete | Delete a pod with minimal delay", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4480"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --now\n```\n\ndelete | Force delete a pod on a dead node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4481"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --force\n```\n\ndelete | Delete all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4482"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods --all\n```\n\ndelete | Delete resources by file names, stdin, resources and names, or by resources and label selector.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4483"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./pod.json\n```\n\napply | Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4484"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k dir/\n```\n\napply | Apply the JSON passed into stdin to a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4485"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml -l app=nginx\n```\n\napply | Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4486"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap\n```\n\napply | Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initia", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4487"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/nginx\n```\n\napply | Edit the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4488"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied -f deploy.yaml -o json\n```\n\napply | Edit the latest last-applied-configuration annotations of resources from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4489"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml\n```\n\napply | Execute set-last-applied against each configuration file in a directory", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4490"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f path/\n```\n\napply | Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4491"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml --create-annotation=true\n```\n\napply | Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run,", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4492"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied deployment/nginx\n```\n\napply | View the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4493"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied -f deploy.yaml -o json\n```\n\napply | View the latest last-applied-configuration annotations by type/name or file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4494"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend'\n```\n\nannotate | Update a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4495"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate -f pod.json description='my frontend'\n```\n\nannotate | Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4496"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate --overwrite pods foo description='my frontend running nginx'\n```\n\nannotate | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4497"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods --all description='my frontend running nginx'\n```\n\nannotate | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4498"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend running nginx' --resource-version=1\n```\n\nannotate | Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4499"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description-\n```\n\nannotate | Update the annotations on one or more resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4500"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment foo --min=2 --max=10\n```\n\nautoscale | Auto scale a replication controller \"foo\", with the number of pods between 1 and 5, target CPU utilization at 80%", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4501"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rc foo --max=5 --cpu-percent=80\n```\n\nautoscale | Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4502"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox\n```\n\ndebug | Create a debug container named debugger using a custom automated debugging image. # (requires the EphemeralContainers feature to be enabled in the cluster)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4503"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug --image=myproj/debug-tools -c debugger mypod\n```\n\ndebug | Create a copy of mypod adding a debug container and attach to it", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4504"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox --copy-to=my-debugger\n```\n\ndebug | Create a copy of mypod changing the command of mycontainer", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4505"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh\n```\n\ndebug | Create a copy of mypod changing all container images to busybox", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4506"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod --copy-to=my-debugger --set-image=*=busybox\n```\n\ndebug | Create a copy of mypod adding a debug container and changing container images", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4507"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug\n```\n\ndebug | Create an interactive debugging session on a node and immediately attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at /host", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4508"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=busybox\n```\n\ndebug | Debug cluster resources using interactive debugging containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4509"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f pod.json\n```\n\ndiff | Diff file read from stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4510"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry\n```\n\nedit | Use an alternative editor", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4511"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit job.v1.batch/myjob -o json\n```\n\nedit | Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4512"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/mydeployment -o yaml --save-config\n```\n\nedit | Edit a resource from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4513"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize /home/config/production\n```\n\nkustomize | Build from github", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4514"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6\n```\n\nkustomize | Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying sa", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4515"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo unhealthy=true\n```\n\nlabel | Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4516"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite pods foo status=unhealthy\n```\n\nlabel | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4517"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods --all status=unhealthy\n```\n\nlabel | Update a pod identified by the type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4518"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label -f pod.json status=unhealthy\n```\n\nlabel | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4519"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo status=unhealthy --resource-version=1\n```\n\nlabel | Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4520"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo bar-\n```\n\nlabel | Update the labels on a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4521"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Partially update a node using a strategic merge patch, specifying the patch as YAML", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4522"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p $'spec:\\n unschedulable: true'\n```\n\npatch | Partially update a node identified by the type and name specified in \"node.json\" using strategic merge patch", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4523"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch -f node.json -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Update a container's image; spec.containers[*].name is required because it's a merge key", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4524"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n```\n\npatch | Update a container's image using a JSON patch with positional arrays", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4525"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n```\n\npatch | Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4526"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f ./pod.json\n```\n\nreplace | Replace a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4527"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n```\n\nreplace | Force replace, delete and then re-create the resource", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4528"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace --force -f ./pod.json\n```\n\nreplace | Replace a resource by file name or stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4529"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Check the rollout status of a daemonset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4530"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status daemonset/foo\n```\n\nrollout | Manage the rollout of a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4531"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/abc\n```\n\nrollout | View the details of daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4532"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset/abc --revision=3\n```\n\nrollout | View previous rollout revisions and configurations.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4533"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx\n```\n\nrollout | Mark the provided resource as paused.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4534"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment/nginx\n```\n\nrollout | Restart a daemon set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4535"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart daemonset/abc\n```\n\nrollout | Restart a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4536"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx\n```\n\nrollout | Resume a paused resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4537"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx\n```\n\nrollout | Show the status of the rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4538"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Roll back to daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4539"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset/abc --to-revision=3\n```\n\nrollout | Roll back to the previous deployment with dry-run", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4540"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo --dry-run=server deployment/abc\n```\n\nrollout | Roll back to a previous rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4541"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo\n```\n\nscale | Scale a resource identified by type and name specified in \"foo.yaml\" to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4542"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 -f foo.yaml\n```\n\nscale | If the deployment named mysql's current size is 2, scale mysql to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4543"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql\n```\n\nscale | Scale multiple replication controllers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4544"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz\n```\n\nscale | Scale stateful set named 'web' to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4545"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 statefulset/web\n```\n\nscale | Set a new size for a deployment, replica set, replication controller, or stateful set.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4546"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/registry STORAGE_DIR=/local\n```\n\nset | List the environment variables defined on a deployments 'sample-build'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4547"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build --list\n```\n\nset | List the environment variables defined on all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4548"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env pods --all --list\n```\n\nset | Output modified deployment in YAML, and does not alter the object on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4549"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml\n```\n\nset | Update all containers in all replication controllers in the project to have ENV=prod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4550"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env rc --all ENV=prod\n```\n\nset | Import environment from a secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4551"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=secret/mysecret deployment/myapp\n```\n\nset | Import environment from a config map with a prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4552"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp\n```\n\nset | Import specific keys from a config map", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4553"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp\n```\n\nset | Remove the environment variable ENV from container 'c1' in all deployment configs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4554"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployments --all --containers=\"c1\" ENV-\n```\n\nset | Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4555"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env -f deploy.json ENV-\n```\n\nset | Set some of the local shell environment into a deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4556"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1\n```\n\nset | Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4557"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments,rc nginx=nginx:1.9.1 --all\n```\n\nset | Update image of all containers of daemonset abc to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4558"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image daemonset abc *=nginx:1.9.1\n```\n\nset | Print result (in yaml format) of updating nginx container image from local file, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4559"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml\n```\n\nset | Update existing container image(s) of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4560"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nset | Set the resource request and limits for all containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4561"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi\n```\n\nset | Remove the resource requests for resources on containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4562"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0\n```\n\nset | Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4563"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml\n```\n\nset | Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4564"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\nkubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -\n```\n\nset | Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4565"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount deployment nginx-deployment serviceaccount1\n```\n\nset | Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4566"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml\n```\n\nset | Update the service account of pod template resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4567"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1\n```\n\nset | Update a role binding for user1, user2, and group1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4568"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1\n```\n\nset | Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4569"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml\n```\n\nset | Update the user, group, or service account in a role binding or cluster role binding.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4570"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready pod/busybox1\n```\n\nwait | The default value of status condition is true; you can set it to false", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4571"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready=false pod/busybox1\n```\n\nwait | Wait for the pod \"busybox1\" to be deleted, with a timeout of 60s, after having issued the \"delete\" command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4572"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/busybox1\nkubectl wait --for=delete pod/busybox1 --timeout=60s\n```\n\nwait | Experimental: Wait for a specific condition on one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4573"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container\n```\n\nattach | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4574"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container -i -t\n```\n\nattach | Get output from the first pod of a replica set named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4575"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach rs/nginx\n```\n\nattach | Attach to a process that is already running inside an existing container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4576"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create pods --all-namespaces\n```\n\nauth | Check to see if I can list deployments in my current namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4577"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list deployments.apps\n```\n\nauth | Check to see if I can do everything in my current namespace (\"*\" means all)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4578"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i '*' '*'\n```\n\nauth | Check to see if I can get the job named \"bar\" in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4579"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list jobs.batch/bar -n foo\n```\n\nauth | Check to see if I can read pod logs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4580"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get pods --subresource=log\n```\n\nauth | Check to see if I can access the URL /logs/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4581"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get /logs/\n```\n\nauth | List all allowed actions in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4582"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i --list --namespace=foo\n```\n\nauth | Check whether an action is allowed.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4583"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nauth | Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4584"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar\n```\n\ncp | Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4585"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4586"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4587"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar\n```\n\ncp | Copy /tmp/foo from a remote pod to /tmp/bar locally", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4588"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar\n```\n\ncp | Copy files and directories to and from containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4589"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes kubernetes-node-emt8.c.myproject.internal\n```\n\ndescribe | Describe a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4590"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods/nginx\n```\n\ndescribe | Describe a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4591"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f pod.json\n```\n\ndescribe | Describe all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4592"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\ndescribe | Describe pods by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4593"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe po -l name=myLabel\n```\n\ndescribe | Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4594"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods frontend\n```\n\ndescribe | Show details of a specific resource or group of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4595"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -- date\n```\n\nexec | Get output from running the 'date' command in ruby-container from pod mypod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4596"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -- date\n```\n\nexec | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4597"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -i -t -- bash -il\n```\n\nexec | List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4598"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -i -t -- ls -t /usr\n```\n\nexec | Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4599"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec deploy/mydeployment -- date\n```\n\nexec | Get output from running 'date' command from the first pod of the service myservice, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4600"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec svc/myservice -- date\n```\n\nexec | Execute a command in a container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4601"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs nginx --all-containers=true\n```\n\nlogs | Return snapshot logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4602"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app=nginx --all-containers=true\n```\n\nlogs | Return snapshot of previous terminated ruby container logs from pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4603"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -p -c ruby web-1\n```\n\nlogs | Begin streaming the logs of the ruby container in pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4604"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -c ruby web-1\n```\n\nlogs | Begin streaming the logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4605"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l app=nginx --all-containers=true\n```\n\nlogs | Display only the most recent 20 lines of output in pod nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4606"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --tail=20 nginx\n```\n\nlogs | Show all logs from pod nginx written in the last hour", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4607"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --since=1h nginx\n```\n\nlogs | Show logs from a kubelet with an expired serving certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4608"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --insecure-skip-tls-verify-backend nginx\n```\n\nlogs | Return snapshot logs from first container of a job named hello", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4609"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs job/hello\n```\n\nlogs | Return snapshot logs from container nginx-1 of a deployment named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4610"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/nginx -c nginx-1\n```\n\nlogs | Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4611"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 5000 6000\n```\n\nport-forward | Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4612"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mydeployment 5000 6000\n```\n\nport-forward | Listen on port 8443 locally, forwarding to the targetPort of the service's port named \"https\" in a pod selected by the service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4613"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/myservice 8443:https\n```\n\nport-forward | Listen on port 8888 locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4614"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on all addresses, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4615"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4616"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000\n```\n\nport-forward | Listen on a random port locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4617"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod :5000\n```\n\nport-forward | Forward one or more local ports to a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4618"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/\n```\n\nproxy | To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4619"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/\n```\n\nproxy | To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4620"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/custom/\n```\n\nproxy | Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4621"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8011 --www=./local/www/\n```\n\nproxy | Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4622"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=0\n```\n\nproxy | Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4623"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/k8s-api\n```\n\nproxy | Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through on", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4624"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top node NODE_NAME\n```\n\ntop | Display resource (CPU/memory) usage of nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4625"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod --namespace=NAMESPACE\n```\n\ntop | Show metrics for a given pod and its containers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4626"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod POD_NAME --containers\n```\n\ntop | Show metrics for the pods defined by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4627"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -l name=myLabel\n```\n\ntop | Display resource (CPU/memory) usage of pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4628"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve csr-sqgzp\n```\n\ncertificate | Approve a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4629"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny csr-sqgzp\n```\n\ncertificate | Deny a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4630"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\ncluster-info | Dump current cluster state to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4631"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump all namespaces to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4632"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --all-namespaces\n```\n\ncluster-info | Dump a set of namespaces to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4633"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you sp", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4634"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --force\n```\n\ndrain | As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4635"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --grace-period=900\n```\n\ndrain | Drain node in preparation for maintenance.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4636"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\ntaint | Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4637"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated:NoSchedule-\n```\n\ntaint | Remove from node 'foo' all the taints with key 'dedicated'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4638"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated-\n```\n\ntaint | Add a taint with key 'dedicated' on nodes having label mylabel=X", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4639"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint node -l myLabel=X  dedicated=foo:PreferNoSchedule\n```\n\ntaint | Add to node 'foo' a taint with key 'bar' and no value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4640"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo bar:NoSchedule\n```\n\ntaint | Update the taints on one or more nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4641"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\napi-resources | Print the supported API resources with more information", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4642"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources -o wide\n```\n\napi-resources | Print the supported API resources sorted by a column", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4643"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --sort-by=name\n```\n\napi-resources | Print the supported namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4644"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true\n```\n\napi-resources | Print the supported non-namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4645"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=false\n```\n\napi-resources | Print the supported API resources with a specific APIGroup", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4646"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --api-group=extensions\n```\n\napi-resources | Print the supported API resources on the server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4647"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl\n```\n\ncompletion | Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion co", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4648"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > ~/.kube/completion.bash.inc\nprintf \"\n```\n\ncompletion | Kubectl shell completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4649"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh > \"${fpath[1]}/_kubectl\"\n```\n\ncompletion | Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .b", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4650"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nconfig | Display the current-context.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4651"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster minikube\n```\n\nconfig | Delete the specified cluster from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4652"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context minikube\n```\n\nconfig | Delete the specified context from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4653"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user minikube\n```\n\nconfig | Delete the specified user from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4654"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters\n```\n\nconfig | Display clusters defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4655"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nconfig | Describe one context in your kubeconfig file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4656"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts my-context\n```\n\nconfig | Display one or many contexts from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4657"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users\n```\n\nconfig | Display users defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4658"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context old-name new-name\n```\n\nconfig | Renames a context from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4659"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.server https://1.2.3.4\n```\n\nconfig | Set the certificate-authority-data field on the my-cluster cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4660"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.certificate-authority-data $(echo \"cert_data_here\" | base64 -i -)\n```\n\nconfig | Set the cluster field in the my-context context to my-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4661"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set contexts.my-context.cluster my-cluster\n```\n\nconfig | Set the client-key-data field in the cluster-admin user using --set-raw-bytes option", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4662"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true\n```\n\nconfig | Set an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4663"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --server=https://1.2.3.4\n```\n\nconfig | Embed certificate authority data for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4664"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt\n```\n\nconfig | Disable cert checking for the dev cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4665"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --insecure-skip-tls-verify=true\n```\n\nconfig | Set custom TLS server name to use for validation for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4666"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --tls-server-name=my-cluster-name\n```\n\nconfig | Set a cluster entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4667"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context gce --user=cluster-admin\n```\n\nconfig | Set a context entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4668"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key\n```\n\nconfig | Set basic auth for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4669"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif\n```\n\nconfig | Embed client certificate data in the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4670"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true\n```\n\nconfig | Enable the Google Compute Platform auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4671"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=gcp\n```\n\nconfig | Enable the OpenID Connect auth provider for the \"cluster-admin\" entry with additional args", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4672"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar\n```\n\nconfig | Remove the \"client-secret\" config value for the OpenID Connect auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4673"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-\n```\n\nconfig | Enable new exec auth plugin for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4674"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1\n```\n\nconfig | Define new exec auth plugin args for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4675"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2\n```\n\nconfig | Create or update exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4676"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2\n```\n\nconfig | Remove exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4677"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=var-to-remove-\n```\n\nconfig | Set a user entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4678"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset current-context\n```\n\nconfig | Unset namespace in foo context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4679"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset contexts.foo.namespace\n```\n\nconfig | Unset an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4680"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context minikube\n```\n\nconfig | Set the current-context in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4681"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view --raw\n```\n\nconfig | Get the password for the e2e user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4682"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n```\n\nconfig | Display merged kubeconfig settings or a specified kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4683"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl explain pods.spec.containers\n```\n\nexplain | List the fields for supported resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4684"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./pod.json\n```\n\ncreate | Create a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4685"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f docker-registry.yaml --edit -o json\n```\n\ncreate | Create a resource from a file or from stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4686"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\ncreate | Create a cluster role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4687"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a cluster role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4688"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a cluster role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4689"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a cluster role name \"foo\" with NonResourceURL specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4690"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\ncreate | Create a cluster role name \"monitoring\" with AggregationRule specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4691"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\ncreate | Create a cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4692"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a cluster role binding for a particular cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4693"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config with specified keys instead of file basenames on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4694"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt\n```\n\ncreate | Create a new config map named my-config with key1=config1 and key2=config2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4695"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2\n```\n\ncreate | Create a new config map named my-config from the key=value pairs in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4696"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4697"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-env-file=path/to/bar.env\n```\n\ncreate | Create a config map based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4698"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\"\n```\n\ncreate | Create a cron job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4699"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" -- date\n```\n\ncreate | Create a cron job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4700"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox\n```\n\ncreate | Create a deployment with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4701"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox -- date\n```\n\ncreate | Create a deployment named my-dep that runs the nginx image with 3 replicas", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4702"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=nginx --replicas=3\n```\n\ncreate | Create a deployment named my-dep that runs the busybox image and expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4703"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox --port=5701\n```\n\ncreate | Create a deployment with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4704"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress simple --rule=\"foo.com/bar=svc1:8080,tls=my-cert\"\n```\n\ncreate | Create a catch all ingress of \"/path\" pointing to service svc:port and Ingress Class as \"otheringress\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4705"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress catch-all --class=otheringress --rule=\"/path=svc:port\"\n```\n\ncreate | Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4706"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress annotated --class=default --rule=\"foo.com/bar=svc:port\" \\\n--annotation ingress.annotation1=foo \\\n--annotation ingress.annotation2=bla\n```\n\ncreate | Create an ingress with the same host and multiple paths", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4707"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress multipath --class=default \\\n--rule=\"foo.com/=svc:port\" \\\n--rule=\"foo.com/admin/=svcadmin:portadmin\"\n```\n\ncreate | Create an ingress with multiple hosts and the pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4708"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingress1 --class=default \\\n--rule=\"foo.com/path*=svc:8080\" \\\n--rule=\"bar.com/admin*=svc2:http\"\n```\n\ncreate | Create an ingress with TLS enabled using the default ingress certificate and different path types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4709"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingtls --class=default \\\n--rule=\"foo.com/=svc:https,tls\" \\\n--rule=\"foo.com/path/subpath*=othersvc:8080\"\n```\n\ncreate | Create an ingress with TLS enabled using a specific secret and pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4710"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingsecret --class=default \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with a default backend", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4711"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingdefault --class=default \\\n--default-backend=defaultsvc:http \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4712"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox\n```\n\ncreate | Create a job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4713"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox -- date\n```\n\ncreate | Create a job from a cron job named \"a-cronjob\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4714"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job test-job --from=cronjob/a-cronjob\n```\n\ncreate | Create a job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4715"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace my-namespace\n```\n\ncreate | Create a namespace with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4716"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1\n```\n\ncreate | Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4717"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create pdb my-pdb --selector=app=nginx --min-available=50%\n```\n\ncreate | Create a pod disruption budget with the specified name, selector, and desired minimum available pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4718"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\"\n```\n\ncreate | Create a priority class named default-priority that is considered as the global default priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4719"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass default-priority --value=1000 --global-default=true --description=\"default priority\"\n```\n\ncreate | Create a priority class named high-priority that cannot preempt pods with lower priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4720"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\" --preemption-policy=\"Never\"\n```\n\ncreate | Create a priority class with the specified name, value, globalDefault and description.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4721"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10\n```\n\ncreate | Create a new resource quota named best-effort", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4722"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota best-effort --hard=pods=100 --scopes=BestEffort\n```\n\ncreate | Create a resource quota with the specified name, hard limits, and optional scopes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4723"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\ncreate | Create a role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4724"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4725"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4726"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a role with single rule.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4727"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a role binding for a particular role or cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4728"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL\n```\n\ncreate | Create a new secret named my-secret from ~/.docker/config.json", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4729"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json\n```\n\ncreate | Create a new secret for use with Docker registries.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4730"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=path/to/bar\n```\n\ncreate | Create a new secret named my-secret with specified keys instead of names on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4731"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub\n```\n\ncreate | Create a new secret named my-secret with key1=supersecret and key2=topsecret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4732"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret\n```\n\ncreate | Create a new secret named my-secret using a combination of a file and a literal", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4733"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret\n```\n\ncreate | Create a new secret named my-secret from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4734"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-env-file=path/to/bar.env\n```\n\ncreate | Create a secret based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4735"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key\n```\n\ncreate | Create a TLS secret from the given public/private key pair.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4736"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --tcp=5678:8080\n```\n\ncreate | Create a new ClusterIP service named my-cs (in headless mode)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4737"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --clusterip=\"None\"\n```\n\ncreate | Create a ClusterIP service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4738"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname my-ns --external-name bar.com\n```\n\ncreate | Create an ExternalName service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4739"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer my-lbs --tcp=5678:8080\n```\n\ncreate | Create a LoadBalancer service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4740"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport my-ns --tcp=5678:8080\n```\n\ncreate | Create a NodePort service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4741"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount my-service-account\n```\n\ncreate | Create a service account with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4742"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nget | List a single replication controller with specified NAME in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4743"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get replicationcontroller web\n```\n\nget | List deployments in JSON output format, in the \"v1\" version of the \"apps\" API group", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4744"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments.v1.apps -o json\n```\n\nget | List a single pod in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4745"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o json pod web-pod-13je7\n```\n\nget | List a pod identified by type and name specified in \"pod.yaml\" in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4746"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -f pod.yaml -o json\n```\n\nget | List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4747"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}\n```\n\nget | List resource information in custom columns", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4748"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image\n```\n\nget | List all replication controllers and services together in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4749"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc,services\n```\n\nget | List one or more resources by their type and names", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4750"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc/web service/frontend pods/web-pod-13je7\n```\n\nget | Display one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4751"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx\n```\n\nrun | Start a hazelcast pod and let the container expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4752"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --port=5701\n```\n\nrun | Start a hazelcast pod and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4753"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --env=\"DNS_DOMAIN=cluster\" --env=\"POD_NAMESPACE=default\"\n```\n\nrun | Start a hazelcast pod and set labels \"app=hazelcast\" and \"env=prod\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4754"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --labels=\"app=hazelcast,env=prod\"\n```\n\nrun | Dry run; print the corresponding API objects without creating them", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4755"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --dry-run=client\n```\n\nrun | Start a nginx pod, but overload the spec with a partial set of values parsed from JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4756"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\": \"v1\", \"spec\": { ... } }'\n```\n\nrun | Start a busybox pod and keep it in the foreground, don't restart it if it exits", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4757"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run -i -t busybox --image=busybox --restart=Never\n```\n\nrun | Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4758"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>\n```\n\nrun | Start the nginx pod using a different command and custom arguments", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4759"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>\n```\n\nrun | Create and run a particular image in a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4760"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4761"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose -f nginx-controller.yaml --port=80 --target-port=8000\n```\n\nexpose | Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4762"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod valid-pod --port=444 --name=frontend\n```\n\nexpose | Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4763"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https\n```\n\nexpose | Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4764"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream\n```\n\nexpose | Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4765"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rs nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4766"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80 --target-port=8000\n```\n\nexpose | Expose a resource as a new Kubernetes service.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4767"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json\n```\n\ndelete | Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4768"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -k dir\n```\n\ndelete | Delete a pod based on the type and name in the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4769"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod,service baz foo\n```\n\ndelete | Delete pods and services with label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4770"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods,services -l name=myLabel\n```\n\ndelete | Delete a pod with minimal delay", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4771"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --now\n```\n\ndelete | Force delete a pod on a dead node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4772"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --force\n```\n\ndelete | Delete all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4773"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods --all\n```\n\ndelete | Delete resources by file names, stdin, resources and names, or by resources and label selector.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4774"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./pod.json\n```\n\napply | Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4775"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k dir/\n```\n\napply | Apply the JSON passed into stdin to a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4776"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml -l app=nginx\n```\n\napply | Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4777"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap\n```\n\napply | Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initia", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4778"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/nginx\n```\n\napply | Edit the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4779"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied -f deploy.yaml -o json\n```\n\napply | Edit the latest last-applied-configuration annotations of resources from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4780"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml\n```\n\napply | Execute set-last-applied against each configuration file in a directory", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4781"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f path/\n```\n\napply | Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4782"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml --create-annotation=true\n```\n\napply | Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run,", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4783"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied deployment/nginx\n```\n\napply | View the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4784"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied -f deploy.yaml -o json\n```\n\napply | View the latest last-applied-configuration annotations by type/name or file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4785"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend'\n```\n\nannotate | Update a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4786"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate -f pod.json description='my frontend'\n```\n\nannotate | Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4787"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate --overwrite pods foo description='my frontend running nginx'\n```\n\nannotate | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4788"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods --all description='my frontend running nginx'\n```\n\nannotate | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4789"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend running nginx' --resource-version=1\n```\n\nannotate | Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4790"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description-\n```\n\nannotate | Update the annotations on one or more resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4791"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment foo --min=2 --max=10\n```\n\nautoscale | Auto scale a replication controller \"foo\", with the number of pods between 1 and 5, target CPU utilization at 80%", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4792"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rc foo --max=5 --cpu-percent=80\n```\n\nautoscale | Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4793"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox\n```\n\ndebug | Create a debug container named debugger using a custom automated debugging image. # (requires the EphemeralContainers feature to be enabled in the cluster)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4794"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug --image=myproj/debug-tools -c debugger mypod\n```\n\ndebug | Create a copy of mypod adding a debug container and attach to it", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4795"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox --copy-to=my-debugger\n```\n\ndebug | Create a copy of mypod changing the command of mycontainer", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4796"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh\n```\n\ndebug | Create a copy of mypod changing all container images to busybox", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4797"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod --copy-to=my-debugger --set-image=*=busybox\n```\n\ndebug | Create a copy of mypod adding a debug container and changing container images", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4798"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug\n```\n\ndebug | Create an interactive debugging session on a node and immediately attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at /host", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4799"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=busybox\n```\n\ndebug | Debug cluster resources using interactive debugging containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4800"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f pod.json\n```\n\ndiff | Diff file read from stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4801"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry\n```\n\nedit | Use an alternative editor", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4802"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit job.v1.batch/myjob -o json\n```\n\nedit | Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4803"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/mydeployment -o yaml --save-config\n```\n\nedit | Edit a resource from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4804"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize /home/config/production\n```\n\nkustomize | Build from github", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4805"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6\n```\n\nkustomize | Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying sa", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4806"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo unhealthy=true\n```\n\nlabel | Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4807"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite pods foo status=unhealthy\n```\n\nlabel | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4808"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods --all status=unhealthy\n```\n\nlabel | Update a pod identified by the type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4809"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label -f pod.json status=unhealthy\n```\n\nlabel | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4810"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo status=unhealthy --resource-version=1\n```\n\nlabel | Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4811"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo bar-\n```\n\nlabel | Update the labels on a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4812"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Partially update a node using a strategic merge patch, specifying the patch as YAML", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4813"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p $'spec:\\n unschedulable: true'\n```\n\npatch | Partially update a node identified by the type and name specified in \"node.json\" using strategic merge patch", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4814"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch -f node.json -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Update a container's image; spec.containers[*].name is required because it's a merge key", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4815"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n```\n\npatch | Update a container's image using a JSON patch with positional arrays", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4816"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n```\n\npatch | Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4817"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f ./pod.json\n```\n\nreplace | Replace a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4818"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n```\n\nreplace | Force replace, delete and then re-create the resource", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4819"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace --force -f ./pod.json\n```\n\nreplace | Replace a resource by file name or stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4820"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Check the rollout status of a daemonset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4821"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status daemonset/foo\n```\n\nrollout | Manage the rollout of a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4822"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/abc\n```\n\nrollout | View the details of daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4823"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset/abc --revision=3\n```\n\nrollout | View previous rollout revisions and configurations.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4824"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx\n```\n\nrollout | Mark the provided resource as paused.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4825"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment/nginx\n```\n\nrollout | Restart a daemon set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4826"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart daemonset/abc\n```\n\nrollout | Restart a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4827"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx\n```\n\nrollout | Resume a paused resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4828"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx\n```\n\nrollout | Show the status of the rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4829"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Roll back to daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4830"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset/abc --to-revision=3\n```\n\nrollout | Roll back to the previous deployment with dry-run", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4831"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo --dry-run=server deployment/abc\n```\n\nrollout | Roll back to a previous rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4832"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo\n```\n\nscale | Scale a resource identified by type and name specified in \"foo.yaml\" to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4833"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 -f foo.yaml\n```\n\nscale | If the deployment named mysql's current size is 2, scale mysql to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4834"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql\n```\n\nscale | Scale multiple replication controllers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4835"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz\n```\n\nscale | Scale stateful set named 'web' to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4836"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 statefulset/web\n```\n\nscale | Set a new size for a deployment, replica set, replication controller, or stateful set.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4837"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/registry STORAGE_DIR=/local\n```\n\nset | List the environment variables defined on a deployments 'sample-build'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4838"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build --list\n```\n\nset | List the environment variables defined on all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4839"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env pods --all --list\n```\n\nset | Output modified deployment in YAML, and does not alter the object on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4840"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml\n```\n\nset | Update all containers in all replication controllers in the project to have ENV=prod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4841"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env rc --all ENV=prod\n```\n\nset | Import environment from a secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4842"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=secret/mysecret deployment/myapp\n```\n\nset | Import environment from a config map with a prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4843"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp\n```\n\nset | Import specific keys from a config map", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4844"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp\n```\n\nset | Remove the environment variable ENV from container 'c1' in all deployment configs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4845"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployments --all --containers=\"c1\" ENV-\n```\n\nset | Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4846"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env -f deploy.json ENV-\n```\n\nset | Set some of the local shell environment into a deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4847"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1\n```\n\nset | Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4848"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments,rc nginx=nginx:1.9.1 --all\n```\n\nset | Update image of all containers of daemonset abc to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4849"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image daemonset abc *=nginx:1.9.1\n```\n\nset | Print result (in yaml format) of updating nginx container image from local file, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4850"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml\n```\n\nset | Update existing container image(s) of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4851"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nset | Set the resource request and limits for all containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4852"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi\n```\n\nset | Remove the resource requests for resources on containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4853"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0\n```\n\nset | Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4854"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml\n```\n\nset | Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4855"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\nkubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -\n```\n\nset | Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4856"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount deployment nginx-deployment serviceaccount1\n```\n\nset | Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4857"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml\n```\n\nset | Update the service account of pod template resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4858"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1\n```\n\nset | Update a role binding for user1, user2, and group1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4859"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1\n```\n\nset | Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4860"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml\n```\n\nset | Update the user, group, or service account in a role binding or cluster role binding.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4861"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready pod/busybox1\n```\n\nwait | The default value of status condition is true; you can set it to false", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4862"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready=false pod/busybox1\n```\n\nwait | Wait for the pod \"busybox1\" to be deleted, with a timeout of 60s, after having issued the \"delete\" command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4863"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/busybox1\nkubectl wait --for=delete pod/busybox1 --timeout=60s\n```\n\nwait | Experimental: Wait for a specific condition on one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4864"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container\n```\n\nattach | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4865"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container -i -t\n```\n\nattach | Get output from the first pod of a replica set named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4866"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach rs/nginx\n```\n\nattach | Attach to a process that is already running inside an existing container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4867"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create pods --all-namespaces\n```\n\nauth | Check to see if I can list deployments in my current namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4868"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list deployments.apps\n```\n\nauth | Check to see if I can do everything in my current namespace (\"*\" means all)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4869"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i '*' '*'\n```\n\nauth | Check to see if I can get the job named \"bar\" in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4870"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list jobs.batch/bar -n foo\n```\n\nauth | Check to see if I can read pod logs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4871"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get pods --subresource=log\n```\n\nauth | Check to see if I can access the URL /logs/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4872"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get /logs/\n```\n\nauth | List all allowed actions in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4873"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i --list --namespace=foo\n```\n\nauth | Check whether an action is allowed.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4874"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nauth | Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4875"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar\n```\n\ncp | Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4876"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4877"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4878"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar\n```\n\ncp | Copy /tmp/foo from a remote pod to /tmp/bar locally", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4879"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar\n```\n\ncp | Copy files and directories to and from containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4880"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes kubernetes-node-emt8.c.myproject.internal\n```\n\ndescribe | Describe a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4881"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods/nginx\n```\n\ndescribe | Describe a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4882"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f pod.json\n```\n\ndescribe | Describe all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4883"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\ndescribe | Describe pods by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4884"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe po -l name=myLabel\n```\n\ndescribe | Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4885"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods frontend\n```\n\ndescribe | Show details of a specific resource or group of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4886"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -- date\n```\n\nexec | Get output from running the 'date' command in ruby-container from pod mypod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4887"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -- date\n```\n\nexec | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4888"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -i -t -- bash -il\n```\n\nexec | List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4889"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -i -t -- ls -t /usr\n```\n\nexec | Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4890"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec deploy/mydeployment -- date\n```\n\nexec | Get output from running 'date' command from the first pod of the service myservice, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4891"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec svc/myservice -- date\n```\n\nexec | Execute a command in a container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4892"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs nginx --all-containers=true\n```\n\nlogs | Return snapshot logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4893"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app=nginx --all-containers=true\n```\n\nlogs | Return snapshot of previous terminated ruby container logs from pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4894"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -p -c ruby web-1\n```\n\nlogs | Begin streaming the logs of the ruby container in pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4895"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -c ruby web-1\n```\n\nlogs | Begin streaming the logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4896"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l app=nginx --all-containers=true\n```\n\nlogs | Display only the most recent 20 lines of output in pod nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4897"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --tail=20 nginx\n```\n\nlogs | Show all logs from pod nginx written in the last hour", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4898"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --since=1h nginx\n```\n\nlogs | Show logs from a kubelet with an expired serving certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4899"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --insecure-skip-tls-verify-backend nginx\n```\n\nlogs | Return snapshot logs from first container of a job named hello", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4900"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs job/hello\n```\n\nlogs | Return snapshot logs from container nginx-1 of a deployment named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4901"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/nginx -c nginx-1\n```\n\nlogs | Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4902"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 5000 6000\n```\n\nport-forward | Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4903"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mydeployment 5000 6000\n```\n\nport-forward | Listen on port 8443 locally, forwarding to the targetPort of the service's port named \"https\" in a pod selected by the service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4904"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/myservice 8443:https\n```\n\nport-forward | Listen on port 8888 locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4905"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on all addresses, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4906"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4907"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000\n```\n\nport-forward | Listen on a random port locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4908"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod :5000\n```\n\nport-forward | Forward one or more local ports to a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4909"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/\n```\n\nproxy | To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4910"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/\n```\n\nproxy | To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4911"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/custom/\n```\n\nproxy | Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4912"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8011 --www=./local/www/\n```\n\nproxy | Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4913"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=0\n```\n\nproxy | Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4914"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/k8s-api\n```\n\nproxy | Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through on", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4915"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top node NODE_NAME\n```\n\ntop | Display resource (CPU/memory) usage of nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4916"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod --namespace=NAMESPACE\n```\n\ntop | Show metrics for a given pod and its containers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4917"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod POD_NAME --containers\n```\n\ntop | Show metrics for the pods defined by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4918"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -l name=myLabel\n```\n\ntop | Display resource (CPU/memory) usage of pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4919"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve csr-sqgzp\n```\n\ncertificate | Approve a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4920"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny csr-sqgzp\n```\n\ncertificate | Deny a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4921"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\ncluster-info | Dump current cluster state to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4922"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump all namespaces to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4923"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --all-namespaces\n```\n\ncluster-info | Dump a set of namespaces to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4924"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you sp", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4925"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --force\n```\n\ndrain | As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4926"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --grace-period=900\n```\n\ndrain | Drain node in preparation for maintenance.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4927"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\ntaint | Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4928"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated:NoSchedule-\n```\n\ntaint | Remove from node 'foo' all the taints with key 'dedicated'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4929"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated-\n```\n\ntaint | Add a taint with key 'dedicated' on nodes having label mylabel=X", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4930"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint node -l myLabel=X  dedicated=foo:PreferNoSchedule\n```\n\ntaint | Add to node 'foo' a taint with key 'bar' and no value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4931"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo bar:NoSchedule\n```\n\ntaint | Update the taints on one or more nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4932"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\napi-resources | Print the supported API resources with more information", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4933"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources -o wide\n```\n\napi-resources | Print the supported API resources sorted by a column", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4934"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --sort-by=name\n```\n\napi-resources | Print the supported namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4935"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true\n```\n\napi-resources | Print the supported non-namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4936"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=false\n```\n\napi-resources | Print the supported API resources with a specific APIGroup", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4937"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --api-group=extensions\n```\n\napi-resources | Print the supported API resources on the server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4938"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl\n```\n\ncompletion | Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion co", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4939"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > ~/.kube/completion.bash.inc\nprintf \"\n```\n\ncompletion | Kubectl shell completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4940"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh > \"${fpath[1]}/_kubectl\"\n```\n\ncompletion | Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .b", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4941"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nconfig | Display the current-context.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4942"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster minikube\n```\n\nconfig | Delete the specified cluster from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4943"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context minikube\n```\n\nconfig | Delete the specified context from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4944"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user minikube\n```\n\nconfig | Delete the specified user from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4945"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters\n```\n\nconfig | Display clusters defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4946"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nconfig | Describe one context in your kubeconfig file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4947"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts my-context\n```\n\nconfig | Display one or many contexts from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4948"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users\n```\n\nconfig | Display users defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4949"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context old-name new-name\n```\n\nconfig | Renames a context from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4950"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.server https://1.2.3.4\n```\n\nconfig | Set the certificate-authority-data field on the my-cluster cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4951"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.certificate-authority-data $(echo \"cert_data_here\" | base64 -i -)\n```\n\nconfig | Set the cluster field in the my-context context to my-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4952"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set contexts.my-context.cluster my-cluster\n```\n\nconfig | Set the client-key-data field in the cluster-admin user using --set-raw-bytes option", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4953"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true\n```\n\nconfig | Set an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4954"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --server=https://1.2.3.4\n```\n\nconfig | Embed certificate authority data for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4955"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt\n```\n\nconfig | Disable cert checking for the dev cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4956"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --insecure-skip-tls-verify=true\n```\n\nconfig | Set custom TLS server name to use for validation for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4957"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --tls-server-name=my-cluster-name\n```\n\nconfig | Set a cluster entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4958"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context gce --user=cluster-admin\n```\n\nconfig | Set a context entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4959"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key\n```\n\nconfig | Set basic auth for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4960"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif\n```\n\nconfig | Embed client certificate data in the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4961"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true\n```\n\nconfig | Enable the Google Compute Platform auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4962"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=gcp\n```\n\nconfig | Enable the OpenID Connect auth provider for the \"cluster-admin\" entry with additional args", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4963"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar\n```\n\nconfig | Remove the \"client-secret\" config value for the OpenID Connect auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4964"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-\n```\n\nconfig | Enable new exec auth plugin for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4965"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1\n```\n\nconfig | Define new exec auth plugin args for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4966"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2\n```\n\nconfig | Create or update exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4967"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2\n```\n\nconfig | Remove exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4968"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=var-to-remove-\n```\n\nconfig | Set a user entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4969"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset current-context\n```\n\nconfig | Unset namespace in foo context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4970"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset contexts.foo.namespace\n```\n\nconfig | Unset an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4971"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context minikube\n```\n\nconfig | Set the current-context in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4972"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view --raw\n```\n\nconfig | Get the password for the e2e user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4973"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n```\n\nconfig | Display merged kubeconfig settings or a specified kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4974"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl explain pods.spec.containers\n```\n\nexplain | List the fields for supported resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4975"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./pod.json\n```\n\ncreate | Create a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4976"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f docker-registry.yaml --edit -o json\n```\n\ncreate | Create a resource from a file or from stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4977"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\ncreate | Create a cluster role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4978"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a cluster role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4979"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a cluster role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4980"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a cluster role name \"foo\" with NonResourceURL specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4981"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\ncreate | Create a cluster role name \"monitoring\" with AggregationRule specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4982"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\ncreate | Create a cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4983"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a cluster role binding for a particular cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4984"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config with specified keys instead of file basenames on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4985"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt\n```\n\ncreate | Create a new config map named my-config with key1=config1 and key2=config2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4986"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2\n```\n\ncreate | Create a new config map named my-config from the key=value pairs in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4987"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4988"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-env-file=path/to/bar.env\n```\n\ncreate | Create a config map based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4989"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\"\n```\n\ncreate | Create a cron job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4990"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" -- date\n```\n\ncreate | Create a cron job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4991"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox\n```\n\ncreate | Create a deployment with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4992"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox -- date\n```\n\ncreate | Create a deployment named my-dep that runs the nginx image with 3 replicas", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4993"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=nginx --replicas=3\n```\n\ncreate | Create a deployment named my-dep that runs the busybox image and expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4994"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox --port=5701\n```\n\ncreate | Create a deployment with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4995"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress simple --rule=\"foo.com/bar=svc1:8080,tls=my-cert\"\n```\n\ncreate | Create a catch all ingress of \"/path\" pointing to service svc:port and Ingress Class as \"otheringress\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4996"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress catch-all --class=otheringress --rule=\"/path=svc:port\"\n```\n\ncreate | Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4997"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress annotated --class=default --rule=\"foo.com/bar=svc:port\" \\\n--annotation ingress.annotation1=foo \\\n--annotation ingress.annotation2=bla\n```\n\ncreate | Create an ingress with the same host and multiple paths", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4998"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress multipath --class=default \\\n--rule=\"foo.com/=svc:port\" \\\n--rule=\"foo.com/admin/=svcadmin:portadmin\"\n```\n\ncreate | Create an ingress with multiple hosts and the pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_4999"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingress1 --class=default \\\n--rule=\"foo.com/path*=svc:8080\" \\\n--rule=\"bar.com/admin*=svc2:http\"\n```\n\ncreate | Create an ingress with TLS enabled using the default ingress certificate and different path types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5000"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingtls --class=default \\\n--rule=\"foo.com/=svc:https,tls\" \\\n--rule=\"foo.com/path/subpath*=othersvc:8080\"\n```\n\ncreate | Create an ingress with TLS enabled using a specific secret and pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5001"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingsecret --class=default \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with a default backend", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5002"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingdefault --class=default \\\n--default-backend=defaultsvc:http \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5003"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox\n```\n\ncreate | Create a job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5004"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox -- date\n```\n\ncreate | Create a job from a cron job named \"a-cronjob\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5005"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job test-job --from=cronjob/a-cronjob\n```\n\ncreate | Create a job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5006"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace my-namespace\n```\n\ncreate | Create a namespace with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5007"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1\n```\n\ncreate | Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5008"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create pdb my-pdb --selector=app=nginx --min-available=50%\n```\n\ncreate | Create a pod disruption budget with the specified name, selector, and desired minimum available pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5009"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\"\n```\n\ncreate | Create a priority class named default-priority that is considered as the global default priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5010"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass default-priority --value=1000 --global-default=true --description=\"default priority\"\n```\n\ncreate | Create a priority class named high-priority that cannot preempt pods with lower priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5011"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\" --preemption-policy=\"Never\"\n```\n\ncreate | Create a priority class with the specified name, value, globalDefault and description.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5012"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10\n```\n\ncreate | Create a new resource quota named best-effort", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5013"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota best-effort --hard=pods=100 --scopes=BestEffort\n```\n\ncreate | Create a resource quota with the specified name, hard limits, and optional scopes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5014"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\ncreate | Create a role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5015"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5016"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5017"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a role with single rule.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5018"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a role binding for a particular role or cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5019"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL\n```\n\ncreate | Create a new secret named my-secret from ~/.docker/config.json", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5020"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json\n```\n\ncreate | Create a new secret for use with Docker registries.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5021"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=path/to/bar\n```\n\ncreate | Create a new secret named my-secret with specified keys instead of names on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5022"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub\n```\n\ncreate | Create a new secret named my-secret with key1=supersecret and key2=topsecret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5023"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret\n```\n\ncreate | Create a new secret named my-secret using a combination of a file and a literal", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5024"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret\n```\n\ncreate | Create a new secret named my-secret from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5025"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-env-file=path/to/bar.env\n```\n\ncreate | Create a secret based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5026"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key\n```\n\ncreate | Create a TLS secret from the given public/private key pair.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5027"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --tcp=5678:8080\n```\n\ncreate | Create a new ClusterIP service named my-cs (in headless mode)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5028"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --clusterip=\"None\"\n```\n\ncreate | Create a ClusterIP service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5029"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname my-ns --external-name bar.com\n```\n\ncreate | Create an ExternalName service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5030"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer my-lbs --tcp=5678:8080\n```\n\ncreate | Create a LoadBalancer service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5031"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport my-ns --tcp=5678:8080\n```\n\ncreate | Create a NodePort service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5032"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount my-service-account\n```\n\ncreate | Create a service account with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5033"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nget | List a single replication controller with specified NAME in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5034"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get replicationcontroller web\n```\n\nget | List deployments in JSON output format, in the \"v1\" version of the \"apps\" API group", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5035"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments.v1.apps -o json\n```\n\nget | List a single pod in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5036"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o json pod web-pod-13je7\n```\n\nget | List a pod identified by type and name specified in \"pod.yaml\" in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5037"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -f pod.yaml -o json\n```\n\nget | List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5038"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}\n```\n\nget | List resource information in custom columns", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5039"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image\n```\n\nget | List all replication controllers and services together in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5040"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc,services\n```\n\nget | List one or more resources by their type and names", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5041"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc/web service/frontend pods/web-pod-13je7\n```\n\nget | Display one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5042"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx\n```\n\nrun | Start a hazelcast pod and let the container expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5043"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --port=5701\n```\n\nrun | Start a hazelcast pod and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5044"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --env=\"DNS_DOMAIN=cluster\" --env=\"POD_NAMESPACE=default\"\n```\n\nrun | Start a hazelcast pod and set labels \"app=hazelcast\" and \"env=prod\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5045"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --labels=\"app=hazelcast,env=prod\"\n```\n\nrun | Dry run; print the corresponding API objects without creating them", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5046"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --dry-run=client\n```\n\nrun | Start a nginx pod, but overload the spec with a partial set of values parsed from JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5047"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\": \"v1\", \"spec\": { ... } }'\n```\n\nrun | Start a busybox pod and keep it in the foreground, don't restart it if it exits", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5048"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run -i -t busybox --image=busybox --restart=Never\n```\n\nrun | Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5049"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>\n```\n\nrun | Start the nginx pod using a different command and custom arguments", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5050"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>\n```\n\nrun | Create and run a particular image in a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5051"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5052"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose -f nginx-controller.yaml --port=80 --target-port=8000\n```\n\nexpose | Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5053"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod valid-pod --port=444 --name=frontend\n```\n\nexpose | Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5054"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https\n```\n\nexpose | Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5055"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream\n```\n\nexpose | Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5056"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rs nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5057"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80 --target-port=8000\n```\n\nexpose | Expose a resource as a new Kubernetes service.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5058"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json\n```\n\ndelete | Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5059"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -k dir\n```\n\ndelete | Delete a pod based on the type and name in the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5060"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod,service baz foo\n```\n\ndelete | Delete pods and services with label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5061"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods,services -l name=myLabel\n```\n\ndelete | Delete a pod with minimal delay", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5062"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --now\n```\n\ndelete | Force delete a pod on a dead node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5063"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --force\n```\n\ndelete | Delete all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5064"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods --all\n```\n\ndelete | Delete resources by file names, stdin, resources and names, or by resources and label selector.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5065"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./pod.json\n```\n\napply | Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5066"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k dir/\n```\n\napply | Apply the JSON passed into stdin to a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5067"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml -l app=nginx\n```\n\napply | Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5068"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap\n```\n\napply | Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initia", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5069"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/nginx\n```\n\napply | Edit the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5070"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied -f deploy.yaml -o json\n```\n\napply | Edit the latest last-applied-configuration annotations of resources from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5071"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml\n```\n\napply | Execute set-last-applied against each configuration file in a directory", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5072"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f path/\n```\n\napply | Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5073"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml --create-annotation=true\n```\n\napply | Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run,", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5074"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied deployment/nginx\n```\n\napply | View the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5075"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied -f deploy.yaml -o json\n```\n\napply | View the latest last-applied-configuration annotations by type/name or file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5076"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend'\n```\n\nannotate | Update a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5077"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate -f pod.json description='my frontend'\n```\n\nannotate | Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5078"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate --overwrite pods foo description='my frontend running nginx'\n```\n\nannotate | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5079"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods --all description='my frontend running nginx'\n```\n\nannotate | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5080"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend running nginx' --resource-version=1\n```\n\nannotate | Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5081"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description-\n```\n\nannotate | Update the annotations on one or more resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5082"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment foo --min=2 --max=10\n```\n\nautoscale | Auto scale a replication controller \"foo\", with the number of pods between 1 and 5, target CPU utilization at 80%", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5083"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rc foo --max=5 --cpu-percent=80\n```\n\nautoscale | Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5084"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox\n```\n\ndebug | Create a debug container named debugger using a custom automated debugging image. # (requires the EphemeralContainers feature to be enabled in the cluster)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5085"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug --image=myproj/debug-tools -c debugger mypod\n```\n\ndebug | Create a copy of mypod adding a debug container and attach to it", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5086"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox --copy-to=my-debugger\n```\n\ndebug | Create a copy of mypod changing the command of mycontainer", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5087"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh\n```\n\ndebug | Create a copy of mypod changing all container images to busybox", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5088"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod --copy-to=my-debugger --set-image=*=busybox\n```\n\ndebug | Create a copy of mypod adding a debug container and changing container images", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5089"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug\n```\n\ndebug | Create an interactive debugging session on a node and immediately attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at /host", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5090"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=busybox\n```\n\ndebug | Debug cluster resources using interactive debugging containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5091"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f pod.json\n```\n\ndiff | Diff file read from stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5092"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry\n```\n\nedit | Use an alternative editor", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5093"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit job.v1.batch/myjob -o json\n```\n\nedit | Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5094"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/mydeployment -o yaml --save-config\n```\n\nedit | Edit a resource from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5095"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize /home/config/production\n```\n\nkustomize | Build from github", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5096"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6\n```\n\nkustomize | Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying sa", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5097"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo unhealthy=true\n```\n\nlabel | Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5098"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite pods foo status=unhealthy\n```\n\nlabel | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5099"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods --all status=unhealthy\n```\n\nlabel | Update a pod identified by the type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5100"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label -f pod.json status=unhealthy\n```\n\nlabel | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5101"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo status=unhealthy --resource-version=1\n```\n\nlabel | Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5102"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo bar-\n```\n\nlabel | Update the labels on a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5103"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Partially update a node using a strategic merge patch, specifying the patch as YAML", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5104"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p $'spec:\\n unschedulable: true'\n```\n\npatch | Partially update a node identified by the type and name specified in \"node.json\" using strategic merge patch", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5105"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch -f node.json -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Update a container's image; spec.containers[*].name is required because it's a merge key", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5106"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n```\n\npatch | Update a container's image using a JSON patch with positional arrays", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5107"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n```\n\npatch | Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5108"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f ./pod.json\n```\n\nreplace | Replace a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5109"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n```\n\nreplace | Force replace, delete and then re-create the resource", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5110"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace --force -f ./pod.json\n```\n\nreplace | Replace a resource by file name or stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5111"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Check the rollout status of a daemonset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5112"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status daemonset/foo\n```\n\nrollout | Manage the rollout of a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5113"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/abc\n```\n\nrollout | View the details of daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5114"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset/abc --revision=3\n```\n\nrollout | View previous rollout revisions and configurations.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5115"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx\n```\n\nrollout | Mark the provided resource as paused.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5116"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment/nginx\n```\n\nrollout | Restart a daemon set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5117"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart daemonset/abc\n```\n\nrollout | Restart a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5118"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx\n```\n\nrollout | Resume a paused resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5119"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx\n```\n\nrollout | Show the status of the rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5120"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Roll back to daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5121"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset/abc --to-revision=3\n```\n\nrollout | Roll back to the previous deployment with dry-run", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5122"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo --dry-run=server deployment/abc\n```\n\nrollout | Roll back to a previous rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5123"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo\n```\n\nscale | Scale a resource identified by type and name specified in \"foo.yaml\" to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5124"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 -f foo.yaml\n```\n\nscale | If the deployment named mysql's current size is 2, scale mysql to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5125"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql\n```\n\nscale | Scale multiple replication controllers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5126"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz\n```\n\nscale | Scale stateful set named 'web' to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5127"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 statefulset/web\n```\n\nscale | Set a new size for a deployment, replica set, replication controller, or stateful set.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5128"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/registry STORAGE_DIR=/local\n```\n\nset | List the environment variables defined on a deployments 'sample-build'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5129"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build --list\n```\n\nset | List the environment variables defined on all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5130"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env pods --all --list\n```\n\nset | Output modified deployment in YAML, and does not alter the object on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5131"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml\n```\n\nset | Update all containers in all replication controllers in the project to have ENV=prod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5132"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env rc --all ENV=prod\n```\n\nset | Import environment from a secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5133"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=secret/mysecret deployment/myapp\n```\n\nset | Import environment from a config map with a prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5134"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp\n```\n\nset | Import specific keys from a config map", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5135"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp\n```\n\nset | Remove the environment variable ENV from container 'c1' in all deployment configs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5136"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployments --all --containers=\"c1\" ENV-\n```\n\nset | Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5137"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env -f deploy.json ENV-\n```\n\nset | Set some of the local shell environment into a deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5138"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1\n```\n\nset | Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5139"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments,rc nginx=nginx:1.9.1 --all\n```\n\nset | Update image of all containers of daemonset abc to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5140"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image daemonset abc *=nginx:1.9.1\n```\n\nset | Print result (in yaml format) of updating nginx container image from local file, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5141"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml\n```\n\nset | Update existing container image(s) of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5142"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nset | Set the resource request and limits for all containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5143"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi\n```\n\nset | Remove the resource requests for resources on containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5144"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0\n```\n\nset | Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5145"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml\n```\n\nset | Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5146"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\nkubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -\n```\n\nset | Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5147"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount deployment nginx-deployment serviceaccount1\n```\n\nset | Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5148"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml\n```\n\nset | Update the service account of pod template resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5149"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1\n```\n\nset | Update a role binding for user1, user2, and group1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5150"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1\n```\n\nset | Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5151"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml\n```\n\nset | Update the user, group, or service account in a role binding or cluster role binding.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5152"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready pod/busybox1\n```\n\nwait | The default value of status condition is true; you can set it to false", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5153"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready=false pod/busybox1\n```\n\nwait | Wait for the pod \"busybox1\" to be deleted, with a timeout of 60s, after having issued the \"delete\" command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5154"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/busybox1\nkubectl wait --for=delete pod/busybox1 --timeout=60s\n```\n\nwait | Experimental: Wait for a specific condition on one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5155"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container\n```\n\nattach | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5156"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container -i -t\n```\n\nattach | Get output from the first pod of a replica set named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5157"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach rs/nginx\n```\n\nattach | Attach to a process that is already running inside an existing container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5158"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create pods --all-namespaces\n```\n\nauth | Check to see if I can list deployments in my current namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5159"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list deployments.apps\n```\n\nauth | Check to see if I can do everything in my current namespace (\"*\" means all)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5160"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i '*' '*'\n```\n\nauth | Check to see if I can get the job named \"bar\" in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5161"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list jobs.batch/bar -n foo\n```\n\nauth | Check to see if I can read pod logs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5162"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get pods --subresource=log\n```\n\nauth | Check to see if I can access the URL /logs/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5163"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get /logs/\n```\n\nauth | List all allowed actions in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5164"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i --list --namespace=foo\n```\n\nauth | Check whether an action is allowed.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5165"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nauth | Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5166"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar\n```\n\ncp | Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5167"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5168"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5169"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar\n```\n\ncp | Copy /tmp/foo from a remote pod to /tmp/bar locally", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5170"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar\n```\n\ncp | Copy files and directories to and from containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5171"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes kubernetes-node-emt8.c.myproject.internal\n```\n\ndescribe | Describe a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5172"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods/nginx\n```\n\ndescribe | Describe a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5173"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f pod.json\n```\n\ndescribe | Describe all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5174"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\ndescribe | Describe pods by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5175"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe po -l name=myLabel\n```\n\ndescribe | Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5176"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods frontend\n```\n\ndescribe | Show details of a specific resource or group of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5177"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -- date\n```\n\nexec | Get output from running the 'date' command in ruby-container from pod mypod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5178"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -- date\n```\n\nexec | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5179"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -i -t -- bash -il\n```\n\nexec | List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5180"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -i -t -- ls -t /usr\n```\n\nexec | Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5181"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec deploy/mydeployment -- date\n```\n\nexec | Get output from running 'date' command from the first pod of the service myservice, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5182"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec svc/myservice -- date\n```\n\nexec | Execute a command in a container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5183"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs nginx --all-containers=true\n```\n\nlogs | Return snapshot logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5184"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app=nginx --all-containers=true\n```\n\nlogs | Return snapshot of previous terminated ruby container logs from pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5185"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -p -c ruby web-1\n```\n\nlogs | Begin streaming the logs of the ruby container in pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5186"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -c ruby web-1\n```\n\nlogs | Begin streaming the logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5187"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l app=nginx --all-containers=true\n```\n\nlogs | Display only the most recent 20 lines of output in pod nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5188"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --tail=20 nginx\n```\n\nlogs | Show all logs from pod nginx written in the last hour", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5189"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --since=1h nginx\n```\n\nlogs | Show logs from a kubelet with an expired serving certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5190"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --insecure-skip-tls-verify-backend nginx\n```\n\nlogs | Return snapshot logs from first container of a job named hello", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5191"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs job/hello\n```\n\nlogs | Return snapshot logs from container nginx-1 of a deployment named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5192"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/nginx -c nginx-1\n```\n\nlogs | Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5193"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 5000 6000\n```\n\nport-forward | Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5194"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mydeployment 5000 6000\n```\n\nport-forward | Listen on port 8443 locally, forwarding to the targetPort of the service's port named \"https\" in a pod selected by the service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5195"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/myservice 8443:https\n```\n\nport-forward | Listen on port 8888 locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5196"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on all addresses, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5197"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5198"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000\n```\n\nport-forward | Listen on a random port locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5199"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod :5000\n```\n\nport-forward | Forward one or more local ports to a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5200"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/\n```\n\nproxy | To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5201"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/\n```\n\nproxy | To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5202"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/custom/\n```\n\nproxy | Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5203"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8011 --www=./local/www/\n```\n\nproxy | Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5204"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=0\n```\n\nproxy | Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5205"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/k8s-api\n```\n\nproxy | Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through on", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5206"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top node NODE_NAME\n```\n\ntop | Display resource (CPU/memory) usage of nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5207"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod --namespace=NAMESPACE\n```\n\ntop | Show metrics for a given pod and its containers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5208"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod POD_NAME --containers\n```\n\ntop | Show metrics for the pods defined by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5209"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -l name=myLabel\n```\n\ntop | Display resource (CPU/memory) usage of pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5210"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve csr-sqgzp\n```\n\ncertificate | Approve a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5211"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny csr-sqgzp\n```\n\ncertificate | Deny a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5212"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\ncluster-info | Dump current cluster state to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5213"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump all namespaces to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5214"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --all-namespaces\n```\n\ncluster-info | Dump a set of namespaces to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5215"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you sp", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5216"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --force\n```\n\ndrain | As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5217"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --grace-period=900\n```\n\ndrain | Drain node in preparation for maintenance.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5218"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\ntaint | Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5219"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated:NoSchedule-\n```\n\ntaint | Remove from node 'foo' all the taints with key 'dedicated'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5220"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated-\n```\n\ntaint | Add a taint with key 'dedicated' on nodes having label mylabel=X", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5221"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint node -l myLabel=X  dedicated=foo:PreferNoSchedule\n```\n\ntaint | Add to node 'foo' a taint with key 'bar' and no value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5222"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo bar:NoSchedule\n```\n\ntaint | Update the taints on one or more nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5223"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\napi-resources | Print the supported API resources with more information", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5224"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources -o wide\n```\n\napi-resources | Print the supported API resources sorted by a column", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5225"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --sort-by=name\n```\n\napi-resources | Print the supported namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5226"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true\n```\n\napi-resources | Print the supported non-namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5227"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=false\n```\n\napi-resources | Print the supported API resources with a specific APIGroup", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5228"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --api-group=extensions\n```\n\napi-resources | Print the supported API resources on the server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5229"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl\n```\n\ncompletion | Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion co", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5230"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > ~/.kube/completion.bash.inc\nprintf \"\n```\n\ncompletion | Kubectl shell completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5231"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh > \"${fpath[1]}/_kubectl\"\n```\n\ncompletion | Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .b", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5232"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nconfig | Display the current-context.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5233"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster minikube\n```\n\nconfig | Delete the specified cluster from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5234"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context minikube\n```\n\nconfig | Delete the specified context from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5235"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user minikube\n```\n\nconfig | Delete the specified user from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5236"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters\n```\n\nconfig | Display clusters defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5237"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nconfig | Describe one context in your kubeconfig file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5238"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts my-context\n```\n\nconfig | Display one or many contexts from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5239"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users\n```\n\nconfig | Display users defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5240"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context old-name new-name\n```\n\nconfig | Renames a context from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5241"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.server https://1.2.3.4\n```\n\nconfig | Set the certificate-authority-data field on the my-cluster cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5242"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.certificate-authority-data $(echo \"cert_data_here\" | base64 -i -)\n```\n\nconfig | Set the cluster field in the my-context context to my-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5243"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set contexts.my-context.cluster my-cluster\n```\n\nconfig | Set the client-key-data field in the cluster-admin user using --set-raw-bytes option", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5244"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true\n```\n\nconfig | Set an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5245"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --server=https://1.2.3.4\n```\n\nconfig | Embed certificate authority data for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5246"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt\n```\n\nconfig | Disable cert checking for the dev cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5247"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --insecure-skip-tls-verify=true\n```\n\nconfig | Set custom TLS server name to use for validation for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5248"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --tls-server-name=my-cluster-name\n```\n\nconfig | Set a cluster entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5249"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context gce --user=cluster-admin\n```\n\nconfig | Set a context entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5250"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key\n```\n\nconfig | Set basic auth for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5251"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif\n```\n\nconfig | Embed client certificate data in the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5252"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true\n```\n\nconfig | Enable the Google Compute Platform auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5253"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=gcp\n```\n\nconfig | Enable the OpenID Connect auth provider for the \"cluster-admin\" entry with additional args", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5254"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar\n```\n\nconfig | Remove the \"client-secret\" config value for the OpenID Connect auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5255"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-\n```\n\nconfig | Enable new exec auth plugin for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5256"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1\n```\n\nconfig | Define new exec auth plugin args for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5257"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2\n```\n\nconfig | Create or update exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5258"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2\n```\n\nconfig | Remove exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5259"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=var-to-remove-\n```\n\nconfig | Set a user entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5260"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset current-context\n```\n\nconfig | Unset namespace in foo context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5261"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset contexts.foo.namespace\n```\n\nconfig | Unset an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5262"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context minikube\n```\n\nconfig | Set the current-context in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5263"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view --raw\n```\n\nconfig | Get the password for the e2e user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5264"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n```\n\nconfig | Display merged kubeconfig settings or a specified kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5265"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl explain pods.spec.containers\n```\n\nexplain | List the fields for supported resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands", "id": "k8s_00389_code_5266"}
{"instruction": "Explain the Kubernetes concept: StatefulSets", "response": "StatefulSetsA StatefulSet runs a group of Pods, and maintains a sticky identity for each of those Pods. This is useful for managing applications that need persistent storage or a stable, unique network identity.StatefulSet is the workload API object used to manage stateful applications.Manages the deployment and scaling of a set of Pods, and provides guarantees about the ordering and uniqueness of these Pods.Like a Deployment, a StatefulSet manages Pods that are based on an identical container spec. Unlike a Deployment, a StatefulSet maintains a sticky identity for each of its Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.If you want to use storage volumes to provide persistence for your workload, you can use a StatefulSet as part of the solution. Although individual Pods in a StatefulSet are susceptible to failure, the persistent Pod identifiers make it easier to match existing volumes to the new Pods that replace any that have failed.Using StatefulSetsStatefulSets are valuable for applications that require one or more of the following.Stable, unique network identifiers.Stable, persistent storage.Ordered, graceful deployment and scaling.Ordered, automated rolling updates.In the above, stable is synonymous with persistence across Pod (re)scheduling. If an application doesn't require any stable identifiers or ordered deployment, deletion, or scaling, you should deploy your application using a workload object that provides a set of stateless replicas. Deployment or ReplicaSet may be better suited to your stateless needs.LimitationsThe storage for a given Pod must either be provisioned by a PersistentVolume Provisioner (examples here) based on the requested storage class, or pre-provisioned by an admin.Deleting and/or scaling a StatefulSet down will not delete the volumes associated with the StatefulSet. This is done to ensure data safety, which is generally more valuable than an automatic purge of all related StatefulSet resources.StatefulSets currently require a Headless Service to be responsible for the network identity of the Pods. You are responsible for creating this Service.StatefulSets do not provide any guarantees on the termination of pods when a StatefulSet is deleted. To achieve ordered and graceful termination of the pods in the StatefulSet, it is possible to scale the StatefulSet down to 0 prior to deletion.When using Rolling Updates with the default Pod Management Policy (OrderedReady), it's possible to get into a broken state that requires manual intervention to repair.ComponentsThe example below demonstrates the components of a StatefulSet.apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: selector: matchLabels: app: nginx # has to match .spec.template.metadata.labels serviceName: \"nginx\" replicas: 3 # by default is 1 minReadySeconds: 10 # by default is 0 template: metadata: labels: app: nginx # has to match .spec.selector.matchLabels spec: terminationGracePeriodSeconds: 10 containers: - name: nginx image: registry.k8s.io/nginx-slim:0.24 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates: - metadata: name: www spec: accessModes: [ \"ReadWriteOnce\" ] storageClassName: \"my-storage-class\" resources: requests: storage: 1Gi Note:This example uses the ReadWriteOnce access mode, for simplicity. For production use, the Kubernetes project recommends using the ReadWriteOncePod access mode instead.In the above example:A Headless Service, named nginx, is used to control the network domain.The StatefulSet, named web, has a Spec that indicates that 3 replicas of the nginx container will be launched in unique Pods.The volumeClaimTemplates will provide stable storage using PersistentVolumes provisioned by", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5268"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\nStatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5269"}
{"instruction": "Write a bash example for statefulsets", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\nStatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5270"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\nStatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5271"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5272"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\nStatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5273"}
{"instruction": "Write a bash example for statefulsets", "response": "Here's a bash example:\n\n```bash\n# View revision history\nkubectl rollout history statefulset/webapp\n\n# Rollback to a specific revision\nkubectl rollout undo statefulset/webapp --to-revision=3\n```\n\nStatefulSets | This will:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5274"}
{"instruction": "Write a bash example for statefulsets", "response": "Here's a bash example:\n\n```bash\n# List all revisions for the StatefulSet\nkubectl get controllerrevisions -l app.kubernetes.io/name=webapp\n\n# View detailed configuration of a specific revision\nkubectl get controllerrevision/webapp-3 -o yaml\n```\n\nStatefulSets | Regularly check revisions with:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5275"}
{"instruction": "Write a bash example for statefulsets", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\nStatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5276"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\nStatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5277"}
{"instruction": "Write a bash example for statefulsets", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset statefulset --replicas=X\n```\n\nStatefulSets | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Statefulset, don't set .spec.replicas. Instead, allow the Kubernetes control plane to manage the .spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5278"}
{"instruction": "Write a bash example for statefulsets", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f statefulset.yaml\n```\n\nStatefulSets | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Statefulset, don't set .spec.replicas. Instead, allow the Kubernetes control plane to manage the .spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5279"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5280"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\nStatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5281"}
{"instruction": "Write a bash example for statefulsets", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\nStatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5282"}
{"instruction": "Write a yaml example for statefulsets", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\nStatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/", "id": "k8s_00390_code_5283"}
{"instruction": "Explain available documentation versions in Kubernetes", "response": "Available Documentation VersionsThis website contains documentation for the current version of Kubernetes and the four previous versions of Kubernetes.The availability of documentation for a Kubernetes version is separate from whether that release is currently supported. Read Support period to learn about which versions of Kubernetes are officially supported, and for how long.Latest versionv1.34 (this documentation)Older versionsv1.33v1.32v1.31v1.30", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/home/supported-doc-versions/", "id": "k8s_00391"}
{"instruction": "How do you define environment variables for a container in Kubernetes?", "response": "Define Environment Variables for a ContainerThis page shows how to define environment variables for a container in a Kubernetes Pod.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesDefine an environment variable for a containerWhen you create a Pod, you can set environment variables for the containers that run in the Pod. To set environment variables, include the env or envFrom field in the configuration file.The env and envFrom fields have different effects.envallows you to set environment variables for a container, specifying a value directly for each variable that you name.envFromallows you to set environment variables for a container by referencing either a ConfigMap or a Secret. When you use envFrom, all the key-value pairs in the referenced ConfigMap or Secret are set as environment variables for the container. You can also specify a common prefix string.You can read more about ConfigMap and Secret.This page explains how to use env.In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines an environment variable with name DEMO_GREETING and value \"Hello from the environment\". Here is the configuration manifest for the Pod:pods/inject/envars.yaml apiVersion: v1 kind: Pod metadata: name: envar-demo labels: purpose: demonstrate-envars spec: containers: - name: envar-demo-container image: gcr.io/google-samples/hello-app:2.0 env: - name: DEMO_GREETING value: \"Hello from the environment\" - name: DEMO_FAREWELL value: \"Such a sweet sorrow\" Create a Pod based on that manifest:kubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml List the running Pods:kubectl get pods -l purpose=demonstrate-envars The output is similar to:NAME READY STATUS RESTARTS AGE envar-demo 1/1 Running 0 9s List the Pod's container environment variables:kubectl exec envar-demo -- printenv The output is similar to this:NODE_VERSION=4.4.2 EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237 HOSTNAME=envar-demo ... DEMO_GREETING=Hello from the environment DEMO_FAREWELL=Such a sweet sorrow Note:The environment variables set using the env or envFrom field override any environment variables specified in the container image.Note:Environment variables may reference each other, however ordering is important. Variables making use of others defined in the same context must come later in the list. Similarly, avoid circular references.Using environment variables inside of your configEnvironment variables that you define in a Pod's configuration under .spec.containers[*].env[*] can be used elsewhere in the configuration, for example in commands and arguments that you set for the Pod's containers. In the example configuration below, the GREETING, HONORIFIC, and NAME environment variables are set to Warm greetings to, The Most Honorable, and Kubernetes, respectively. The environment variable MESSAGE combines the set of all these environment variables and then uses it as a CLI argument passed to the env-print-demo container.Environment variable names may consist of any printable ASCII characters except '='.apiVersion: v1 kind: Pod metadata: name: print-greeting spec: containers: - name: env-print-demo image: bash env: - name: GREETING value: \"Warm greetings to\" - name: HONORIFIC value: \"The Most Honorable\" - name: NAME value: \"Kubernetes\" - name: MESSAGE value: \"$(GREETING) $(HONORIFIC) $(NAME)\" command: [\"echo\"] args: [\"$(MESSAGE)\"] Upon creation, the command echo Warm greetings to The Most Honorable Kubernetes is run on the container.What's nextLearn more about environment variables.Learn about using secrets as environment variables.See EnvV", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392"}
{"instruction": "Write a yaml example for define environment variables for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\nDefine Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5286"}
{"instruction": "Write a bash example for define environment variables for a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml\n```\n\nDefine Environment Variables for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5287"}
{"instruction": "Write a bash example for define environment variables for a container", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l purpose=demonstrate-envars\n```\n\nDefine Environment Variables for a Container | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5288"}
{"instruction": "Write a bash example for define environment variables for a container", "response": "Here's a bash example:\n\n```bash\nkubectl exec envar-demo -- printenv\n```\n\nDefine Environment Variables for a Container | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5289"}
{"instruction": "Write a yaml example for define environment variables for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: print-greeting\nspec:\n  containers:\n  - name: env-print-demo\n    image: bash\n    env:\n    - name: GREETING\n      value: \"Warm greetings to\"\n    - name: HONORIFIC\n      value: \"The Most Honorable\"\n    - name: NAME\n      value: \"Kubernetes\"\n    - name: MESSAGE\n      value: \"$(GREETING) $(HONORIFIC) $(NAME)\"\n    command: [\"echo\"]\n    args: [\"$(MESSAGE)\"]\n```\n\nDefine Environment Variables for a Container | Upon creation, the command echo Warm greetings to The Most Honorable Kubernetes is run on the container.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5290"}
{"instruction": "Write a yaml example for define environment variables for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\nDefine Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5291"}
{"instruction": "Write a yaml example for define environment variables for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: print-greeting\nspec:\n  containers:\n  - name: env-print-demo\n    image: bash\n    env:\n    - name: GREETING\n      value: \"Warm greetings to\"\n    - name: HONORIFIC\n      value: \"The Most Honorable\"\n    - name: NAME\n      value: \"Kubernetes\"\n    - name: MESSAGE\n      value: \"$(GREETING) $(HONORIFIC) $(NAME)\"\n    command: [\"echo\"]\n    args: [\"$(MESSAGE)\"]\n```\n\nDefine Environment Variables for a Container | Upon creation, the command echo Warm greetings to The Most Honorable Kubernetes is run on the container.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5292"}
{"instruction": "Write a yaml example for define environment variables for a container", "response": "Here's a yaml example:\n\n```yaml\npods/inject/envars.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\nDefine Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5293"}
{"instruction": "Write a yaml example for define environment variables for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\nDefine Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5294"}
{"instruction": "Write a bash example for define environment variables for a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml\n```\n\nDefine Environment Variables for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5295"}
{"instruction": "Write a bash example for define environment variables for a container", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l purpose=demonstrate-envars\n```\n\nDefine Environment Variables for a Container | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5296"}
{"instruction": "Write a bash example for define environment variables for a container", "response": "Here's a bash example:\n\n```bash\nkubectl exec envar-demo -- printenv\n```\n\nDefine Environment Variables for a Container | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5297"}
{"instruction": "Write a yaml example for define environment variables for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: print-greeting\nspec:\n  containers:\n  - name: env-print-demo\n    image: bash\n    env:\n    - name: GREETING\n      value: \"Warm greetings to\"\n    - name: HONORIFIC\n      value: \"The Most Honorable\"\n    - name: NAME\n      value: \"Kubernetes\"\n    - name: MESSAGE\n      value: \"$(GREETING) $(HONORIFIC) $(NAME)\"\n    command: [\"echo\"]\n    args: [\"$(MESSAGE)\"]\n```\n\nDefine Environment Variables for a Container | Upon creation, the command echo Warm greetings to The Most Honorable Kubernetes is run on the container.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/", "id": "k8s_00392_code_5298"}
{"instruction": "Explain the Kubernetes concept: Field Selectors", "response": "Field SelectorsField selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:metadata.name=my-servicemetadata.namespace!=defaultstatus.phase=PendingThis kubectl command selects all Pods for which the value of the status.phase field is Running:kubectl get pods --field-selector status.phase=Running Note:Field selectors are essentially resource filters. By default, no selectors/filters are applied, meaning that all resources of the specified type are selected. This makes the kubectl queries kubectl get pods and kubectl get pods --field-selector \"\" equivalent.Supported fieldsSupported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example:kubectl get ingress --field-selector foo.bar=baz Error from server (BadRequest): Unable to find \"ingresses\" that match label selector \"\", field selector \"foo.bar=baz\": \"foo.bar\" is not a known field selector: only \"metadata.name\", \"metadata.namespace\" List of supported fieldsKindFieldsPodspec.nodeNamespec.restartPolicyspec.schedulerNamespec.serviceAccountNamespec.hostNetworkstatus.phasestatus.podIPstatus.nominatedNodeNameEventinvolvedObject.kindinvolvedObject.namespaceinvolvedObject.nameinvolvedObject.uidinvolvedObject.apiVersioninvolvedObject.resourceVersioninvolvedObject.fieldPathreasonreportingComponentsourcetypeSecrettypeNamespacestatus.phaseReplicaSetstatus.replicasReplicationControllerstatus.replicasJobstatus.successfulNodespec.unschedulableCertificateSigningRequestspec.signerNameCustom resources fieldsAll custom resource types support the metadata.name and metadata.namespace fields.Additionally, the spec.versions[*].selectableFields field of a CustomResourceDefinition declares which other fields in a custom resource may be used in field selectors. See selectable fields for custom resources for more information about how to use field selectors with CustomResourceDefinitions.Supported operatorsYou can use the =, ==, and != operators with field selectors (= and == mean the same thing). This kubectl command, for example, selects all Kubernetes Services that aren't in the default namespace:kubectl get services --all-namespaces --field-selector metadata.namespace!=default Note:Set-based operators (in, notin, exists) are not supported for field selectors.Chained selectorsAs with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the spec.restartPolicy field equals Always:kubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always Multiple resource typesYou can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:kubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector status.phase=Running\n```\n\nField Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5300"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress --field-selector foo.bar=baz\n```\n\nField Selectors | All custom resource types support the metadata.name and metadata.namespace fields.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5301"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get services  --all-namespaces --field-selector metadata.namespace!=default\n```\n\nField Selectors | As with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5302"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always\n```\n\nField Selectors | You can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5303"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default\n```\n\nField Selectors |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5304"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector \"\"\n```\n\nField Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5305"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector status.phase=Running\n```\n\nField Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5306"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress --field-selector foo.bar=baz\n```\n\nField Selectors | All custom resource types support the metadata.name and metadata.namespace fields.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5307"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get services  --all-namespaces --field-selector metadata.namespace!=default\n```\n\nField Selectors | As with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5308"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always\n```\n\nField Selectors | You can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5309"}
{"instruction": "Write a bash example for field selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default\n```\n\nField Selectors |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/", "id": "k8s_00393_code_5310"}
{"instruction": "Explain validate node setup in Kubernetes", "response": "Validate node setupNode Conformance TestNode conformance test is a containerized test framework that provides a system verification and functionality test for a node. The test validates whether the node meets the minimum requirements for Kubernetes; a node that passes the test is qualified to join a Kubernetes cluster.Node PrerequisiteTo run node conformance test, a node must satisfy the same prerequisites as a standard Kubernetes node. At a minimum, the node should have the following daemons installed:CRI-compatible container runtimes such as Docker, containerd and CRI-OkubeletRunning Node Conformance TestTo run the node conformance test, perform the following steps:Work out the value of the --kubeconfig option for the kubelet; for example: --kubeconfig=/var/lib/kubelet/config.yaml. Because the test framework starts a local control plane to test the kubelet, use http://localhost:8080 as the URL of the API server. There are some other kubelet command line parameters you may want to use:--cloud-provider: If you are using --cloud-provider=gce, you should remove the flag to run the test.Run the node conformance test with command:# $CONFIG_DIR is the pod manifest path of your kubelet. # $LOG_DIR is the test output path. sudo docker run -it --rm --privileged --net=host \\ -v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \\ registry.k8s.io/node-test:0.2 Running Node Conformance Test for Other ArchitecturesKubernetes also provides node conformance test docker images for other architectures:ArchImageamd64node-test-amd64armnode-test-armarm64node-test-arm64Running Selected TestTo run specific tests, overwrite the environment variable FOCUS with the regular expression of tests you want to run.sudo docker run -it --rm --privileged --net=host \\ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \\ -e FOCUS=MirrorPod \\ # Only run MirrorPod test registry.k8s.io/node-test:0.2 To skip specific tests, overwrite the environment variable SKIP with the regular expression of tests you want to skip.sudo docker run -it --rm --privileged --net=host \\ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \\ -e SKIP=MirrorPod \\ # Run all conformance tests but skip MirrorPod test registry.k8s.io/node-test:0.2 Node conformance test is a containerized version of node e2e test. By default, it runs all conformance tests.Theoretically, you can run any node e2e test if you configure the container and mount required volumes properly. But it is strongly recommended to only run conformance test, because it requires much more complex configuration to run non-conformance test.CaveatsThe test leaves some docker images on the node, including the node conformance test image and images of containers used in the functionality test.The test leaves dead containers on the node. These containers are created during the functionality test.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/best-practices/node-conformance/", "id": "k8s_00394"}
{"instruction": "Explain the Kubernetes concept: Pod Hostname", "response": "Pod HostnameThis page explains how to set a Pod's hostname, potential side effects after configuration, and the underlying mechanics.Default Pod hostnameWhen a Pod is created, its hostname (as observed from within the Pod) is derived from the Pod's metadata.name value. Both the hostname and its corresponding fully qualified domain name (FQDN) are set to the metadata.name value (from the Pod's perspective)apiVersion: v1 kind: Pod metadata: name: busybox-1 spec: containers: - image: busybox:1.28 command: - sleep - \"3600\" name: busybox The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.Hostname with pod's hostname and subdomain fieldsThe Pod spec includes an optional hostname field. When set, this value takes precedence over the Pod's metadata.name as the hostname (observed from within the Pod). For example, a Pod with spec.hostname set to my-host will have its hostname set to my-host.The Pod spec also includes an optional subdomain field, indicating the Pod belongs to a subdomain within its namespace. If a Pod has spec.hostname set to \"foo\" and spec.subdomain set to \"bar\" in the namespace my-namespace, its hostname becomes foo and its fully qualified domain name (FQDN) becomes foo.bar.my-namespace.svc.cluster-domain.example (observed from within the Pod).When both hostname and subdomain are set, the cluster's DNS server will create A and/or AAAA records based on these fields. Refer to: Pod's hostname and subdomain fields.Hostname with pod's setHostnameAsFQDN fieldsFEATURE STATE: Kubernetes v1.22 [stable]When a Pod is configured to have fully qualified domain name (FQDN), its hostname is the short hostname. For example, if you have a Pod with the fully qualified domain name busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example, then by default the hostname command inside that Pod returns busybox-1 and the hostname --fqdn command returns the FQDN.When both setHostnameAsFQDN: true and the subdomain field is set in the Pod spec, the kubelet writes the Pod's FQDN into the hostname for that Pod's namespace. In this case, both hostname and hostname --fqdn return the Pod's FQDN.The Pod's FQDN is constructed in the same manner as previously defined. It is composed of the Pod's spec.hostname (if specified) or metadata.name field, the spec.subdomain, the namespace name, and the cluster domain suffix.Note:In Linux, the hostname field of the kernel (the nodename field of struct utsname) is limited to 64 characters.If a Pod enables this feature and its FQDN is longer than 64 character, it will fail to start. The Pod will remain in Pending status (ContainerCreating as seen by kubectl) generating error events, such as \"Failed to construct FQDN from Pod hostname and cluster domain\".This means that when using this field, you must ensure the combined length of the Pod's metadata.name (or spec.hostname) and spec.subdomain fields results in an FQDN that does not exceed 64 characters.Hostname with pod's hostnameOverrideFEATURE STATE: Kubernetes v1.34 [alpha] (enabled by default: false)Setting a value for hostnameOverride in the Pod spec causes the kubelet to unconditionally set both the Pod's hostname and fully qualified domain name (FQDN) to the hostnameOverride value.The hostnameOverride field has a length limitation of 64 characters and must adhere to the DNS subdomain names standard defined in RFC 1123.Example:apiVersion: v1 kind: Pod metadata: name: busybox-2-busybox-example-domain spec: hostnameOverride: busybox-2.busybox.example.domain containers: - image: busybox:1.28 command: - sleep - \"3600\" name: busybox Note:This only affects the hostname within the Pod; it does not affect the Pod's A or AAAA records in the cluster DNS server.If hostnameOverride is set alongside hostname and subdomain fields:The hostname inside the Pod is overridden to the hostnameOverride value.The Pod's A and/or AAAA records in the cluster DNS server are still generated based on the hostname and ", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-hostname/", "id": "k8s_00395"}
{"instruction": "Write a yaml example for pod hostname", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nPod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-hostname/", "id": "k8s_00395_code_5313"}
{"instruction": "Write a yaml example for pod hostname", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nPod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-hostname/", "id": "k8s_00395_code_5314"}
{"instruction": "Write a yaml example for pod hostname", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nPod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-hostname/", "id": "k8s_00395_code_5315"}
{"instruction": "Write a yaml example for pod hostname", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nPod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-hostname/", "id": "k8s_00395_code_5316"}
{"instruction": "Write a yaml example for pod hostname", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nPod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-hostname/", "id": "k8s_00395_code_5317"}
{"instruction": "Write a yaml example for pod hostname", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nPod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-hostname/", "id": "k8s_00395_code_5318"}
{"instruction": "What is the reference documentation for ingress?", "response": "IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.apiVersion: networking.k8s.io/v1import \"k8s.io/api/networking/v1\"IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.apiVersion: networking.k8s.io/v1kind: Ingressmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (IngressSpec)spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (IngressStatus)status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusIngressSpecIngressSpec describes the Ingress the user wishes to exist.defaultBackend (IngressBackend)defaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller.ingressClassName (string)ingressClassName is the name of an IngressClass cluster resource. Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -> IngressClass -> Ingress resource). Although the kubernetes.io/ingress.class annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present.rules ([]IngressRule)Atomic: will be replaced during a mergerules is a list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.rules.host (string)host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the \"host\" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the IP in the Spec of the parent Ingress. 2. The : delimiter is not respected because ports are not allowed. Currently the port of an Ingress is implicitly :80 for http and :443 for https. Both these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue.host can be \"precise\" which is a domain name without the terminating dot of a network host (e.g. \"foo.bar.com\") or \"wildcard\", which is a domain name prefixed with a single wildcard label (e.g. \".foo.com\"). The wildcard character '' must appear by itself as the first DNS label and matches only a single label. You cannot have a wildcard label by itself (e.g. Host == \"*\"). Requests will be matched against the Host field in the following way: 1. If host is precise, the request matches this rule if the http host header is equal to Host. 2. If host is a wildcard, then the request matches this rule if the http host header is to equal to the suffix (removing the first label) of the wildcard rule.rules.http (HTTPIngressRuleValue)HTTPIngressRuleValue is a list of http selectors pointing to backends. In th", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/ingress-v1/", "id": "k8s_00396"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\nIngress | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/ingress-v1/", "id": "k8s_00396_code_5320"}
{"instruction": "What is the reference documentation for kubelet device manager api versions?", "response": "Kubelet Device Manager API VersionsThis page provides details of version compatibility between the Kubernetes device plugin API, and different versions of Kubernetes itself.Compatibility matrixv1alpha1v1beta1Kubernetes 1.21-✓Kubernetes 1.22-✓Kubernetes 1.23-✓Kubernetes 1.24-✓Kubernetes 1.25-✓Kubernetes 1.26-✓Key:✓ Exactly the same features / API objects in both device plugin API and the Kubernetes version.+ The device plugin API has features or API objects that may not be present in the Kubernetes cluster, either because the device plugin API has added additional new API calls, or that the server has removed an old API call. However, everything they have in common (most other APIs) will work. Note that alpha APIs may vanish or change significantly between one minor release and the next.- The Kubernetes cluster has features the device plugin API can't use, either because server has added additional API calls, or that device plugin API has removed an old API call. However, everything they share in common (most APIs) will work.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/node/device-plugin-api-versions/", "id": "k8s_00397"}
{"instruction": "What is the reference documentation for kubectl create ingress?", "response": "kubectl create ingressSynopsisCreate an ingress with the specified name.kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]] Examples # Create a single ingress called 'simple' that directs requests to foo.com/bar to svc # svc1:8080 with a TLS secret \"my-cert\" kubectl create ingress simple --rule=\"foo.com/bar=svc1:8080,tls=my-cert\" # Create a catch all ingress of \"/path\" pointing to service svc:port and Ingress Class as \"otheringress\" kubectl create ingress catch-all --class=otheringress --rule=\"/path=svc:port\" # Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2 kubectl create ingress annotated --class=default --rule=\"foo.com/bar=svc:port\" \\ --annotation ingress.annotation1=foo \\ --annotation ingress.annotation2=bla # Create an ingress with the same host and multiple paths kubectl create ingress multipath --class=default \\ --rule=\"foo.com/=svc:port\" \\ --rule=\"foo.com/admin/=svcadmin:portadmin\" # Create an ingress with multiple hosts and the pathType as Prefix kubectl create ingress ingress1 --class=default \\ --rule=\"foo.com/path*=svc:8080\" \\ --rule=\"bar.com/admin*=svc2:http\" # Create an ingress with TLS enabled using the default ingress certificate and different path types kubectl create ingress ingtls --class=default \\ --rule=\"foo.com/=svc:https,tls\" \\ --rule=\"foo.com/path/subpath*=othersvc:8080\" # Create an ingress with TLS enabled using a specific secret and pathType as Prefix kubectl create ingress ingsecret --class=default \\ --rule=\"foo.com/*=svc:8080,tls=secret1\" # Create an ingress with a default backend kubectl create ingress ingdefault --class=default \\ --default-backend=defaultsvc:http \\ --rule=\"foo.com/*=svc:8080,tls=secret1\" Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--annotation stringsAnnotation to insert in the ingress object, in the format annotation=value--class stringIngress Class to be used--default-backend stringDefault service for backend, in format of svcname:port--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for ingress-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--rule stringsRule in format host/path=service:port[,tls=secretname]. Paths containing the leading character '*' are considered pathType=Prefix. tls argument is optional.--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Opt", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_ingress/", "id": "k8s_00398"}
{"instruction": "Write a bash example for kubectl create ingress", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]\n```\n\nkubectl create ingress | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_ingress/", "id": "k8s_00398_code_5323"}
{"instruction": "Write a bash example for kubectl create ingress", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]\n```\n\nkubectl create ingress | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_ingress/", "id": "k8s_00398_code_5324"}
{"instruction": "Provide a tutorial on namespaces walkthrough", "response": "Namespaces WalkthroughKubernetes namespaces help different projects, teams, or customers to share a Kubernetes cluster.It does this by providing the following:A scope for Names.A mechanism to attach authorization and policy to a subsection of the cluster.Use of multiple namespaces is optional.This example demonstrates how to use Kubernetes namespaces to subdivide your cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.PrerequisitesThis example assumes the following:You have an existing Kubernetes cluster.You have a basic understanding of Kubernetes Pods, Services, and Deployments.Understand the default namespaceBy default, a Kubernetes cluster will instantiate a default namespace when provisioning the cluster to hold the default set of Pods, Services, and Deployments used by the cluster.Assuming you have a fresh cluster, you can inspect the available namespaces by doing the following:kubectl get namespaces NAME STATUS AGE default Active 13m Create new namespacesFor this exercise, we will create two additional Kubernetes namespaces to hold our content.Let's imagine a scenario where an organization is using a shared Kubernetes cluster for development and production use cases.The development team would like to maintain a space in the cluster where they can get a view on the list of Pods, Services, and Deployments they use to build and run their application. In this space, Kubernetes resources come and go, and the restrictions on who can or cannot modify resources are relaxed to enable agile development.The operations team would like to maintain a space in the cluster where they can enforce strict procedures on who can or cannot manipulate the set of Pods, Services, and Deployments that run the production site.One pattern this organization could follow is to partition the Kubernetes cluster into two namespaces: development and production.Let's create two new namespaces to hold our work.Use the file namespace-dev.yaml which describes a development namespace:admin/namespace-dev.yaml apiVersion: v1 kind: Namespace metadata: name: development labels: name: development Create the development namespace using kubectl.kubectl create -f https://k8s.io/examples/admin/namespace-dev.yaml Save the following contents into file namespace-prod.yaml which describes a production namespace:admin/namespace-prod.yaml apiVersion: v1 kind: Namespace metadata: name: production labels: name: production And then let's create the production namespace using kubectl.kubectl create -f https://k8s.io/examples/admin/namespace-prod.yaml To be sure things are right, let's list all of the namespaces in our cluster.kubectl get namespaces --show-labels NAME STATUS AGE LABELS default Active 32m <none> development Active 29s name=development production Active 23s name=production Create pods in each namespaceA Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster.Users interacting with one namespace do not see the content in another namespace.To demonstrate this, let's spin up a simple Deployment and Pods in the development namespace.We first check what is the current context:kubectl config view apiVersion: v1 clusters: - cluster: certificate-authority-data: REDACTED server: https://130.211.122.180 name: lithe-cocoa-92103_kubernetes contexts: - context: cluster: lithe-cocoa-92103_kubernetes user: lithe-cocoa-92103_kubernetes name: lithe-cocoa-92103_kubernetes current-context: lithe-cocoa-92103_kubernetes kind: Config preferences: {} users: - name: lithe-cocoa-92103_kubernetes user: client-certificate-d", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\nNamespaces Walkthrough | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5326"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\nNamespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5327"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.yaml\n```\n\nNamespaces Walkthrough | Save the following contents into file namespace-prod.yaml which describes a production namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5328"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\nNamespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5329"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.yaml\n```\n\nNamespaces Walkthrough | To be sure things are right, let's list all of the namespaces in our cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5330"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\nNamespaces Walkthrough | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5331"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\nNamespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5332"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nNamespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5333"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context dev --namespace=development \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n\nkubectl config set-context prod --namespace=production \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n```\n\nNamespaces Walkthrough | By default, the above commands add two contexts that are saved into file .kube/config. You can now view the contexts and alternate against the two new request contexts depending on which namespace you", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5334"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: development\n    user: lithe-cocoa-92103_kubernetes\n  name: dev\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: production\n    user: lithe-cocoa-92103_kubernetes\n  name: prod\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\nNamespaces Walkthrough | Let's switch to operate in the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5335"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context dev\n```\n\nNamespaces Walkthrough | You can verify your current context by doing the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5336"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nNamespaces Walkthrough | At this point, all requests we make to the Kubernetes cluster from the command line are scoped to the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5337"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\nNamespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5338"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/snowflake-deployment.yaml\n```\n\nNamespaces Walkthrough | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5339"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\nNamespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5340"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake\n```\n\nNamespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5341"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context prod\n```\n\nNamespaces Walkthrough | The production namespace should be empty, and the following commands should return nothing.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5342"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\nkubectl get pods\n```\n\nNamespaces Walkthrough | Production likes to run cattle, so let's create some cattle pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5343"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname --replicas=5\n\nkubectl get deployment\n```\n\nNamespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5344"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle\n```\n\nNamespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5345"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\nNamespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5346"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\nNamespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5347"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\nNamespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5348"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: development\n    user: lithe-cocoa-92103_kubernetes\n  name: dev\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: production\n    user: lithe-cocoa-92103_kubernetes\n  name: prod\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\nNamespaces Walkthrough | Let's switch to operate in the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5349"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\nNamespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5350"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\nNamespaces Walkthrough | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5351"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\nadmin/namespace-dev.yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\nNamespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5352"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\nNamespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5353"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.yaml\n```\n\nNamespaces Walkthrough | Save the following contents into file namespace-prod.yaml which describes a production namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5354"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\nadmin/namespace-prod.yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\nNamespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5355"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\nNamespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5356"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.yaml\n```\n\nNamespaces Walkthrough | To be sure things are right, let's list all of the namespaces in our cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5357"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\nNamespaces Walkthrough | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5358"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\nNamespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5359"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nNamespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5360"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context dev --namespace=development \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n\nkubectl config set-context prod --namespace=production \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n```\n\nNamespaces Walkthrough | By default, the above commands add two contexts that are saved into file .kube/config. You can now view the contexts and alternate against the two new request contexts depending on which namespace you", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5361"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: development\n    user: lithe-cocoa-92103_kubernetes\n  name: dev\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: production\n    user: lithe-cocoa-92103_kubernetes\n  name: prod\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\nNamespaces Walkthrough | Let's switch to operate in the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5362"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context dev\n```\n\nNamespaces Walkthrough | You can verify your current context by doing the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5363"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nNamespaces Walkthrough | At this point, all requests we make to the Kubernetes cluster from the command line are scoped to the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5364"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\nadmin/snowflake-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\nNamespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5365"}
{"instruction": "Write a yaml example for namespaces walkthrough", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\nNamespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5366"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/snowflake-deployment.yaml\n```\n\nNamespaces Walkthrough | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5367"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\nNamespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5368"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake\n```\n\nNamespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5369"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context prod\n```\n\nNamespaces Walkthrough | The production namespace should be empty, and the following commands should return nothing.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5370"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\nkubectl get pods\n```\n\nNamespaces Walkthrough | Production likes to run cattle, so let's create some cattle pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5371"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname --replicas=5\n\nkubectl get deployment\n```\n\nNamespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5372"}
{"instruction": "Write a bash example for namespaces walkthrough", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle\n```\n\nNamespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/namespaces-walkthrough/", "id": "k8s_00399_code_5373"}
{"instruction": "What is the reference documentation for kubectl proxy?", "response": "kubectl proxySynopsisCreates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote Kubernetes API server port, except for the path matching the static content path.kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] Examples # To proxy all of the Kubernetes API and nothing else kubectl proxy --api-prefix=/ # To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods' kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/ # To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods' kubectl proxy --api-prefix=/custom/ # Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/ kubectl proxy --port=8011 --www=./local/www/ # Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout kubectl proxy --port=0 # Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/ kubectl proxy --api-prefix=/k8s-api Options--accept-hosts string Default: \"^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$\"Regular expression for hosts that the proxy should accept.--accept-paths string Default: \"^.*\"Regular expression for paths that the proxy should accept.--address string Default: \"127.0.0.1\"The IP address on which to serve on.--api-prefix string Default: \"/\"Prefix to serve the proxied API under.--append-server-pathIf true, enables automatic path appending of the kube context server path to each request.--disable-filterIf true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port.-h, --helphelp for proxy--keepalive durationkeepalive specifies the keep-alive period for an active network connection. Set to 0 to disable keepalive.-p, --port int Default: 8001The port on which to run the proxy. Set to 0 to pick a random port.--reject-methods string Default: \"^$\"Regular expression for HTTP methods that the proxy should reject (example --reject-methods='POST,PUT,PATCH').--reject-paths string Default: \"^/api/.*/pods/.*/exec,^/api/.*/pods/.*/attach\"Regular expression for paths that the proxy should reject. Paths specified here will be rejected even accepted by --accept-paths.-u, --unix-socket stringUnix socket on which to run the proxy.-w, --www stringAlso serve static files from the given directory under the specified prefix.-P, --www-prefix string Default: \"/static/\"Prefix to serve static files under, if static file directory is specified.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_proxy/", "id": "k8s_00400"}
{"instruction": "Write a bash example for kubectl proxy", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]\n```\n\nkubectl proxy | Regular expression for hosts that the proxy should accept.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_proxy/", "id": "k8s_00400_code_5375"}
{"instruction": "Write a bash example for kubectl proxy", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]\n```\n\nkubectl proxy | Regular expression for hosts that the proxy should accept.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_proxy/", "id": "k8s_00400_code_5376"}
{"instruction": "What is the reference documentation for kubeadm kubeconfig?", "response": "kubeadm kubeconfigkubeadm kubeconfig provides utilities for managing kubeconfig files.For examples on how to use kubeadm kubeconfig user see Generating kubeconfig files for additional users.kubeadm kubeconfigSynopsisKubeconfig file utilities.Options-h, --helphelp for kubeconfigOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm kubeconfig userThis command can be used to output a kubeconfig file for an additional user.SynopsisOutput a kubeconfig file for an additional user.kubeadm kubeconfig user [flags] Examples # Output a kubeconfig file for an additional user named foo kubeadm kubeconfig user --client-name=foo # Output a kubeconfig file for an additional user named foo using a kubeadm config file bar kubeadm kubeconfig user --client-name=foo --config=bar Options--client-name stringThe name of user. It will be used as the CN if client certificates are created--config stringPath to a kubeadm configuration file.-h, --helphelp for user--org stringsThe organizations of the client certificate. It will be used as the O if client certificates are created--token stringThe token that should be used as the authentication mechanism for this kubeconfig, instead of client certificates--validity-period duration Default: 8760h0m0sThe validity period of the client certificate. It is an offset from the current time.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.", "category": "reference", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-kubeconfig/", "id": "k8s_00401"}
{"instruction": "What is the reference documentation for kubectl edit?", "response": "kubectl editSynopsisEdit a resource from the default editor.The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows. When attempting to open the editor, it will first attempt to use the shell that has been defined in the 'SHELL' environment variable. If this is not defined, the default shell will be used, which is '/bin/bash' for Linux or 'cmd' for Windows.You can edit multiple objects, although changes are applied one at a time. The command accepts file names as well as command-line arguments, although the files you point to must be previously saved versions of resources.Editing is done with the API version used to fetch the resource. To edit using a specific API version, fully-qualify the resource, version, and group.The default format is YAML. To edit in JSON, specify \"-o json\".The flag --windows-line-endings can be used to force Windows line endings, otherwise the default for your operating system will be used.In the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version.kubectl edit (RESOURCE/NAME | -f FILENAME) Examples # Edit the service named 'registry' kubectl edit svc/registry # Use an alternative editor KUBE_EDITOR=\"nano\" kubectl edit svc/registry # Edit the job 'myjob' in JSON using the v1 API format kubectl edit job.v1.batch/myjob -o json # Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation kubectl edit deployment/mydeployment -o yaml --save-config # Edit the 'status' subresource for the 'mydeployment' deployment kubectl edit deployment mydeployment --subresource='status' Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--field-manager string Default: \"kubectl-edit\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files to use to edit the resource-h, --helphelp for edit-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--output-patchOutput the patch if the resource is edited.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--subresource stringIf specified, edit will operate on the subresource of the requested object.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_edit/", "id": "k8s_00402"}
{"instruction": "Write a bash example for kubectl edit", "response": "Here's a bash example:\n\n```bash\nkubectl edit (RESOURCE/NAME | -f FILENAME)\n```\n\nkubectl edit | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_edit/", "id": "k8s_00402_code_5379"}
{"instruction": "Write a bash example for kubectl edit", "response": "Here's a bash example:\n\n```bash\nkubectl edit (RESOURCE/NAME | -f FILENAME)\n```\n\nkubectl edit | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_edit/", "id": "k8s_00402_code_5380"}
{"instruction": "Explain the Kubernetes concept: API-initiated Eviction", "response": "API-initiated EvictionAPI-initiated eviction is the process by which you use the Eviction API to create an Eviction object that triggers graceful pod termination.You can request eviction by calling the Eviction API directly, or programmatically using a client of the API server, like the kubectl drain command. This creates an Eviction object, which causes the API server to terminate the Pod.API-initiated evictions respect your configured PodDisruptionBudgets and terminationGracePeriodSeconds.Using the API to create an Eviction object for a Pod is like performing a policy-controlled DELETE operation on the Pod.Calling the Eviction APIYou can use a Kubernetes language client to access the Kubernetes API and create an Eviction object. To do this, you POST the attempted operation, similar to the following example:Note:policy/v1 Eviction is available in v1.22+. Use policy/v1beta1 with prior releases.{ \"apiVersion\": \"policy/v1\", \"kind\": \"Eviction\", \"metadata\": { \"name\": \"quux\", \"namespace\": \"default\" } } Note:Deprecated in v1.22 in favor of policy/v1{ \"apiVersion\": \"policy/v1beta1\", \"kind\": \"Eviction\", \"metadata\": { \"name\": \"quux\", \"namespace\": \"default\" } } Alternatively, you can attempt an eviction operation by accessing the API using curl or wget, similar to the following example:curl -v -H 'Content-type: application/json' https://your-cluster-api-endpoint.example/api/v1/namespaces/default/pods/quux/eviction -d @eviction.json How API-initiated eviction worksWhen you request an eviction using the API, the API server performs admission checks and responds in one of the following ways:200 OK: the eviction is allowed, the Eviction subresource is created, and the Pod is deleted, similar to sending a DELETE request to the Pod URL.429 Too Many Requests: the eviction is not currently allowed because of the configured PodDisruptionBudget. You may be able to attempt the eviction again later. You might also see this response because of API rate limiting.500 Internal Server Error: the eviction is not allowed because there is a misconfiguration, like if multiple PodDisruptionBudgets reference the same Pod.If the Pod you want to evict isn't part of a workload that has a PodDisruptionBudget, the API server always returns 200 OK and allows the eviction.If the API server allows the eviction, the Pod is deleted as follows:The Pod resource in the API server is updated with a deletion timestamp, after which the API server considers the Pod resource to be terminated. The Pod resource is also marked with the configured grace period.The kubelet on the node where the local Pod is running notices that the Pod resource is marked for termination and starts to gracefully shut down the local Pod.While the kubelet is shutting the Pod down, the control plane removes the Pod from EndpointSlice objects. As a result, controllers no longer consider the Pod as a valid object.After the grace period for the Pod expires, the kubelet forcefully terminates the local Pod.The kubelet tells the API server to remove the Pod resource.The API server deletes the Pod resource.Troubleshooting stuck evictionsIn some cases, your applications may enter a broken state, where the Eviction API will only return 429 or 500 responses until you intervene. This can happen if, for example, a ReplicaSet creates pods for your application but new pods do not enter a Ready state. You may also notice this behavior in cases where the last evicted Pod had a long termination grace period.If you notice stuck evictions, try one of the following solutions:Abort or pause the automated operation causing the issue. Investigate the stuck application before you restart the operation.Wait a while, then directly delete the Pod from your cluster control plane instead of using the Eviction API.What's nextLearn how to protect your applications with a Pod Disruption Budget.Learn about Node-pressure Eviction.Learn about Pod Priority and Preemption.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/api-eviction/", "id": "k8s_00403"}
{"instruction": "Write a bash example for api-initiated eviction", "response": "Here's a bash example:\n\n```bash\ncurl -v -H 'Content-type: application/json' https://your-cluster-api-endpoint.example/api/v1/namespaces/default/pods/quux/eviction -d @eviction.json\n```\n\nAPI-initiated Eviction | When you request an eviction using the API, the API server performs admission checks and responds in one of the following ways:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/api-eviction/", "id": "k8s_00403_code_5382"}
{"instruction": "How do you connect a frontend to a backend using services in Kubernetes?", "response": "Connect a Frontend to a Backend Using ServicesThis task shows how to create a frontend and a backend microservice. The backend microservice is a hello greeter. The frontend exposes the backend using nginx and a Kubernetes Service object.ObjectivesCreate and run a sample hello backend microservice using a Deployment object.Use a Service object to send traffic to the backend microservice's multiple replicas.Create and run a nginx frontend microservice, also using a Deployment object.Configure the frontend microservice to send traffic to the backend microservice.Use a Service object of type=LoadBalancer to expose the frontend microservice outside the cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.This task uses Services with external load balancers, which require a supported environment. If your environment does not support this, you can use a Service of type NodePort instead.Creating the backend using a DeploymentThe backend is a simple hello greeter microservice. Here is the configuration file for the backend Deployment:service/access/backend-deployment.yaml --- apiVersion: apps/v1 kind: Deployment metadata: name: backend spec: selector: matchLabels: app: hello tier: backend track: stable replicas: 3 template: metadata: labels: app: hello tier: backend track: stable spec: containers: - name: hello image: \"gcr.io/google-samples/hello-go-gke:1.0\" ports: - name: http containerPort: 80 ...Create the backend Deployment:kubectl apply -f https://k8s.io/examples/service/access/backend-deployment.yaml View information about the backend Deployment:kubectl describe deployment backend The output is similar to this:Name: backend Namespace: default CreationTimestamp: Mon, 24 Oct 2016 14:21:02 -0700 Labels: app=hello tier=backend track=stable Annotations: deployment.kubernetes.io/revision=1 Selector: app=hello,tier=backend,track=stable Replicas: 3 desired | 3 updated | 3 total | 3 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge Pod Template: Labels: app=hello tier=backend track=stable Containers: hello: Image: \"gcr.io/google-samples/hello-go-gke:1.0\" Port: 80/TCP Environment: <none> Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: hello-3621623197 (3/3 replicas created) Events: ... Creating the hello Service objectThe key to sending requests from a frontend to a backend is the backend Service. A Service creates a persistent IP address and DNS name entry so that the backend microservice can always be reached. A Service uses selectors to find the Pods that it routes traffic to.First, explore the Service configuration file:service/access/backend-service.yaml --- apiVersion: v1 kind: Service metadata: name: hello spec: selector: app: hello tier: backend ports: - protocol: TCP port: 80 targetPort: http ...In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.Create the backend Service:kubectl apply -f https://k8s.io/examples/service/access/backend-service.yaml At this point, you have a backend Deployment running three replicas of your hello application, and you have a Service that can route traffic to them. However, this service is neither available nor resolvable outside the cluster.Creating the frontendNow that you have your backend running, you can create a frontend that is accessible outside the c", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5384"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-deployment.yaml\n```\n\nConnect a Frontend to a Backend Using Services | View information about the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5385"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment backend\n```\n\nConnect a Frontend to a Backend Using Services | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5386"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\nConnect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5387"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-service.yaml\n```\n\nConnect a Frontend to a Backend Using Services | At this point, you have a backend Deployment running three replicas of your hello application, and you have a Service that can route traffic to them. However, this service is neither available nor res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5388"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5389"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5390"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/frontend-deployment.yaml\nkubectl apply -f https://k8s.io/examples/service/access/frontend-service.yaml\n```\n\nConnect a Frontend to a Backend Using Services | The output verifies that both resources were created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5391"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend --watch\n```\n\nConnect a Frontend to a Backend Using Services | This displays the configuration for the frontend Service and watches for changes. Initially, the external IP is listed as <pending>:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5392"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl delete services frontend backend\n```\n\nConnect a Frontend to a Backend Using Services | To delete the Deployments, the ReplicaSets and the Pods that are running the backend and frontend applications, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5393"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment frontend backend\n```\n\nConnect a Frontend to a Backend Using Services |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5394"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5395"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\nConnect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5396"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5397"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5398"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\nservice/access/backend-deployment.yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5399"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5400"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-deployment.yaml\n```\n\nConnect a Frontend to a Backend Using Services | View information about the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5401"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment backend\n```\n\nConnect a Frontend to a Backend Using Services | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5402"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\nservice/access/backend-service.yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\nConnect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5403"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\nConnect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5404"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-service.yaml\n```\n\nConnect a Frontend to a Backend Using Services | At this point, you have a backend Deployment running three replicas of your hello application, and you have a Service that can route traffic to them. However, this service is neither available nor res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5405"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\nservice/access/frontend-service.yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5406"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5407"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\nservice/access/frontend-deployment.yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5408"}
{"instruction": "Write a yaml example for connect a frontend to a backend using services", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\nConnect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5409"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/frontend-deployment.yaml\nkubectl apply -f https://k8s.io/examples/service/access/frontend-service.yaml\n```\n\nConnect a Frontend to a Backend Using Services | The output verifies that both resources were created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5410"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend --watch\n```\n\nConnect a Frontend to a Backend Using Services | This displays the configuration for the frontend Service and watches for changes. Initially, the external IP is listed as <pending>:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5411"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl delete services frontend backend\n```\n\nConnect a Frontend to a Backend Using Services | To delete the Deployments, the ReplicaSets and the Pods that are running the backend and frontend applications, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5412"}
{"instruction": "Write a bash example for connect a frontend to a backend using services", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment frontend backend\n```\n\nConnect a Frontend to a Backend Using Services |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/", "id": "k8s_00404_code_5413"}
{"instruction": "Explain the Kubernetes concept: Cloud Controller Manager", "response": "Cloud Controller ManagerFEATURE STATE: Kubernetes v1.11 [beta]Cloud infrastructure technologies let you run Kubernetes on public, private, and hybrid clouds. Kubernetes believes in automated, API-driven infrastructure without tight coupling between components.The cloud-controller-manager is a Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.By decoupling the interoperability logic between Kubernetes and the underlying cloud infrastructure, the cloud-controller-manager component enables cloud providers to release features at a different pace compared to the main Kubernetes project.The cloud-controller-manager is structured using a plugin mechanism that allows different cloud providers to integrate their platforms with Kubernetes.DesignThe cloud controller manager runs in the control plane as a replicated set of processes (usually, these are containers in Pods). Each cloud-controller-manager implements multiple controllers in a single process.Note:You can also run the cloud controller manager as a Kubernetes addon rather than as part of the control plane.Cloud controller manager functionsThe controllers inside the cloud controller manager include:Node controllerThe node controller is responsible for updating Node objects when new servers are created in your cloud infrastructure. The node controller obtains information about the hosts running inside your tenancy with the cloud provider. The node controller performs the following functions:Update a Node object with the corresponding server's unique identifier obtained from the cloud provider API.Annotating and labelling the Node object with cloud-specific information, such as the region the node is deployed into and the resources (CPU, memory, etc) that it has available.Obtain the node's hostname and network addresses.Verifying the node's health. In case a node becomes unresponsive, this controller checks with your cloud provider's API to see if the server has been deactivated / deleted / terminated. If the node has been deleted from the cloud, the controller deletes the Node object from your Kubernetes cluster.Some cloud provider implementations split this into a node controller and a separate node lifecycle controller.Route controllerThe route controller is responsible for configuring routes in the cloud appropriately so that containers on different nodes in your Kubernetes cluster can communicate with each other.Depending on the cloud provider, the route controller might also allocate blocks of IP addresses for the Pod network.Service controllerServices integrate with cloud infrastructure components such as managed load balancers, IP addresses, network packet filtering, and target health checking. The service controller interacts with your cloud provider's APIs to set up load balancers and other infrastructure components when you declare a Service resource that requires them.AuthorizationThis section breaks down the access that the cloud controller manager requires on various API objects, in order to perform its operations.Node controllerThe Node controller only works with Node objects. It requires full access to read and modify Node objects.v1/Node:getlistcreateupdatepatchwatchdeleteRoute controllerThe route controller listens to Node object creation and configures routes appropriately. It requires Get access to Node objects.v1/Node:getService controllerThe service controller watches for Service object create, update and delete events and then configures load balancers for those Services appropriately.To access Services, it requires list, and watch access. To update Services, it requires patch and update access to the status subresource.v1/Service:listgetwatchpatchupdateOthersThe implementation of the core of the cloud controller manager re", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/cloud-controller/", "id": "k8s_00405"}
{"instruction": "Write a yaml example for cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\nCloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/cloud-controller/", "id": "k8s_00405_code_5415"}
{"instruction": "Write a yaml example for cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\nCloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/cloud-controller/", "id": "k8s_00405_code_5416"}
{"instruction": "Write a yaml example for cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\nCloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/cloud-controller/", "id": "k8s_00405_code_5417"}
{"instruction": "Explain blog article mirroring in Kubernetes", "response": "Blog article mirroringThere are two official Kubernetes blogs, and the CNCF has its own blog where you can cover Kubernetes too. For the main Kubernetes blog, we (the Kubernetes project) like to publish articles with different perspectives and special focuses, that have a link to Kubernetes.Some articles appear on both blogs: there is a primary version of the article, and a mirror article on the other blog.This page describes the criteria for mirroring, the motivation for mirroring, and explains what you should do to ensure that an article publishes to both blogs.Before you beginMake sure you are familiar with the introduction sections of contributing to Kubernetes blogs, not just to learn about the two official blogs and the differences between them, but also to get an overview of the process.Why we mirrorMirroring is nearly always from the contributor blog to the main blog. The project does this for articles that are about the contributor community, or a part of it, but are also relevant to the wider set of readers for Kubernetes' main blog.As an author (or reviewer), consider the target audience and whether the blog post is appropriate for the main blog. For example: if the target audience are Kubernetes contributors only, then the contributor blog. may be more appropriate; if the blog post is about open source in general then it may be more suitable on another site outside the Kubernetes project.This consideration about target audience applies to original and mirrored articles equally.The Kubernetes project is willing to mirror any blog article that was published to https://kubernetes.dev/blog/ (the contributor blog), provided that all of the following criteria are met:the mirrored article has the same publication date as the original (it should have the same publication time too, but you can also set a time stamp up to 12 hours later for special cases)For PRs that add a mirrored article to the main blog after the original article has merged into the contributor blog, ensure that all of the following criteria are met:No articles were published to the main blog after the original article was published to the contributor blog.There are no main blog articles scheduled for publication between the publication time of the original article and the publication time of your mirrored article.This is because the Kubernetes project doesn't want to add articles to people's feeds, such as RSS, except at the very end of their feed.the original article doesn't contravene any strongly recommended review guidelines or community normsthe mirrored article will have canonicalUrl set correctly in its front matterthe audience for the original article would find it relevantthe article content is not off-topic for the target blog where the mirror article would appearMirroring from the main blog to the contributor blog is rare, but could feasibly happen.How to mirrorYou make a PR against the other Git repository (usually, https://github.com/kubernetes/website) that adds the article. You do this before the articles merge.As the article author, you should set the canonical URL for the mirrored article, to the URL of the original article (you can use a preview to predict the URL and fill this in ahead of actual publication). Use the canonicalUrl field in front matter for this.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/blog/article-mirroring/", "id": "k8s_00406"}
{"instruction": "How do you migrating telemetry and security agents from dockershim in Kubernetes?", "response": "Migrating telemetry and security agents from dockershimNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Kubernetes' support for direct integration with Docker Engine is deprecated and has been removed. Most apps do not have a direct dependency on runtime hosting containers. However, there are still a lot of telemetry and monitoring agents that have a dependency on Docker to collect containers metadata, logs, and metrics. This document aggregates information on how to detect these dependencies as well as links on how to migrate these agents to use generic tools or alternative runtimes.Telemetry and security agentsWithin a Kubernetes cluster there are a few different ways to run telemetry or security agents. Some agents have a direct dependency on Docker Engine when they run as DaemonSets or directly on nodes.Why do some telemetry agents communicate with Docker Engine?Historically, Kubernetes was written to work specifically with Docker Engine. Kubernetes took care of networking and scheduling, relying on Docker Engine for launching and running containers (within Pods) on a node. Some information that is relevant to telemetry, such as a pod name, is only available from Kubernetes components. Other data, such as container metrics, is not the responsibility of the container runtime. Early telemetry agents needed to query the container runtime and Kubernetes to report an accurate picture. Over time, Kubernetes gained the ability to support multiple runtimes, and now supports any runtime that is compatible with the container runtime interface.Some telemetry agents rely specifically on Docker Engine tooling. For example, an agent might run a command such as docker ps or docker top to list containers and processes or docker logs to receive streamed logs. If nodes in your existing cluster use Docker Engine, and you switch to a different container runtime, these commands will not work any longer.Identify DaemonSets that depend on Docker EngineIf a pod wants to make calls to the dockerd running on the node, the pod must either:mount the filesystem containing the Docker daemon's privileged socket, as a volume; ormount the specific path of the Docker daemon's privileged socket directly, also as a volume.For example: on COS images, Docker exposes its Unix domain socket at /var/run/docker.sock This means that the pod spec will include a hostPath volume mount of /var/run/docker.sock.Here's a sample shell script to find Pods that have a mount directly mapping the Docker socket. This script outputs the namespace and name of the pod. You can remove the grep '/var/run/docker.sock' to review other mounts.kubectl get pods --all-namespaces \\ -o=jsonpath='{range .items[*]}{\"\\n\"}{.metadata.namespace}{\":\\t\"}{.metadata.name}{\":\\t\"}{range .spec.volumes[*]}{.hostPath.path}{\", \"}{end}{end}' \\ | sort \\ | grep '/var/run/docker.sock' Note:There are alternative ways for a pod to access Docker on the host. For instance, the parent directory /var/run may be mounted instead of the full path (like in this example). The script above only detects the most common uses.Detecting Docker dependency from node agentsIf your cluster nodes are customized and install additional security and telemetry agents on the node, check with the agent vendor to verify whether it has any dependency on Docker.Telemetry and security agent vendorsThis section is intended to aggregate information about various telemetry and security agents that may have a dependency on container runtimes.We keep the work in progress version of migration instructions for various telemetry and security agent vendors in Google doc. Please contact the vendor to get up to date instructions for migrating from dockershim.Migration from dockershimAquaNo changes are n", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407"}
{"instruction": "Write a bash example for migrating telemetry and security agents from dockershim", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces \\\n-o=jsonpath='{range .items[*]}{\"\\n\"}{.metadata.namespace}{\":\\t\"}{.metadata.name}{\":\\t\"}{range .spec.volumes[*]}{.hostPath.path}{\", \"}{end}{end}' \\\n| sort \\\n| grep '/var/run/docker.sock'\n```\n\nMigrating telemetry and security agents from dockershim | If your cluster nodes are customized and install additional security and telemetry agents on the node, check with the agent vendor to verify whether it has any dependency on Docker.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407_code_5420"}
{"instruction": "Write a bash example for migrating telemetry and security agents from dockershim", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces \\\n-o=jsonpath='{range .items[*]}{\"\\n\"}{.metadata.namespace}{\":\\t\"}{.metadata.name}{\":\\t\"}{range .spec.volumes[*]}{.hostPath.path}{\", \"}{end}{end}' \\\n| sort \\\n| grep '/var/run/docker.sock'\n```\n\nMigrating telemetry and security agents from dockershim | If your cluster nodes are customized and install additional security and telemetry agents on the node, check with the agent vendor to verify whether it has any dependency on Docker.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407_code_5421"}
{"instruction": "Write a bash example for migrating telemetry and security agents from dockershim", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\nMigrating telemetry and security agents from dockershim | How to migrate from dockershim-dependent agent:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407_code_5422"}
{"instruction": "Write a bash example for migrating telemetry and security agents from dockershim", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\nMigrating telemetry and security agents from dockershim | How to migrate from dockershim-dependent agent:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407_code_5423"}
{"instruction": "Write a bash example for migrating telemetry and security agents from dockershim", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\nMigrating telemetry and security agents from dockershim | How to migrate from dockershim-dependent agent:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407_code_5424"}
{"instruction": "Write a bash example for migrating telemetry and security agents from dockershim", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\nMigrating telemetry and security agents from dockershim | The Pod accessing Docker may be named something like:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407_code_5425"}
{"instruction": "Write a bash example for migrating telemetry and security agents from dockershim", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces \\\n-o=jsonpath='{range .items[*]}{\"\\n\"}{.metadata.namespace}{\":\\t\"}{.metadata.name}{\":\\t\"}{range .spec.volumes[*]}{.hostPath.path}{\", \"}{end}{end}' \\\n| sort \\\n| grep '/var/run/docker.sock'\n```\n\nMigrating telemetry and security agents from dockershim | If your cluster nodes are customized and install additional security and telemetry agents on the node, check with the agent vendor to verify whether it has any dependency on Docker.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/migrating-telemetry-and-security-agents/", "id": "k8s_00407_code_5426"}
{"instruction": "Explain the Kubernetes concept: Downward API", "response": "Downward APIThere are two ways to expose Pod and container fields to a running container: environment variables, and as files that are populated by a special volume type. Together, these two ways of exposing Pod and container fields are called the downward API.It is sometimes useful for a container to have information about itself, without being overly coupled to Kubernetes. The downward API allows containers to consume information about themselves or the cluster without using the Kubernetes client or API server.An example is an existing application that assumes a particular well-known environment variable holds a unique identifier. One possibility is to wrap the application, but that is tedious and error-prone, and it violates the goal of low coupling. A better option would be to use the Pod's name as an identifier, and inject the Pod's name into the well-known environment variable.In Kubernetes, there are two ways to expose Pod and container fields to a running container:as environment variablesas files in a downwardAPI volumeTogether, these two ways of exposing Pod and container fields are called the downward API.Available fieldsOnly some Kubernetes API fields are available through the downward API. This section lists which fields you can make available.You can pass information from available Pod-level fields using fieldRef. At the API level, the spec for a Pod always defines at least one Container. You can pass information from available Container-level fields using resourceFieldRef.Information available via fieldRefFor some Pod-level fields, you can provide them to a container either as an environment variable or using a downwardAPI volume. The fields available via either mechanism are:metadata.namethe pod's namemetadata.namespacethe pod's namespacemetadata.uidthe pod's unique IDmetadata.annotations['<KEY>']the value of the pod's annotation named <KEY> (for example, metadata.annotations['myannotation'])metadata.labels['<KEY>']the text value of the pod's label named <KEY> (for example, metadata.labels['mylabel'])The following information is available through environment variables but not as a downwardAPI volume fieldRef:spec.serviceAccountNamethe name of the pod's service accountspec.nodeNamethe name of the node where the Pod is executingstatus.hostIPthe primary IP address of the node to which the Pod is assignedstatus.hostIPsthe IP addresses is a dual-stack version of status.hostIP, the first is always the same as status.hostIP.status.podIPthe pod's primary IP address (usually, its IPv4 address)status.podIPsthe IP addresses is a dual-stack version of status.podIP, the first is always the same as status.podIPThe following information is available through a downwardAPI volume fieldRef, but not as environment variables:metadata.labelsall of the pod's labels, formatted as label-key=\"escaped-label-value\" with one label per linemetadata.annotationsall of the pod's annotations, formatted as annotation-key=\"escaped-annotation-value\" with one annotation per lineInformation available via resourceFieldRefThese container-level fields allow you to provide information about requests and limits for resources such as CPU and memory.Note:FEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: true)Container CPU and memory resources can be resized while the container is running. If this happens, a downward API volume will be updated, but environment variables will not be updated unless the container restarts. See Resize CPU and Memory Resources assigned to Containers for more details.resource: limits.cpuA container's CPU limitresource: requests.cpuA container's CPU requestresource: limits.memoryA container's memory limitresource: requests.memoryA container's memory requestresource: limits.hugepages-*A container's hugepages limitresource: requests.hugepages-*A container's hugepages requestresource: limits.ephemeral-storageA container's ephemeral-storage limitresource: requests.ephemeral-storageA container's ephemeral-storage requestFall", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/downward-api/", "id": "k8s_00408"}
{"instruction": "What is the reference documentation for servicecidr?", "response": "ServiceCIDRServiceCIDR defines a range of IP addresses using CIDR format (e.apiVersion: networking.k8s.io/v1import \"k8s.io/api/networking/v1\"ServiceCIDRServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects.apiVersion: networking.k8s.io/v1kind: ServiceCIDRmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (ServiceCIDRSpec)spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (ServiceCIDRStatus)status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusServiceCIDRSpecServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.cidrs ([]string)Atomic: will be replaced during a mergeCIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.ServiceCIDRStatusServiceCIDRStatus describes the current state of the ServiceCIDR.conditions ([]Condition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeconditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. Current service stateCondition contains details for one aspect of the current state of this API Resource.conditions.lastTransitionTime (Time), requiredlastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.conditions.message (string), requiredmessage is a human readable message indicating details about the transition. This may be an empty string.conditions.reason (string), requiredreason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.conditions.status (string), requiredstatus of the condition, one of True, False, Unknown.conditions.type (string), requiredtype of condition in CamelCase or in foo.example.com/CamelCase.conditions.observedGeneration (int64)observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.ServiceCIDRListServiceCIDRList contains a list of ServiceCIDR objects.apiVersion: networking.k8s.io/v1kind: ServiceCIDRListmetadata (ListMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]ServiceCIDR), requireditems is the list of ServiceCIDRs.Operationsget read the specified ServiceCIDRHTTP RequestGET /apis/networking.k8s.io/v1/servicecidrs/{name}Parametersname (in path): string, requiredname of the ServiceCIDRpretty (in query): stringprettyResponse200 (ServiceCIDR): OK401: Unauthorizedget read status of the specified ServiceCIDRHTTP RequestGET /apis/networking.k8s.io/v1/servicecidrs/{name}/statusParametersname (in path): string, requiredname of the ServiceCIDRpretty (in query): stringprettyResponse200 (ServiceCIDR): OK401: Unauthorizedlist list or watch objects of kind ServiceCIDRHTTP RequestGET /a", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/service-cidr-v1/", "id": "k8s_00409"}
{"instruction": "Write a yaml example for servicecidr", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\nServiceCIDR | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/service-cidr-v1/", "id": "k8s_00409_code_5429"}
{"instruction": "How do you using coredns for service discovery in Kubernetes?", "response": "Using CoreDNS for Service DiscoveryThis page describes the CoreDNS upgrade process and how to install CoreDNS instead of kube-dns.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.9.To check the version, enter kubectl version.About CoreDNSCoreDNS is a flexible, extensible DNS server that can serve as the Kubernetes cluster DNS. Like Kubernetes, the CoreDNS project is hosted by the CNCF.You can use CoreDNS instead of kube-dns in your cluster by replacing kube-dns in an existing deployment, or by using tools like kubeadm that will deploy and upgrade the cluster for you.Installing CoreDNSFor manual deployment or replacement of kube-dns, see the documentation at the CoreDNS website.Migrating to CoreDNSUpgrading an existing cluster with kubeadmIn Kubernetes version 1.21, kubeadm removed its support for kube-dns as a DNS application. For kubeadm v1.34, the only supported cluster DNS application is CoreDNS.You can move to CoreDNS when you use kubeadm to upgrade a cluster that is using kube-dns. In this case, kubeadm generates the CoreDNS configuration (\"Corefile\") based upon the kube-dns ConfigMap, preserving configurations for stub domains, and upstream name server.Upgrading CoreDNSYou can check the version of CoreDNS that kubeadm installs for each version of Kubernetes in the page CoreDNS version in Kubernetes.CoreDNS can be upgraded manually in case you want to only upgrade CoreDNS or use your own custom image. There is a helpful guideline and walkthrough available to ensure a smooth upgrade. Make sure the existing CoreDNS configuration (\"Corefile\") is retained when upgrading your cluster.If you are upgrading your cluster using the kubeadm tool, kubeadm can take care of retaining the existing CoreDNS configuration automatically.Tuning CoreDNSWhen resource utilisation is a concern, it may be useful to tune the configuration of CoreDNS. For more details, check out the documentation on scaling CoreDNS.What's nextYou can configure CoreDNS to support many more use cases than kube-dns does by modifying the CoreDNS configuration (\"Corefile\"). For more information, see the documentation for the kubernetes CoreDNS plugin, or read the Custom DNS Entries for Kubernetes. in the CoreDNS blog.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/coredns/", "id": "k8s_00410"}
{"instruction": "Explain the Kubernetes concept: Cluster Architecture", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Cluster ArchitectureThe architectural concepts behind Kubernetes.1: Nodes2: Communication between Nodes and the Control Plane3: Controllers4: Leases5: Cloud Controller Manager6: About cgroup v27: Kubernetes Self-Healing8: Container Runtime Interface (CRI)9: Garbage Collection10: Mixed Version ProxyA Kubernetes cluster consists of a control plane plus a set of worker machines, called nodes, that run containerized applications. Every cluster needs at least one worker node in order to run Pods.The worker node(s) host the Pods that are the components of the application workload. The control plane manages the worker nodes and the Pods in the cluster. In production environments, the control plane usually runs across multiple computers and a cluster usually runs multiple nodes, providing fault-tolerance and high availability.This document outlines the various components you need to have for a complete and working Kubernetes cluster.Figure 1. Kubernetes cluster components.About this architectureThe diagram in Figure 1 presents an example reference architecture for a Kubernetes cluster. The actual distribution of components can vary based on specific cluster setups and requirements.In the diagram, each node runs the kube-proxy component. You need a network proxy component on each node to ensure that the Service API and associated behaviors are available on your cluster network. However, some network plugins provide their own, third party implementation of proxying. When you use that kind of network plugin, the node does not need to run kube-proxy.Control plane componentsThe control plane's components make global decisions about the cluster (for example, scheduling), as well as detecting and responding to cluster events (for example, starting up a new pod when a Deployment's replicas field is unsatisfied).Control plane components can be run on any machine in the cluster. However, for simplicity, setup scripts typically start all control plane components on the same machine, and do not run user containers on this machine. See Creating Highly Available clusters with kubeadm for an example control plane setup that runs across multiple machines.kube-apiserverThe API server is a component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.The main implementation of a Kubernetes API server is kube-apiserver. kube-apiserver is designed to scale horizontally—that is, it scales by deploying more instances. You can run several instances of kube-apiserver and balance traffic between those instances.etcdConsistent and highly-available key value store used as Kubernetes' backing store for all cluster data.If your Kubernetes cluster uses etcd as its backing store, make sure you have a back up plan for the data.You can find in-depth information about etcd in the official documentation.kube-schedulerControl plane component that watches for newly created Pods with no assigned node, and selects a node for them to run on.Factors taken into account for scheduling decisions include: individual and collective resource requirements, hardware/software/policy constraints, affinity and anti-affinity specifications, data locality, inter-workload interference, and deadlines.kube-controller-managerControl plane component that runs controller processes.Logically, each controller is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process.There are many different types of controllers. Some examples of them are:Node controller: Responsible for noticing and responding when nodes go down.Job controller: Watches for Job objects that represent one-off tasks, then creates Pods to run those tasks to completion.EndpointSlice controller: Populates EndpointSlice objects (to provide a link between Services and Pods).ServiceAccou", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl cordon $NODENAME\n```\n\n1 - Nodes | See Safely Drain a Node for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5432"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\n1 - Nodes | See Node Status for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5433"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease -l apiserver.kubernetes.io/identity=kube-apiserver\n```\n\n4 - Leases | The SHA256 hash used in the lease name is based on the OS hostname as seen by that API server. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instanc", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5434"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease apiserver-07a5ea9b9b072c4a5f3d1c3702 -o yaml\n```\n\n4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5435"}
{"instruction": "Write a yaml example for cluster architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\n4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5436"}
{"instruction": "Write a yaml example for cluster architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\n5 - Cloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5437"}
{"instruction": "Write a yaml example for cluster architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\n4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5438"}
{"instruction": "Write a yaml example for cluster architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\n5 - Cloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5439"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace\n```\n\n9 - Garbage Collection | Kubernetes checks for and deletes objects that no longer have owner references, like the pods left behind when you delete a ReplicaSet. When you delete an object, you can control whether Kubernetes de", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5440"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl cordon $NODENAME\n```\n\n1 - Nodes | See Safely Drain a Node for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5441"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\n1 - Nodes | See Node Status for more details.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5442"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease -l apiserver.kubernetes.io/identity=kube-apiserver\n```\n\n4 - Leases | The SHA256 hash used in the lease name is based on the OS hostname as seen by that API server. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instanc", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5443"}
{"instruction": "Write a bash example for cluster architecture", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease apiserver-07a5ea9b9b072c4a5f3d1c3702 -o yaml\n```\n\n4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5444"}
{"instruction": "Write a yaml example for cluster architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\n4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5445"}
{"instruction": "Write a yaml example for cluster architecture", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\n5 - Cloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/_print/", "id": "k8s_00411_code_5446"}
{"instruction": "How do you list all container images running in a cluster in Kubernetes?", "response": "List All Container Images Running in a ClusterThis page shows how to use kubectl to list all of the Container images for Pods running in a cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.In this exercise you will use kubectl to fetch all of the Pods running in a cluster, and format the output to pull out the list of Containers for each.List all Container images in all namespacesFetch all Pods in all namespaces using kubectl get pods --all-namespacesFormat the output to include only the list of Container image names using -o jsonpath={.items[*].spec['initContainers', 'containers'][*].image}. This will recursively parse out the image field from the returned json.See the jsonpath reference for further information on how to use jsonpath.Format the output using standard tools: tr, sort, uniqUse tr to replace spaces with newlinesUse sort to sort the resultsUse uniq to aggregate image countskubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec['initContainers', 'containers'][*].image}\" |\\ tr -s '[[:space:]]' '\\n' |\\ sort |\\ uniq -c The jsonpath is interpreted as follows:.items[*]: for each returned value.spec: get the spec['initContainers', 'containers'][*]: for each container.image: get the imageNote:When fetching a single Pod by name, for example kubectl get pod nginx, the .items[*] portion of the path should be omitted because a single Pod is returned instead of a list of items.List Container images by PodThe formatting can be controlled further by using the range operation to iterate over elements individually.kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{\"\\n\"}{.metadata.name}{\":\\t\"}{range .spec.containers[*]}{.image}{\", \"}{end}{end}' |\\ sort List Container images filtering by Pod labelTo target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching app=nginx.kubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec.containers[*].image}\" -l app=nginx List Container images filtering by Pod namespaceTo target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the kube-system namespace.kubectl get pods --namespace kube-system -o jsonpath=\"{.items[*].spec.containers[*].image}\" List Container images using a go-template instead of jsonpathAs an alternative to jsonpath, Kubectl supports using go-templates for formatting the output:kubectl get pods --all-namespaces -o go-template --template=\"{{range .items}}{{range .spec.containers}}{{.image}} {{end}}{{end}}\" What's nextReferenceJsonpath reference guideGo template reference guide", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec['initContainers', 'containers'][*].image}\" |\\\ntr -s '[[:space:]]' '\\n' |\\\nsort |\\\nuniq -c\n```\n\nList All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5448"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{\"\\n\"}{.metadata.name}{\":\\t\"}{range .spec.containers[*]}{.image}{\", \"}{end}{end}' |\\\nsort\n```\n\nList All Container Images Running in a Cluster | To target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching app=nginx.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5449"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec.containers[*].image}\" -l app=nginx\n```\n\nList All Container Images Running in a Cluster | To target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the kube-system namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5450"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace kube-system -o jsonpath=\"{.items[*].spec.containers[*].image}\"\n```\n\nList All Container Images Running in a Cluster | As an alternative to jsonpath, Kubectl supports using go-templates for formatting the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5451"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o go-template --template=\"{{range .items}}{{range .spec.containers}}{{.image}} {{end}}{{end}}\"\n```\n\nList All Container Images Running in a Cluster |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5452"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces\n```\n\nList All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5453"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx\n```\n\nList All Container Images Running in a Cluster | The formatting can be controlled further by using the range operation to iterate over elements individually.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5454"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec['initContainers', 'containers'][*].image}\" |\\\ntr -s '[[:space:]]' '\\n' |\\\nsort |\\\nuniq -c\n```\n\nList All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5455"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{\"\\n\"}{.metadata.name}{\":\\t\"}{range .spec.containers[*]}{.image}{\", \"}{end}{end}' |\\\nsort\n```\n\nList All Container Images Running in a Cluster | To target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching app=nginx.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5456"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec.containers[*].image}\" -l app=nginx\n```\n\nList All Container Images Running in a Cluster | To target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the kube-system namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5457"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace kube-system -o jsonpath=\"{.items[*].spec.containers[*].image}\"\n```\n\nList All Container Images Running in a Cluster | As an alternative to jsonpath, Kubectl supports using go-templates for formatting the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5458"}
{"instruction": "Write a bash example for list all container images running in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o go-template --template=\"{{range .items}}{{range .spec.containers}}{{.image}} {{end}}{{end}}\"\n```\n\nList All Container Images Running in a Cluster |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/", "id": "k8s_00412_code_5459"}
{"instruction": "What is the reference documentation for kube-apiserver audit configuration (v1)?", "response": "kube-apiserver Audit Configuration (v1)Resource TypesEventEventListPolicyPolicyListEventAppears in:EventListEvent captures all the information that can be included in an API audit log.FieldDescriptionapiVersionstringaudit.k8s.io/v1kindstringEventlevel [Required]LevelAuditLevel at which event was generatedauditID [Required]k8s.io/apimachinery/pkg/types.UIDUnique audit ID, generated for each request.stage [Required]StageStage of the request handling when this event instance was generated.requestURI [Required]stringRequestURI is the request URI as sent by the client to a server.verb [Required]stringVerb is the kubernetes verb associated with the request. For non-resource requests, this is the lower-cased HTTP method.user [Required]authentication/v1.UserInfoAuthenticated user information.impersonatedUserauthentication/v1.UserInfoImpersonated user information.sourceIPs[]stringSource IPs, from where the request originated and intermediate proxies. The source IPs are listed from (in order):X-Forwarded-For request header IPsX-Real-Ip header, if not present in the X-Forwarded-For listThe remote address for the connection, if it doesn't match the last IP in the list up to here (X-Forwarded-For or X-Real-Ip). Note: All but the last IP can be arbitrarily set by the client.userAgentstringUserAgent records the user agent string reported by the client. Note that the UserAgent is provided by the client, and must not be trusted.objectRefObjectReferenceObject reference this request is targeted at. Does not apply for List-type requests, or non-resource requests.responseStatusmeta/v1.StatusThe response status, populated even when the ResponseObject is not a Status type. For successful responses, this will only include the Code and StatusSuccess. For non-status type error responses, this will be auto-populated with the error Message.requestObjectk8s.io/apimachinery/pkg/runtime.UnknownAPI object from the request, in JSON format. The RequestObject is recorded as-is in the request (possibly re-encoded as JSON), prior to version conversion, defaulting, admission or merging. It is an external versioned object type, and may not be a valid object on its own. Omitted for non-resource requests. Only logged at Request Level and higher.responseObjectk8s.io/apimachinery/pkg/runtime.UnknownAPI object returned in the response, in JSON. The ResponseObject is recorded after conversion to the external type, and serialized as JSON. Omitted for non-resource requests. Only logged at Response Level.requestReceivedTimestampmeta/v1.MicroTimeTime the request reached the apiserver.stageTimestampmeta/v1.MicroTimeTime the request reached current audit stage.annotationsmap[string]stringAnnotations is an unstructured key value map stored with an audit event that may be set by plugins invoked in the request serving chain, including authentication, authorization and admission plugins. Note that these annotations are for the audit event, and do not correspond to the metadata.annotations of the submitted object. Keys should uniquely identify the informing component to avoid name collisions (e.g. podsecuritypolicy.admission.k8s.io/policy). Values should be short. Annotations are included in the Metadata level.EventListEventList is a list of audit Events.FieldDescriptionapiVersionstringaudit.k8s.io/v1kindstringEventListmetadatameta/v1.ListMetaNo description provided.items [Required][]EventNo description provided.PolicyAppears in:PolicyListPolicy defines the configuration of audit logging, and the rules for how different request categories are logged.FieldDescriptionapiVersionstringaudit.k8s.io/v1kindstringPolicymetadatameta/v1.ObjectMetaObjectMeta is included for interoperability with API infrastructure.Refer to the Kubernetes API documentation for the fields of the metadata field.rules [Required][]PolicyRuleRules specify the audit Level a request should be recorded at. A request may match multiple rules, in which case the FIRST matching rule is used. The default audit level is Non", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-audit.v1/", "id": "k8s_00413"}
{"instruction": "What is the reference documentation for node reference information?", "response": "Node Reference InformationThis section contains the following reference topics about nodes:the kubelet's checkpoint APIa list of Articles on dockershim Removal and on Using CRI-compatible RuntimesKubelet Device Manager API VersionsNode Labels Populated By The KubeletLocal Files And Paths Used By The KubeletNode .status informationLinux Node Swap BehaviorsSeccomp informationYou can also read node reference details from elsewhere in the Kubernetes documentation, including:Node Metrics Data.CRI Pod & Container Metrics.Understand Pressure Stall Information (PSI) Metrics.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/", "id": "k8s_00414"}
{"instruction": "Explain the Kubernetes concept: Images", "response": "ImagesA container image represents binary data that encapsulates an application and all its software dependencies. Container images are executable software bundles that can run standalone and that make very well-defined assumptions about their runtime environment.You typically create a container image of your application and push it to a registry before referring to it in a Pod.This page provides an outline of the container image concept.Note:If you are looking for the container images for a Kubernetes release (such as v1.34, the latest minor release), visit Download Kubernetes.Image namesContainer images are usually given a name such as pause, example/mycontainer, or kube-apiserver. Images can also include a registry hostname; for example: fictional.registry.example/imagename, and possibly a port number as well; for example: fictional.registry.example:10443/imagename.If you don't specify a registry hostname, Kubernetes assumes that you mean the Docker public registry. You can change this behavior by setting a default image registry in the container runtime configuration.After the image name part you can add a tag or digest (in the same way you would when using with commands like docker or podman). Tags let you identify different versions of the same series of images. Digests are a unique identifier for a specific version of an image. Digests are hashes of the image's content, and are immutable. Tags can be moved to point to different images, but digests are fixed.Image tags consist of lowercase and uppercase letters, digits, underscores (_), periods (.), and dashes (-). A tag can be up to 128 characters long, and must conform to the following regex pattern: [a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}. You can read more about it and find the validation regex in the OCI Distribution Specification. If you don't specify a tag, Kubernetes assumes you mean the tag latest.Image digests consists of a hash algorithm (such as sha256) and a hash value. For example: sha256:1ff6c18fbef2045af6b9c16bf034cc421a29027b800e4f9b68ae9b1cb3e9ae07. You can find more information about the digest format in the OCI Image Specification.Some image name examples that Kubernetes can use are:busybox — Image name only, no tag or digest. Kubernetes will use the Docker public registry and latest tag. Equivalent to docker.io/library/busybox:latest.busybox:1.32.0 — Image name with tag. Kubernetes will use the Docker public registry. Equivalent to docker.io/library/busybox:1.32.0.registry.k8s.io/pause:latest — Image name with a custom registry and latest tag.registry.k8s.io/pause:3.5 — Image name with a custom registry and non-latest tag.registry.k8s.io/pause@sha256:1ff6c18fbef2045af6b9c16bf034cc421a29027b800e4f9b68ae9b1cb3e9ae07 — Image name with digest.registry.k8s.io/pause:3.5@sha256:1ff6c18fbef2045af6b9c16bf034cc421a29027b800e4f9b68ae9b1cb3e9ae07 — Image name with tag and digest. Only the digest will be used for pulling.Updating imagesWhen you first create a Deployment, StatefulSet, Pod, or other object that includes a PodTemplate, and a pull policy was not explicitly specified, then by default the pull policy of all containers in that Pod will be set to IfNotPresent. This policy causes the kubelet to skip pulling an image if it already exists.Image pull policyThe imagePullPolicy for a container and the tag of the image both affect when the kubelet attempts to pull (download) the specified image.Here's a list of the values you can set for imagePullPolicy and the effects these values have:IfNotPresentthe image is pulled only if it is not already present locally.Alwaysevery time the kubelet launches a container, the kubelet queries the container image registry to resolve the name to an image digest. If the kubelet has a container image with that exact digest cached locally, the kubelet uses its cached image; otherwise, the kubelet pulls the image with the resolved digest, and uses that image to launch the container.Neverthe kubelet does not try fetching the image. If th", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415"}
{"instruction": "Write a bash example for images", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry <name> \\\n  --docker-server=<docker-registry-server> \\\n  --docker-username=<docker-user> \\\n  --docker-password=<docker-password> \\\n  --docker-email=<docker-email>\n```\n\nImages | If you already have a Docker credentials file then, rather than using the above command, you can import the credentials file as a Kubernetes Secret. Create a Secret based on existing Docker credential", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415_code_5463"}
{"instruction": "Write a yaml example for images", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: foo\n  namespace: awesomeapps\nspec:\n  containers:\n    - name: foo\n      image: janedoe/awesomeapp:v1\n  imagePullSecrets:\n    - name: myregistrykey\nEOF\n\ncat <<EOF >> ./kustomization.yaml\nresources:\n- pod.yaml\nEOF\n```\n\nImages | This needs to be done for each Pod that is using a private registry.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415_code_5464"}
{"instruction": "Write a bash example for images", "response": "Here's a bash example:\n\n```bash\ndocker.io/library/busybox:latest\n```\n\nImages | When you first create a Deployment, StatefulSet, Pod, or other object that includes a PodTemplate, and a pull policy was not explicitly specified, then by default the pull policy of all containers in", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415_code_5465"}
{"instruction": "Write a bash example for images", "response": "Here's a bash example:\n\n```bash\ndocker.io/library/busybox:1.32.0\n```\n\nImages | When you first create a Deployment, StatefulSet, Pod, or other object that includes a PodTemplate, and a pull policy was not explicitly specified, then by default the pull policy of all containers in", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415_code_5466"}
{"instruction": "Write a bash example for images", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry\n```\n\nImages | Now, you can create pods which reference that secret by adding the imagePullSecrets section to a Pod definition. Each item in the imagePullSecrets array can only reference one Secret in the same names", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415_code_5467"}
{"instruction": "Write a bash example for images", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry <name> \\\n  --docker-server=<docker-registry-server> \\\n  --docker-username=<docker-user> \\\n  --docker-password=<docker-password> \\\n  --docker-email=<docker-email>\n```\n\nImages | If you already have a Docker credentials file then, rather than using the above command, you can import the credentials file as a Kubernetes Secret. Create a Secret based on existing Docker credential", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415_code_5468"}
{"instruction": "Write a yaml example for images", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: foo\n  namespace: awesomeapps\nspec:\n  containers:\n    - name: foo\n      image: janedoe/awesomeapp:v1\n  imagePullSecrets:\n    - name: myregistrykey\nEOF\n\ncat <<EOF >> ./kustomization.yaml\nresources:\n- pod.yaml\nEOF\n```\n\nImages | This needs to be done for each Pod that is using a private registry.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/images/", "id": "k8s_00415_code_5469"}
{"instruction": "What is the reference documentation for authentication resources?", "response": "Authentication ResourcesServiceAccountServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets.TokenRequestTokenRequest requests a token for a given service account.TokenReviewTokenReview attempts to authenticate a token to a known user.CertificateSigningRequestCertificateSigningRequest objects provide a mechanism to obtain x509 certificates by submitting a certificate signing request, and having it asynchronously approved and issued.ClusterTrustBundle v1beta1ClusterTrustBundle is a cluster-scoped container for X.SelfSubjectReviewSelfSubjectReview contains the user information that the kube-apiserver has about the user making this request.PodCertificateRequest v1alpha1PodCertificateRequest encodes a pod requesting a certificate from a given signer.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/", "id": "k8s_00416"}
{"instruction": "What is the reference documentation for kubeadm join phase?", "response": "kubeadm join phasekubeadm join phase enables you to invoke atomic steps of the join process. Hence, you can let kubeadm do some of the work and you can fill in the gaps if you wish to apply customization.kubeadm join phase is consistent with the kubeadm join workflow, and behind the scene both use the same code.kubeadm join phaseSynopsisUse this command to invoke single phase of the \"join\" workflowkubeadm join phase [flags] Options-h, --helphelp for phaseOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm join phase preflightUsing this phase you can execute preflight checks on a joining node.Run join pre-flight checksSynopsisRun pre-flight checks for kubeadm join.kubeadm join phase preflight [api-server-endpoint] [flags] Examples # Run join pre-flight checks using a config file. kubeadm join phase preflight --config kubeadm-config.yaml Options--apiserver-advertise-address stringIf the node should host a new control plane instance, the IP address the API Server will advertise it's listening on. If not set the default network interface will be used.--apiserver-bind-port int32 Default: 6443If the node should host a new control plane instance, the port for the API Server to bind to.--certificate-key stringUse this key to decrypt the certificate secrets uploaded by init. The certificate key is a hex encoded string that is an AES key of size 32 bytes.--config stringPath to a kubeadm configuration file.--control-planeCreate a new control plane instance on this node--cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.--discovery-file stringFor file-based discovery, a file or URL from which to load cluster information.--discovery-token stringFor token-based discovery, the token used to validate cluster information fetched from the API server.--discovery-token-ca-cert-hash stringsFor token-based discovery, validate that the root CA public key matches this hash (format: \"<type>:<value>\").--discovery-token-unsafe-skip-ca-verificationFor token-based discovery, allow joining without --discovery-token-ca-cert-hash pinning.--dry-runDon't apply any changes; just output what would be done.-h, --helphelp for preflight--ignore-preflight-errors stringsA list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.--node-name stringSpecify the node name.--tls-bootstrap-token stringSpecify the token used to temporarily authenticate with the Kubernetes Control Plane while joining the node.--token stringUse this token for both discovery-token and tls-bootstrap-token when those values are not provided.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm join phase control-plane-prepareUsing this phase you can prepare a node for serving a control-plane.SynopsisPrepare the machine for serving a control planekubeadm join phase control-plane-prepare [flags] Examples # Prepares the machine for serving a control plane kubeadm join phase control-plane-prepare all Options-h, --helphelp for control-plane-prepareOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisPrepare the machine for serving a control planekubeadm join phase control-plane-prepare all [api-server-endpoint] [flags] Options--apiserver-advertise-address stringIf the node should host a new control plane instance, the IP address the API Server will advertise it's listening on. If not set the default network interface will be used.--apiserver-bind-port int32 Default: 6443If the node should host a new control plane instance, the port for the API Server t", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join-phase/", "id": "k8s_00417"}
{"instruction": "Explain install tools in Kubernetes", "response": "Install ToolsSet up Kubernetes tools on your computer.kubectlThe Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. For more information including a complete list of kubectl operations, see the kubectl reference documentation.kubectl is installable on a variety of Linux platforms, macOS and Windows. Find your preferred operating system below.Install kubectl on LinuxInstall kubectl on macOSInstall kubectl on Windowskindkind lets you run Kubernetes on your local computer. This tool requires that you have either Docker or Podman installed.The kind Quick Start page shows you what you need to do to get up and running with kind.View kind Quick Start GuideminikubeLike kind, minikube is a tool that lets you run Kubernetes locally. minikube runs an all-in-one or a multi-node local Kubernetes cluster on your personal computer (including Windows, macOS and Linux PCs) so that you can try out Kubernetes, or for daily development work.You can follow the official Get Started! guide if your focus is on getting the tool installed.View minikube Get Started! GuideOnce you have minikube working, you can use it to run a sample application.kubeadmYou can use the kubeadm tool to create and manage Kubernetes clusters. It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way.Installing kubeadm shows you how to install kubeadm. Once installed, you can use it to create a cluster.View kubeadm Install Guide", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/learning-environment/", "id": "k8s_00418"}
{"instruction": "What is the reference documentation for kube-controller-manager configuration (v1alpha1)?", "response": "kube-controller-manager Configuration (v1alpha1)Resource TypesCloudControllerManagerConfigurationLeaderMigrationConfigurationKubeControllerManagerConfigurationClientConnectionConfigurationAppears in:KubeSchedulerConfigurationGenericControllerManagerConfigurationClientConnectionConfiguration contains details for constructing a client.FieldDescriptionkubeconfig [Required]stringkubeconfig is the path to a KubeConfig file.acceptContentTypes [Required]stringacceptContentTypes defines the Accept header sent by clients when connecting to a server, overriding the default value of 'application/json'. This field will control all connections to the server used by a particular client.contentType [Required]stringcontentType is the content type used when sending data to the server from this client.qps [Required]float32qps controls the number of queries per second allowed for this connection.burst [Required]int32burst allows extra queries to accumulate when a client is exceeding its rate.DebuggingConfigurationAppears in:KubeSchedulerConfigurationGenericControllerManagerConfigurationDebuggingConfiguration holds configuration for Debugging related features.FieldDescriptionenableProfiling [Required]boolenableProfiling enables profiling via web interface host:port/debug/pprof/enableContentionProfiling [Required]boolenableContentionProfiling enables block profiling, if enableProfiling is true.LeaderElectionConfigurationAppears in:KubeSchedulerConfigurationGenericControllerManagerConfigurationLeaderElectionConfiguration defines the configuration of leader election clients for components that can run with leader election enabled.FieldDescriptionleaderElect [Required]boolleaderElect enables a leader election client to gain leadership before executing the main loop. Enable this when running replicated components for high availability.leaseDuration [Required]meta/v1.DurationleaseDuration is the duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled.renewDeadline [Required]meta/v1.DurationrenewDeadline is the interval between attempts by the acting master to renew a leadership slot before it stops leading. This must be less than or equal to the lease duration. This is only applicable if leader election is enabled.retryPeriod [Required]meta/v1.DurationretryPeriod is the duration the clients should wait between attempting acquisition and renewal of a leadership. This is only applicable if leader election is enabled.resourceLock [Required]stringresourceLock indicates the resource object type that will be used to lock during leader election cycles.resourceName [Required]stringresourceName indicates the name of resource object that will be used to lock during leader election cycles.resourceNamespace [Required]stringresourceName indicates the namespace of resource object that will be used to lock during leader election cycles.NodeControllerConfigurationAppears in:CloudControllerManagerConfigurationNodeControllerConfiguration contains elements describing NodeController.FieldDescriptionConcurrentNodeSyncs [Required]int32ConcurrentNodeSyncs is the number of workers concurrently synchronizing nodesServiceControllerConfigurationAppears in:CloudControllerManagerConfigurationKubeControllerManagerConfigurationServiceControllerConfiguration contains elements describing ServiceController.FieldDescriptionConcurrentServiceSyncs [Required]int32concurrentServiceSyncs is the number of services that are allowed to sync concurrently. Larger number = more responsive service management, but more CPU (and network) load.CloudControllerManagerConfigurationCloudControllerManagerConfiguration contains elements describing cloud-controller manager.FieldDescriptionapiVersionstringcloudcontrollermanager.config.k8s.io/v1", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kube-controller-manager-config.v1alpha1/", "id": "k8s_00419"}
{"instruction": "What is the reference documentation for kubectl apply view-last-applied?", "response": "kubectl apply view-last-appliedSynopsisView the latest last-applied-configuration annotations by type/name or file.The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.kubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME) Examples # View the last-applied-configuration annotations by type/name in YAML kubectl apply view-last-applied deployment/nginx # View the last-applied-configuration annotations by file in JSON kubectl apply view-last-applied -f deploy.yaml -o json Options--allSelect all resources in the namespace of the specified resource types-f, --filename stringsFilename, directory, or URL to files that contains the last-applied-configuration annotations-h, --helphelp for view-last-applied-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output string Default: \"yaml\"Output format. Must be one of (yaml, json)-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--use", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_view-last-applied/", "id": "k8s_00420"}
{"instruction": "Write a bash example for kubectl apply view-last-applied", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)\n```\n\nkubectl apply view-last-applied | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_view-last-applied/", "id": "k8s_00420_code_5475"}
{"instruction": "Write a bash example for kubectl apply view-last-applied", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)\n```\n\nkubectl apply view-last-applied | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_view-last-applied/", "id": "k8s_00420_code_5476"}
{"instruction": "Explain the Kubernetes concept: Volumes", "response": "VolumesKubernetes volumes provide a way for containers in a pod to access and share data via the filesystem. There are different kinds of volume that you can use for different purposes, such as:populating a configuration file based on a ConfigMap or a Secretproviding some temporary scratch space for a podsharing a filesystem between two different containers in the same podsharing a filesystem between two different pods (even if those Pods run on different nodes)durably storing data so that it stays available even if the Pod restarts or is replacedpassing configuration information to an app running in a container, based on details of the Pod the container is in (for example: telling a sidecar container what namespace the Pod is running in)providing read-only access to data in a different container imageData sharing can be between different local processes within a container, or between different containers, or between Pods.Why volumes are importantData persistence: On-disk files in a container are ephemeral, which presents some problems for non-trivial applications when running in containers. One problem occurs when a container crashes or is stopped, the container state is not saved so all of the files that were created or modified during the lifetime of the container are lost. After a crash, kubelet restarts the container with a clean state.Shared storage: Another problem occurs when multiple containers are running in a Pod and need to share files. It can be challenging to set up and access a shared filesystem across all of the containers.The Kubernetes volume abstraction can help you to solve both of these problems.Before you learn about volumes, PersistentVolumes and PersistentVolumeClaims, you should read up about Pods and make sure that you understand how Kubernetes uses Pods to run containers.How volumes workKubernetes supports many types of volumes. A Pod can use any number of volume types simultaneously. Ephemeral volume types have a lifetime linked to a specific Pod, but persistent volumes exist beyond the lifetime of any individual pod. When a pod ceases to exist, Kubernetes destroys ephemeral volumes; however, Kubernetes does not destroy persistent volumes. For any kind of volume in a given pod, data is preserved across container restarts.At its core, a volume is a directory, possibly with some data in it, which is accessible to the containers in a pod. How that directory comes to be, the medium that backs it, and the contents of it are determined by the particular volume type used.To use a volume, specify the volumes to provide for the Pod in .spec.volumes and declare where to mount those volumes into containers in .spec.containers[*].volumeMounts.When a pod is launched, a process in the container sees a filesystem view composed from the initial contents of the container image, plus volumes (if defined) mounted inside the container. The process sees a root filesystem that initially matches the contents of the container image. Any writes to within that filesystem hierarchy, if allowed, affect what that process views when it performs a subsequent filesystem access. Volumes are mounted at specified paths within the container filesystem. For each container defined within a Pod, you must independently specify where to mount each volume that the container uses.Volumes cannot mount within other volumes (but see Using subPath for a related mechanism). Also, a volume cannot contain a hard link to anything in a different volume.Types of volumesKubernetes supports several types of volumes.awsElasticBlockStore (deprecated)In Kubernetes 1.34, all operations for the in-tree awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver.The AWSElasticBlockStore in-tree storage driver was deprecated in the Kubernetes v1.19 release and then removed entirely in the v1.27 release.The Kubernetes project suggests that you use the AWS EBS third party storage driver instead.azureDisk (deprecated)In Kubernetes 1.34, all operati", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\nVolumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5478"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\nVolumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5479"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\nVolumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5480"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\nVolumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5481"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\nVolumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5482"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\nVolumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5483"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\nVolumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5484"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nVolumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5485"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\nVolumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5486"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\nVolumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5487"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\nVolumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5488"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\nVolumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5489"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\nVolumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5490"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\nVolumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5491"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\nVolumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5492"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\nVolumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5493"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\nVolumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5494"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\nVolumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5495"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\nVolumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5496"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\nVolumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5497"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\nVolumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5498"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nVolumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5499"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\nVolumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5500"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\nVolumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5501"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\nVolumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5502"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\nVolumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5503"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\nVolumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5504"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\nVolumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5505"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\nVolumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5506"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\nVolumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5507"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\nVolumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5508"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\nVolumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5509"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\nVolumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5510"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\nVolumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5511"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\nVolumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5512"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nVolumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5513"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\nVolumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5514"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\nVolumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5515"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\nVolumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5516"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\nVolumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5517"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\nVolumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5518"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\nVolumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5519"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\nstorage/rro.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\nVolumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5520"}
{"instruction": "Write a yaml example for volumes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\nVolumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/volumes/", "id": "k8s_00421_code_5521"}
{"instruction": "Explain reviewing for approvers and reviewers in Kubernetes", "response": "Reviewing for approvers and reviewersSIG Docs Reviewers and Approvers do a few extra things when reviewing a change.Every week a specific docs approver volunteers to triage and review pull requests. This person is the \"PR Wrangler\" for the week. See the PR Wrangler scheduler for more information. To become a PR Wrangler, attend the weekly SIG Docs meeting and volunteer. Even if you are not on the schedule for the current week, you can still review pull requests (PRs) that are not already under active review.In addition to the rotation, a bot assigns reviewers and approvers for the PR based on the owners for the affected files.Reviewing a PRKubernetes documentation follows the Kubernetes code review process.Everything described in Reviewing a pull request applies, but Reviewers and Approvers should also do the following:Using the /assign Prow command to assign a specific reviewer to a PR as needed. This is extra important when it comes to requesting technical review from code contributors.Note:Look at the reviewers field in the front-matter at the top of a Markdown file to see who can provide technical review.Making sure the PR follows the Content and Style guides; link the author to the relevant part of the guide(s) if it doesn't.Using the GitHub Request Changes option when applicable to suggest changes to the PR author.Changing your review status in GitHub using the /approve or /lgtm Prow commands, if your suggestions are implemented.Commit into another person's PRLeaving PR comments is helpful, but there might be times when you need to commit into another person's PR instead.Do not \"take over\" for another person unless they explicitly ask you to, or you want to resurrect a long-abandoned PR. While it may be faster in the short term, it deprives the person of the chance to contribute.The process you use depends on whether you need to edit a file that is already in the scope of the PR, or a file that the PR has not yet touched.You can't commit into someone else's PR if either of the following things is true:If the PR author pushed their branch directly to the https://github.com/kubernetes/website/ repository. Only a reviewer with push access can commit to another user's PR.Note:Encourage the author to push their branch to their fork before opening the PR next time.The PR author explicitly disallows edits from approvers.Prow commands for reviewingProw is the Kubernetes-based CI/CD system that runs jobs against pull requests (PRs). Prow enables chatbot-style commands to handle GitHub actions across the Kubernetes organization, like adding and removing labels, closing issues, and assigning an approver. Enter Prow commands as GitHub comments using the /<command-name> format.The most common prow commands reviewers and approvers use are:Prow commands for reviewingProw CommandRole RestrictionsDescription/lgtmOrganization membersSignals that you've finished reviewing a PR and are satisfied with the changes./approveApproversApproves a PR for merging./assignAnyoneAssigns a person to review or approve a PR/closeOrganization membersCloses an issue or PR./holdAnyoneAdds the do-not-merge/hold label, indicating the PR cannot be automatically merged./hold cancelAnyoneRemoves the do-not-merge/hold label.To view the commands that you can use in a PR, see the Prow Command Reference.Triage and categorize issuesIn general, SIG Docs follows the Kubernetes issue triage process and uses the same labels.This GitHub Issue filter finds issues that might need triage.Triaging an issueValidate the issueMake sure the issue is about website documentation. Some issues can be closed quickly by answering a question or pointing the reporter to a resource. See the Support requests or code bug reports section for details.Assess whether the issue has merit.Add the triage/needs-information label if the issue doesn't have enough detail to be actionable or the template is not filled out adequately.Close the issue if it has both the lifecycle/stale and triage/needs-inf", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/review/for-approvers/", "id": "k8s_00422"}
{"instruction": "What is the reference documentation for namespace?", "response": "NamespaceNamespace provides a scope for Names.apiVersion: v1import \"k8s.io/api/core/v1\"NamespaceNamespace provides a scope for Names. Use of multiple namespaces is optional.apiVersion: v1kind: Namespacemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (NamespaceSpec)Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (NamespaceStatus)Status describes the current status of a Namespace. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusNamespaceSpecNamespaceSpec describes the attributes on a Namespace.finalizers ([]string)Atomic: will be replaced during a mergeFinalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/NamespaceStatusNamespaceStatus is information about the current status of a Namespace.conditions ([]NamespaceCondition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeRepresents the latest available observations of a namespace's current state.NamespaceCondition contains details about state of namespace.conditions.status (string), requiredStatus of the condition, one of True, False, Unknown.conditions.type (string), requiredType of namespace controller condition.conditions.lastTransitionTime (Time)Last time the condition transitioned from one status to another.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.conditions.message (string)Human-readable message indicating details about last transition.conditions.reason (string)Unique, one-word, CamelCase reason for the condition's last transition.phase (string)Phase is the current lifecycle phase of the namespace. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/NamespaceListNamespaceList is a list of Namespaces.apiVersion: v1kind: NamespaceListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems ([]Namespace), requiredItems is the list of Namespace objects in the list. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/Operationsget read the specified NamespaceHTTP RequestGET /api/v1/namespaces/{name}Parametersname (in path): string, requiredname of the Namespacepretty (in query): stringprettyResponse200 (Namespace): OK401: Unauthorizedget read status of the specified NamespaceHTTP RequestGET /api/v1/namespaces/{name}/statusParametersname (in path): string, requiredname of the Namespacepretty (in query): stringprettyResponse200 (Namespace): OK401: Unauthorizedlist list or watch objects of kind NamespaceHTTP RequestGET /api/v1/namespacesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (NamespaceList): OK401: Unauthorizedcreate create a NamespaceHTTP RequestPOST /api/v1/namespacesParametersbody: Namespace, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (Namespace): OK201 (Namespace): Created202 (Namespace): Accepted401: Unauthorizedupdate replace the specified NamespaceHTTP RequestPUT /api/v1", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/namespace-v1/", "id": "k8s_00423"}
{"instruction": "Explain the Kubernetes concept: Cluster Architecture", "response": "Cluster ArchitectureThe architectural concepts behind Kubernetes.A Kubernetes cluster consists of a control plane plus a set of worker machines, called nodes, that run containerized applications. Every cluster needs at least one worker node in order to run Pods.The worker node(s) host the Pods that are the components of the application workload. The control plane manages the worker nodes and the Pods in the cluster. In production environments, the control plane usually runs across multiple computers and a cluster usually runs multiple nodes, providing fault-tolerance and high availability.This document outlines the various components you need to have for a complete and working Kubernetes cluster.Figure 1. Kubernetes cluster components.About this architectureThe diagram in Figure 1 presents an example reference architecture for a Kubernetes cluster. The actual distribution of components can vary based on specific cluster setups and requirements.In the diagram, each node runs the kube-proxy component. You need a network proxy component on each node to ensure that the Service API and associated behaviors are available on your cluster network. However, some network plugins provide their own, third party implementation of proxying. When you use that kind of network plugin, the node does not need to run kube-proxy.Control plane componentsThe control plane's components make global decisions about the cluster (for example, scheduling), as well as detecting and responding to cluster events (for example, starting up a new pod when a Deployment's replicas field is unsatisfied).Control plane components can be run on any machine in the cluster. However, for simplicity, setup scripts typically start all control plane components on the same machine, and do not run user containers on this machine. See Creating Highly Available clusters with kubeadm for an example control plane setup that runs across multiple machines.kube-apiserverThe API server is a component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.The main implementation of a Kubernetes API server is kube-apiserver. kube-apiserver is designed to scale horizontally—that is, it scales by deploying more instances. You can run several instances of kube-apiserver and balance traffic between those instances.etcdConsistent and highly-available key value store used as Kubernetes' backing store for all cluster data.If your Kubernetes cluster uses etcd as its backing store, make sure you have a back up plan for the data.You can find in-depth information about etcd in the official documentation.kube-schedulerControl plane component that watches for newly created Pods with no assigned node, and selects a node for them to run on.Factors taken into account for scheduling decisions include: individual and collective resource requirements, hardware/software/policy constraints, affinity and anti-affinity specifications, data locality, inter-workload interference, and deadlines.kube-controller-managerControl plane component that runs controller processes.Logically, each controller is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process.There are many different types of controllers. Some examples of them are:Node controller: Responsible for noticing and responding when nodes go down.Job controller: Watches for Job objects that represent one-off tasks, then creates Pods to run those tasks to completion.EndpointSlice controller: Populates EndpointSlice objects (to provide a link between Services and Pods).ServiceAccount controller: Create default ServiceAccounts for new namespaces.The above is not an exhaustive list.cloud-controller-managerA Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that ", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/", "id": "k8s_00424"}
{"instruction": "Explain the Kubernetes concept: Installing Addons", "response": "Installing AddonsNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Add-ons extend the functionality of Kubernetes.This page lists some of the available add-ons and links to their respective installation instructions. The list does not try to be exhaustive.Networking and Network PolicyACI provides integrated container networking and network security with Cisco ACI.Antrea operates at Layer 3/4 to provide networking and security services for Kubernetes, leveraging Open vSwitch as the networking data plane. Antrea is a CNCF project at the Sandbox level.Calico is a networking and network policy provider. Calico supports a flexible set of networking options so you can choose the most efficient option for your situation, including non-overlay and overlay networks, with or without BGP. Calico uses the same engine to enforce network policy for hosts, pods, and (if using Istio & Envoy) applications at the service mesh layer.Canal unites Flannel and Calico, providing networking and network policy.Cilium is a networking, observability, and security solution with an eBPF-based data plane. Cilium provides a simple flat Layer 3 network with the ability to span multiple clusters in either a native routing or overlay/encapsulation mode, and can enforce network policies on L3-L7 using an identity-based security model that is decoupled from network addressing. Cilium can act as a replacement for kube-proxy; it also offers additional, opt-in observability and security features. Cilium is a CNCF project at the Graduated level.CNI-Genie enables Kubernetes to seamlessly connect to a choice of CNI plugins, such as Calico, Canal, Flannel, or Weave. CNI-Genie is a CNCF project at the Sandbox level.Contiv provides configurable networking (native L3 using BGP, overlay using vxlan, classic L2, and Cisco-SDN/ACI) for various use cases and a rich policy framework. Contiv project is fully open sourced. The installer provides both kubeadm and non-kubeadm based installation options.Contrail, based on Tungsten Fabric, is an open source, multi-cloud network virtualization and policy management platform. Contrail and Tungsten Fabric are integrated with orchestration systems such as Kubernetes, OpenShift, OpenStack and Mesos, and provide isolation modes for virtual machines, containers/pods and bare metal workloads.Flannel is an overlay network provider that can be used with Kubernetes.Gateway API is an open source project managed by the SIG Network community and provides an expressive, extensible, and role-oriented API for modeling service networking.Knitter is a plugin to support multiple network interfaces in a Kubernetes pod.Multus is a Multi plugin for multiple network support in Kubernetes to support all CNI plugins (e.g. Calico, Cilium, Contiv, Flannel), in addition to SRIOV, DPDK, OVS-DPDK and VPP based workloads in Kubernetes.OVN-Kubernetes is a networking provider for Kubernetes based on OVN (Open Virtual Network), a virtual networking implementation that came out of the Open vSwitch (OVS) project. OVN-Kubernetes provides an overlay based networking implementation for Kubernetes, including an OVS based implementation of load balancing and network policy.Nodus is an OVN based CNI controller plugin to provide cloud native based Service function chaining(SFC).NSX-T Container Plug-in (NCP) provides integration between VMware NSX-T and container orchestrators such as Kubernetes, as well as integration between NSX-T and container-based CaaS/PaaS platforms such as Pivotal Container Service (PKS) and OpenShift.Nuage is an SDN platform that provides policy-based networking between Kubernetes Pods and non-Kubernetes environments with visibility and security monitoring.Romana is a Layer 3 networking solution for pod n", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/addons/", "id": "k8s_00425"}
{"instruction": "What is the reference documentation for using abac authorization?", "response": "Using ABAC AuthorizationAttribute-based access control (ABAC) defines an access control paradigm whereby access rights are granted to users through the use of policies which combine attributes together.Policy File FormatTo enable ABAC mode, specify --authorization-policy-file=SOME_FILENAME and --authorization-mode=ABAC on startup.The file format is one JSON object per line. There should be no enclosing list or map, only one map per line.Each line is a \"policy object\", where each such object is a map with the following properties:Versioning properties:apiVersion, type string; valid values are \"abac.authorization.kubernetes.io/v1beta1\". Allows versioning and conversion of the policy format.kind, type string: valid values are \"Policy\". Allows versioning and conversion of the policy format.spec property set to a map with the following properties:Subject-matching properties:user, type string; the user-string from --token-auth-file. If you specify user, it must match the username of the authenticated user.group, type string; if you specify group, it must match one of the groups of the authenticated user. system:authenticated matches all authenticated requests. system:unauthenticated matches all unauthenticated requests.Resource-matching properties:apiGroup, type string; an API group.Ex: apps, networking.k8s.ioWildcard: * matches all API groups.namespace, type string; a namespace.Ex: kube-systemWildcard: * matches all resource requests.resource, type string; a resource typeEx: pods, deploymentsWildcard: * matches all resource requests.Non-resource-matching properties:nonResourcePath, type string; non-resource request paths.Ex: /version or /apisWildcard:* matches all non-resource requests./foo/* matches all subpaths of /foo/.readonly, type boolean, when true, means that the Resource-matching policy only applies to get, list, and watch operations, Non-resource-matching policy only applies to get operation.Note:An unset property is the same as a property set to the zero value for its type (e.g. empty string, 0, false). However, unset should be preferred for readability.In the future, policies may be expressed in a JSON format, and managed via a REST interface.Authorization AlgorithmA request has attributes which correspond to the properties of a policy object.When a request is received, the attributes are determined. Unknown attributes are set to the zero value of its type (e.g. empty string, 0, false).A property set to \"*\" will match any value of the corresponding attribute.The tuple of attributes is checked for a match against every policy in the policy file. If at least one line matches the request attributes, then the request is authorized (but may fail later validation).To permit any authenticated user to do something, write a policy with the group property set to \"system:authenticated\".To permit any unauthenticated user to do something, write a policy with the group property set to \"system:unauthenticated\".To permit a user to do anything, write a policy with the apiGroup, namespace, resource, and nonResourcePath properties set to \"*\".KubectlKubectl uses the /api and /apis endpoints of apiserver to discover served resource types, and validates objects sent to the API by create/update operations using schema information located at /openapi/v2.When using ABAC authorization, those special resources have to be explicitly exposed via the nonResourcePath property in a policy (see examples below):/api, /api/*, /apis, and /apis/* for API version negotiation./version for retrieving the server version via kubectl version./swaggerapi/* for create/update operations.To inspect the HTTP calls involved in a specific kubectl operation you can turn up the verbosity:kubectl --v=8 version ExamplesAlice can do anything to all resources:{\"apiVersion\": \"abac.authorization.kubernetes.io/v1beta1\", \"kind\": \"Policy\", \"spec\": {\"user\": \"alice\", \"namespace\": \"*\", \"resource\": \"*\", \"apiGroup\": \"*\"}} The kubelet can read any pods:{\"apiVersion\": \"abac.authorizatio", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/abac/", "id": "k8s_00426"}
{"instruction": "Write a bash example for using abac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl --v=8 version\n```\n\nUsing ABAC Authorization | Alice can do anything to all resources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/abac/", "id": "k8s_00426_code_5527"}
{"instruction": "Write a bash example for using abac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl --v=8 version\n```\n\nUsing ABAC Authorization | Alice can do anything to all resources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/abac/", "id": "k8s_00426_code_5528"}
{"instruction": "Explain advanced contributing in Kubernetes", "response": "Advanced contributingThis page assumes that you understand how to contribute to new content and review others' work, and are ready to learn about more ways to contribute. You need to use the Git command line client and other tools for some of these tasks.Propose improvementsSIG Docs members can propose improvements.After you've been contributing to the Kubernetes documentation for a while, you may have ideas for improving the Style Guide , the Content Guide, the toolchain used to build the documentation, the website style, the processes for reviewing and merging pull requests, or other aspects of the documentation. For maximum transparency, these types of proposals need to be discussed in a SIG Docs meeting or on the kubernetes-sig-docs mailing list. In addition, it can help to have some context about the way things currently work and why past decisions have been made before proposing sweeping changes. The quickest way to get answers to questions about how the documentation currently works is to ask in the #sig-docs Slack channel on kubernetes.slack.comAfter the discussion has taken place and the SIG is in agreement about the desired outcome, you can work on the proposed changes in the way that is the most appropriate. For instance, an update to the style guide or the website's functionality might involve opening a pull request, while a change related to documentation testing might involve working with sig-testing.Coordinate docs for a Kubernetes releaseSIG Docs approvers can coordinate docs for a Kubernetes release.Each Kubernetes release is coordinated by a team of people participating in the sig-release Special Interest Group (SIG). Others on the release team for a given release include an overall release lead, as well as representatives from sig-testing and others. To find out more about Kubernetes release processes, refer to https://github.com/kubernetes/sig-release.The SIG Docs representative for a given release coordinates the following tasks:Monitor the feature-tracking spreadsheet for new or changed features with an impact on documentation. If the documentation for a given feature won't be ready for the release, the feature may not be allowed to go into the release.Attend sig-release meetings regularly and give updates on the status of the docs for the release.Review and copyedit feature documentation drafted by the SIG responsible for implementing the feature.Merge release-related pull requests and maintain the Git feature branch for the release.Mentor other SIG Docs contributors who want to learn how to do this role in the future. This is known as \"shadowing\".Publish the documentation changes related to the release when the release artifacts are published.Coordinating a release is typically a 3-4 month commitment, and the duty is rotated among SIG Docs approvers.Serve as a New Contributor AmbassadorSIG Docs approvers can serve as New Contributor Ambassadors.New Contributor Ambassadors welcome new contributors to SIG-Docs, suggest PRs to new contributors, and mentor new contributors through their first few PR submissions.Responsibilities for New Contributor Ambassadors include:Monitoring the #sig-docs Slack channel for questions from new contributors.Working with PR wranglers to identify good first issues for new contributors.Mentoring new contributors through their first few PRs to the docs repo.Helping new contributors create the more complex PRs they need to become Kubernetes members.Sponsoring contributors on their path to becoming Kubernetes members.Hosting a monthly meeting to help and mentor new contributors.Current New Contributor Ambassadors are announced at each SIG-Docs meeting and in the Kubernetes #sig-docs channel.Sponsor a new contributorSIG Docs reviewers can sponsor new contributors.After a new contributor has successfully submitted 5 substantive pull requests to one or more Kubernetes repositories, they are eligible to apply for membership in the Kubernetes organization. The contributor's membership", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/advanced/", "id": "k8s_00427"}
{"instruction": "What is the reference documentation for kubelet authentication/authorization?", "response": "Kubelet authentication/authorizationOverviewA kubelet's HTTPS endpoint exposes APIs which give access to data of varying sensitivity, and allow you to perform operations with varying levels of power on the node and within containers.This document describes how to authenticate and authorize access to the kubelet's HTTPS endpoint.Kubelet authenticationBy default, requests to the kubelet's HTTPS endpoint that are not rejected by other configured authentication methods are treated as anonymous requests, and given a username of system:anonymous and a group of system:unauthenticated.To disable anonymous access and send 401 Unauthorized responses to unauthenticated requests:start the kubelet with the --anonymous-auth=false flagTo enable X509 client certificate authentication to the kubelet's HTTPS endpoint:start the kubelet with the --client-ca-file flag, providing a CA bundle to verify client certificates withstart the apiserver with --kubelet-client-certificate and --kubelet-client-key flagssee the apiserver authentication documentation for more detailsTo enable API bearer tokens (including service account tokens) to be used to authenticate to the kubelet's HTTPS endpoint:ensure the authentication.k8s.io/v1beta1 API group is enabled in the API serverstart the kubelet with the --authentication-token-webhook and --kubeconfig flagsthe kubelet calls the TokenReview API on the configured API server to determine user information from bearer tokensKubelet authorizationAny request that is successfully authenticated (including an anonymous request) is then authorized. The default authorization mode is AlwaysAllow, which allows all requests.There are many possible reasons to subdivide access to the kubelet API:anonymous auth is enabled, but anonymous users' ability to call the kubelet API should be limitedbearer token auth is enabled, but arbitrary API users' (like service accounts) ability to call the kubelet API should be limitedclient certificate auth is enabled, but only some of the client certificates signed by the configured CA should be allowed to use the kubelet APITo subdivide access to the kubelet API, delegate authorization to the API server:ensure the authorization.k8s.io/v1beta1 API group is enabled in the API serverstart the kubelet with the --authorization-mode=Webhook and the --kubeconfig flagsthe kubelet calls the SubjectAccessReview API on the configured API server to determine whether each request is authorizedThe kubelet authorizes API requests using the same request attributes approach as the apiserver.The verb is determined from the incoming request's HTTP verb:HTTP verbrequest verbPOSTcreateGET, HEADgetPUTupdatePATCHpatchDELETEdeleteThe resource and subresource is determined from the incoming request's path:Kubelet APIresourcesubresource/stats/*nodesstats/metrics/*nodesmetrics/logs/*nodeslog/spec/*nodesspec/checkpoint/*nodescheckpointall othersnodesproxyThe namespace and API group attributes are always an empty string, and the resource name is always the name of the kubelet's Node API object.When running in this mode, ensure the user identified by the --kubelet-client-certificate and --kubelet-client-key flags passed to the apiserver is authorized for the following attributes:verb=*, resource=nodes, subresource=proxyverb=*, resource=nodes, subresource=statsverb=*, resource=nodes, subresource=logverb=*, resource=nodes, subresource=specverb=*, resource=nodes, subresource=metricsFine-grained authorizationFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: true)When the feature gate KubeletFineGrainedAuthz is enabled kubelet performs a fine-grained check before falling back to the proxy subresource for the /pods, /runningPods, /configz and /healthz endpoints. The resource and subresource are determined from the incoming request's path:Kubelet APIresourcesubresource/stats/*nodesstats/metrics/*nodesmetrics/logs/*nodeslog/podsnodespods, proxy/runningPods/nodespods, proxy/healthznodeshealthz, proxy/configznodesconfigz,", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/kubelet-authn-authz/", "id": "k8s_00428"}
{"instruction": "What is the reference documentation for kubelet configuration (v1beta1)?", "response": "Kubelet Configuration (v1beta1)Resource TypesCredentialProviderConfigKubeletConfigurationSerializedNodeConfigSourceFormatOptionsAppears in:LoggingConfigurationFormatOptions contains options for the different logging formats.FieldDescriptiontext [Required]TextOptions[Alpha] Text contains options for logging format \"text\". Only available when the LoggingAlphaOptions feature gate is enabled.json [Required]JSONOptions[Alpha] JSON contains options for logging format \"json\". Only available when the LoggingAlphaOptions feature gate is enabled.JSONOptionsAppears in:FormatOptionsJSONOptions contains options for logging format \"json\".FieldDescriptionOutputRoutingOptions [Required]OutputRoutingOptions(Members of OutputRoutingOptions are embedded into this type.) No description provided.LogFormatFactoryLogFormatFactory provides support for a certain additional, non-default log format.LoggingConfigurationAppears in:KubeletConfigurationLoggingConfiguration contains logging options.FieldDescriptionformat [Required]stringFormat Flag specifies the structure of log messages. default value of format is textflushFrequency [Required]TimeOrMetaDurationMaximum time between log flushes. If a string, parsed as a duration (i.e. \"1s\") If an int, the maximum number of nanoseconds (i.e. 1s = 1000000000). Ignored if the selected logging backend writes log messages without buffering.verbosity [Required]VerbosityLevelVerbosity is the threshold that determines which log messages are logged. Default is zero which logs only the most important messages. Higher values enable additional messages. Error messages are always logged.vmodule [Required]VModuleConfigurationVModule overrides the verbosity threshold for individual files. Only supported for \"text\" log format.options [Required]FormatOptions[Alpha] Options holds additional parameters that are specific to the different logging formats. Only the options for the selected format get used, but all of them get validated. Only available when the LoggingAlphaOptions feature gate is enabled.LoggingOptionsLoggingOptions can be used with ValidateAndApplyWithOptions to override certain global defaults.FieldDescriptionErrorStream [Required]io.WriterErrorStream can be used to override the os.Stderr default.InfoStream [Required]io.WriterInfoStream can be used to override the os.Stdout default.OutputRoutingOptionsAppears in:JSONOptionsTextOptionsOutputRoutingOptions contains options that are supported by both \"text\" and \"json\".FieldDescriptionsplitStream [Required]bool[Alpha] SplitStream redirects error messages to stderr while info messages go to stdout, with buffering. The default is to write both to stdout, without buffering. Only available when the LoggingAlphaOptions feature gate is enabled.infoBufferSize [Required]k8s.io/apimachinery/pkg/api/resource.QuantityValue[Alpha] InfoBufferSize sets the size of the info stream when using split streams. The default is zero, which disables buffering. Only available when the LoggingAlphaOptions feature gate is enabled.TextOptionsAppears in:FormatOptionsTextOptions contains options for logging format \"text\".FieldDescriptionOutputRoutingOptions [Required]OutputRoutingOptions(Members of OutputRoutingOptions are embedded into this type.) No description provided.TimeOrMetaDurationAppears in:LoggingConfigurationTimeOrMetaDuration is present only for backwards compatibility for the flushFrequency field, and new fields should use metav1.Duration.FieldDescriptionDuration [Required]meta/v1.DurationDuration holds the duration- [Required]boolSerializeAsString controls whether the value is serialized as a string or an integerTracingConfigurationAppears in:KubeletConfigurationTracingConfiguration provides versioned configuration for OpenTelemetry tracing clients.FieldDescriptionendpointstringEndpoint of the collector this component will report traces to. The connection is insecure, and does not currently support TLS. Recommended is unset, and endpoint is the otlp grpc default, localhost:4317.sa", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/", "id": "k8s_00429"}
{"instruction": "What is the reference documentation for webhookadmission configuration (v1)?", "response": "WebhookAdmission Configuration (v1)Package v1 is the v1 version of the API.Resource TypesWebhookAdmissionWebhookAdmissionWebhookAdmission provides configuration for the webhook admission controller.FieldDescriptionapiVersionstringapiserver.config.k8s.io/v1kindstringWebhookAdmissionkubeConfigFile [Required]stringKubeConfigFile is the path to the kubeconfig file.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-webhookadmission.v1/", "id": "k8s_00430"}
{"instruction": "What is the reference documentation for kubelet configuration directory merging?", "response": "Kubelet Configuration Directory MergingWhen using the kubelet's --config-dir flag to specify a drop-in directory for configuration, there is some specific behavior on how different types are merged.Here are some examples of how different data types behave during configuration merging:Structure FieldsThere are two types of structure fields in a YAML structure: singular (or a scalar type) and embedded (structures that contain scalar types). The configuration merging process handles the overriding of singular and embedded struct fields to create a resulting kubelet configuration.For instance, you may want a baseline kubelet configuration for all nodes, but you may want to customize the address and authorization fields. This can be done as follows:Main kubelet configuration file contents:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration port: 20250 authorization: mode: Webhook webhook: cacheAuthorizedTTL: \"5m\" cacheUnauthorizedTTL: \"30s\" serializeImagePulls: false address: \"192.168.0.1\" Contents of a file in --config-dir directory:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration authorization: mode: AlwaysAllow webhook: cacheAuthorizedTTL: \"8m\" cacheUnauthorizedTTL: \"45s\" address: \"192.168.0.8\" The resulting configuration will be as follows:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration port: 20250 serializeImagePulls: false authorization: mode: AlwaysAllow webhook: cacheAuthorizedTTL: \"8m\" cacheUnauthorizedTTL: \"45s\" address: \"192.168.0.8\" ListsYou can override the slices/lists values of the kubelet configuration. However, the entire list gets overridden during the merging process. For example, you can override the clusterDNS list as follows:Main kubelet configuration file contents:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration port: 20250 serializeImagePulls: false clusterDNS: - \"192.168.0.9\" - \"192.168.0.8\" Contents of a file in --config-dir directory:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration clusterDNS: - \"192.168.0.2\" - \"192.168.0.3\" - \"192.168.0.5\" The resulting configuration will be as follows:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration port: 20250 serializeImagePulls: false clusterDNS: - \"192.168.0.2\" - \"192.168.0.3\" - \"192.168.0.5\" Maps, including Nested StructuresIndividual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden. However, for map[string][]string, the entire list associated with a specific field gets overridden. Let's understand this better with an example, particularly on fields like featureGates and staticPodURLHeader:Main kubelet configuration file contents:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration port: 20250 serializeImagePulls: false featureGates: AllAlpha: false MemoryQoS: true staticPodURLHeader: kubelet-api-support: - \"Authorization: 234APSDFA\" - \"X-Custom-Header: 123\" custom-static-pod: - \"Authorization: 223EWRWER\" - \"X-Custom-Header: 456\" Contents of a file in --config-dir directory:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration featureGates: MemoryQoS: false KubeletTracing: true DynamicResourceAllocation: true staticPodURLHeader: custom-static-pod: - \"Authorization: 223EWRWER\" - \"X-Custom-Header: 345\" The resulting configuration will be as follows:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration port: 20250 serializeImagePulls: false featureGates: AllAlpha: false MemoryQoS: false KubeletTracing: true DynamicResourceAllocation: true staticPodURLHeader: kubelet-api-support: - \"Authorization: 234APSDFA\" - \"X-Custom-Header: 123\" custom-static-pod: - \"Authorization: 223EWRWER\" - \"X-Custom-Header: 345\"", "category": "reference", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nauthorization:\n  mode: Webhook\n  webhook:\n    cacheAuthorizedTTL: \"5m\"\n    cacheUnauthorizedTTL: \"30s\"\nserializeImagePulls: false\naddress: \"192.168.0.1\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5534"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5535"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | You can override the slices/lists values of the kubelet configuration. However, the entire list gets overridden during the merging process. For example, you can override the clusterDNS list as follows", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5536"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.9\"\n  - \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5537"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5538"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\nKubelet Configuration Directory Merging | Individual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden. However, for map[string][]string, the entire list associated with a specific field ge", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5539"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 456\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5540"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5541"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\nKubelet Configuration Directory Merging |", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5542"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nauthorization:\n  mode: Webhook\n  webhook:\n    cacheAuthorizedTTL: \"5m\"\n    cacheUnauthorizedTTL: \"30s\"\nserializeImagePulls: false\naddress: \"192.168.0.1\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5543"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5544"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | You can override the slices/lists values of the kubelet configuration. However, the entire list gets overridden during the merging process. For example, you can override the clusterDNS list as follows", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5545"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.9\"\n  - \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5546"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5547"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\nKubelet Configuration Directory Merging | Individual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden. However, for map[string][]string, the entire list associated with a specific field ge", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5548"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 456\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5549"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5550"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\nKubelet Configuration Directory Merging |", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5551"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nauthorization:\n  mode: Webhook\n  webhook:\n    cacheAuthorizedTTL: \"5m\"\n    cacheUnauthorizedTTL: \"30s\"\nserializeImagePulls: false\naddress: \"192.168.0.1\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5552"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5553"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | You can override the slices/lists values of the kubelet configuration. However, the entire list gets overridden during the merging process. For example, you can override the clusterDNS list as follows", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5554"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.9\"\n  - \"192.168.0.8\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5555"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5556"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\nKubelet Configuration Directory Merging | Individual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden. However, for map[string][]string, the entire list associated with a specific field ge", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5557"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 456\"\n```\n\nKubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5558"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\nKubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5559"}
{"instruction": "Write a yaml example for kubelet configuration directory merging", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\nKubelet Configuration Directory Merging |", "category": "reference_code", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-config-directory-merging/", "id": "k8s_00431_code_5560"}
{"instruction": "What is the reference documentation for kubeadm configuration (v1beta4)?", "response": "kubeadm Configuration (v1beta4)OverviewPackage v1beta4 defines the v1beta4 version of the kubeadm configuration file format. This version improves on the v1beta3 format by fixing some minor issues and adding a few new fields.A list of changes since v1beta3:v1.33:Add an EtcdUpgrade field to UpgradeConfiguration.plan that can be used to control whether the etcd upgrade plan should be displayed.v1.31:Support custom environment variables in control plane components under ClusterConfiguration. Use apiServer.extraEnvs, controllerManager.extraEnvs, scheduler.extraEnvs, etcd.local.extraEnvs.The ResetConfiguration API type is now supported in v1beta4. Users are able to reset a node by passing a --config file to kubeadm reset.Dry run mode is now configureable in InitConfiguration and JoinConfigurationB.Replace the existing string/string extra argument maps with structured extra arguments that support duplicates. The change applies to ClusterConfiguration - apiServer.extraArgs, controllerManager.extraArgs, scheduler.extraArgs, etcd.local.extraArgs. Also to nodeRegistration.kubeletExtraArgs.Add ClusterConfiguration.encryptionAlgorithm that can be used to set the asymmetric encryption algorithm used for this cluster's keys and certificates. Can be one of \"RSA-2048\" (default), \"RSA-3072\", \"RSA-4096\" or \"ECDSA-P256\".Add ClusterConfiguration.dns.disabled and ClusterConfiguration.proxy.disabled that can be used to disable the CoreDNS and kube-proxy addons during cluster initialization. Skipping the related addons phases, during cluster creation will set the same fields to true.Add the nodeRegistration.imagePullSerial field in InitConfiguration and JoinConfiguration, which can be used to control if kubeadm pulls images serially or in parallel.The UpgradeConfiguration kubeadm API is now supported in v1beta4 when passing --config to kubeadm upgrade subcommands. Usage of component configuration for kubelet and kube-proxy, InitConfiguration and ClusterConfiguration is deprecated and will be ignored when passing --config to upgrade subcommands.Add a Timeouts structure to InitConfiguration, JoinConfiguration, ResetConfiguration and UpgradeConfiguration that can be used to configure various timeouts. The ClusterConfiguration.timeoutForControlPlane field is replaced by Timeouts.controlPlaneComponentHealthCheck. The JoinConfiguration.discovery.timeout is replaced by timeouts.Discovery.Add a certificateValidityPeriod and caCertificateValidityPeriod fields to ClusterConfiguration. These fields can be used to control the validity period of certificates generated by kubeadm during sub-commands such as init, join, upgrade and certs. Default values continue to be 1 year for non-CA certificates and 10 years for CA certificates. Only non-CA certificates continue to be renewable by kubeadm certs renew.Migration from old kubeadm config versionskubeadm v1.15.x and newer can be used to migrate from v1beta1 to v1beta2.kubeadm v1.22.x and newer no longer support v1beta1 and older APIs, but can be used to migrate v1beta2 to v1beta3.kubeadm v1.27.x and newer no longer support v1beta2 and older APIs.kubeadm v1.31.x and newer can be used to migrate from v1beta3 to v1beta4.BasicsThe preferred way to configure kubeadm is to pass a YAML configuration file with the --config option. Some of the configuration options defined in the kubeadm config file are also available as command line flags, but only the most common/simple use case are supported with this approach.A kubeadm config file could contain multiple configuration types separated using three dashes (---).kubeadm supports the following configuration types:apiVersion: kubeadm.k8s.io/v1beta4 kind: InitConfiguration apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration apiVersion: kubeadm.k8s.io/v1beta4 kind: JoinConfiguration apiVersion: kubeadm.k8s.io/v1beta4 kind: ResetC", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ResetConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: UpgradeConfiguration\n```\n\nMigration from old kubeadm config versions | To print the defaults for init and join actions use the following commands:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5562"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nbootstrapTokens:\n...\nnodeRegistration:\n...\n```\n\nMigration from old kubeadm config versions | The InitConfiguration type should be used to configure runtime settings, that in case of kubeadm init are the configuration of the bootstrap token and all the setting which are specific to the node wh", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5563"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  ...\netcd:\n  ...\napiServer:\n  extraArgs:\n    ...\n  extraVolumes:\n    ...\n...\n```\n\nMigration from old kubeadm config versions | The ClusterConfiguration type should be used to configure cluster-wide settings, including settings for:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5564"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n...\n```\n\nMigration from old kubeadm config versions | The KubeProxyConfiguration type should be used to change the configuration passed to kube-proxy instances deployed in the cluster. If this object is not provided or provided only partially, kubeadm ap", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5565"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\n```\n\nMigration from old kubeadm config versions | The KubeletConfiguration type should be used to change the configurations that will be passed to all kubelet instances deployed in the cluster. If this object is not provided or provided only partiall", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5566"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nbootstrapTokens:\n  - token: \"9a08jv.c0izixklcxtmnze7\"\n    description: \"kubeadm bootstrap token\"\n    ttl: \"24h\"\n  - token: \"783bde.3f89s0fje9f38fhf\"\n    description: \"another bootstrap token\"\n    usages:\n  - authentication\n  - signing\n    groups:\n  - system:bootstrappers:kubeadm:default-node-token\n\nnodeRegistration:\n  name: \"ec2-10-100-0-1\"\n  criSocket: \"unix:///var/run/containerd/containerd.sock\"\n  taints:\n    - key: \"kubeadmNode\"\n      value: \"someValue\"\n      effect: \"NoSchedule\"\n  kubeletExtraArgs:\n    - name: v\n      value: \"5\"\n  ignorePreflightErrors:\n    - IsPrivilegedUser\n  imagePullPolicy: \"IfNotPresent\"\n  imagePullSerial: true\n\nlocalAPIEndpoint:\n  advertiseAddress: \"10.100.0.1\"\n  bindPort: 6443\ncertificateKey: \"e6a2eb8581237ab72a4f494f30285ec12a9694d750b9785706a83bfcbbbd2204\"\nskipPhases:\n  - preflight\ntimeouts:\n  controlPlaneComponentHealthCheck: \"60s\"\n  kubenetesAPICall: \"40s\"\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\netcd:\n\n  # one of local or external\n  local:\n    imageRepository: \"registry.k8s.io\"\n    imageTag: \"3.2.24\"\n    dataDir: \"/var/lib/etcd\"\n    extraArgs:\n      - name: listen-client-urls\n        value: http://10.100.0.1:2379\n    extraEnvs:\n      - name: SOME_VAR\n        value: SOME_VALUE\n    serverCertSANs:\n      - ec2-10-100-0-1.compute-1.amazonaws.com\n    peerCertSANs:\n      - 10.100.0.1\n  # external:\n  #   endpoints:\n  #     - 10.100.0.1:2379\n  #     - 10.100.0.2:2379\n  #   caFile: \"/etcd/kubernetes/pki/etcd/etcd-ca.crt\"\n  #   certFile: \"/etcd/kubernetes/pki/etcd/etcd.crt\"\n  #   keyFile: \"/etcd/kubernetes/pki/etcd/etcd.key\"\n\nnetworking:\n  serviceSubnet: \"10.96.0.0/16\"\n  podSubnet: \"10.244.0.0/24\"\n  dnsDomain: \"cluster.local\"\nkubernetesVersion: \"v1.21.0\"\ncontrolPlaneEndpoint: \"10.100.0.1:6443\"\napiServer:\n  extraArgs:\n    - name: authorization-mode\n      value: Node,RBAC\n  extraEnvs:\n    - name: SOME_VAR\n      value: SOME_VALUE\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n  certSANs:\n    - \"10.100.1.1\"\n    - \"ec2-10-100-0-1.compute-1.amazonaws.com\"\n\ncontrollerManager:\n  extraArgs:\n    - name: node-cidr-mask-size\n      value: \"20\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n\nscheduler:\n  extraArgs:\n    - name: address\n      value: 10.100.0.1\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n\ncertificatesDir: \"/etc/kubernetes/pki\"\nimageRepository: \"registry.k8s.io\"\nclusterName: \"example-cluster\"\nencryptionAlgorithm: ECDSA-P256\ndns:\n  disabled: true  # disable CoreDNS\nproxy:\n  disabled: true   # disable kube-proxy\n\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n# kubelet specific options here\n---\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n# kube-proxy specific options here\n```\n\nMigration from old kubeadm config versions | When executing kubeadm join with the --config option, the JoinConfiguration type should be provided.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5567"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: some-address:6443\n    token: abcdef.0123456789abcdef\n    unsafeSkipCAVerification: true\n  tlsBootstrapToken: abcdef.0123456789abcdef\n```\n\nMigration from old kubeadm config versions | The JoinConfiguration type should be used to configure runtime settings, that in case of kubeadm join are the discovery method used for accessing the cluster info and all the setting which are specifi", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5568"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ResetConfiguration\n...\n```\n\nMigration from old kubeadm config versions | When executing kubeadm upgrade with the --config option, the UpgradeConfiguration type should be provided.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5569"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta4)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: UpgradeConfiguration\napply:\n  ...\ndiff:\n  ...\nnode:\n  ...\nplan:\n  ...\n```\n\nMigration from old kubeadm config versions | The UpgradeConfiguration structure includes a few substructures that only apply to different subcommands of kubeadm upgrade. For example, the apply substructure will be used with the kubeadm upgrade a", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/", "id": "k8s_00432_code_5570"}
{"instruction": "How do you set up konnectivity service in Kubernetes?", "response": "Set up Konnectivity serviceThe Konnectivity service provides a TCP level proxy for the control plane to cluster communication.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube.Configure the Konnectivity serviceThe following steps require an egress configuration, for example:admin/konnectivity/egress-selector-configuration.yaml apiVersion: apiserver.k8s.io/v1beta1 kind: EgressSelectorConfiguration egressSelections: # Since we want to control the egress traffic to the cluster, we use the # \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\". - name: cluster connection: # This controls the protocol between the API Server and the Konnectivity # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no # end user visible difference between the two modes. You need to set the # Konnectivity server to work in the same mode. proxyProtocol: GRPC transport: # This controls what transport the API Server uses to communicate with the # Konnectivity server. UDS is recommended if the Konnectivity server # locates on the same machine as the API Server. You need to configure the # Konnectivity server to listen on the same UDS socket. # The other supported transport is \"tcp\". You will need to set up TLS # config to secure the TCP transport. uds: udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:Make sure that Service Account Token Volume Projection feature enabled in your cluster. It is enabled by default since Kubernetes v1.20.Create an egress configuration file such as admin/konnectivity/egress-selector-configuration.yaml.Set the --egress-selector-config-file flag of the API Server to the path of your API Server egress configuration file.If you use UDS connection, add volumes config to the kube-apiserver:spec: containers: volumeMounts: - name: konnectivity-uds mountPath: /etc/kubernetes/konnectivity-server readOnly: false volumes: - name: konnectivity-uds hostPath: path: /etc/kubernetes/konnectivity-server type: DirectoryOrCreate Generate or obtain a certificate and kubeconfig for konnectivity-server. For example, you can use the OpenSSL command line tool to issue a X.509 certificate, using the cluster CA certificate /etc/kubernetes/pki/ca.crt from a control-plane host.openssl req -subj \"/CN=system:konnectivity-server\" -new -newkey rsa:2048 -nodes -out konnectivity.csr -keyout konnectivity.key openssl x509 -req -in konnectivity.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out konnectivity.crt -days 375 -sha256 SERVER=$(kubectl config view -o jsonpath='{.clusters..server}') kubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-credentials system:konnectivity-server --client-certificate konnectivity.crt --client-key konnectivity.key --embed-certs=true kubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-cluster kubernetes --server \"$SERVER\" --certificate-authority /etc/kubernetes/pki/ca.crt --embed-certs=true kubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-context system:konnectivity-server@kubernetes --cluster kubernetes --user system:konnectivity-server kubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config use-context system:konnectivity-server@kubernetes rm -f konnectivity.crt konnectivity.key konnectivity.csr Next, you need to deploy the Konnectivity server and agents. kubernetes-sigs/apiserver-network-proxy is a reference implementation.Deploy the Konnectivity server on your control plane node. The provided konnectivity-server.yaml manifest assumes that the Kubernetes", "category": "tasks", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\nSet up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5572"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\nSet up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5573"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\nSet up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5574"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\nSet up Konnectivity service |", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5575"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\nSet up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5576"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    volumeMounts:\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\nSet up Konnectivity service | Generate or obtain a certificate and kubeconfig for konnectivity-server. For example, you can use the OpenSSL command line tool to issue a X.509 certificate, using the cluster CA certificate /etc/kube", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5577"}
{"instruction": "Write a bash example for set up konnectivity service", "response": "Here's a bash example:\n\n```bash\nopenssl req -subj \"/CN=system:konnectivity-server\" -new -newkey rsa:2048 -nodes -out konnectivity.csr -keyout konnectivity.key\nopenssl x509 -req -in konnectivity.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out konnectivity.crt -days 375 -sha256\nSERVER=$(kubectl config view -o jsonpath='{.clusters..server}')\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-credentials system:konnectivity-server --client-certificate konnectivity.crt --client-key konnectivity.key --embed-certs=true\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-cluster kubernetes --server \"$SERVER\" --certificate-authority /etc/kubernetes/pki/ca.crt --embed-certs=true\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-context system:konnectivity-server@kubernetes --cluster kubernetes --user system:konnectivity-server\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config use-context system:konnectivity-server@kubernetes\nrm -f konnectivity.crt konnectivity.key konnectivity.csr\n```\n\nSet up Konnectivity service | Next, you need to deploy the Konnectivity server and agents. kubernetes-sigs/apiserver-network-proxy is a reference implementation.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5578"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\nSet up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5579"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\nSet up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5580"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\nSet up Konnectivity service |", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5581"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/egress-selector-configuration.yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\nSet up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5582"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\nSet up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5583"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/konnectivity-server.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\nSet up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5584"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\nSet up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5585"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/konnectivity-agent.yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\nSet up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5586"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\nSet up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5587"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/konnectivity-rbac.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\nSet up Konnectivity service |", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5588"}
{"instruction": "Write a yaml example for set up konnectivity service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\nSet up Konnectivity service |", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/", "id": "k8s_00433_code_5589"}
{"instruction": "What is the reference documentation for kubectl rollout history?", "response": "kubectl rollout historySynopsisView previous rollout revisions and configurations.kubectl rollout history (TYPE NAME | TYPE/NAME) [flags] Examples # View the rollout history of a deployment kubectl rollout history deployment/abc # View the details of daemonset revision 3 kubectl rollout history daemonset/abc --revision=3 Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for history-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--revision intSee the details, including podTemplate of the revision specified-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table s", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_history/", "id": "k8s_00434"}
{"instruction": "Write a bash example for kubectl rollout history", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history (TYPE NAME | TYPE/NAME) [flags]\n```\n\nkubectl rollout history | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_history/", "id": "k8s_00434_code_5591"}
{"instruction": "Write a bash example for kubectl rollout history", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history (TYPE NAME | TYPE/NAME) [flags]\n```\n\nkubectl rollout history | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_history/", "id": "k8s_00434_code_5592"}
{"instruction": "Explain generating reference pages for kubernetes components and tools in Kubernetes", "response": "Generating Reference Pages for Kubernetes Components and ToolsThis page shows how to build the Kubernetes component and tool reference pages.Before you beginStart with the Prerequisites section in the Reference Documentation Quickstart guide.Follow the Reference Documentation Quickstart to generate the Kubernetes component and tool reference pages.What's nextGenerating Reference Documentation QuickstartGenerating Reference Documentation for kubectl CommandsGenerating Reference Documentation for the Kubernetes APIContributing to the Upstream Kubernetes Project for Documentation", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/kubernetes-components/", "id": "k8s_00435"}
{"instruction": "How do you limit storage consumption in Kubernetes?", "response": "Limit Storage ConsumptionThis example demonstrates how to limit the amount of storage consumed in a namespace.The following resources are used in the demonstration: ResourceQuota, LimitRange, and PersistentVolumeClaim.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Scenario: Limiting Storage ConsumptionThe cluster-admin is operating a cluster on behalf of a user population and the admin wants to control how much storage a single namespace can consume in order to control cost.The admin would like to limit:The number of persistent volume claims in a namespaceThe amount of storage each claim can requestThe amount of cumulative storage the namespace can haveLimitRange to limit requests for storageAdding a LimitRange to a namespace enforces storage request sizes to a minimum and maximum. Storage is requested via PersistentVolumeClaim. The admission controller that enforces limit ranges will reject any PVC that is above or below the values set by the admin.In this example, a PVC requesting 10Gi of storage would be rejected because it exceeds the 2Gi max.apiVersion: v1 kind: LimitRange metadata: name: storagelimits spec: limits: - type: PersistentVolumeClaim max: storage: 2Gi min: storage: 1Gi Minimum storage requests are used when the underlying storage provider requires certain minimums. For example, AWS EBS volumes have a 1Gi minimum requirement.ResourceQuota to limit PVC count and cumulative storage capacityAdmins can limit the number of PVCs in a namespace as well as the cumulative capacity of those PVCs. New PVCs that exceed either maximum value will be rejected.In this example, a 6th PVC in the namespace would be rejected because it exceeds the maximum count of 5. Alternatively, a 5Gi maximum quota when combined with the 2Gi max limit above, cannot have 3 PVCs where each has 2Gi. That would be 6Gi requested for a namespace capped at 5Gi.apiVersion: v1 kind: ResourceQuota metadata: name: storagequota spec: hard: persistentvolumeclaims: \"5\" requests.storage: \"5Gi\" SummaryA limit range can put a ceiling on how much storage is requested while a resource quota can effectively cap the storage consumed by a namespace through claim counts and cumulative storage capacity. The allows a cluster-admin to plan their cluster's storage budget without risk of any one project going over their allotment.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/limit-storage-consumption/", "id": "k8s_00436"}
{"instruction": "Write a yaml example for limit storage consumption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: storagelimits\nspec:\n  limits:\n  - type: PersistentVolumeClaim\n    max:\n      storage: 2Gi\n    min:\n      storage: 1Gi\n```\n\nLimit Storage Consumption | Minimum storage requests are used when the underlying storage provider requires certain minimums. For example, AWS EBS volumes have a 1Gi minimum requirement.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/limit-storage-consumption/", "id": "k8s_00436_code_5595"}
{"instruction": "Write a yaml example for limit storage consumption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: storagequota\nspec:\n  hard:\n    persistentvolumeclaims: \"5\"\n    requests.storage: \"5Gi\"\n```\n\nLimit Storage Consumption | A limit range can put a ceiling on how much storage is requested while a resource quota can effectively cap the storage consumed by a namespace through claim counts and cumulative storage capacity. Th", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/limit-storage-consumption/", "id": "k8s_00436_code_5596"}
{"instruction": "Write a yaml example for limit storage consumption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: storagelimits\nspec:\n  limits:\n  - type: PersistentVolumeClaim\n    max:\n      storage: 2Gi\n    min:\n      storage: 1Gi\n```\n\nLimit Storage Consumption | Minimum storage requests are used when the underlying storage provider requires certain minimums. For example, AWS EBS volumes have a 1Gi minimum requirement.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/limit-storage-consumption/", "id": "k8s_00436_code_5597"}
{"instruction": "Write a yaml example for limit storage consumption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: storagequota\nspec:\n  hard:\n    persistentvolumeclaims: \"5\"\n    requests.storage: \"5Gi\"\n```\n\nLimit Storage Consumption | A limit range can put a ceiling on how much storage is requested while a resource quota can effectively cap the storage consumed by a namespace through claim counts and cumulative storage capacity. Th", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/limit-storage-consumption/", "id": "k8s_00436_code_5598"}
{"instruction": "Write a yaml example for limit storage consumption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: storagelimits\nspec:\n  limits:\n  - type: PersistentVolumeClaim\n    max:\n      storage: 2Gi\n    min:\n      storage: 1Gi\n```\n\nLimit Storage Consumption | Minimum storage requests are used when the underlying storage provider requires certain minimums. For example, AWS EBS volumes have a 1Gi minimum requirement.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/limit-storage-consumption/", "id": "k8s_00436_code_5599"}
{"instruction": "Write a yaml example for limit storage consumption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: storagequota\nspec:\n  hard:\n    persistentvolumeclaims: \"5\"\n    requests.storage: \"5Gi\"\n```\n\nLimit Storage Consumption | A limit range can put a ceiling on how much storage is requested while a resource quota can effectively cap the storage consumed by a namespace through claim counts and cumulative storage capacity. Th", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/limit-storage-consumption/", "id": "k8s_00436_code_5600"}
{"instruction": "What is the reference documentation for kubectl events?", "response": "kubectl eventsSynopsisDisplay events.Prints a table of the most important information about events. You can request events for a namespace, for all namespace, or filtered to only those pertaining to a specified resource.kubectl events [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file] [--for TYPE/NAME] [--watch] [--types=Normal,Warning] Examples # List recent events in the default namespace kubectl events # List recent events in all namespaces kubectl events --all-namespaces # List recent events for the specified pod, then wait for more events and list them as they arrive kubectl events --for pod/web-pod-13je7 --watch # List recent events in YAML format kubectl events -oyaml # List recent only events of type 'Warning' or 'Normal' kubectl events --types=Warning,Normal Options-A, --all-namespacesIf present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--chunk-size int Default: 500Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future.--for stringFilter events to only those pertaining to the specified resource.-h, --helphelp for events--no-headersWhen using the default output format, don't print headers.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--types stringsOutput only events of given types.-w, --watchAfter listing the requested events, watch for more events.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-durati", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_events/", "id": "k8s_00437"}
{"instruction": "Write a bash example for kubectl events", "response": "Here's a bash example:\n\n```bash\nkubectl events [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file] [--for TYPE/NAME] [--watch] [--types=Normal,Warning]\n```\n\nkubectl events | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_events/", "id": "k8s_00437_code_5602"}
{"instruction": "Write a bash example for kubectl events", "response": "Here's a bash example:\n\n```bash\nkubectl events [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file] [--for TYPE/NAME] [--watch] [--types=Normal,Warning]\n```\n\nkubectl events | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_events/", "id": "k8s_00437_code_5603"}
{"instruction": "How do you find out what container runtime is used on a node in Kubernetes?", "response": "Find Out What Container Runtime is Used on a NodeThis page outlines steps to find out what container runtime the nodes in your cluster use.Depending on the way you run your cluster, the container runtime for the nodes may have been pre-configured or you need to configure it. If you're using a managed Kubernetes service, there might be vendor-specific ways to check what container runtime is configured for the nodes. The method described on this page should work whenever the execution of kubectl is allowed.Before you beginInstall and configure kubectl. See Install Tools section for details.Find out the container runtime used on a NodeUse kubectl to fetch and show node information:kubectl get nodes -o wide The output is similar to the following. The column CONTAINER-RUNTIME outputs the runtime and its version.For Docker Engine, the output is similar to this:NAME STATUS VERSION CONTAINER-RUNTIME node-1 Ready v1.16.15 docker://19.3.1 node-2 Ready v1.16.15 docker://19.3.1 node-3 Ready v1.16.15 docker://19.3.1 If your runtime shows as Docker Engine, you still might not be affected by the removal of dockershim in Kubernetes v1.24. Check the runtime endpoint to see if you use dockershim. If you don't use dockershim, you aren't affected.For containerd, the output is similar to this:NAME STATUS VERSION CONTAINER-RUNTIME node-1 Ready v1.19.6 containerd://1.4.1 node-2 Ready v1.19.6 containerd://1.4.1 node-3 Ready v1.19.6 containerd://1.4.1 Find out more information about container runtimes on Container Runtimes page.Find out what container runtime endpoint you useThe container runtime talks to the kubelet over a Unix socket using the CRI protocol, which is based on the gRPC framework. The kubelet acts as a client, and the runtime acts as the server. In some cases, you might find it useful to know which socket your nodes use. For example, with the removal of dockershim in Kubernetes v1.24 and later, you might want to know whether you use Docker Engine with dockershim.Note:If you currently use Docker Engine in your nodes with cri-dockerd, you aren't affected by the dockershim removal.You can check which socket you use by checking the kubelet configuration on your nodes.Read the starting commands for the kubelet process:tr \\\\0 ' ' < /proc/\"$(pgrep kubelet)\"/cmdline If you don't have tr or pgrep, check the command line for the kubelet process manually.In the output, look for the --container-runtime flag and the --container-runtime-endpoint flag.If your nodes use Kubernetes v1.23 and earlier and these flags aren't present or if the --container-runtime flag is not remote, you use the dockershim socket with Docker Engine. The --container-runtime command line argument is not available in Kubernetes v1.27 and later.If the --container-runtime-endpoint flag is present, check the socket name to find out which runtime you use. For example, unix:///run/containerd/containerd.sock is the containerd endpoint.If you want to change the Container Runtime on a Node from Docker Engine to containerd, you can find out more information on migrating from Docker Engine to containerd, or, if you want to continue using Docker Engine in Kubernetes v1.24 and later, migrate to a CRI-compatible adapter like cri-dockerd.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/find-out-runtime-you-use/", "id": "k8s_00438"}
{"instruction": "Write a bash example for find out what container runtime is used on a node", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o wide\n```\n\nFind Out What Container Runtime is Used on a Node | The output is similar to the following. The column CONTAINER-RUNTIME outputs the runtime and its version.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/find-out-runtime-you-use/", "id": "k8s_00438_code_5605"}
{"instruction": "Write a bash example for find out what container runtime is used on a node", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o wide\n```\n\nFind Out What Container Runtime is Used on a Node | The output is similar to the following. The column CONTAINER-RUNTIME outputs the runtime and its version.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/find-out-runtime-you-use/", "id": "k8s_00438_code_5606"}
{"instruction": "Explain the Kubernetes concept: Service ClusterIP allocation", "response": "Service ClusterIP allocationIn Kubernetes, Services are an abstract way to expose an application running on a set of Pods. Services can have a cluster-scoped virtual IP address (using a Service of type: ClusterIP). Clients can connect using that virtual IP address, and Kubernetes then load-balances traffic to that Service across the different backing Pods.How Service ClusterIPs are allocated?When Kubernetes needs to assign a virtual IP address for a Service, that assignment happens one of two ways:dynamicallythe cluster's control plane automatically picks a free IP address from within the configured IP range for type: ClusterIP Services.staticallyyou specify an IP address of your choice, from within the configured IP range for Services.Across your whole cluster, every Service ClusterIP must be unique. Trying to create a Service with a specific ClusterIP that has already been allocated will return an error.Why do you need to reserve Service Cluster IPs?Sometimes you may want to have Services running in well-known IP addresses, so other components and users in the cluster can use them.The best example is the DNS Service for the cluster. As a soft convention, some Kubernetes installers assign the 10th IP address from the Service IP range to the DNS service. Assuming you configured your cluster with Service IP range 10.96.0.0/16 and you want your DNS Service IP to be 10.96.0.10, you'd have to create a Service like this:apiVersion: v1 kind: Service metadata: labels: k8s-app: kube-dns kubernetes.io/cluster-service: \"true\" kubernetes.io/name: CoreDNS name: kube-dns namespace: kube-system spec: clusterIP: 10.96.0.10 ports: - name: dns port: 53 protocol: UDP targetPort: 53 - name: dns-tcp port: 53 protocol: TCP targetPort: 53 selector: k8s-app: kube-dns type: ClusterIP But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this IP. Hence, you will not be able to create the DNS Service because it will fail with a conflict error.How can you avoid Service ClusterIP conflicts?The allocation strategy implemented in Kubernetes to allocate ClusterIPs to Services reduces the risk of collision.The ClusterIP range is divided, based on the formula min(max(16, cidrSize / 16), 256), described as never less than 16 or more than 256 with a graduated step between them.Dynamic IP assignment uses the upper band by default, once this has been exhausted it will use the lower range. This will allow users to use static allocations on the lower band with a low risk of collision.ExamplesExample 1This example uses the IP address range: 10.96.0.0/24 (CIDR notation) for the IP addresses of Services.Range Size: 28 - 2 = 254Band Offset: min(max(16, 256/16), 256) = min(16, 256) = 16Static band start: 10.96.0.1Static band end: 10.96.0.16Range end: 10.96.0.254pie showData title 10.96.0.0/24 \"Static\" : 16 \"Dynamic\" : 238JavaScript must be enabled to view this contentExample 2This example uses the IP address range: 10.96.0.0/20 (CIDR notation) for the IP addresses of Services.Range Size: 212 - 2 = 4094Band Offset: min(max(16, 4096/16), 256) = min(256, 256) = 256Static band start: 10.96.0.1Static band end: 10.96.1.0Range end: 10.96.15.254pie showData title 10.96.0.0/20 \"Static\" : 256 \"Dynamic\" : 3838JavaScript must be enabled to view this contentExample 3This example uses the IP address range: 10.96.0.0/16 (CIDR notation) for the IP addresses of Services.Range Size: 216 - 2 = 65534Band Offset: min(max(16, 65536/16), 256) = min(4096, 256) = 256Static band start: 10.96.0.1Static band ends: 10.96.1.0Range end: 10.96.255.254pie showData title 10.96.0.0/16 \"Static\" : 256 \"Dynamic\" : 65278JavaScript must be enabled to view this contentWhat's nextRead about Service External Traffic PolicyRead about Connecting Applications with ServicesRead about Services", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/cluster-ip-allocation/", "id": "k8s_00439"}
{"instruction": "Write a yaml example for service clusterip allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\nService ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/cluster-ip-allocation/", "id": "k8s_00439_code_5608"}
{"instruction": "Write a yaml example for service clusterip allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\nService ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/cluster-ip-allocation/", "id": "k8s_00439_code_5609"}
{"instruction": "Write a yaml example for service clusterip allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\nService ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/cluster-ip-allocation/", "id": "k8s_00439_code_5610"}
{"instruction": "Explain the Kubernetes concept: Kubernetes Scheduler", "response": "Kubernetes SchedulerIn Kubernetes, scheduling refers to making sure that Pods are matched to Nodes so that Kubelet can run them.Scheduling overviewA scheduler watches for newly created Pods that have no Node assigned. For every Pod that the scheduler discovers, the scheduler becomes responsible for finding the best Node for that Pod to run on. The scheduler reaches this placement decision taking into account the scheduling principles described below.If you want to understand why Pods are placed onto a particular Node, or if you're planning to implement a custom scheduler yourself, this page will help you learn about scheduling.kube-schedulerkube-scheduler is the default scheduler for Kubernetes and runs as part of the control plane. kube-scheduler is designed so that, if you want and need to, you can write your own scheduling component and use that instead.Kube-scheduler selects an optimal node to run newly created or not yet scheduled (unscheduled) pods. Since containers in pods - and pods themselves - can have different requirements, the scheduler filters out any nodes that don't meet a Pod's specific scheduling needs. Alternatively, the API lets you specify a node for a Pod when you create it, but this is unusual and is only done in special cases.In a cluster, Nodes that meet the scheduling requirements for a Pod are called feasible nodes. If none of the nodes are suitable, the pod remains unscheduled until the scheduler is able to place it.The scheduler finds feasible Nodes for a Pod and then runs a set of functions to score the feasible Nodes and picks a Node with the highest score among the feasible ones to run the Pod. The scheduler then notifies the API server about this decision in a process called binding.Factors that need to be taken into account for scheduling decisions include individual and collective resource requirements, hardware / software / policy constraints, affinity and anti-affinity specifications, data locality, inter-workload interference, and so on.Node selection in kube-schedulerkube-scheduler selects a node for the pod in a 2-step operation:FilteringScoringThe filtering step finds the set of Nodes where it's feasible to schedule the Pod. For example, the PodFitsResources filter checks whether a candidate Node has enough available resources to meet a Pod's specific resource requests. After this step, the node list contains any suitable Nodes; often, there will be more than one. If the list is empty, that Pod isn't (yet) schedulable.In the scoring step, the scheduler ranks the remaining nodes to choose the most suitable Pod placement. The scheduler assigns a score to each Node that survived filtering, basing this score on the active scoring rules.Finally, kube-scheduler assigns the Pod to the Node with the highest ranking. If there is more than one node with equal scores, kube-scheduler selects one of these at random.There are two supported ways to configure the filtering and scoring behavior of the scheduler:Scheduling Policies allow you to configure Predicates for filtering and Priorities for scoring.Scheduling Profiles allow you to configure Plugins that implement different scheduling stages, including: QueueSort, Filter, Score, Bind, Reserve, Permit, and others. You can also configure the kube-scheduler to run different profiles.What's nextRead about scheduler performance tuningRead about Pod topology spread constraintsRead the reference documentation for kube-schedulerRead the kube-scheduler config (v1) referenceLearn about configuring multiple schedulersLearn about topology management policiesLearn about Pod OverheadLearn about scheduling of Pods that use volumes in:Volume Topology SupportStorage Capacity TrackingNode-specific Volume Limits", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/", "id": "k8s_00440"}
{"instruction": "How do you get a shell to a running container in Kubernetes?", "response": "Get a Shell to a Running ContainerThis page shows how to use kubectl exec to get a shell to a running container.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesGetting a shell to a containerIn this exercise, you create a Pod that has one container. The container runs the nginx image. Here is the configuration file for the Pod:application/shell-demo.yaml apiVersion: v1 kind: Pod metadata: name: shell-demo spec: volumes: - name: shared-data emptyDir: {} containers: - name: nginx image: nginx volumeMounts: - name: shared-data mountPath: /usr/share/nginx/html hostNetwork: true dnsPolicy: Default Create the Pod:kubectl apply -f https://k8s.io/examples/application/shell-demo.yaml Verify that the container is running:kubectl get pod shell-demo Get a shell to the running container:kubectl exec --stdin --tty shell-demo -- /bin/bash Note:The double dash (--) separates the arguments you want to pass to the command from the kubectl arguments.In your shell, list the root directory:# Run this inside the container ls / In your shell, experiment with other commands. Here are some examples:# You can run these example commands inside the container ls / cat /proc/mounts cat /proc/1/maps apt-get update apt-get install -y tcpdump tcpdump apt-get install -y lsof lsof apt-get install -y procps ps aux ps aux | grep nginx Writing the root page for nginxLook again at the configuration file for your Pod. The Pod has an emptyDir volume, and the container mounts the volume at /usr/share/nginx/html.In your shell, create an index.html file in the /usr/share/nginx/html directory:# Run this inside the container echo 'Hello shell demo' > /usr/share/nginx/html/index.html In your shell, send a GET request to the nginx server:# Run this in the shell inside your container apt-get update apt-get install curl curl http://localhost/ The output shows the text that you wrote to the index.html file:Hello shell demo When you are finished with your shell, enter exit.exit # To quit the shell in the container Running individual commands in a containerIn an ordinary command window, not your shell, list the environment variables in the running container:kubectl exec shell-demo -- env Experiment with running other commands. Here are some examples:kubectl exec shell-demo -- ps aux kubectl exec shell-demo -- ls / kubectl exec shell-demo -- cat /proc/1/mounts Opening a shell when a Pod has more than one containerIf a Pod has more than one container, use --container or -c to specify a container in the kubectl exec command. For example, suppose you have a Pod named my-pod, and the Pod has two containers named main-app and helper-app. The following command would open a shell to the main-app container.kubectl exec -i -t my-pod --container main-app -- /bin/bash Note:The short options -i and -t are the same as the long options --stdin and --ttyWhat's nextRead about kubectl exec", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441"}
{"instruction": "Write a yaml example for get a shell to a running container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\nGet a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5613"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/shell-demo.yaml\n```\n\nGet a Shell to a Running Container | Verify that the container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5614"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod shell-demo\n```\n\nGet a Shell to a Running Container | Get a shell to the running container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5615"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec --stdin --tty shell-demo -- /bin/bash\n```\n\nGet a Shell to a Running Container | In your shell, list the root directory:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5616"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- env\n```\n\nGet a Shell to a Running Container | Experiment with running other commands. Here are some examples:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5617"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- ps aux\nkubectl exec shell-demo -- ls /\nkubectl exec shell-demo -- cat /proc/1/mounts\n```\n\nGet a Shell to a Running Container | If a Pod has more than one container, use --container or -c to specify a container in the kubectl exec command. For example, suppose you have a Pod named my-pod, and the Pod has two containers named m", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5618"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t my-pod --container main-app -- /bin/bash\n```\n\nGet a Shell to a Running Container |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5619"}
{"instruction": "Write a yaml example for get a shell to a running container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\nGet a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5620"}
{"instruction": "Write a yaml example for get a shell to a running container", "response": "Here's a yaml example:\n\n```yaml\napplication/shell-demo.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\nGet a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5621"}
{"instruction": "Write a yaml example for get a shell to a running container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\nGet a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5622"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/shell-demo.yaml\n```\n\nGet a Shell to a Running Container | Verify that the container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5623"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod shell-demo\n```\n\nGet a Shell to a Running Container | Get a shell to the running container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5624"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec --stdin --tty shell-demo -- /bin/bash\n```\n\nGet a Shell to a Running Container | In your shell, list the root directory:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5625"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- env\n```\n\nGet a Shell to a Running Container | Experiment with running other commands. Here are some examples:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5626"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- ps aux\nkubectl exec shell-demo -- ls /\nkubectl exec shell-demo -- cat /proc/1/mounts\n```\n\nGet a Shell to a Running Container | If a Pod has more than one container, use --container or -c to specify a container in the kubectl exec command. For example, suppose you have a Pod named my-pod, and the Pod has two containers named m", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5627"}
{"instruction": "Write a bash example for get a shell to a running container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t my-pod --container main-app -- /bin/bash\n```\n\nGet a Shell to a Running Container |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/", "id": "k8s_00441_code_5628"}
{"instruction": "What is the reference documentation for listmeta?", "response": "ListMetaListMeta describes metadata that synthetic resources must have, including lists and various status objects.import \"k8s.io/apimachinery/pkg/apis/meta/v1\"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.continue (string)continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.remainingItemCount (int64)remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is estimating the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.resourceVersion (string)String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistencyselfLink (string)Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/list-meta/", "id": "k8s_00442"}
{"instruction": "What is the reference documentation for configuration apis?", "response": "Configuration APIsClient Authentication (v1)Client Authentication (v1beta1)Event Rate Limit Configuration (v1alpha1)Image Policy API (v1alpha1)kube-apiserver Admission (v1)kube-apiserver Audit Configuration (v1)kube-apiserver Configuration (v1)kube-apiserver Configuration (v1alpha1)kube-apiserver Configuration (v1beta1)kube-controller-manager Configuration (v1alpha1)kube-proxy Configuration (v1alpha1)kube-scheduler Configuration (v1)kubeadm Configuration (v1beta3)kubeadm Configuration (v1beta4)kubeconfig (v1)Kubelet Configuration (v1)Kubelet Configuration (v1alpha1)Kubelet Configuration (v1beta1)Kubelet CredentialProvider (v1)kuberc (v1alpha1)WebhookAdmission Configuration (v1)", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/", "id": "k8s_00443"}
{"instruction": "What is the reference documentation for kubectl set selector?", "response": "kubectl set selectorSynopsisSet the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.A selector must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters. If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used. Note: currently selectors can only be set on Service objects.kubectl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version] Examples # Set the labels and selector before creating a deployment/service pair kubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f - kubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f - Options--allSelect all resources in the namespace of the specified resource types--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-set\"Name of the manager used to track field ownership.-f, --filename stringsidentifying the resource.-h, --helphelp for selector--localIf true, annotation will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursive Default: trueProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--resource-version stringIf non-empty, the selectors update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goro", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_selector/", "id": "k8s_00444"}
{"instruction": "Write a bash example for kubectl set selector", "response": "Here's a bash example:\n\n```bash\nkubectl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]\n```\n\nkubectl set selector | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_selector/", "id": "k8s_00444_code_5632"}
{"instruction": "Write a bash example for kubectl set selector", "response": "Here's a bash example:\n\n```bash\nkubectl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]\n```\n\nkubectl set selector | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_selector/", "id": "k8s_00444_code_5633"}
{"instruction": "What is the reference documentation for kubernetes issue tracker?", "response": "Kubernetes Issue TrackerTo report a security issue, please follow the Kubernetes security disclosure process.Work on Kubernetes code and public issues are tracked using GitHub Issues.Official list of known CVEs (security vulnerabilities) that have been announced by the Security Response CommitteeCVE-related GitHub issuesSecurity-related announcements are sent to the kubernetes-security-announce@googlegroups.com mailing list.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/issues-security/issues/", "id": "k8s_00445"}
{"instruction": "Provide a tutorial on example: deploying php guestbook application with redis", "response": "Example: Deploying PHP Guestbook application with RedisThis tutorial shows you how to build and deploy a simple (not production ready), multi-tier web application using Kubernetes and Docker. This example consists of the following components:A single-instance Redis to store guestbook entriesMultiple web frontend instancesObjectivesStart up a Redis leader.Start up two Redis followers.Start up the guestbook frontend.Expose and view the Frontend Service.Clean up.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.14.To check the version, enter kubectl version.Start up the Redis DatabaseThe guestbook application uses Redis to store its data.Creating the Redis DeploymentThe manifest file, included below, specifies a Deployment controller that runs a single replica Redis Pod.application/guestbook/redis-leader-deployment.yaml # SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook apiVersion: apps/v1 kind: Deployment metadata: name: redis-leader labels: app: redis role: leader tier: backend spec: replicas: 1 selector: matchLabels: app: redis template: metadata: labels: app: redis role: leader tier: backend spec: containers: - name: leader image: \"docker.io/redis:6.0.5\" resources: requests: cpu: 100m memory: 100Mi ports: - containerPort: 6379Launch a terminal window in the directory you downloaded the manifest files.Apply the Redis Deployment from the redis-leader-deployment.yaml file:kubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-deployment.yaml Query the list of Pods to verify that the Redis Pod is running:kubectl get pods The response should be similar to this:NAME READY STATUS RESTARTS AGE redis-leader-fb76b4755-xjr2n 1/1 Running 0 13s Run the following command to view the logs from the Redis leader Pod:kubectl logs -f deployment/redis-leader Creating the Redis leader ServiceThe guestbook application needs to communicate to the Redis to write its data. You need to apply a Service to proxy the traffic to the Redis Pod. A Service defines a policy to access the Pods.application/guestbook/redis-leader-service.yaml # SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook apiVersion: v1 kind: Service metadata: name: redis-leader labels: app: redis role: leader tier: backend spec: ports: - port: 6379 targetPort: 6379 selector: app: redis role: leader tier: backendApply the Redis Service from the following redis-leader-service.yaml file:kubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-service.yaml Query the list of Services to verify that the Redis Service is running:kubectl get service The response should be similar to this:NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 1m redis-leader ClusterIP 10.103.78.24 <none> 6379/TCP 16s Note:This manifest file creates a Service named redis-leader with a set of labels that match the labels previously defined, so the Service routes network traffic to the Redis Pod.Set up Redis followersAlthough the Redis leader is a single Pod, you can make it highly available and meet traffic demands by adding a few Redis followers, or replicas.application/guestbook/redis-follower-deployment.yaml # SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook apiVersion: apps/v1 kind: Deployment metadata: name: redis-follower labels: app: redis role: follower tier: backend spec: replicas: 2 selector: matchLabels: app: redis template: metadata: labels: app: redis role: follower tier: backend spec: containers: - name: followe", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5636"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-deployment.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the Redis Pod is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5637"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f deployment/redis-leader\n```\n\nExample: Deploying PHP Guestbook application with Redis | The guestbook application needs to communicate to the Redis to write its data. You need to apply a Service to proxy the traffic to the Redis Pod. A Service defines a policy to access the Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5638"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5639"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-service.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5640"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5641"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-deployment.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Verify that the two Redis follower replicas are running by querying the list of Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5642"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5643"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-service.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5644"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5645"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-deployment.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the three frontend replicas are running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5646"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=guestbook -l tier=frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5647"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5648"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-service.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the frontend Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5649"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward svc/frontend 8080:80\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5650"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5651"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=5\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5652"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=2\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5653"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment -l app=redis\nkubectl delete service -l app=redis\nkubectl delete deployment frontend\nkubectl delete service frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should look similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5654"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5655"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5656"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5657"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5658"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5659"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5660"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-leader-deployment.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5661"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5662"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-deployment.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the Redis Pod is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5663"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f deployment/redis-leader\n```\n\nExample: Deploying PHP Guestbook application with Redis | The guestbook application needs to communicate to the Redis to write its data. You need to apply a Service to proxy the traffic to the Redis Pod. A Service defines a policy to access the Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5664"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-leader-service.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5665"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5666"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-service.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5667"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-follower-deployment.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5668"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5669"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-deployment.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Verify that the two Redis follower replicas are running by querying the list of Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5670"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-follower-service.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5671"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5672"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-service.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5673"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/frontend-deployment.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5674"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5675"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-deployment.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the three frontend replicas are running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5676"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=guestbook -l tier=frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5677"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/frontend-service.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5678"}
{"instruction": "Write a yaml example for example: deploying php guestbook application with redis", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5679"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-service.yaml\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the frontend Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5680"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward svc/frontend 8080:80\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5681"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5682"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=5\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5683"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=2\n```\n\nExample: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5684"}
{"instruction": "Write a bash example for example: deploying php guestbook application with redis", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment -l app=redis\nkubectl delete service -l app=redis\nkubectl delete deployment frontend\nkubectl delete service frontend\n```\n\nExample: Deploying PHP Guestbook application with Redis | The response should look similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/guestbook/", "id": "k8s_00446_code_5685"}
{"instruction": "What is the reference documentation for kubelet checkpoint api?", "response": "Kubelet Checkpoint APIFEATURE STATE: Kubernetes v1.30 [beta] (enabled by default: true)Checkpointing a container is the functionality to create a stateful copy of a running container. Once you have a stateful copy of a container, you could move it to a different computer for debugging or similar purposes.If you move the checkpointed container data to a computer that's able to restore it, that restored container continues to run at exactly the same point it was checkpointed. You can also inspect the saved data, provided that you have suitable tools for doing so.Creating a checkpoint of a container might have security implications. Typically a checkpoint contains all memory pages of all processes in the checkpointed container. This means that everything that used to be in memory is now available on the local disk. This includes all private data and possibly keys used for encryption. The underlying CRI implementations (the container runtime on that node) should create the checkpoint archive to be only accessible by the root user. It is still important to remember if the checkpoint archive is transferred to another system all memory pages will be readable by the owner of the checkpoint archive.Operationspost checkpoint the specified containerTell the kubelet to checkpoint a specific container from the specified Pod.Consult the Kubelet authentication/authorization reference for more information about how access to the kubelet checkpoint interface is controlled.The kubelet will request a checkpoint from the underlying CRI implementation. In the checkpoint request the kubelet will specify the name of the checkpoint archive as checkpoint-<podFullName>-<containerName>-<timestamp>.tar and also request to store the checkpoint archive in the checkpoints directory below its root directory (as defined by --root-dir). This defaults to /var/lib/kubelet/checkpoints.The checkpoint archive is in tar format, and could be listed using an implementation of tar. The contents of the archive depend on the underlying CRI implementation (the container runtime on that node).HTTP RequestPOST /checkpoint/{namespace}/{pod}/{container}Parametersnamespace (in path): string, requiredNamespacepod (in path): string, requiredPodcontainer (in path): string, requiredContainertimeout (in query): integerTimeout in seconds to wait until the checkpoint creation is finished. If zero or no timeout is specified the default CRI timeout value will be used. Checkpoint creation time depends directly on the used memory of the container. The more memory a container uses the more time is required to create the corresponding checkpoint.Response200: OK401: Unauthorized404: Not Found (if the ContainerCheckpoint feature gate is disabled)404: Not Found (if the specified namespace, pod or container cannot be found)500: Internal Server Error (if the CRI implementation encounter an error during checkpointing (see error message for further details))500: Internal Server Error (if the CRI implementation does not implement the checkpoint CRI API (see error message for further details))", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/node/kubelet-checkpoint-api/", "id": "k8s_00447"}
{"instruction": "What is the reference documentation for kubectl plugin list?", "response": "kubectl plugin listSynopsisList all available plugin files on a user's PATH. To see plugins binary names without the full path use --name-only flag.Available plugin files are those that are: - executable - anywhere on the user's PATH - begin with \"kubectl-\"kubectl plugin list [flags] Examples # List all available plugins kubectl plugin list # List only binary names of available plugins without paths kubectl plugin list --name-only Options-h, --helphelp for list--name-onlyIf true, display only the binary name of each plugin, rather than its full pathParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl plugin - Provides utilities for interacting with pluginsThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_plugin/kubectl_plugin_list/", "id": "k8s_00448"}
{"instruction": "Write a bash example for kubectl plugin list", "response": "Here's a bash example:\n\n```bash\nkubectl plugin list [flags]\n```\n\nkubectl plugin list | help for list", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_plugin/kubectl_plugin_list/", "id": "k8s_00448_code_5688"}
{"instruction": "Write a bash example for kubectl plugin list", "response": "Here's a bash example:\n\n```bash\nkubectl plugin list [flags]\n```\n\nkubectl plugin list | help for list", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_plugin/kubectl_plugin_list/", "id": "k8s_00448_code_5689"}
{"instruction": "Explain installing kubernetes with deployment tools in Kubernetes", "response": "Installing Kubernetes with deployment toolsThere are many methods and tools for setting up your own production Kubernetes cluster. For example:kubeadmCluster API: A Kubernetes sub-project focused on providing declarative APIs and tooling to simplify provisioning, upgrading, and operating multiple Kubernetes clusters.kops: An automated cluster provisioning tool. For tutorials, best practices, configuration options and information on reaching out to the community, please check the kOps website for details.kubespray: A composition of Ansible playbooks, inventory, provisioning tools, and domain knowledge for generic OS/Kubernetes clusters configuration management tasks. You can reach out to the community on Slack channel #kubespray.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/", "id": "k8s_00449"}
{"instruction": "Explain the Kubernetes concept: Networking on Windows", "response": "Networking on WindowsKubernetes supports running nodes on either Linux or Windows. You can mix both kinds of node within a single cluster. This page provides an overview to networking specific to the Windows operating system.Container networking on WindowsNetworking for Windows containers is exposed through CNI plugins. Windows containers function similarly to virtual machines in regards to networking. Each container has a virtual network adapter (vNIC) which is connected to a Hyper-V virtual switch (vSwitch). The Host Networking Service (HNS) and the Host Compute Service (HCS) work together to create containers and attach container vNICs to networks. HCS is responsible for the management of containers whereas HNS is responsible for the management of networking resources such as:Virtual networks (including creation of vSwitches)Endpoints / vNICsNamespacesPolicies including packet encapsulations, load-balancing rules, ACLs, and NAT rules.The Windows HNS and vSwitch implement namespacing and can create virtual NICs as needed for a pod or container. However, many configurations such as DNS, routes, and metrics are stored in the Windows registry database rather than as files inside /etc, which is how Linux stores those configurations. The Windows registry for the container is separate from that of the host, so concepts like mapping /etc/resolv.conf from the host into a container don't have the same effect they would on Linux. These must be configured using Windows APIs run in the context of that container. Therefore CNI implementations need to call the HNS instead of relying on file mappings to pass network details into the pod or container.Network modesWindows supports five different networking drivers/modes: L2bridge, L2tunnel, Overlay (Beta), Transparent, and NAT. In a heterogeneous cluster with Windows and Linux worker nodes, you need to select a networking solution that is compatible on both Windows and Linux. The following table lists the out-of-tree plugins are supported on Windows, with recommendations on when to use each CNI:Network DriverDescriptionContainer Packet ModificationsNetwork PluginsNetwork Plugin CharacteristicsL2bridgeContainers are attached to an external vSwitch. Containers are attached to the underlay network, although the physical network doesn't need to learn the container MACs because they are rewritten on ingress/egress.MAC is rewritten to host MAC, IP may be rewritten to host IP using HNS OutboundNAT policy.win-bridge, Azure-CNI, Flannel host-gateway uses win-bridgewin-bridge uses L2bridge network mode, connects containers to the underlay of hosts, offering best performance. Requires user-defined routes (UDR) for inter-node connectivity.L2TunnelThis is a special case of l2bridge, but only used on Azure. All packets are sent to the virtualization host where SDN policy is applied.MAC rewritten, IP visible on the underlay networkAzure-CNIAzure-CNI allows integration of containers with Azure vNET, and allows them to leverage the set of capabilities that Azure Virtual Network provides. For example, securely connect to Azure services or use Azure NSGs. See azure-cni for some examplesOverlayContainers are given a vNIC connected to an external vSwitch. Each overlay network gets its own IP subnet, defined by a custom IP prefix.The overlay network driver uses VXLAN encapsulation.Encapsulated with an outer header.win-overlay, Flannel VXLAN (uses win-overlay)win-overlay should be used when virtual container networks are desired to be isolated from underlay of hosts (e.g. for security reasons). Allows for IPs to be re-used for different overlay networks (which have different VNID tags) if you are restricted on IPs in your datacenter. This option requires KB4489899 on Windows Server 2019.Transparent (special use case for ovn-kubernetes)Requires an external vSwitch. Containers are attached to an external vSwitch which enables intra-pod communication via logical networks (logical switches and routers).Packet is encap", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/windows-networking/", "id": "k8s_00450"}
{"instruction": "What is the reference documentation for kubectl set?", "response": "kubectl setSynopsisConfigure application resources.These commands help you make changes to existing application resources.kubectl set SUBCOMMAND Options-h, --helphelp for setParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerkubectl set env - Update environment variables on a pod templatekubectl set image - Update the image of a pod templatekubectl set resources - Update resource requests/limits on objects with pod templateskubectl set selector - Set the selector on a resourcekubectl set serviceaccount - Update the service account of a resourcekubectl set subject - Update the user, group, or service account in a role binding or cluster role bindingThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/", "id": "k8s_00451"}
{"instruction": "Write a bash example for kubectl set", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND\n```\n\nkubectl set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/", "id": "k8s_00451_code_5693"}
{"instruction": "Write a bash example for kubectl set", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND\n```\n\nkubectl set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/", "id": "k8s_00451_code_5694"}
{"instruction": "How do you utilizing the numa-aware memory manager in Kubernetes?", "response": "Utilizing the NUMA-aware Memory ManagerFEATURE STATE: Kubernetes v1.32 [stable] (enabled by default: true)The Kubernetes Memory Manager enables the feature of guaranteed memory (and hugepages) allocation for pods in the Guaranteed QoS class.The Memory Manager employs hint generation protocol to yield the most suitable NUMA affinity for a pod. The Memory Manager feeds the central manager (Topology Manager) with these affinity hints. Based on both the hints and Topology Manager policy, the pod is rejected or admitted to the node.Moreover, the Memory Manager ensures that the memory which a pod requests is allocated from a minimum number of NUMA nodes.The Memory Manager is only pertinent to Linux based hosts.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.32.To check the version, enter kubectl version.To align memory resources with other requested resources in a Pod spec:the CPU Manager should be enabled and proper CPU Manager policy should be configured on a Node. See control CPU Management Policies;the Topology Manager should be enabled and proper Topology Manager policy should be configured on a Node. See control Topology Management Policies.Starting from v1.22, the Memory Manager is enabled by default through MemoryManager feature gate.Preceding v1.22, the kubelet must be started with the following flag:--feature-gates=MemoryManager=truein order to enable the Memory Manager feature.How does the Memory Manager Operate?The Memory Manager currently offers the guaranteed memory (and hugepages) allocation for Pods in Guaranteed QoS class. To immediately put the Memory Manager into operation follow the guidelines in the section Memory Manager configuration, and subsequently, prepare and deploy a Guaranteed pod as illustrated in the section Placing a Pod in the Guaranteed QoS class.The Memory Manager is a Hint Provider, and it provides topology hints for the Topology Manager which then aligns the requested resources according to these topology hints. On Linux, it also enforces cgroups (i.e. cpuset.mems) for pods. The complete flow diagram concerning pod admission and deployment process is illustrated in Memory Manager KEP: Design Overview and below:During this process, the Memory Manager updates its internal counters stored in Node Map and Memory Maps to manage guaranteed memory allocation.The Memory Manager updates the Node Map during the startup and runtime as follows.StartupThis occurs once a node administrator employs --reserved-memory (section Reserved memory flag). In this case, the Node Map becomes updated to reflect this reservation as illustrated in Memory Manager KEP: Memory Maps at start-up (with examples).The administrator must provide --reserved-memory flag when Static policy is configured.RuntimeReference Memory Manager KEP: Memory Maps at runtime (with examples) illustrates how a successful pod deployment affects the Node Map, and it also relates to how potential Out-of-Memory (OOM) situations are handled further by Kubernetes or operating system.Important topic in the context of Memory Manager operation is the management of NUMA groups. Each time pod's memory request is in excess of single NUMA node capacity, the Memory Manager attempts to create a group that comprises several NUMA nodes and features extend memory capacity. The problem has been solved as elaborated in Memory Manager KEP: How to enable the guaranteed memory allocation over many NUMA nodes?. Also, reference Memory Manager KEP: Simulation - how the Memory Manager works? (by examples) illustrates how the managemen", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/", "id": "k8s_00452"}
{"instruction": "Write a yaml example for utilizing the numa-aware memory manager", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: guaranteed\nspec:\n  containers:\n  - name: guaranteed\n    image: consumer\n    imagePullPolicy: Never\n    resources:\n      limits:\n        cpu: \"2\"\n        memory: 150Gi\n      requests:\n        cpu: \"2\"\n        memory: 150Gi\n    command: [\"sleep\",\"infinity\"]\n```\n\nUtilizing the NUMA-aware Memory Manager | Next, let us log into the node where it was deployed and examine the state file in /var/lib/kubelet/memory_manager_state:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/", "id": "k8s_00452_code_5696"}
{"instruction": "Write a yaml example for utilizing the numa-aware memory manager", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n```\n\nUtilizing the NUMA-aware Memory Manager | Also, a pod sharing CPU(s) runs in the Guaranteed QoS class, when requests are equal to limits.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/", "id": "k8s_00452_code_5697"}
{"instruction": "Write a yaml example for utilizing the numa-aware memory manager", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n```\n\nUtilizing the NUMA-aware Memory Manager | Notice that both CPU and memory requests must be specified for a Pod to lend it to Guaranteed QoS class.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/", "id": "k8s_00452_code_5698"}
{"instruction": "Write a bash example for utilizing the numa-aware memory manager", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <id>\n```\n\nUtilizing the NUMA-aware Memory Manager | Search system logs with respect to a particular pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/", "id": "k8s_00452_code_5699"}
{"instruction": "Write a yaml example for utilizing the numa-aware memory manager", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: guaranteed\nspec:\n  containers:\n  - name: guaranteed\n    image: consumer\n    imagePullPolicy: Never\n    resources:\n      limits:\n        cpu: \"2\"\n        memory: 150Gi\n      requests:\n        cpu: \"2\"\n        memory: 150Gi\n    command: [\"sleep\",\"infinity\"]\n```\n\nUtilizing the NUMA-aware Memory Manager | Next, let us log into the node where it was deployed and examine the state file in /var/lib/kubelet/memory_manager_state:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/", "id": "k8s_00452_code_5700"}
{"instruction": "Write a yaml example for utilizing the numa-aware memory manager", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: guaranteed\nspec:\n  containers:\n  - name: guaranteed\n    image: consumer\n    imagePullPolicy: Never\n    resources:\n      limits:\n        cpu: \"2\"\n        memory: 150Gi\n      requests:\n        cpu: \"2\"\n        memory: 150Gi\n    command: [\"sleep\",\"infinity\"]\n```\n\nUtilizing the NUMA-aware Memory Manager | Next, let us log into the node where it was deployed and examine the state file in /var/lib/kubelet/memory_manager_state:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/", "id": "k8s_00452_code_5701"}
{"instruction": "What is the reference documentation for selfsubjectaccessreview?", "response": "SelfSubjectAccessReviewSelfSubjectAccessReview checks whether or the current user can perform an action.apiVersion: authorization.k8s.io/v1import \"k8s.io/api/authorization/v1\"SelfSubjectAccessReviewSelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an actionapiVersion: authorization.k8s.io/v1kind: SelfSubjectAccessReviewmetadata (ObjectMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (SelfSubjectAccessReviewSpec), requiredSpec holds information about the request being evaluated. user and groups must be emptystatus (SubjectAccessReviewStatus)Status is filled in by the server and indicates whether the request is allowed or notSelfSubjectAccessReviewSpecSelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be setnonResourceAttributes (NonResourceAttributes)NonResourceAttributes describes information for a non-resource access requestNonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interfacenonResourceAttributes.path (string)Path is the URL path of the requestnonResourceAttributes.verb (string)Verb is the standard HTTP verbresourceAttributes (ResourceAttributes)ResourceAuthorizationAttributes describes information for a resource access requestResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interfaceresourceAttributes.fieldSelector (FieldSelectorAttributes)fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it.*FieldSelectorAttributes indicates a field limited access. Webhook authors are encouraged to * ensure rawSelector and requirements are not both set * consider the requirements field if set * not try to parse or consider the rawSelector field if set. This is to avoid another CVE-2022-2880 (i.e. getting different systems to agree on how exactly to parse a query is not something we want), see https://www.oxeye.io/resources/golang-parameter-smuggling-attack for more details. For the SubjectAccessReview endpoints of the kube-apiserver: * If rawSelector is empty and requirements are empty, the request is not limited. * If rawSelector is present and requirements are empty, the rawSelector will be parsed and limited if the parsing succeeds. * If rawSelector is empty and requirements are present, the requirements should be honored * If rawSelector is present and requirements are present, the request is invalid.resourceAttributes.fieldSelector.rawSelector (string)rawSelector is the serialization of a field selector that would be included in a query parameter. Webhook implementations are encouraged to ignore rawSelector. The kube-apiserver's *SubjectAccessReview will parse the rawSelector as long as the requirements are not present.resourceAttributes.fieldSelector.requirements ([]FieldSelectorRequirement)Atomic: will be replaced during a mergerequirements is the parsed interpretation of a field selector. All requirements must be met for a resource instance to match the selector. Webhook implementations should handle requirements, but how to handle them is up to the webhook. Since requirements can only limit the request, it is safe to authorize as unlimited request if the requirements are not understood.FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.resourceAttributes.fieldSelector.requirements.key (string), requiredkey is the field selector key that the requirement applies to.resourceAttributes.fieldSelector.requirements.operator (string), requiredoperator represents a key's relationship to a set of values. Valid operators are I", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/self-subject-access-review-v1/", "id": "k8s_00453"}
{"instruction": "Write a yaml example for selfsubjectaccessreview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\nSelfSubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/self-subject-access-review-v1/", "id": "k8s_00453_code_5703"}
{"instruction": "How do you versions in customresourcedefinitions in Kubernetes?", "response": "Versions in CustomResourceDefinitionsThis page explains how to add versioning information to CustomResourceDefinitions, to indicate the stability level of your CustomResourceDefinitions or advance your API to a new version with conversion between API representations. It also describes how to upgrade an object from one version to another.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou should have an initial understanding of custom resources.Your Kubernetes server must be at or later than version v1.16.To check the version, enter kubectl version.OverviewThe CustomResourceDefinition API provides a workflow for introducing and upgrading to new versions of a CustomResourceDefinition.When a CustomResourceDefinition is created, the first version is set in the CustomResourceDefinition spec.versions list to an appropriate stability level and a version number. For example v1beta1 would indicate that the first version is not yet stable. All custom resource objects will initially be stored at this version.Once the CustomResourceDefinition is created, clients may begin using the v1beta1 API.Later it might be necessary to add new version such as v1.Adding a new version:Pick a conversion strategy. Since custom resource objects need the ability to be served at both versions, that means they will sometimes be served in a different version than the one stored. To make this possible, the custom resource objects must sometimes be converted between the version they are stored at and the version they are served at. If the conversion involves schema changes and requires custom logic, a conversion webhook should be used. If there are no schema changes, the default None conversion strategy may be used and only the apiVersion field will be modified when serving different versions.If using conversion webhooks, create and deploy the conversion webhook. See the Webhook conversion for more details.Update the CustomResourceDefinition to include the new version in the spec.versions list with served:true. Also, set spec.conversion field to the selected conversion strategy. If using a conversion webhook, configure spec.conversion.webhookClientConfig field to call the webhook.Once the new version is added, clients may incrementally migrate to the new version. It is perfectly safe for some clients to use the old version while others use the new version.Migrate stored objects to the new version:See the upgrade existing objects to a new stored version section.It is safe for clients to use both the old and new version before, during and after upgrading the objects to a new stored version.Removing an old version:Ensure all clients are fully migrated to the new version. The kube-apiserver logs can be reviewed to help identify any clients that are still accessing via the old version.Set served to false for the old version in the spec.versions list. If any clients are still unexpectedly using the old version they may begin reporting errors attempting to access the custom resource objects at the old version. If this occurs, switch back to using served:true on the old version, migrate the remaining clients to the new version and repeat this step.Ensure the upgrade of existing objects to the new stored version step has been completed.Verify that the storage is set to true for the new version in the spec.versions list in the CustomResourceDefinition.Verify that the old version is no longer listed in the CustomResourceDefinition status.storedVersions.Remove the old version from the CustomResourceDefinition spec.versions list.Drop conversion support for the old version in conversion webh", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # A schema is required\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5705"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n  - name: v1\n    served: true\n    storage: false\n  validation:\n    openAPIV3Schema:\n      type: object\n      properties:\n        host:\n          type: string\n        port:\n          type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the PascalCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to create it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5706"}
{"instruction": "Write a bash example for versions in customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab.yaml\n```\n\nVersions in CustomResourceDefinitions | After creation, the API server starts to serve each enabled version at an HTTP REST endpoint. In the above example, the API versions are available at /apis/example.com/v1beta1 and /apis/example.com/v1", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5707"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n    \n    schema: ...\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n    schema: ...\n  - name: v1\n    served: true\n    storage: true\n    schema: ...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: crontabs.example.com spec: group: example.com na", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5708"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  validation: ...\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n  - name: v1\n    served: true\n    storage: true\n```\n\nVersions in CustomResourceDefinitions | An older API version cannot be dropped from a CustomResourceDefinition manifest until existing stored data has been migrated to the newer API version for all clusters that served the older version of", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5709"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1beta1\n    # This indicates the v1beta1 version of the custom resource is no longer served.\n    # API requests to this version receive a not found error in the server response.\n    served: false\n    schema: ...\n  - name: v1\n    served: true\n    # The new served version should be set as the storage version\n    storage: true\n    schema: ...\n```\n\nVersions in CustomResourceDefinitions | The above example has a None conversion between versions which only sets the apiVersion field on conversion and does not change the rest of the object. The API server also supports webhook conversions", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5710"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhook is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhook:\n      # conversionReviewVersions indicates what ConversionReview versions are understood/preferred by the webhook.\n      # The first version in the list understood by the API server is sent to the webhook.\n      # The webhook must respond with a ConversionReview object in the same version it received.\n      conversionReviewVersions: [\"v1\",\"v1beta1\"]\n      clientConfig:\n        service:\n          namespace: default\n          name: example-conversion-webhook-server\n          path: /crdconvert\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5711"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # prunes object fields that are not specified in OpenAPI schemas below.\n  preserveUnknownFields: false\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhookClientConfig is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhookClientConfig:\n      service:\n        namespace: default\n        name: example-conversion-webhook-server\n        path: /crdconvert\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to apply it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5712"}
{"instruction": "Write a bash example for versions in customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab-with-conversion.yaml\n```\n\nVersions in CustomResourceDefinitions | Make sure the conversion service is up and running before applying new changes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5713"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5714"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\nVersions in CustomResourceDefinitions | The service stanza inside webhookClientConfig is a reference to the service for a conversion webhook. If the webhook is running within the cluster, then you should use service instead of url. The serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5715"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        service:\n          namespace: my-service-namespace\n          name: my-service-name\n          path: /my-path\n          port: 1234\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5716"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      service:\n        namespace: my-service-namespace\n        name: my-service-name\n        path: /my-path\n        port: 1234\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nVersions in CustomResourceDefinitions | Webhooks are sent a POST request, with Content-Type: application/json, with a ConversionReview API object in the apiextensions.k8s.io API group serialized to JSON as the body.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5717"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      conversionReviewVersions: [\"v1\", \"v1beta1\"]\n      ...\n```\n\nVersions in CustomResourceDefinitions | conversionReviewVersions is a required field when creating apiextensions.k8s.io/v1 custom resource definitions. Webhooks are required to support at least one ConversionReview version understood by the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5718"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    conversionReviewVersions: [\"v1\", \"v1beta1\"]\n    ...\n```\n\nVersions in CustomResourceDefinitions | If no conversionReviewVersions are specified, the default when creating apiextensions.k8s.io/v1beta1 custom resource definitions is v1beta1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5719"}
{"instruction": "Write a bash example for versions in customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl patch customresourcedefinitions <CRD_Name> --subresource='status' --type='merge' -p '{\"status\":{\"storedVersions\":[\"v1\"]}}'\n```\n\nVersions in CustomResourceDefinitions |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5720"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # A schema is required\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5721"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n  - name: v1\n    served: true\n    storage: false\n  validation:\n    openAPIV3Schema:\n      type: object\n      properties:\n        host:\n          type: string\n        port:\n          type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the PascalCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to create it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5722"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n    \n    schema: ...\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n    schema: ...\n  - name: v1\n    served: true\n    storage: true\n    schema: ...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: crontabs.example.com spec: group: example.com na", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5723"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  validation: ...\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n  - name: v1\n    served: true\n    storage: true\n```\n\nVersions in CustomResourceDefinitions | An older API version cannot be dropped from a CustomResourceDefinition manifest until existing stored data has been migrated to the newer API version for all clusters that served the older version of", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5724"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1beta1\n    # This indicates the v1beta1 version of the custom resource is no longer served.\n    # API requests to this version receive a not found error in the server response.\n    served: false\n    schema: ...\n  - name: v1\n    served: true\n    # The new served version should be set as the storage version\n    storage: true\n    schema: ...\n```\n\nVersions in CustomResourceDefinitions | The above example has a None conversion between versions which only sets the apiVersion field on conversion and does not change the rest of the object. The API server also supports webhook conversions", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5725"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhook is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhook:\n      # conversionReviewVersions indicates what ConversionReview versions are understood/preferred by the webhook.\n      # The first version in the list understood by the API server is sent to the webhook.\n      # The webhook must respond with a ConversionReview object in the same version it received.\n      conversionReviewVersions: [\"v1\",\"v1beta1\"]\n      clientConfig:\n        service:\n          namespace: default\n          name: example-conversion-webhook-server\n          path: /crdconvert\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5726"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # prunes object fields that are not specified in OpenAPI schemas below.\n  preserveUnknownFields: false\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhookClientConfig is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhookClientConfig:\n      service:\n        namespace: default\n        name: example-conversion-webhook-server\n        path: /crdconvert\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to apply it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5727"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5728"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\nVersions in CustomResourceDefinitions | The service stanza inside webhookClientConfig is a reference to the service for a conversion webhook. If the webhook is running within the cluster, then you should use service instead of url. The serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5729"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        service:\n          namespace: my-service-namespace\n          name: my-service-name\n          path: /my-path\n          port: 1234\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5730"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      service:\n        namespace: my-service-namespace\n        name: my-service-name\n        path: /my-path\n        port: 1234\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nVersions in CustomResourceDefinitions | Webhooks are sent a POST request, with Content-Type: application/json, with a ConversionReview API object in the apiextensions.k8s.io API group serialized to JSON as the body.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5731"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      conversionReviewVersions: [\"v1\", \"v1beta1\"]\n      ...\n```\n\nVersions in CustomResourceDefinitions | conversionReviewVersions is a required field when creating apiextensions.k8s.io/v1 custom resource definitions. Webhooks are required to support at least one ConversionReview version understood by the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5732"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    conversionReviewVersions: [\"v1\", \"v1beta1\"]\n    ...\n```\n\nVersions in CustomResourceDefinitions | If no conversionReviewVersions are specified, the default when creating apiextensions.k8s.io/v1beta1 custom resource definitions is v1beta1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5733"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"apiextensions.k8s.io/v1\",\n  \"kind\": \"ConversionReview\",\n  \"request\": {\n    # Random uid uniquely identifying this conversion call\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \n    # The API group and version the objects should be converted to\n    \"desiredAPIVersion\": \"example.com/v1\",\n    \n    # The list of objects to convert.\n    # May contain one or more objects, in one or more versions.\n    \"objects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"hostPort\": \"localhost:1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"hostPort\": \"example.com:2345\"\n      }\n    ]\n  }\n}\n```\n\nVersions in CustomResourceDefinitions | { # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 \"apiVersion\": \"apiextensions.k8s.io/v1beta1\", \"kind\": \"ConversionReview\", \"request\": { # Random uid uniquely identifying this co", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5734"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n{\n  # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\n  \"apiVersion\": \"apiextensions.k8s.io/v1beta1\",\n  \"kind\": \"ConversionReview\",\n  \"request\": {\n    # Random uid uniquely identifying this conversion call\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \n    # The API group and version the objects should be converted to\n    \"desiredAPIVersion\": \"example.com/v1\",\n    \n    # The list of objects to convert.\n    # May contain one or more objects, in one or more versions.\n    \"objects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"hostPort\": \"localhost:1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"hostPort\": \"example.com:2345\"\n      }\n    ]\n  }\n}\n```\n\nVersions in CustomResourceDefinitions | Webhooks respond with a 200 HTTP status code, Content-Type: application/json, and a body containing a ConversionReview object (in the same version they were sent), with the response stanza populated,", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5735"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"apiextensions.k8s.io/v1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    # must match <request.uid>\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \"result\": {\n      \"status\": \"Success\"\n    },\n    # Objects must match the order of request.objects, and have apiVersion set to <request.desiredAPIVersion>.\n    # kind, metadata.uid, metadata.name, and metadata.namespace fields must not be changed by the webhook.\n    # metadata.labels and metadata.annotations fields may be changed by the webhook.\n    # All other changes to metadata fields by the webhook are ignored.\n    \"convertedObjects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"host\": \"localhost\",\n        \"port\": \"1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"host\": \"example.com\",\n        \"port\": \"2345\"\n      }\n    ]\n  }\n}\n```\n\nVersions in CustomResourceDefinitions | { # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 \"apiVersion\": \"apiextensions.k8s.io/v1beta1\", \"kind\": \"ConversionReview\", \"response\": { # must match <request.uid> \"uid\": \"7", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5736"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n{\n  # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\n  \"apiVersion\": \"apiextensions.k8s.io/v1beta1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    # must match <request.uid>\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \"result\": {\n      \"status\": \"Failed\"\n    },\n    # Objects must match the order of request.objects, and have apiVersion set to <request.desiredAPIVersion>.\n    # kind, metadata.uid, metadata.name, and metadata.namespace fields must not be changed by the webhook.\n    # metadata.labels and metadata.annotations fields may be changed by the webhook.\n    # All other changes to metadata fields by the webhook are ignored.\n    \"convertedObjects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"host\": \"localhost\",\n        \"port\": \"1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"host\": \"example.com\",\n        \"port\": \"2345\"\n      }\n    ]\n  }\n}\n```\n\nVersions in CustomResourceDefinitions | If conversion fails, a webhook should return a response stanza containing the following fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5737"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"apiextensions.k8s.io/v1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    \"uid\": \"<value from request.uid>\",\n    \"result\": {\n      \"status\": \"Failed\",\n      \"message\": \"hostPort could not be parsed into a separate host and port\"\n    }\n  }\n}\n```\n\nVersions in CustomResourceDefinitions | { # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 \"apiVersion\": \"apiextensions.k8s.io/v1beta1\", \"kind\": \"ConversionReview\", \"response\": { \"uid\": \"<value from request.uid>\", \"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5738"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n{\n  # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\n  \"apiVersion\": \"apiextensions.k8s.io/v1beta1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    \"uid\": \"<value from request.uid>\",\n    \"result\": {\n      \"status\": \"Failed\",\n      \"message\": \"hostPort could not be parsed into a separate host and port\"\n    }\n  }\n}\n```\n\nVersions in CustomResourceDefinitions | When an object is written, it is stored at the version designated as the storage version at the time of the write. If the storage version changes, existing objects are never converted automatically. H", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5739"}
{"instruction": "Write a bash example for versions in customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl patch customresourcedefinitions <CRD_Name> --subresource='status' --type='merge' -p '{\"status\":{\"storedVersions\":[\"v1\"]}}'\n```\n\nVersions in CustomResourceDefinitions |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5740"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # A schema is required\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5741"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n  - name: v1\n    served: true\n    storage: false\n  validation:\n    openAPIV3Schema:\n      type: object\n      properties:\n        host:\n          type: string\n        port:\n          type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the PascalCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to create it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5742"}
{"instruction": "Write a bash example for versions in customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab.yaml\n```\n\nVersions in CustomResourceDefinitions | After creation, the API server starts to serve each enabled version at an HTTP REST endpoint. In the above example, the API versions are available at /apis/example.com/v1beta1 and /apis/example.com/v1", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5743"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n    \n    schema: ...\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n    schema: ...\n  - name: v1\n    served: true\n    storage: true\n    schema: ...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: crontabs.example.com spec: group: example.com na", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5744"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  validation: ...\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n  - name: v1\n    served: true\n    storage: true\n```\n\nVersions in CustomResourceDefinitions | An older API version cannot be dropped from a CustomResourceDefinition manifest until existing stored data has been migrated to the newer API version for all clusters that served the older version of", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5745"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1beta1\n    # This indicates the v1beta1 version of the custom resource is no longer served.\n    # API requests to this version receive a not found error in the server response.\n    served: false\n    schema: ...\n  - name: v1\n    served: true\n    # The new served version should be set as the storage version\n    storage: true\n    schema: ...\n```\n\nVersions in CustomResourceDefinitions | The above example has a None conversion between versions which only sets the apiVersion field on conversion and does not change the rest of the object. The API server also supports webhook conversions", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5746"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhook is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhook:\n      # conversionReviewVersions indicates what ConversionReview versions are understood/preferred by the webhook.\n      # The first version in the list understood by the API server is sent to the webhook.\n      # The webhook must respond with a ConversionReview object in the same version it received.\n      conversionReviewVersions: [\"v1\",\"v1beta1\"]\n      clientConfig:\n        service:\n          namespace: default\n          name: example-conversion-webhook-server\n          path: /crdconvert\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5747"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # prunes object fields that are not specified in OpenAPI schemas below.\n  preserveUnknownFields: false\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhookClientConfig is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhookClientConfig:\n      service:\n        namespace: default\n        name: example-conversion-webhook-server\n        path: /crdconvert\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nVersions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to apply it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5748"}
{"instruction": "Write a bash example for versions in customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab-with-conversion.yaml\n```\n\nVersions in CustomResourceDefinitions | Make sure the conversion service is up and running before applying new changes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5749"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5750"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\nVersions in CustomResourceDefinitions | The service stanza inside webhookClientConfig is a reference to the service for a conversion webhook. If the webhook is running within the cluster, then you should use service instead of url. The serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5751"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        service:\n          namespace: my-service-namespace\n          name: my-service-name\n          path: /my-path\n          port: 1234\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nVersions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5752"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      service:\n        namespace: my-service-namespace\n        name: my-service-name\n        path: /my-path\n        port: 1234\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\nVersions in CustomResourceDefinitions | Webhooks are sent a POST request, with Content-Type: application/json, with a ConversionReview API object in the apiextensions.k8s.io API group serialized to JSON as the body.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5753"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      conversionReviewVersions: [\"v1\", \"v1beta1\"]\n      ...\n```\n\nVersions in CustomResourceDefinitions | conversionReviewVersions is a required field when creating apiextensions.k8s.io/v1 custom resource definitions. Webhooks are required to support at least one ConversionReview version understood by the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5754"}
{"instruction": "Write a yaml example for versions in customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    conversionReviewVersions: [\"v1\", \"v1beta1\"]\n    ...\n```\n\nVersions in CustomResourceDefinitions | If no conversionReviewVersions are specified, the default when creating apiextensions.k8s.io/v1beta1 custom resource definitions is v1beta1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5755"}
{"instruction": "Write a bash example for versions in customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl patch customresourcedefinitions <CRD_Name> --subresource='status' --type='merge' -p '{\"status\":{\"storedVersions\":[\"v1\"]}}'\n```\n\nVersions in CustomResourceDefinitions |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/", "id": "k8s_00454_code_5756"}
{"instruction": "Explain the Kubernetes concept: Concepts", "response": "The Concepts section helps you learn about the parts of the Kubernetes system and the abstractions Kubernetes uses to represent your cluster, and helps you obtain a deeper understanding of how Kubernetes works.OverviewKubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.Cluster ArchitectureThe architectural concepts behind Kubernetes.ContainersTechnology for packaging an application along with its runtime dependencies.WorkloadsUnderstand Pods, the smallest deployable compute object in Kubernetes, and the higher-level abstractions that help you to run them.Services, Load Balancing, and NetworkingConcepts and resources behind networking in Kubernetes.StorageWays to provide both long-term and temporary storage to Pods in your cluster.ConfigurationResources that Kubernetes provides for configuring Pods.SecurityConcepts for keeping your cloud-native workload secure.PoliciesManage security and best-practices with policies.Scheduling, Preemption and EvictionCluster AdministrationLower-level detail relevant to creating or administering a Kubernetes cluster.Windows in KubernetesKubernetes supports nodes that run Microsoft Windows.Extending KubernetesDifferent ways to change the behavior of your Kubernetes cluster.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/", "id": "k8s_00455"}
{"instruction": "Explain the Kubernetes concept: Policies", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.PoliciesManage security and best-practices with policies.1: Limit Ranges2: Resource Quotas3: Process ID Limits And Reservations4: Node Resource ManagersKubernetes policies are configurations that manage other configurations or runtime behaviors. Kubernetes offers various forms of policies, described below:Apply policies using API objectsSome API objects act as policies. Here are some examples:NetworkPolicies can be used to restrict ingress and egress traffic for a workload.LimitRanges manage resource allocation constraints across different object kinds.ResourceQuotas limit resource consumption for a namespace.Apply policies using admission controllersAn admission controller runs in the API server and can validate or mutate API requests. Some admission controllers act to apply policies. For example, the AlwaysPullImages admission controller modifies a new Pod to set the image pull policy to Always.Kubernetes has several built-in admission controllers that are configurable via the API server --enable-admission-plugins flag.Details on admission controllers, with the complete list of available admission controllers, are documented in a dedicated section:Admission ControllersApply policies using ValidatingAdmissionPolicyValidating admission policies allow configurable validation checks to be executed in the API server using the Common Expression Language (CEL). For example, a ValidatingAdmissionPolicy can be used to disallow use of the latest image tag.A ValidatingAdmissionPolicy operates on an API request and can be used to block, audit, and warn users about non-compliant configurations.Details on the ValidatingAdmissionPolicy API, with examples, are documented in a dedicated section:Validating Admission PolicyApply policies using dynamic admission controlDynamic admission controllers (or admission webhooks) run outside the API server as separate applications that register to receive webhooks requests to perform validation or mutation of API requests.Dynamic admission controllers can be used to apply policies on API requests and trigger other policy-based workflows. A dynamic admission controller can perform complex checks including those that require retrieval of other cluster resources and external data. For example, an image verification check can lookup data from OCI registries to validate the container image signatures and attestations.Details on dynamic admission control are documented in a dedicated section:Dynamic Admission ControlImplementationsNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Dynamic Admission Controllers that act as flexible policy engines are being developed in the Kubernetes ecosystem, such as:KubewardenKyvernoOPA GatekeeperPolarisApply policies using Kubelet configurationsKubernetes allows configuring the Kubelet on each worker node. Some Kubelet configurations act as policies:Process ID limits and reservations are used to limit and reserve allocatable PIDs.Node Resource Managers can manage compute, memory, and device resources for latency-critical and high-throughput workloads.1 - Limit RangesBy default, containers run with unbounded compute resources on a Kubernetes cluster. Using Kubernetes resource quotas, administrators (also termed cluster operators) can restrict consumption and creation of cluster resources (such as CPU time, memory, and persistent storage) within a specified namespace. Within a namespace, a Pod can consume as much CPU and memory as is allowed by the ResourceQuotas that apply to that namespace. As a cluster operator, or as a namespace-level administrator, you might also be concerned about making sure that a single ob", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5759"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5760"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5761"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5762"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota.yaml\n```\n\n2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5763"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5764"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5765"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./high-priority-pod.yaml\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"high\" priority quota, pods-high, has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5766"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Operators can use CrossNamespacePodAffinity quota scope to limit which namespaces are allowed to have pods with affinity terms that cross namespaces. Specifically, it controls which pods are allowed t", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5767"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\n2 - Resource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5768"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\n2 - Resource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5769"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5770"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota-vac.yaml\n```\n\n2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5771"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5772"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5773"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./gold-vac-pvc.yaml\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"gold\" volume attributes class quota, pvcs-gold has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5774"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Once the PVC is bound, it is allowed to modify the desired volume attributes class. Let's change it to \"silver\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5775"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"silver\"}}'\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"silver\" volume attributes class quota, pvcs-silver has changed, pvcs-copper is unchanged, and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5776"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Let's change it to \"copper\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5777"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"copper\"}}'\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"copper\" volume attributes class quota, pvcs-copper has changed, pvcs-silver and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5778"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Print the manifest of the PVC using the following command:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5779"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc gold-vac-pvc -o yaml\n```\n\n2 - Resource Quotas | It might show the following output:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5780"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\n2 - Resource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5781"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | When allocating compute resources, each container may specify a request and a limit value for either CPU or memory. The quota can be configured to quota either value.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5782"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5783"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > compute-resources.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: compute-resources\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: \"1Gi\"\n    limits.cpu: \"2\"\n    limits.memory: \"2Gi\"\n    requests.nvidia.com/gpu: 4\nEOF\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5784"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./compute-resources.yaml --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5785"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > object-counts.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-counts\nspec:\n  hard:\n    configmaps: \"10\"\n    persistentvolumeclaims: \"4\"\n    pods: \"4\"\n    replicationcontrollers: \"20\"\n    secrets: \"10\"\n    services: \"10\"\n    services.loadbalancers: \"2\"\nEOF\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5786"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./object-counts.yaml --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5787"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl get quota --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5788"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota compute-resources --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5789"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota object-counts --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5790"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5791"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create quota test --hard=count/deployments.apps=2,count/replicasets.apps=4,count/pods=3,count/secrets=4 --namespace=myspace\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5792"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx --namespace=myspace --replicas=2\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5793"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota --namespace=myspace\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5794"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\n2 - Resource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5795"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5796"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/policy/priority-class-resourcequota.yaml -n kube-system\n```\n\n2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5797"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5798"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5799"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5800"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nscopeSelector:\n    matchExpressions:\n      - scopeName: PriorityClass\n        operator: In\n        values:\n          - middle\n```\n\n2 - Resource Quotas | If the operator is Exists or DoesNotExist, the values field must NOT be specified.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5801"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5802"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5803"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5804"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\n2 - Resource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5805"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\n2 - Resource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5806"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5807"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5808"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5809"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\n2 - Resource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5810"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\n2 - Resource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5811"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5812"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n```\n\n4 - Node Resource Managers | The pod above runs in the BestEffort QoS class because no resource requests or limits are specified. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5813"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n4 - Node Resource Managers | The pod above runs in the Burstable QoS class because resource requests do not equal limits and the cpu quantity is not specified. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5814"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n      requests:\n        memory: \"100Mi\"\n        cpu: \"1\"\n```\n\n4 - Node Resource Managers | The pod above runs in the Burstable QoS class because resource requests do not equal limits. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5815"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"2\"\n```\n\n4 - Node Resource Managers | The pod above runs in the Guaranteed QoS class because requests are equal to limits. And the container's resource limit for the CPU resource is an integer greater than or equal to one. The nginx conta", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5816"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"1.5\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"1.5\"\n```\n\n4 - Node Resource Managers | The pod above runs in the Guaranteed QoS class because requests are equal to limits. But the container's resource limit for the CPU resource is a fraction. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5817"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n```\n\n4 - Node Resource Managers | The pod above runs in the Guaranteed QoS class because only limits are specified and requests are set equal to limits when not explicitly specified. And the container's resource limit for the CPU reso", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5818"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/problematic-limit-range.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5819"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5820"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/example-conflict-with-limitrange-cpu.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5821"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5822"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/example-no-conflict-with-limitrange-cpu.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5823"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5824"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\npolicy/quota.yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5825"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5826"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota.yaml\n```\n\n2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5827"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5828"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\npolicy/high-priority-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5829"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5830"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./high-priority-pod.yaml\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"high\" priority quota, pods-high, has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5831"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Operators can use CrossNamespacePodAffinity quota scope to limit which namespaces are allowed to have pods with affinity terms that cross namespaces. Specifically, it controls which pods are allowed t", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5832"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\n2 - Resource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5833"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\n2 - Resource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5834"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\npolicy/quota-vac.yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5835"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5836"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota-vac.yaml\n```\n\n2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5837"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5838"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\npolicy/gold-vac-pvc.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5839"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5840"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./gold-vac-pvc.yaml\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"gold\" volume attributes class quota, pvcs-gold has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5841"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Once the PVC is bound, it is allowed to modify the desired volume attributes class. Let's change it to \"silver\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5842"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"silver\"}}'\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"silver\" volume attributes class quota, pvcs-silver has changed, pvcs-copper is unchanged, and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5843"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Let's change it to \"copper\" with kubectl patch.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5844"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"copper\"}}'\n```\n\n2 - Resource Quotas | Verify that \"Used\" stats for \"copper\" volume attributes class quota, pvcs-copper has changed, pvcs-silver and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5845"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | Print the manifest of the PVC using the following command:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5846"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc gold-vac-pvc -o yaml\n```\n\n2 - Resource Quotas | It might show the following output:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5847"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\n2 - Resource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5848"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n2 - Resource Quotas | When allocating compute resources, each container may specify a request and a limit value for either CPU or memory. The quota can be configured to quota either value.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5849"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5850"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > compute-resources.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: compute-resources\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: \"1Gi\"\n    limits.cpu: \"2\"\n    limits.memory: \"2Gi\"\n    requests.nvidia.com/gpu: 4\nEOF\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5851"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./compute-resources.yaml --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5852"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > object-counts.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-counts\nspec:\n  hard:\n    configmaps: \"10\"\n    persistentvolumeclaims: \"4\"\n    pods: \"4\"\n    replicationcontrollers: \"20\"\n    secrets: \"10\"\n    services: \"10\"\n    services.loadbalancers: \"2\"\nEOF\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5853"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./object-counts.yaml --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5854"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl get quota --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5855"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota compute-resources --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5856"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota object-counts --namespace=myspace\n```\n\n2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5857"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5858"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create quota test --hard=count/deployments.apps=2,count/replicasets.apps=4,count/pods=3,count/secrets=4 --namespace=myspace\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5859"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx --namespace=myspace --replicas=2\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5860"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota --namespace=myspace\n```\n\n2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5861"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\n2 - Resource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5862"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\npolicy/priority-class-resourcequota.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5863"}
{"instruction": "Write a yaml example for policies", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5864"}
{"instruction": "Write a bash example for policies", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/policy/priority-class-resourcequota.yaml -n kube-system\n```\n\n2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/_print/", "id": "k8s_00456_code_5865"}
{"instruction": "What is the reference documentation for kubectl create rolebinding?", "response": "kubectl create rolebindingSynopsisCreate a role binding for a particular role or cluster role.kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none] Examples # Create a role binding for user1, user2, and group1 using the admin cluster role kubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1 # Create a role binding for service account monitoring:sa-dev using the admin role kubectl create rolebinding admin-binding --role=admin --serviceaccount=monitoring:sa-dev Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--clusterrole stringClusterRole this RoleBinding should reference--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--group stringsGroups to bind to the role. The flag can be repeated to add multiple groups.-h, --helphelp for rolebinding-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--role stringRole this RoleBinding should reference--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--serviceaccount stringsService accounts to bind to the role, in the format <namespace>:<name>. The flag can be repeated to add multiple service accounts.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--user stringsUsernames to bind to the role. The flag can be repeated to add multiple users.--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the ku", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_rolebinding/", "id": "k8s_00457"}
{"instruction": "Write a bash example for kubectl create rolebinding", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\nkubectl create rolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_rolebinding/", "id": "k8s_00457_code_5867"}
{"instruction": "Write a bash example for kubectl create rolebinding", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\nkubectl create rolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_rolebinding/", "id": "k8s_00457_code_5868"}
{"instruction": "What is the reference documentation for kubectl create?", "response": "kubectl createSynopsisCreate a resource from a file or from stdin.JSON and YAML formats are accepted.kubectl create -f FILENAME Examples # Create a pod using the data in pod.json kubectl create -f ./pod.json # Create a pod based on the JSON passed into stdin cat pod.json | kubectl create -f - # Edit the data in registry.yaml in JSON then create the resource using the edited data kubectl create -f registry.yaml --edit -o json Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--editEdit the API resource before creating--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files to use to create the resource-h, --helphelp for create-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--raw stringRaw URI to POST to the server. Uses the transport specified by the kubeconfig file.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.--windows-line-endingsOnly relevant if --edit=true. Defaults to the line ending native to your platform.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for val", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/", "id": "k8s_00458"}
{"instruction": "Write a bash example for kubectl create", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME\n```\n\nkubectl create | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/", "id": "k8s_00458_code_5870"}
{"instruction": "Write a bash example for kubectl create", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME\n```\n\nkubectl create | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/", "id": "k8s_00458_code_5871"}
{"instruction": "What is the reference documentation for kubectl rollout?", "response": "kubectl rolloutSynopsisManage the rollout of one or many resources.Valid resource types include:deploymentsdaemonsetsstatefulsetskubectl rollout SUBCOMMAND Examples # Rollback to the previous deployment kubectl rollout undo deployment/abc # Check the rollout status of a daemonset kubectl rollout status daemonset/foo # Restart a deployment kubectl rollout restart deployment/abc # Restart deployments with the 'app=nginx' label kubectl rollout restart deployment --selector=app=nginx Options-h, --helphelp for rolloutParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerkubectl rollout history - View rollout historykubectl rollout pause - Mark the provided resource as pausedkubectl rollout restart - Restart a resourcekubectl rollout resume - Resume a paused resourcekubectl rollout status - Show the status of the rolloutkubectl rollout undo - Undo a previous rolloutThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generate", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/", "id": "k8s_00459"}
{"instruction": "Write a bash example for kubectl rollout", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND\n```\n\nkubectl rollout | help for rollout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/", "id": "k8s_00459_code_5873"}
{"instruction": "Write a bash example for kubectl rollout", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND\n```\n\nkubectl rollout | help for rollout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/", "id": "k8s_00459_code_5874"}
{"instruction": "How do you define a command and arguments for a container in Kubernetes?", "response": "Define a Command and Arguments for a ContainerThis page shows how to define commands and arguments when you run a container in a Pod.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Define a command and arguments when you create a PodWhen you create a Pod, you can define a command and arguments for the containers that run in the Pod. To define a command, include the command field in the configuration file. To define arguments for the command, include the args field in the configuration file. The command and arguments that you define cannot be changed after the Pod is created.The command and arguments that you define in the configuration file override the default command and arguments provided by the container image. If you define args, but do not define a command, the default command is used with your new arguments.Note:The command field corresponds to ENTRYPOINT, and the args field corresponds to CMD in some container runtimes.In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines a command and two arguments:pods/commands.yaml apiVersion: v1 kind: Pod metadata: name: command-demo labels: purpose: demonstrate-command spec: containers: - name: command-demo-container image: debian command: [\"printenv\"] args: [\"HOSTNAME\", \"KUBERNETES_PORT\"] restartPolicy: OnFailure Create a Pod based on the YAML configuration file:kubectl apply -f https://k8s.io/examples/pods/commands.yaml List the running Pods:kubectl get pods The output shows that the container that ran in the command-demo Pod has completed.To see the output of the command that ran in the container, view the logs from the Pod:kubectl logs command-demo The output shows the values of the HOSTNAME and KUBERNETES_PORT environment variables:command-demo tcp://10.3.240.1:443 Use environment variables to define argumentsIn the preceding example, you defined the arguments directly by providing strings. As an alternative to providing strings directly, you can define arguments by using environment variables:env: - name: MESSAGE value: \"hello world\" command: [\"/bin/echo\"] args: [\"$(MESSAGE)\"] This means you can define an argument for a Pod using any of the techniques available for defining environment variables, including ConfigMaps and Secrets.Note:The environment variable appears in parentheses, \"$(VAR)\". This is required for the variable to be expanded in the command or args field.Run a command in a shellIn some cases, you need your command to run in a shell. For example, your command might consist of several commands piped together, or it might be a shell script. To run your command in a shell, wrap it like this:command: [\"/bin/sh\"] args: [\"-c\", \"while true; do echo hello; sleep 10;done\"] What's nextLearn more about configuring pods and containers.Learn more about running commands in a container.See Container.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460"}
{"instruction": "Write a yaml example for define a command and arguments for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\nDefine a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5876"}
{"instruction": "Write a bash example for define a command and arguments for a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/commands.yaml\n```\n\nDefine a Command and Arguments for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5877"}
{"instruction": "Write a bash example for define a command and arguments for a container", "response": "Here's a bash example:\n\n```bash\nkubectl logs command-demo\n```\n\nDefine a Command and Arguments for a Container | The output shows the values of the HOSTNAME and KUBERNETES_PORT environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5878"}
{"instruction": "Write a yaml example for define a command and arguments for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\nDefine a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5879"}
{"instruction": "Write a yaml example for define a command and arguments for a container", "response": "Here's a yaml example:\n\n```yaml\nenv:\n- name: MESSAGE\n  value: \"hello world\"\ncommand: [\"/bin/echo\"]\nargs: [\"$(MESSAGE)\"]\n```\n\nDefine a Command and Arguments for a Container | This means you can define an argument for a Pod using any of the techniques available for defining environment variables, including ConfigMaps and Secrets.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5880"}
{"instruction": "Write a yaml example for define a command and arguments for a container", "response": "Here's a yaml example:\n\n```yaml\npods/commands.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\nDefine a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5881"}
{"instruction": "Write a yaml example for define a command and arguments for a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\nDefine a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5882"}
{"instruction": "Write a bash example for define a command and arguments for a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/commands.yaml\n```\n\nDefine a Command and Arguments for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5883"}
{"instruction": "Write a bash example for define a command and arguments for a container", "response": "Here's a bash example:\n\n```bash\nkubectl logs command-demo\n```\n\nDefine a Command and Arguments for a Container | The output shows the values of the HOSTNAME and KUBERNETES_PORT environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/", "id": "k8s_00460_code_5884"}
{"instruction": "How do you perform a rollback on a daemonset in Kubernetes?", "response": "Perform a Rollback on a DaemonSetThis page shows how to perform a rollback on a DaemonSet.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.7.To check the version, enter kubectl version.You should already know how to perform a rolling update on a DaemonSet.Performing a rollback on a DaemonSetStep 1: Find the DaemonSet revision you want to roll back toYou can skip this step if you only want to roll back to the last revision.List all revisions of a DaemonSet:kubectl rollout history daemonset <daemonset-name> This returns a list of DaemonSet revisions:daemonsets \"<daemonset-name>\" REVISION CHANGE-CAUSE 1 ... 2 ... ... Change cause is copied from DaemonSet annotation kubernetes.io/change-cause to its revisions upon creation. You may specify --record=true in kubectl to record the command executed in the change cause annotation.To see the details of a specific revision:kubectl rollout history daemonset <daemonset-name> --revision=1 This returns the details of that revision:daemonsets \"<daemonset-name>\" with revision #1 Pod Template: Labels: foo=bar Containers: app: Image: ... Port: ... Environment: ... Mounts: ... Volumes: ... Step 2: Roll back to a specific revision# Specify the revision number you get from Step 1 in --to-revision kubectl rollout undo daemonset <daemonset-name> --to-revision=<revision> If it succeeds, the command returns:daemonset \"<daemonset-name>\" rolled back Note:If --to-revision flag is not specified, kubectl picks the most recent revision.Step 3: Watch the progress of the DaemonSet rollbackkubectl rollout undo daemonset tells the server to start rolling back the DaemonSet. The real rollback is done asynchronously inside the cluster control plane.To watch the progress of the rollback:kubectl rollout status ds/<daemonset-name> When the rollback is complete, the output is similar to:daemonset \"<daemonset-name>\" successfully rolled out Understanding DaemonSet revisionsIn the previous kubectl rollout history step, you got a list of DaemonSet revisions. Each revision is stored in a resource named ControllerRevision.To see what is stored in each revision, find the DaemonSet revision raw resources:kubectl get controllerrevision -l <daemonset-selector-key>=<daemonset-selector-value> This returns a list of ControllerRevisions:NAME CONTROLLER REVISION AGE <daemonset-name>-<revision-hash> DaemonSet/<daemonset-name> 1 1h <daemonset-name>-<revision-hash> DaemonSet/<daemonset-name> 2 1h Each ControllerRevision stores the annotations and template of a DaemonSet revision.kubectl rollout undo takes a specific ControllerRevision and replaces DaemonSet template with the template stored in the ControllerRevision. kubectl rollout undo is equivalent to updating DaemonSet template to a previous revision through other commands, such as kubectl edit or kubectl apply.Note:DaemonSet revisions only roll forward. That is to say, after a rollback completes, the revision number (.revision field) of the ControllerRevision being rolled back to will advance. For example, if you have revision 1 and 2 in the system, and roll back from revision 2 to revision 1, the ControllerRevision with .revision: 1 will become .revision: 3.TroubleshootingSee troubleshooting DaemonSet rolling update.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name>\n```\n\nPerform a Rollback on a DaemonSet | This returns a list of DaemonSet revisions:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5886"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name> --revision=1\n```\n\nPerform a Rollback on a DaemonSet | This returns the details of that revision:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5887"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/<daemonset-name>\n```\n\nPerform a Rollback on a DaemonSet | When the rollback is complete, the output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5888"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevision -l <daemonset-selector-key>=<daemonset-selector-value>\n```\n\nPerform a Rollback on a DaemonSet | This returns a list of ControllerRevisions:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5889"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset\n```\n\nPerform a Rollback on a DaemonSet | To watch the progress of the rollback:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5890"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history\n```\n\nPerform a Rollback on a DaemonSet | To see what is stored in each revision, find the DaemonSet revision raw resources:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5891"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name>\n```\n\nPerform a Rollback on a DaemonSet | This returns a list of DaemonSet revisions:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5892"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name> --revision=1\n```\n\nPerform a Rollback on a DaemonSet | This returns the details of that revision:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5893"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/<daemonset-name>\n```\n\nPerform a Rollback on a DaemonSet | When the rollback is complete, the output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5894"}
{"instruction": "Write a bash example for perform a rollback on a daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevision -l <daemonset-selector-key>=<daemonset-selector-value>\n```\n\nPerform a Rollback on a DaemonSet | This returns a list of ControllerRevisions:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/rollback-daemon-set/", "id": "k8s_00461_code_5895"}
{"instruction": "How do you schedule gpus in Kubernetes?", "response": "Schedule GPUsConfigure and schedule GPUs for use as a resource by nodes in a cluster.FEATURE STATE: Kubernetes v1.26 [stable]Kubernetes includes stable support for managing AMD and NVIDIA GPUs (graphical processing units) across different nodes in your cluster, using device plugins.This page describes how users can consume GPUs, and outlines some of the limitations in the implementation.Using device pluginsKubernetes implements device plugins to let Pods access specialized hardware features such as GPUs.Note: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.As an administrator, you have to install GPU drivers from the corresponding hardware vendor on the nodes and run the corresponding device plugin from the GPU vendor. Here are some links to vendors' instructions:AMDIntelNVIDIAOnce you have installed the plugin, your cluster exposes a custom schedulable resource such as amd.com/gpu or nvidia.com/gpu.You can consume these GPUs from your containers by requesting the custom GPU resource, the same way you request cpu or memory. However, there are some limitations in how you specify the resource requirements for custom devices.GPUs are only supposed to be specified in the limits section, which means:You can specify GPU limits without specifying requests, because Kubernetes will use the limit as the request value by default.You can specify GPU in both limits and requests but these two values must be equal.You cannot specify GPU requests without specifying limits.Here's an example manifest for a Pod that requests a GPU:apiVersion: v1 kind: Pod metadata: name: example-vector-add spec: restartPolicy: OnFailure containers: - name: example-vector-add image: \"registry.example/example-vector-add:v42\" resources: limits: gpu-vendor.example/example-gpu: 1 # requesting 1 GPU Manage clusters with different types of GPUsIf different nodes in your cluster have different types of GPUs, then you can use Node Labels and Node Selectors to schedule pods to appropriate nodes.For example:# Label your nodes with the accelerator type they have. kubectl label nodes node1 accelerator=example-gpu-x100 kubectl label nodes node2 accelerator=other-gpu-k915 That label key accelerator is just an example; you can use a different label key if you prefer.Automatic node labellingAs an administrator, you can automatically discover and label all your GPU enabled nodes by deploying Kubernetes Node Feature Discovery (NFD). NFD detects the hardware features that are available on each node in a Kubernetes cluster. Typically, NFD is configured to advertise those features as node labels, but NFD can also add extended resources, annotations, and node taints. NFD is compatible with all supported versions of Kubernetes. By default NFD create the feature labels for the detected features. Administrators can leverage NFD to also taint nodes with specific features, so that only pods that request those features can be scheduled on those nodes.You also need a plugin for NFD that adds appropriate labels to your nodes; these might be generic labels or they could be vendor specific. Your GPU vendor may provide a third party plugin for NFD; check their documentation for more details.apiVersion: v1 kind: Pod metadata: name: example-vector-add spec: restartPolicy: OnFailure # You can use Kubernetes node affinity to schedule this Pod onto a node # that provides the kind of GPU that its container needs in order to work affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: \"gpu.gpu-vendor.example/installed-memory\" operator: Gt # (greater than) values: [\"40535\"] - key: \"feature.node.kubernetes.io/pci-10.present\" # NFD Feature label values: [\"true\"] # (optional) only schedule on nodes wit", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/", "id": "k8s_00462"}
{"instruction": "Write a yaml example for schedule gpus", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\nSchedule GPUs | If different nodes in your cluster have different types of GPUs, then you can use Node Labels and Node Selectors to schedule pods to appropriate nodes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/", "id": "k8s_00462_code_5897"}
{"instruction": "Write a yaml example for schedule gpus", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  # You can use Kubernetes node affinity to schedule this Pod onto a node\n  # that provides the kind of GPU that its container needs in order to work\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: \"gpu.gpu-vendor.example/installed-memory\"\n            operator: Gt # (greater than)\n            values: [\"40535\"]\n          - key: \"feature.node.kubernetes.io/pci-10.present\" # NFD Feature label\n            values: [\"true\"] # (optional) only schedule on nodes with PCI device 10\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\nSchedule GPUs | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/", "id": "k8s_00462_code_5898"}
{"instruction": "Write a yaml example for schedule gpus", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\nSchedule GPUs | If different nodes in your cluster have different types of GPUs, then you can use Node Labels and Node Selectors to schedule pods to appropriate nodes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/", "id": "k8s_00462_code_5899"}
{"instruction": "Write a yaml example for schedule gpus", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  # You can use Kubernetes node affinity to schedule this Pod onto a node\n  # that provides the kind of GPU that its container needs in order to work\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: \"gpu.gpu-vendor.example/installed-memory\"\n            operator: Gt # (greater than)\n            values: [\"40535\"]\n          - key: \"feature.node.kubernetes.io/pci-10.present\" # NFD Feature label\n            values: [\"true\"] # (optional) only schedule on nodes with PCI device 10\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\nSchedule GPUs | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/", "id": "k8s_00462_code_5900"}
{"instruction": "Write a yaml example for schedule gpus", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\nSchedule GPUs | If different nodes in your cluster have different types of GPUs, then you can use Node Labels and Node Selectors to schedule pods to appropriate nodes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/", "id": "k8s_00462_code_5901"}
{"instruction": "Write a yaml example for schedule gpus", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  # You can use Kubernetes node affinity to schedule this Pod onto a node\n  # that provides the kind of GPU that its container needs in order to work\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: \"gpu.gpu-vendor.example/installed-memory\"\n            operator: Gt # (greater than)\n            values: [\"40535\"]\n          - key: \"feature.node.kubernetes.io/pci-10.present\" # NFD Feature label\n            values: [\"true\"] # (optional) only schedule on nodes with PCI device 10\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\nSchedule GPUs | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/", "id": "k8s_00462_code_5902"}
{"instruction": "Explain the Kubernetes concept: Kubernetes API Aggregation Layer", "response": "Kubernetes API Aggregation LayerThe aggregation layer allows Kubernetes to be extended with additional APIs, beyond what is offered by the core Kubernetes APIs. The additional APIs can either be ready-made solutions such as a metrics server, or APIs that you develop yourself.The aggregation layer is different from Custom Resource Definitions, which are a way to make the kube-apiserver recognise new kinds of object.Aggregation layerThe aggregation layer runs in-process with the kube-apiserver. Until an extension resource is registered, the aggregation layer will do nothing. To register an API, you add an APIService object, which \"claims\" the URL path in the Kubernetes API. At that point, the aggregation layer will proxy anything sent to that API path (e.g. /apis/myextension.mycompany.io/v1/…) to the registered APIService.The most common way to implement the APIService is to run an extension API server in Pod(s) that run in your cluster. If you're using the extension API server to manage resources in your cluster, the extension API server (also written as \"extension-apiserver\") is typically paired with one or more controllers. The apiserver-builder library provides a skeleton for both extension API servers and the associated controller(s).Response latencyExtension API servers should have low latency networking to and from the kube-apiserver. Discovery requests are required to round-trip from the kube-apiserver in five seconds or less.If your extension API server cannot achieve that latency requirement, consider making changes that let you meet it.What's nextTo get the aggregator working in your environment, configure the aggregation layer.Then, setup an extension api-server to work with the aggregation layer.Read about APIService in the API referenceLearn about Declarative Validation Concepts, an internal mechanism for defining validation rules that in the future will help support validation for extension API server development.Alternatively: learn how to extend the Kubernetes API using Custom Resource Definitions.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/", "id": "k8s_00463"}
{"instruction": "What is the reference documentation for horizontalpodautoscaler?", "response": "HorizontalPodAutoscalerconfiguration of a horizontal pod autoscaler.apiVersion: autoscaling/v1import \"k8s.io/api/autoscaling/v1\"HorizontalPodAutoscalerconfiguration of a horizontal pod autoscaler.apiVersion: autoscaling/v1kind: HorizontalPodAutoscalermetadata (ObjectMeta)Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (HorizontalPodAutoscalerSpec)spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.status (HorizontalPodAutoscalerStatus)status is the current information about the autoscaler.HorizontalPodAutoscalerSpecspecification of a horizontal pod autoscaler.maxReplicas (int32), requiredmaxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas.scaleTargetRef (CrossVersionObjectReference), requiredreference to scaled resource; horizontal pod autoscaler will learn the current resource consumption and will set the desired number of pods by using its Scale subresource.CrossVersionObjectReference contains enough information to let you identify the referred resource.scaleTargetRef.kind (string), requiredkind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsscaleTargetRef.name (string), requiredname is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#namesscaleTargetRef.apiVersion (string)apiVersion is the API version of the referentminReplicas (int32)minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.targetCPUUtilizationPercentage (int32)targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; if not specified the default autoscaling policy will be used.HorizontalPodAutoscalerStatuscurrent status of a horizontal pod autoscalercurrentReplicas (int32), requiredcurrentReplicas is the current number of replicas of pods managed by this autoscaler.desiredReplicas (int32), requireddesiredReplicas is the desired number of replicas of pods managed by this autoscaler.currentCPUUtilizationPercentage (int32)currentCPUUtilizationPercentage is the current average CPU utilization over all pods, represented as a percentage of requested CPU, e.g. 70 means that an average pod is using now 70% of its requested CPU.lastScaleTime (Time)lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods; used by the autoscaler to control how often the number of pods is changed.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.observedGeneration (int64)observedGeneration is the most recent generation observed by this autoscaler.HorizontalPodAutoscalerListlist of horizontal pod autoscaler objects.apiVersion: autoscaling/v1kind: HorizontalPodAutoscalerListmetadata (ListMeta)Standard list metadata.items ([]HorizontalPodAutoscaler), requireditems is the list of horizontal pod autoscaler objects.Operationsget read the specified HorizontalPodAutoscalerHTTP RequestGET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}Parametersname (in path): string, requiredname of the HorizontalPodAutoscalernamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (HorizontalPodAutoscaler): OK401: Unauthorizedget read status of the specified HorizontalPodAutoscalerHTTP RequestGET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscale", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v1/", "id": "k8s_00464"}
{"instruction": "Write a yaml example for horizontalpodautoscaler", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\n```\n\nHorizontalPodAutoscaler | import \"k8s.io/api/autoscaling/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v1/", "id": "k8s_00464_code_5905"}
{"instruction": "How do you accessing the kubernetes api from a pod in Kubernetes?", "response": "Accessing the Kubernetes API from a PodThis guide demonstrates how to access the Kubernetes API from within a pod.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesAccessing the API from within a PodWhen accessing the API from within a Pod, locating and authenticating to the API server are slightly different to the external client case.The easiest way to use the Kubernetes API from a Pod is to use one of the official client libraries. These libraries can automatically discover the API server and authenticate.Using Official Client LibrariesFrom within a Pod, the recommended ways to connect to the Kubernetes API are:For a Go client, use the official Go client library. The rest.InClusterConfig() function handles API host discovery and authentication automatically. See an example here.For a Python client, use the official Python client library. The config.load_incluster_config() function handles API host discovery and authentication automatically. See an example here.There are a number of other libraries available, please refer to the Client Libraries page.In each case, the service account credentials of the Pod are used to communicate securely with the API server.Directly accessing the REST APIWhile running in a Pod, your container can create an HTTPS URL for the Kubernetes API server by fetching the KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT_HTTPS environment variables. The API server's in-cluster address is also published to a Service named kubernetes in the default namespace so that pods may reference kubernetes.default.svc as a DNS name for the local API server.Note:Kubernetes does not guarantee that the API server has a valid certificate for the hostname kubernetes.default.svc; however, the control plane is expected to present a valid certificate for the hostname or IP address that $KUBERNETES_SERVICE_HOST represents.The recommended way to authenticate to the API server is with a service account credential. By default, a Pod is associated with a service account, and a credential (token) for that service account is placed into the filesystem tree of each container in that Pod, at /var/run/secrets/kubernetes.io/serviceaccount/token.If available, a certificate bundle is placed into the filesystem tree of each container at /var/run/secrets/kubernetes.io/serviceaccount/ca.crt, and should be used to verify the serving certificate of the API server.Finally, the default namespace to be used for namespaced API operations is placed in a file at /var/run/secrets/kubernetes.io/serviceaccount/namespace in each container.Using kubectl proxyIf you would like to query the API without an official client library, you can run kubectl proxy as the command of a new sidecar container in the Pod. This way, kubectl proxy will authenticate to the API and expose it on the localhost interface of the Pod, so that other containers in the Pod can use it directly.Without using a proxyIt is possible to avoid using the kubectl proxy by passing the authentication token directly to the API server. The internal certificate secures the connection.# Point to the internal API server hostname APISERVER=https://kubernetes.default.svc # Path to ServiceAccount token SERVICEACCOUNT=/var/run/secrets/kubernetes.io/serviceaccount # Read this Pod's namespace NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace) # Read the ServiceAccount bearer token TOKEN=$(cat ${SERVICEACCOUNT}/token) # Reference the internal certificate authority (CA) CACERT=${SERVICEACCOUNT}/ca.crt # Explore the API with TOKEN curl --cacert ${CACERT} --header \"Authorization: Bearer ${TOKEN}\" -X GET ${APISERVER}/api The o", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/access-api-from-pod/", "id": "k8s_00465"}
{"instruction": "Explain the Kubernetes concept: Linux kernel security constraints for Pods and containers", "response": "Linux kernel security constraints for Pods and containersOverview of Linux kernel security modules and constraints that you can use to harden your Pods and containers.This page describes some of the security features that are built into the Linux kernel that you can use in your Kubernetes workloads. To learn how to apply these features to your Pods and containers, refer to Configure a SecurityContext for a Pod or Container. You should already be familiar with Linux and with the basics of Kubernetes workloads.Run workloads without root privilegesWhen you deploy a workload in Kubernetes, use the Pod specification to restrict that workload from running as the root user on the node. You can use the Pod securityContext to define the specific Linux user and group for the processes in the Pod, and explicitly restrict containers from running as root users. Setting these values in the Pod manifest takes precedence over similar values in the container image, which is especially useful if you're running images that you don't own.Caution:Ensure that the user or group that you assign to the workload has the permissions required for the application to function correctly. Changing the user or group to one that doesn't have the correct permissions could lead to file access issues or failed operations.Configuring the kernel security features on this page provides fine-grained control over the actions that processes in your cluster can take, but managing these configurations can be challenging at scale. Running containers as non-root, or in user namespaces if you need root privileges, helps to reduce the chance that you'll need to enforce your configured kernel security capabilities.Security features in the Linux kernelKubernetes lets you configure and use Linux kernel features to improve isolation and harden your containerized workloads. Common features include the following:Secure computing mode (seccomp): Filter which system calls a process can makeAppArmor: Restrict the access privileges of individual programsSecurity Enhanced Linux (SELinux): Assign security labels to objects for more manageable security policy enforcementTo configure settings for one of these features, the operating system that you choose for your nodes must enable the feature in the kernel. For example, Ubuntu 7.10 and later enable AppArmor by default. To learn whether your OS enables a specific feature, consult the OS documentation.You use the securityContext field in your Pod specification to define the constraints that apply to those processes. The securityContext field also supports other security settings, such as specific Linux capabilities or file access permissions using UIDs and GIDs. To learn more, refer to Configure a SecurityContext for a Pod or Container.seccompSome of your workloads might need privileges to perform specific actions as the root user on your node's host machine. Linux uses capabilities to divide the available privileges into categories, so that processes can get the privileges required to perform specific actions without being granted all privileges. Each capability has a set of system calls (syscalls) that a process can make. seccomp lets you restrict these individual syscalls. It can be used to sandbox the privileges of a process, restricting the calls it is able to make from userspace into the kernel.In Kubernetes, you use a container runtime on each node to run your containers. Example runtimes include CRI-O, Docker, or containerd. Each runtime allows only a subset of Linux capabilities by default. You can further limit the allowed syscalls individually by using a seccomp profile. Container runtimes usually include a default seccomp profile. Kubernetes lets you automatically apply seccomp profiles loaded onto a node to your Pods and containers.Note:Kubernetes also has the allowPrivilegeEscalation setting for Pods and containers. When set to false, this prevents processes from gaining new capabilities and restricts unprivileged users from ", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/security/linux-kernel-security-constraints/", "id": "k8s_00466"}
{"instruction": "Explain page content types in Kubernetes", "response": "Page content typesThe Kubernetes documentation follows several types of page content:ConceptTaskTutorialReferenceContent sectionsEach page content type contains a number of sections defined by Markdown comments and HTML headings. You can add content headings to your page with the heading shortcode. The comments and headings help maintain the structure of the page content types.Examples of Markdown comments defining page content sections:<!-- overview --> <!-- body --> To create common headings in your content pages, use the heading shortcode with a heading string.Examples of heading strings:whatsnextprerequisitesobjectivescleanupsynopsisseealsooptionsFor example, to create a whatsnext heading, add the heading shortcode with the \"whatsnext\" string:## {{% heading \"whatsnext\" %}} You can declare a prerequisites heading as follows:## {{% heading \"prerequisites\" %}} The heading shortcode expects one string parameter. The heading string parameter matches the prefix of a variable in the i18n/<lang>/<lang>.toml files. For example:i18n/en/en.toml:[whatsnext_heading] other = \"What's next\" i18n/ko/ko.toml:[whatsnext_heading] other = \"다음 내용\" Content typesEach content type informally defines its expected page structure. Create page content with the suggested page sections.ConceptA concept page explains some aspect of Kubernetes. For example, a concept page might describe the Kubernetes Deployment object and explain the role it plays as an application once it is deployed, scaled, and updated. Typically, concept pages don't include sequences of steps, but instead provide links to tasks or tutorials.To write a new concept page, create a Markdown file in a subdirectory of the /content/en/docs/concepts directory, with the following characteristics:Concept pages are divided into three sections:Page sectionoverviewbodywhatsnextThe overview and body sections appear as comments in the concept page. You can add the whatsnext section to your page with the heading shortcode.Fill each section with content. Follow these guidelines:Organize content with H2 and H3 headings.For overview, set the topic's context with a single paragraph.For body, explain the concept.For whatsnext, provide a bulleted list of topics (5 maximum) to learn more about the concept.Annotations is a published example of a concept page.TaskA task page shows how to do a single thing, typically by giving a short sequence of steps. Task pages have minimal explanation, but often provide links to conceptual topics that provide related background and knowledge.To write a new task page, create a Markdown file in a subdirectory of the /content/en/docs/tasks directory, with the following characteristics:Page sectionoverviewprerequisitesstepsdiscussionwhatsnextThe overview, steps, and discussion sections appear as comments in the task page. You can add the prerequisites and whatsnext sections to your page with the heading shortcode.Within each section, write your content. Use the following guidelines:Use a minimum of H2 headings (with two leading # characters). The sections themselves are titled automatically by the template.For overview, use a paragraph to set context for the entire topic.For prerequisites, use bullet lists when possible. Start adding additional prerequisites below the include. The default prerequisites include a running Kubernetes cluster.For steps, use numbered lists.For discussion, use normal content to expand upon the information covered in steps.For whatsnext, give a bullet list of up to 5 topics the reader might be interested in reading next.An example of a published task topic is Using an HTTP proxy to access the Kubernetes API.TutorialA tutorial page shows how to accomplish a goal that is larger than a single task. Typically a tutorial page has several sections, each of which has a sequence of steps. For example, a tutorial might provide a walkthrough of a code sample that illustrates a certain feature of Kubernetes. Tutorials can include surface-level explanations, bu", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/page-content-types/", "id": "k8s_00467"}
{"instruction": "How do you upgrade a cluster in Kubernetes?", "response": "Upgrade A ClusterThis page provides an overview of the steps you should follow to upgrade a Kubernetes cluster.The Kubernetes project recommends upgrading to the latest patch releases promptly, and to ensure that you are running a supported minor release of Kubernetes. Following this recommendation helps you to stay secure.The way that you upgrade a cluster depends on how you initially deployed it and on any subsequent changes.At a high level, the steps you perform are:Upgrade the control planeUpgrade the nodes in your clusterUpgrade clients such as kubectlAdjust manifests and other resources based on the API changes that accompany the new Kubernetes versionBefore you beginYou must have an existing cluster. This page is about upgrading from Kubernetes 1.33 to Kubernetes 1.34. If your cluster is not currently running Kubernetes 1.33 then please check the documentation for the version of Kubernetes that you plan to upgrade to.Upgrade approacheskubeadmIf your cluster was deployed using the kubeadm tool, refer to Upgrading kubeadm clusters for detailed information on how to upgrade the cluster.Once you have upgraded the cluster, remember to install the latest version of kubectl.Manual deploymentsCaution:These steps do not account for third-party extensions such as network and storage plugins.You should manually update the control plane following this sequence:etcd (all instances)kube-apiserver (all control plane hosts)kube-controller-managerkube-schedulercloud controller manager, if you use oneAt this point you should install the latest version of kubectl.For each node in your cluster, drain that node and then either replace it with a new node that uses the 1.34 kubelet, or upgrade the kubelet on that node and bring the node back into service.Caution:Draining nodes before upgrading kubelet ensures that pods are re-admitted and containers are re-created, which may be necessary to resolve some security issues or other important bugs.Other deploymentsRefer to the documentation for your cluster deployment tool to learn the recommended set up steps for maintenance.Post-upgrade tasksSwitch your cluster's storage API versionThe objects that are serialized into etcd for a cluster's internal representation of the Kubernetes resources active in the cluster are written using a particular version of the API.When the supported API changes, these objects may need to be rewritten in the newer API. Failure to do this will eventually result in resources that are no longer decodable or usable by the Kubernetes API server.For each affected object, fetch it using the latest supported API and then write it back also using the latest supported API.Update manifestsUpgrading to a new Kubernetes version can provide new APIs.You can use kubectl convert command to convert manifests between different API versions. For example:kubectl convert -f pod.yaml --output-version v1 The kubectl tool replaces the contents of pod.yaml with a manifest that sets kind to Pod (unchanged), but with a revised apiVersion.Device PluginsIf your cluster is running device plugins and the node needs to be upgraded to a Kubernetes release with a newer device plugin API version, device plugins must be upgraded to support both version before the node is upgraded in order to guarantee that device allocations continue to complete successfully during the upgrade.Refer to API compatibility and Kubelet Device Manager API Versions for more details.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/cluster-upgrade/", "id": "k8s_00468"}
{"instruction": "Write a bash example for upgrade a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f pod.yaml --output-version v1\n```\n\nUpgrade A Cluster | The kubectl tool replaces the contents of pod.yaml with a manifest that sets kind to Pod (unchanged), but with a revised apiVersion.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/cluster-upgrade/", "id": "k8s_00468_code_5910"}
{"instruction": "Write a bash example for upgrade a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f pod.yaml --output-version v1\n```\n\nUpgrade A Cluster | The kubectl tool replaces the contents of pod.yaml with a manifest that sets kind to Pod (unchanged), but with a revised apiVersion.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/cluster-upgrade/", "id": "k8s_00468_code_5911"}
{"instruction": "How do you specifying a disruption budget for your application in Kubernetes?", "response": "Specifying a Disruption Budget for your ApplicationFEATURE STATE: Kubernetes v1.21 [stable]This page shows how to limit the number of concurrent disruptions that your application experiences, allowing for higher availability while permitting the cluster administrator to manage the clusters nodes.Before you beginYour Kubernetes server must be at or later than version v1.21.To check the version, enter kubectl version.You are the owner of an application running on a Kubernetes cluster that requires high availability.You should know how to deploy Replicated Stateless Applications and/or Replicated Stateful Applications.You should have read about Pod Disruptions.You should confirm with your cluster owner or service provider that they respect Pod Disruption Budgets.Protecting an Application with a PodDisruptionBudgetIdentify what application you want to protect with a PodDisruptionBudget (PDB).Think about how your application reacts to disruptions.Create a PDB definition as a YAML file.Create the PDB object from the YAML file.Identify an Application to ProtectThe most common use case when you want to protect an application specified by one of the built-in Kubernetes controllers:DeploymentReplicationControllerReplicaSetStatefulSetIn this case, make a note of the controller's .spec.selector; the same selector goes into the PDBs .spec.selector.From version 1.15 PDBs support custom controllers where the scale subresource is enabled.You can also use PDBs with pods which are not controlled by one of the above controllers, or arbitrary groups of pods, but there are some restrictions, described in Arbitrary workloads and arbitrary selectors.Think about how your application reacts to disruptionsDecide how many instances can be down at the same time for a short period due to a voluntary disruption.Stateless frontends:Concern: don't reduce serving capacity by more than 10%.Solution: use PDB with minAvailable 90% for example.Single-instance Stateful Application:Concern: do not terminate this application without talking to me.Possible Solution 1: Do not use a PDB and tolerate occasional downtime.Possible Solution 2: Set PDB with maxUnavailable=0. Have an understanding (outside of Kubernetes) that the cluster operator needs to consult you before termination. When the cluster operator contacts you, prepare for downtime, and then delete the PDB to indicate readiness for disruption. Recreate afterwards.Multiple-instance Stateful application such as Consul, ZooKeeper, or etcd:Concern: Do not reduce number of instances below quorum, otherwise writes fail.Possible Solution 1: set maxUnavailable to 1 (works with varying scale of application).Possible Solution 2: set minAvailable to quorum-size (e.g. 3 when scale is 5). (Allows more disruptions at once).Restartable Batch Job:Concern: Job needs to complete in case of voluntary disruption.Possible solution: Do not create a PDB. The Job controller will create a replacement pod.Rounding logic when specifying percentagesValues for minAvailable or maxUnavailable can be expressed as integers or as a percentage.When you specify an integer, it represents a number of Pods. For instance, if you set minAvailable to 10, then 10 Pods must always be available, even during a disruption.When you specify a percentage by setting the value to a string representation of a percentage (eg. \"50%\"), it represents a percentage of total Pods. For instance, if you set minAvailable to \"50%\", then at least 50% of the Pods remain available during a disruption.When you specify the value as a percentage, it may not map to an exact number of Pods. For example, if you have 7 Pods and you set minAvailable to \"50%\", it's not immediately obvious whether that means 3 Pods or 4 Pods must be available. Kubernetes rounds up to the nearest integer, so in this case, 4 Pods must be available. When you specify the value maxUnavailable as a percentage, Kubernetes rounds up the number of Pods that may be disrupted. Thereby a disruption can exceed your", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5913"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5914"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f mypdb.yaml\n```\n\nSpecifying a Disruption Budget for your Application | Use kubectl to check that your PDB is created.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5915"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\nSpecifying a Disruption Budget for your Application | If there are matching pods (say, 3), then you would see something like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5916"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\nSpecifying a Disruption Budget for your Application | The non-zero value for ALLOWED DISRUPTIONS means that the disruption controller has seen the pods, counted the matching pods, and updated the status of the PDB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5917"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets zk-pdb -o yaml\n```\n\nSpecifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5918"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  annotations:\n…\n  creationTimestamp: \"2020-03-04T04:22:56Z\"\n  generation: 1\n  name: zk-pdb\n…\nstatus:\n  currentHealthy: 3\n  desiredHealthy: 2\n  disruptionsAllowed: 1\n  expectedPods: 3\n  observedGeneration: 1\n```\n\nSpecifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5919"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5920"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5921"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  annotations:\n…\n  creationTimestamp: \"2020-03-04T04:22:56Z\"\n  generation: 1\n  name: zk-pdb\n…\nstatus:\n  currentHealthy: 3\n  desiredHealthy: 2\n  disruptionsAllowed: 1\n  expectedPods: 3\n  observedGeneration: 1\n```\n\nSpecifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5922"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\npolicy/zookeeper-pod-disruption-budget-minavailable.yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5923"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5924"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\npolicy/zookeeper-pod-disruption-budget-maxunavailable.yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5925"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\nSpecifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5926"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f mypdb.yaml\n```\n\nSpecifying a Disruption Budget for your Application | Use kubectl to check that your PDB is created.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5927"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\nSpecifying a Disruption Budget for your Application | If there are matching pods (say, 3), then you would see something like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5928"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\nSpecifying a Disruption Budget for your Application | The non-zero value for ALLOWED DISRUPTIONS means that the disruption controller has seen the pods, counted the matching pods, and updated the status of the PDB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5929"}
{"instruction": "Write a bash example for specifying a disruption budget for your application", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets zk-pdb -o yaml\n```\n\nSpecifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5930"}
{"instruction": "Write a yaml example for specifying a disruption budget for your application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  annotations:\n…\n  creationTimestamp: \"2020-03-04T04:22:56Z\"\n  generation: 1\n  name: zk-pdb\n…\nstatus:\n  currentHealthy: 3\n  desiredHealthy: 2\n  disruptionsAllowed: 1\n  expectedPods: 3\n  observedGeneration: 1\n```\n\nSpecifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/run-application/configure-pdb/", "id": "k8s_00469_code_5931"}
{"instruction": "What is the reference documentation for kube-apiserver configuration (v1beta1)?", "response": "kube-apiserver Configuration (v1beta1)Package v1beta1 is the v1beta1 version of the API.Resource TypesAuthenticationConfigurationAuthorizationConfigurationEgressSelectorConfigurationTracingConfigurationTracingConfigurationAppears in:KubeletConfigurationTracingConfigurationTracingConfigurationTracingConfiguration provides versioned configuration for OpenTelemetry tracing clients.FieldDescriptionendpointstringEndpoint of the collector this component will report traces to. The connection is insecure, and does not currently support TLS. Recommended is unset, and endpoint is the otlp grpc default, localhost:4317.samplingRatePerMillionint32SamplingRatePerMillion is the number of samples to collect per million spans. Recommended is unset. If unset, sampler respects its parent span's sampling rate, but otherwise never samples.AuthenticationConfigurationAuthenticationConfiguration provides versioned configuration for authentication.FieldDescriptionapiVersionstringapiserver.k8s.io/v1beta1kindstringAuthenticationConfigurationjwt [Required][]JWTAuthenticatorjwt is a list of authenticator to authenticate Kubernetes users using JWT compliant tokens. The authenticator will attempt to parse a raw ID token, verify it's been signed by the configured issuer. The public key to verify the signature is discovered from the issuer's public endpoint using OIDC discovery. For an incoming token, each JWT authenticator will be attempted in the order in which it is specified in this list. Note however that other authenticators may run before or after the JWT authenticators. The specific position of JWT authenticators in relation to other authenticators is neither defined nor stable across releases. Since each JWT authenticator must have a unique issuer URL, at most one JWT authenticator will attempt to cryptographically validate the token.The minimum valid JWT payload must contain the following claims: { \"iss\": \"https://issuer.example.com\", \"aud\": [\"audience\"], \"exp\": 1234567890, \"\": \"username\" }anonymous [Required]AnonymousAuthConfigIf present --anonymous-auth must not be setAuthorizationConfigurationFieldDescriptionapiVersionstringapiserver.k8s.io/v1beta1kindstringAuthorizationConfigurationauthorizers [Required][]AuthorizerConfigurationAuthorizers is an ordered list of authorizers to authorize requests against. This is similar to the --authorization-modes kube-apiserver flag Must be at least one.EgressSelectorConfigurationEgressSelectorConfiguration provides versioned configuration for egress selector clients.FieldDescriptionapiVersionstringapiserver.k8s.io/v1beta1kindstringEgressSelectorConfigurationegressSelections [Required][]EgressSelectionconnectionServices contains a list of egress selection client configurationsTracingConfigurationTracingConfiguration provides versioned configuration for tracing clients.FieldDescriptionapiVersionstringapiserver.k8s.io/v1beta1kindstringTracingConfigurationTracingConfiguration [Required]TracingConfiguration(Members of TracingConfiguration are embedded into this type.)Embed the component config tracing configuration structAnonymousAuthConditionAppears in:AnonymousAuthConfigAnonymousAuthCondition describes the condition under which anonymous auth should be enabled.FieldDescriptionpath [Required]stringPath for which anonymous auth is enabled.AnonymousAuthConfigAppears in:AuthenticationConfigurationAnonymousAuthConfig provides the configuration for the anonymous authenticator.FieldDescriptionenabled [Required]boolNo description provided.conditions [Required][]AnonymousAuthConditionIf set, anonymous auth is only allowed if the request meets one of the conditions.AudienceMatchPolicyType(Alias of string)Appears in:IssuerAudienceMatchPolicyType is a set of valid values for issuer.audienceMatchPolicyAuthorizerConfigurationAppears in:AuthorizationConfigurationFieldDescriptiontype [Required]stringType refers to the type of the authorizer \"Webhook\" is supported in the generic API server Other API servers may support additional", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-config.v1beta1/", "id": "k8s_00470"}
{"instruction": "Provide a tutorial on exposing an external ip address to access an application in a cluster", "response": "Exposing an External IP Address to Access an Application in a ClusterThis page shows how to create a Kubernetes Service object that exposes an external IP address.Before you beginInstall kubectl.Use a cloud provider like Google Kubernetes Engine or Amazon Web Services to create a Kubernetes cluster. This tutorial creates an external load balancer, which requires a cloud provider.Configure kubectl to communicate with your Kubernetes API server. For instructions, see the documentation for your cloud provider.ObjectivesRun five instances of a Hello World application.Create a Service object that exposes an external IP address.Use the Service object to access the running application.Creating a service for an application running in five podsRun a Hello World application in your cluster:service/load-balancer-example.yaml apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/name: load-balancer-example name: hello-world spec: replicas: 5 selector: matchLabels: app.kubernetes.io/name: load-balancer-example template: metadata: labels: app.kubernetes.io/name: load-balancer-example spec: containers: - image: gcr.io/google-samples/hello-app:2.0 name: hello-world ports: - containerPort: 8080 kubectl apply -f https://k8s.io/examples/service/load-balancer-example.yaml The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.Display information about the Deployment:kubectl get deployments hello-world kubectl describe deployments hello-world Display information about your ReplicaSet objects:kubectl get replicasets kubectl describe replicasets Create a Service object that exposes the deployment:kubectl expose deployment hello-world --type=LoadBalancer --name=my-service Display information about the Service:kubectl get services my-service The output is similar to:NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE my-service LoadBalancer 10.3.245.137 104.198.205.71 8080/TCP 54s Note:The type=LoadBalancer service is backed by external cloud providers, which is not covered in this example, please refer to this page for the details.Note:If the external IP address is shown as <pending>, wait for a minute and enter the same command again.Display detailed information about the Service:kubectl describe services my-service The output is similar to:Name: my-service Namespace: default Labels: app.kubernetes.io/name=load-balancer-example Annotations: <none> Selector: app.kubernetes.io/name=load-balancer-example Type: LoadBalancer IP: 10.3.245.137 LoadBalancer Ingress: 104.198.205.71 Port: <unset> 8080/TCP NodePort: <unset> 32377/TCP Endpoints: 10.0.0.6:8080,10.0.1.6:8080,10.0.1.7:8080 + 2 more... Session Affinity: None Events: <none> Make a note of the external IP address (LoadBalancer Ingress) exposed by your service. In this example, the external IP address is 104.198.205.71. Also note the value of Port and NodePort. In this example, the Port is 8080 and the NodePort is 32377.In the preceding output, you can see that the service has several endpoints: 10.0.0.6:8080,10.0.1.6:8080,10.0.1.7:8080 + 2 more. These are internal addresses of the pods that are running the Hello World application. To verify these are pod addresses, enter this command:kubectl get pods --output=wide The output is similar to:NAME ... IP NODE hello-world-2895499144-1jaz9 ... 10.0.1.6 gke-cluster-1-default-pool-e0b8d269-1afc hello-world-2895499144-2e5uh ... 10.0.1.8 gke-cluster-1-default-pool-e0b8d269-1afc hello-world-2895499144-9m4h1 ... 10.0.0.6 gke-cluster-1-default-pool-e0b8d269-5v7a hello-world-2895499144-o4z13 ... 10.0.1.7 gke-cluster-1-default-pool-e0b8d269-1afc hello-world-2895499144-segjf ... 10.0.2.5 gke-cluster-1-default-pool-e0b8d269-cpuc Use the external IP address (LoadBalancer Ingress) to access the Hello World application:curl http://<external-ip>:<port> where <external-ip> is the external IP address (LoadBalancer Ingress) of your Service, and <port> is the value of Po", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471"}
{"instruction": "Write a yaml example for exposing an external ip address to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5934"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/load-balancer-example.yaml\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5935"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5936"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5937"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=LoadBalancer --name=my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Display information about the Service:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5938"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get services my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5939"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5940"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5941"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5942"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Learn more about connecting applications with services.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5943"}
{"instruction": "Write a yaml example for exposing an external ip address to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5944"}
{"instruction": "Write a yaml example for exposing an external ip address to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/load-balancer-example.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5945"}
{"instruction": "Write a yaml example for exposing an external ip address to access an application in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5946"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/load-balancer-example.yaml\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5947"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5948"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5949"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=LoadBalancer --name=my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Display information about the Service:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5950"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get services my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5951"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5952"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nExposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5953"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services my-service\n```\n\nExposing an External IP Address to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5954"}
{"instruction": "Write a bash example for exposing an external ip address to access an application in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\nExposing an External IP Address to Access an Application in a Cluster | Learn more about connecting applications with services.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/", "id": "k8s_00471_code_5955"}
{"instruction": "What is the reference documentation for admission control in kubernetes?", "response": "Admission Control in KubernetesThis page provides an overview of admission controllers.An admission controller is a piece of code that intercepts requests to the Kubernetes API server prior to persistence of the resource, but after the request is authenticated and authorized.Several important features of Kubernetes require an admission controller to be enabled in order to properly support the feature. As a result, a Kubernetes API server that is not properly configured with the right set of admission controllers is an incomplete server that will not support all the features you expect.What are they?Admission controllers are code within the Kubernetes API server that check the data arriving in a request to modify a resource.Admission controllers apply to requests that create, delete, or modify objects. Admission controllers can also block custom verbs, such as a request to connect to a pod via an API server proxy. Admission controllers do not (and cannot) block requests to read (get, watch or list) objects, because reads bypass the admission control layer.Admission control mechanisms may be validating, mutating, or both. Mutating controllers may modify the data for the resource being modified; validating controllers may not.The admission controllers in Kubernetes 1.34 consist of the list below, are compiled into the kube-apiserver binary, and may only be configured by the cluster administrator.Admission control extension pointsWithin the full list, there are three special controllers: MutatingAdmissionWebhook, ValidatingAdmissionWebhook, and ValidatingAdmissionPolicy. The two webhook controllers execute the mutating and validating (respectively) admission control webhooks which are configured in the API. ValidatingAdmissionPolicy provides a way to embed declarative validation code within the API, without relying on any external HTTP callouts.You can use these three admission controllers to customize cluster behavior at admission time.Admission control phasesThe admission control process proceeds in two phases. In the first phase, mutating admission controllers are run. In the second phase, validating admission controllers are run. Note again that some of the controllers are both.If any of the controllers in either phase reject the request, the entire request is rejected immediately and an error is returned to the end-user.Finally, in addition to sometimes mutating the object in question, admission controllers may sometimes have side effects, that is, mutate related resources as part of request processing. Incrementing quota usage is the canonical example of why this is necessary. Any such side-effect needs a corresponding reclamation or reconciliation process, as a given admission controller does not know for sure that a given request will pass all of the other admission controllers.The ordering of these calls can be seen below.Why do I need them?Several important features of Kubernetes require an admission controller to be enabled in order to properly support the feature. As a result, a Kubernetes API server that is not properly configured with the right set of admission controllers is an incomplete server and will not support all the features you expect.How do I turn on an admission controller?The Kubernetes API server flag enable-admission-plugins takes a comma-delimited list of admission control plugins to invoke prior to modifying objects in the cluster. For example, the following command line enables the NamespaceLifecycle and the LimitRanger admission control plugins:kube-apiserver --enable-admission-plugins=NamespaceLifecycle,LimitRanger ... Note:Depending on the way your Kubernetes cluster is deployed and how the API server is started, you may need to apply the settings in different ways. For example, you may have to modify the systemd unit file if the API server is deployed as a systemd service, you may modify the manifest file for the API server if Kubernetes is deployed in a self-hosted way.How do I turn off an admi", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: EventRateLimit\n    path: eventconfig.yaml\n...\n```\n\nAdmission Control in Kubernetes | There are four types of limits that can be specified in the configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5957"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: eventratelimit.admission.k8s.io/v1alpha1\nkind: Configuration\nlimits:\n  - type: Namespace\n    qps: 50\n    burst: 100\n    cacheSize: 2000\n  - type: User\n    qps: 10\n    burst: 50\n```\n\nAdmission Control in Kubernetes | See the EventRateLimit Config API (v1alpha1) for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5958"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    path: imagepolicyconfig.yaml\n...\n```\n\nAdmission Control in Kubernetes | Alternatively, you can embed the configuration directly in the file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5959"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    configuration:\n      imagePolicy:\n        kubeConfigFile: <path-to-kubeconfig-file>\n        allowTTL: 50\n        denyTTL: 50\n        retryBackoff: 500\n        defaultAllow: true\n```\n\nAdmission Control in Kubernetes | The ImagePolicyWebhook config file must reference a kubeconfig formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5960"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: gluster-vol-default\nprovisioner: kubernetes.io/glusterfs\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\nAdmission Control in Kubernetes | For more information about persistent volume claims, see PersistentVolumeClaims.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5961"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodNodeSelector\n  path: podnodeselector.yaml\n...\n```\n\nAdmission Control in Kubernetes | PodNodeSelector uses the annotation key scheduler.alpha.kubernetes.io/node-selector to assign node selectors to namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5962"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  annotations:\n    scheduler.alpha.kubernetes.io/node-selector: name-of-node-selector\n  name: namespace3\n```\n\nAdmission Control in Kubernetes | This admission controller has the following behavior:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5963"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: apps-that-need-nodes-exclusively\n  annotations:\n    scheduler.alpha.kubernetes.io/defaultTolerations: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n    scheduler.alpha.kubernetes.io/tolerationsWhitelist: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n```\n\nAdmission Control in Kubernetes | This admission controller is disabled by default.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5964"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: EventRateLimit\n    path: eventconfig.yaml\n...\n```\n\nAdmission Control in Kubernetes | There are four types of limits that can be specified in the configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5965"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: eventratelimit.admission.k8s.io/v1alpha1\nkind: Configuration\nlimits:\n  - type: Namespace\n    qps: 50\n    burst: 100\n    cacheSize: 2000\n  - type: User\n    qps: 10\n    burst: 50\n```\n\nAdmission Control in Kubernetes | See the EventRateLimit Config API (v1alpha1) for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5966"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\nimagePolicy:\n  kubeConfigFile: /path/to/kubeconfig/for/backend\n  # time in s to cache approval\n  allowTTL: 50\n  # time in s to cache denial\n  denyTTL: 50\n  # time in ms to wait between retries\n  retryBackoff: 500\n  # determines behavior if the webhook backend fails\n  defaultAllow: true\n```\n\nAdmission Control in Kubernetes | Reference the ImagePolicyWebhook configuration file from the file provided to the API server's command line flag --admission-control-config-file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5967"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    path: imagepolicyconfig.yaml\n...\n```\n\nAdmission Control in Kubernetes | Alternatively, you can embed the configuration directly in the file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5968"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    configuration:\n      imagePolicy:\n        kubeConfigFile: <path-to-kubeconfig-file>\n        allowTTL: 50\n        denyTTL: 50\n        retryBackoff: 500\n        defaultAllow: true\n```\n\nAdmission Control in Kubernetes | The ImagePolicyWebhook config file must reference a kubeconfig formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5969"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-imagepolicy-service\n    cluster:\n      certificate-authority: /path/to/ca.pem    # CA for verifying the remote service.\n      server: https://images.example.com/policy # URL of remote service to query. Must use 'https'.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook admission controller to use\n      client-key: /path/to/key.pem          # key matching the cert\n```\n\nAdmission Control in Kubernetes | For additional HTTP configuration, refer to the kubeconfig documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5970"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: gluster-vol-default\nprovisioner: kubernetes.io/glusterfs\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\nAdmission Control in Kubernetes | For more information about persistent volume claims, see PersistentVolumeClaims.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5971"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\npodNodeSelectorPluginConfig:\n  clusterDefaultNodeSelector: name-of-node-selector\n  namespace1: name-of-node-selector\n  namespace2: name-of-node-selector\n```\n\nAdmission Control in Kubernetes | Reference the PodNodeSelector configuration file from the file provided to the API server's command line flag --admission-control-config-file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5972"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodNodeSelector\n  path: podnodeselector.yaml\n...\n```\n\nAdmission Control in Kubernetes | PodNodeSelector uses the annotation key scheduler.alpha.kubernetes.io/node-selector to assign node selectors to namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5973"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  annotations:\n    scheduler.alpha.kubernetes.io/node-selector: name-of-node-selector\n  name: namespace3\n```\n\nAdmission Control in Kubernetes | This admission controller has the following behavior:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5974"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: apps-that-need-nodes-exclusively\n  annotations:\n    scheduler.alpha.kubernetes.io/defaultTolerations: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n    scheduler.alpha.kubernetes.io/tolerationsWhitelist: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n```\n\nAdmission Control in Kubernetes | This admission controller is disabled by default.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5975"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: EventRateLimit\n    path: eventconfig.yaml\n...\n```\n\nAdmission Control in Kubernetes | There are four types of limits that can be specified in the configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5976"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: eventratelimit.admission.k8s.io/v1alpha1\nkind: Configuration\nlimits:\n  - type: Namespace\n    qps: 50\n    burst: 100\n    cacheSize: 2000\n  - type: User\n    qps: 10\n    burst: 50\n```\n\nAdmission Control in Kubernetes | See the EventRateLimit Config API (v1alpha1) for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5977"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    path: imagepolicyconfig.yaml\n...\n```\n\nAdmission Control in Kubernetes | Alternatively, you can embed the configuration directly in the file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5978"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    configuration:\n      imagePolicy:\n        kubeConfigFile: <path-to-kubeconfig-file>\n        allowTTL: 50\n        denyTTL: 50\n        retryBackoff: 500\n        defaultAllow: true\n```\n\nAdmission Control in Kubernetes | The ImagePolicyWebhook config file must reference a kubeconfig formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5979"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: gluster-vol-default\nprovisioner: kubernetes.io/glusterfs\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\nAdmission Control in Kubernetes | For more information about persistent volume claims, see PersistentVolumeClaims.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5980"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodNodeSelector\n  path: podnodeselector.yaml\n...\n```\n\nAdmission Control in Kubernetes | PodNodeSelector uses the annotation key scheduler.alpha.kubernetes.io/node-selector to assign node selectors to namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5981"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  annotations:\n    scheduler.alpha.kubernetes.io/node-selector: name-of-node-selector\n  name: namespace3\n```\n\nAdmission Control in Kubernetes | This admission controller has the following behavior:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5982"}
{"instruction": "Write a yaml example for admission control in kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: apps-that-need-nodes-exclusively\n  annotations:\n    scheduler.alpha.kubernetes.io/defaultTolerations: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n    scheduler.alpha.kubernetes.io/tolerationsWhitelist: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n```\n\nAdmission Control in Kubernetes | This admission controller is disabled by default.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/", "id": "k8s_00472_code_5983"}
{"instruction": "How do you running automated tasks with a cronjob in Kubernetes?", "response": "Running Automated Tasks with a CronJobThis page shows how to run automated tasks using Kubernetes CronJob object.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesCreating a CronJobCron jobs require a config file. Here is a manifest for a CronJob that runs a simple demonstration task every minute:application/job/cronjob.yaml apiVersion: batch/v1 kind: CronJob metadata: name: hello spec: schedule: \"* * * * *\" jobTemplate: spec: template: spec: containers: - name: hello image: busybox:1.28 imagePullPolicy: IfNotPresent command: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure Run the example CronJob by using this command:kubectl create -f https://k8s.io/examples/application/job/cronjob.yaml The output is similar to this:cronjob.batch/hello created After creating the cron job, get its status using this command:kubectl get cronjob hello The output is similar to this:NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE hello */1 * * * * False 0 <none> 10s As you can see from the results of the command, the cron job has not scheduled or run any jobs yet. Watch for the job to be created in around one minute:kubectl get jobs --watch The output is similar to this:NAME COMPLETIONS DURATION AGE hello-4111706356 0/1 0s hello-4111706356 0/1 0s 0s hello-4111706356 1/1 5s 5s Now you've seen one running job scheduled by the \"hello\" cron job. You can stop watching the job and view the cron job again to see that it scheduled the job:kubectl get cronjob hello The output is similar to this:NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE hello */1 * * * * False 0 50s 75s You should see that the cron job hello successfully scheduled a job at the time specified in LAST SCHEDULE. There are currently 0 active jobs, meaning that the job has completed or failed.Now, find the pods that the last scheduled job created and view the standard output of one of the pods.Note:The job name is different from the pod name.# Replace \"hello-4111706356\" with the job name in your system pods=$(kubectl get pods --selector=job-name=hello-4111706356 --output=jsonpath={.items[*].metadata.name}) Show the pod log:kubectl logs $pods The output is similar to this:Fri Feb 22 11:02:09 UTC 2019 Hello from the Kubernetes cluster Deleting a CronJobWhen you don't need a cron job any more, delete it with kubectl delete cronjob <cronjob name>:kubectl delete cronjob hello Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473"}
{"instruction": "Write a yaml example for running automated tasks with a cronjob", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nRunning Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5985"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/job/cronjob.yaml\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5986"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5987"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs --watch\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5988"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5989"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob hello\n```\n\nRunning Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5990"}
{"instruction": "Write a yaml example for running automated tasks with a cronjob", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nRunning Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5991"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob <cronjob name>\n```\n\nRunning Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5992"}
{"instruction": "Write a yaml example for running automated tasks with a cronjob", "response": "Here's a yaml example:\n\n```yaml\napplication/job/cronjob.yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nRunning Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5993"}
{"instruction": "Write a yaml example for running automated tasks with a cronjob", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\nRunning Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5994"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/job/cronjob.yaml\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5995"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5996"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs --watch\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5997"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\nRunning Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5998"}
{"instruction": "Write a bash example for running automated tasks with a cronjob", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob hello\n```\n\nRunning Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/", "id": "k8s_00473_code_5999"}
{"instruction": "Explain the Kubernetes concept: Containers", "response": "ContainersTechnology for packaging an application along with its runtime dependencies.This page will discuss containers and container images, as well as their use in operations and solution development.The word container is an overloaded term. Whenever you use the word, check whether your audience uses the same definition.Each container that you run is repeatable; the standardization from having dependencies included means that you get the same behavior wherever you run it.Containers decouple applications from the underlying host infrastructure. This makes deployment easier in different cloud or OS environments.Each node in a Kubernetes cluster runs the containers that form the Pods assigned to that node. Containers in a Pod are co-located and co-scheduled to run on the same node.Container imagesA container image is a ready-to-run software package containing everything needed to run an application: the code and any runtime it requires, application and system libraries, and default values for any essential settings.Containers are intended to be stateless and immutable: you should not change the code of a container that is already running. If you have a containerized application and want to make changes, the correct process is to build a new image that includes the change, then recreate the container to start from the updated image.Container runtimesA fundamental component that empowers Kubernetes to run containers effectively. It is responsible for managing the execution and lifecycle of containers within the Kubernetes environment.Kubernetes supports container runtimes such as containerd, CRI-O, and any other implementation of the Kubernetes CRI (Container Runtime Interface).Usually, you can allow your cluster to pick the default container runtime for a Pod. If you need to use more than one container runtime in your cluster, you can specify the RuntimeClass for a Pod to make sure that Kubernetes runs those containers using a particular container runtime.You can also use RuntimeClass to run different Pods with the same container runtime but with different settings.Container EnvironmentContainer Lifecycle Hooks", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/", "id": "k8s_00474"}
{"instruction": "What is the reference documentation for configmap?", "response": "ConfigMapConfigMap holds configuration data for pods to consume.apiVersion: v1import \"k8s.io/api/core/v1\"ConfigMapConfigMap holds configuration data for pods to consume.apiVersion: v1kind: ConfigMapmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatabinaryData (map[string][]byte)BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet.data (map[string]string)Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process.immutable (boolean)Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.ConfigMapListConfigMapList is a resource containing a list of ConfigMap objects.apiVersion: v1kind: ConfigMapListmetadata (ListMeta)More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]ConfigMap), requiredItems is the list of ConfigMaps.Operationsget read the specified ConfigMapHTTP RequestGET /api/v1/namespaces/{namespace}/configmaps/{name}Parametersname (in path): string, requiredname of the ConfigMapnamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (ConfigMap): OK401: Unauthorizedlist list or watch objects of kind ConfigMapHTTP RequestGET /api/v1/namespaces/{namespace}/configmapsParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ConfigMapList): OK401: Unauthorizedlist list or watch objects of kind ConfigMapHTTP RequestGET /api/v1/configmapsParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ConfigMapList): OK401: Unauthorizedcreate create a ConfigMapHTTP RequestPOST /api/v1/namespaces/{namespace}/configmapsParametersnamespace (in path): string, requirednamespacebody: ConfigMap, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (ConfigMap): OK201 (ConfigMap): Created202 (ConfigMap): Accepted401: Unauthorizedupdate replace the specified ConfigMapHTTP RequestPUT /api/v1/namespaces/{namespace}/configmaps/{name}Parametersname (in path): string, requiredname of the ConfigMapnamespace (in path): string, requirednamespacebody: ConfigMap, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (ConfigMap): ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/config-map-v1/", "id": "k8s_00475"}
{"instruction": "Explain participating in sig docs in Kubernetes", "response": "Participating in SIG DocsSIG Docs is one of the special interest groups within the Kubernetes project, focused on writing, updating, and maintaining the documentation for Kubernetes as a whole. See SIG Docs from the community github repo for more information about the SIG.SIG Docs welcomes content and reviews from all contributors. Anyone can open a pull request (PR), and anyone is welcome to file issues about content or comment on pull requests in progress.You can also become a member, reviewer, or approver. These roles require greater access and entail certain responsibilities for approving and committing changes. See community-membership for more information on how membership works within the Kubernetes community.The rest of this document outlines some unique ways these roles function within SIG Docs, which is responsible for maintaining one of the most public-facing aspects of Kubernetes -- the Kubernetes website and documentation.SIG Docs chairpersonEach SIG, including SIG Docs, selects one or more SIG members to act as chairpersons. These are points of contact between SIG Docs and other parts of the Kubernetes organization. They require extensive knowledge of the structure of the Kubernetes project as a whole and how SIG Docs works within it. See Leadership for the current list of chairpersons.SIG Docs teams and automationAutomation in SIG Docs relies on two different mechanisms: GitHub teams and OWNERS files.GitHub teamsThere are two categories of SIG Docs teams on GitHub:@sig-docs-{language}-owners are approvers and leads@sig-docs-{language}-reviews are reviewersEach can be referenced with their @name in GitHub comments to communicate with everyone in that group.Sometimes Prow and GitHub teams overlap without matching exactly. For assignment of issues, pull requests, and to support PR approvals, the automation uses information from OWNERS files.OWNERS files and front-matterThe Kubernetes project uses an automation tool called prow for automation related to GitHub issues and pull requests. The Kubernetes website repository uses two prow plugins:blunderbussapproveThese two plugins use the OWNERS and OWNERS_ALIASES files in the top level of the kubernetes/website GitHub repository to control how prow works within the repository.An OWNERS file contains a list of people who are SIG Docs reviewers and approvers. OWNERS files can also exist in subdirectories, and can override who can act as a reviewer or approver of files in that subdirectory and its descendants. For more information about OWNERS files in general, see OWNERS.In addition, an individual Markdown file can list reviewers and approvers in its front-matter, either by listing individual GitHub usernames or GitHub groups.The combination of OWNERS files and front-matter in Markdown files determines the advice PR owners get from automated systems about who to ask for technical and editorial review of their PR.How merging worksWhen a pull request is merged to the branch used to publish content, that content is published to https://kubernetes.io. To ensure that the quality of our published content is high, we limit merging pull requests to SIG Docs approvers. Here's how it works.When a pull request has both the lgtm and approve labels, has no hold labels, and all tests are passing, the pull request merges automatically.Kubernetes organization members and SIG Docs approvers can add comments to prevent automatic merging of a given pull request (by adding a /hold comment or withholding a /lgtm comment).Any Kubernetes member can add the lgtm label by adding a /lgtm comment.Only SIG Docs approvers can merge a pull request by adding an /approve comment. Some approvers also perform additional specific roles, such as PR Wrangler or SIG Docs chairperson.What's nextFor more information about contributing to the Kubernetes documentation, see:Contributing new contentReviewing contentDocumentation style guideRoles and responsibilitiesIssue WranglersPR wranglers", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/participate/", "id": "k8s_00476"}
{"instruction": "Explain the Kubernetes concept: Pod Priority and Preemption", "response": "Pod Priority and PreemptionFEATURE STATE: Kubernetes v1.14 [stable]Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. If a Pod cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling of the pending Pod possible.Warning:In a cluster where not all users are trusted, a malicious user could create Pods at the highest possible priorities, causing other Pods to be evicted/not get scheduled. An administrator can use ResourceQuota to prevent users from creating pods at high priorities.See limit Priority Class consumption by default for details.How to use priority and preemptionTo use priority and preemption:Add one or more PriorityClasses.Create Pods withpriorityClassName set to one of the added PriorityClasses. Of course you do not need to create the Pods directly; normally you would add priorityClassName to the Pod template of a collection object like a Deployment.Keep reading for more information about these steps.Note:Kubernetes already ships with two PriorityClasses: system-cluster-critical and system-node-critical. These are common classes and are used to ensure that critical components are always scheduled first.PriorityClassA PriorityClass is a non-namespaced object that defines a mapping from a priority class name to the integer value of the priority. The name is specified in the name field of the PriorityClass object's metadata. The value is specified in the required value field. The higher the value, the higher the priority. The name of a PriorityClass object must be a valid DNS subdomain name, and it cannot be prefixed with system-.A PriorityClass object can have any 32-bit integer value smaller than or equal to 1 billion. This means that the range of values for a PriorityClass object is from -2147483648 to 1000000000 inclusive. Larger numbers are reserved for built-in PriorityClasses that represent critical system Pods. A cluster admin should create one PriorityClass object for each such mapping that they want.PriorityClass also has two optional fields: globalDefault and description. The globalDefault field indicates that the value of this PriorityClass should be used for Pods without a priorityClassName. Only one PriorityClass with globalDefault set to true can exist in the system. If there is no PriorityClass with globalDefault set, the priority of Pods with no priorityClassName is zero.The description field is an arbitrary string. It is meant to tell users of the cluster when they should use this PriorityClass.Notes about PodPriority and existing clustersIf you upgrade an existing cluster without this feature, the priority of your existing Pods is effectively zero.Addition of a PriorityClass with globalDefault set to true does not change the priorities of existing Pods. The value of such a PriorityClass is used only for Pods created after the PriorityClass is added.If you delete a PriorityClass, existing Pods that use the name of the deleted PriorityClass remain unchanged, but you cannot create more Pods that use the name of the deleted PriorityClass.Example PriorityClassapiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: name: high-priority value: 1000000 globalDefault: false description: \"This priority class should be used for XYZ service pods only.\" Non-preempting PriorityClassFEATURE STATE: Kubernetes v1.24 [stable]Pods with preemptionPolicy: Never will be placed in the scheduling queue ahead of lower-priority pods, but they cannot preempt other pods. A non-preempting pod waiting to be scheduled will stay in the scheduling queue, until sufficient resources are free, and it can be scheduled. Non-preempting pods, like other pods, are subject to scheduler back-off. This means that if the scheduler tries these pods and they cannot be scheduled, they will be retried with lower frequency, allowing other pods with lower priority to be scheduled before them.Non-preempting pods may still be preempted by other, high-priority pods.pr", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for XYZ service pods only.\"\n```\n\nPod Priority and Preemption | Pods with preemptionPolicy: Never will be placed in the scheduling queue ahead of lower-priority pods, but they cannot preempt other pods. A non-preempting pod waiting to be scheduled will stay in the", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6004"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority-nonpreempting\nvalue: 1000000\npreemptionPolicy: Never\nglobalDefault: false\ndescription: \"This priority class will not cause other pods to be preempted.\"\n```\n\nPod Priority and Preemption | After you have one or more PriorityClasses, you can create Pods that specify one of those PriorityClass names in their specifications. The priority admission controller uses the priorityClassName fiel", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6005"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  priorityClassName: high-priority\n```\n\nPod Priority and Preemption | When Pod priority is enabled, the scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. As a result, the", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6006"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for XYZ service pods only.\"\n```\n\nPod Priority and Preemption | Pods with preemptionPolicy: Never will be placed in the scheduling queue ahead of lower-priority pods, but they cannot preempt other pods. A non-preempting pod waiting to be scheduled will stay in the", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6007"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority-nonpreempting\nvalue: 1000000\npreemptionPolicy: Never\nglobalDefault: false\ndescription: \"This priority class will not cause other pods to be preempted.\"\n```\n\nPod Priority and Preemption | After you have one or more PriorityClasses, you can create Pods that specify one of those PriorityClass names in their specifications. The priority admission controller uses the priorityClassName fiel", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6008"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  priorityClassName: high-priority\n```\n\nPod Priority and Preemption | When Pod priority is enabled, the scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. As a result, the", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6009"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for XYZ service pods only.\"\n```\n\nPod Priority and Preemption | Pods with preemptionPolicy: Never will be placed in the scheduling queue ahead of lower-priority pods, but they cannot preempt other pods. A non-preempting pod waiting to be scheduled will stay in the", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6010"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority-nonpreempting\nvalue: 1000000\npreemptionPolicy: Never\nglobalDefault: false\ndescription: \"This priority class will not cause other pods to be preempted.\"\n```\n\nPod Priority and Preemption | After you have one or more PriorityClasses, you can create Pods that specify one of those PriorityClass names in their specifications. The priority admission controller uses the priorityClassName fiel", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6011"}
{"instruction": "Write a yaml example for pod priority and preemption", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  priorityClassName: high-priority\n```\n\nPod Priority and Preemption | When Pod priority is enabled, the scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. As a result, the", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/", "id": "k8s_00477_code_6012"}
{"instruction": "What is the reference documentation for event rate limit configuration (v1alpha1)?", "response": "Event Rate Limit Configuration (v1alpha1)Resource TypesConfigurationConfigurationConfiguration provides configuration for the EventRateLimit admission controller.FieldDescriptionapiVersionstringeventratelimit.admission.k8s.io/v1alpha1kindstringConfigurationlimits [Required][]Limitlimits are the limits to place on event queries received. Limits can be placed on events received server-wide, per namespace, per user, and per source+object. At least one limit is required.LimitAppears in:ConfigurationLimit is the configuration for a particular limit typeFieldDescriptiontype [Required]LimitTypetype is the type of limit to which this configuration appliesqps [Required]int32qps is the number of event queries per second that are allowed for this type of limit. The qps and burst fields are used together to determine if a particular event query is accepted. The qps determines how many queries are accepted once the burst amount of queries has been exhausted.burst [Required]int32burst is the burst number of event queries that are allowed for this type of limit. The qps and burst fields are used together to determine if a particular event query is accepted. The burst determines the maximum size of the allowance granted for a particular bucket. For example, if the burst is 10 and the qps is 3, then the admission control will accept 10 queries before blocking any queries. Every second, 3 more queries will be allowed. If some of that allowance is not used, then it will roll over to the next second, until the maximum allowance of 10 is reached.cacheSizeint32cacheSize is the size of the LRU cache for this type of limit. If a bucket is evicted from the cache, then the allowance for that bucket is reset. If more queries are later received for an evicted bucket, then that bucket will re-enter the cache with a clean slate, giving that bucket a full allowance of burst queries.The default cache size is 4096.If limitType is 'server', then cacheSize is ignored.LimitType(Alias of string)Appears in:LimitLimitType is the type of the limit (e.g., per-namespace)This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-eventratelimit.v1alpha1/", "id": "k8s_00478"}
{"instruction": "How do you allocate devices to workloads with dra in Kubernetes?", "response": "Allocate Devices to Workloads with DRAFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)This page shows you how to allocate devices to your Pods by using dynamic resource allocation (DRA). These instructions are for workload operators. Before reading this page, familiarize yourself with how DRA works and with DRA terminology like ResourceClaims and ResourceClaimTemplates. For more information, see Dynamic Resource Allocation (DRA).About device allocation with DRAAs a workload operator, you can claim devices for your workloads by creating ResourceClaims or ResourceClaimTemplates. When you deploy your workload, Kubernetes and the device drivers find available devices, allocate them to your Pods, and place the Pods on nodes that can access those devices.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be version v1.34.To check the version, enter kubectl version.Ensure that your cluster admin has set up DRA, attached devices, and installed drivers. For more information, see Set Up DRA in a Cluster.Identify devices to claimYour cluster administrator or the device drivers create DeviceClasses that define categories of devices. You can claim devices by using Common Expression Language to filter for specific device properties.Get a list of DeviceClasses in the cluster:kubectl get deviceclasses The output is similar to the following:NAME AGE driver.example.com 16m If you get a permission error, you might not have access to get DeviceClasses. Check with your cluster administrator or with the driver provider for available device properties.Claim resourcesYou can request resources from a DeviceClass by using ResourceClaims. To create a ResourceClaim, do one of the following:Manually create a ResourceClaim if you want multiple Pods to share access to the same devices, or if you want a claim to exist beyond the lifetime of a Pod.Use a ResourceClaimTemplate to let Kubernetes generate and manage per-Pod ResourceClaims. Create a ResourceClaimTemplate if you want every Pod to have access to separate devices that have similar configurations. For example, you might want simultaneous access to devices for Pods in a Job that uses parallel execution.If you directly reference a specific ResourceClaim in a Pod, that ResourceClaim must already exist in the cluster. If a referenced ResourceClaim doesn't exist, the Pod remains in a pending state until the ResourceClaim is created. You can reference an auto-generated ResourceClaim in a Pod, but this isn't recommended because auto-generated ResourceClaims are bound to the lifetime of the Pod that triggered the generation.To create a workload that claims resources, select one of the following options:Review the following example manifest:dra/resourceclaimtemplate.yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaimTemplate metadata: name: example-resource-claim-template spec: spec: devices: requests: - name: gpu-claim exactly: deviceClassName: example-device-class selectors: - cel: expression: |- device.attributes[\"driver.example.com\"].type == \"gpu\" && device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\") This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:Devices that have a driver.example.com/type attribute with a value of gpu.Devices that have 64Gi of capacity.To create the ResourceClaimTemplate, run the following command:kubectl apply -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml Review the following example manifest:dra/resourceclaim.yaml apiVersion: r", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\nAllocate Devices to Workloads with DRA | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6015"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6016"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\nAllocate Devices to Workloads with DRA | Review the following example manifest:dra/resourceclaim.yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaim metadata: name: example-resource-claim spec: devices: requests: - name: sing", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6017"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6018"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\nAllocate Devices to Workloads with DRA | To request device allocation, specify a ResourceClaim or a ResourceClaimTemplate in the resourceClaims field of the Pod specification. Then, request a specific claim by name in the resources.claims fi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6019"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\nAllocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6020"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\nAllocate Devices to Workloads with DRA | Try the following troubleshooting steps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6021"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\nAllocate Devices to Workloads with DRA | To delete your resource claims, run one of the following commands:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6022"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\nAllocate Devices to Workloads with DRA | Delete the ResourceClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6023"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\nAllocate Devices to Workloads with DRA |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6024"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6025"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6026"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\nAllocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6027"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\nAllocate Devices to Workloads with DRA | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6028"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/resourceclaimtemplate.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6029"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6030"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\nAllocate Devices to Workloads with DRA | Review the following example manifest:dra/resourceclaim.yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaim metadata: name: example-resource-claim spec: devices: requests: - name: sing", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6031"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/resourceclaim.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6032"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\nAllocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6033"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\nAllocate Devices to Workloads with DRA | To request device allocation, specify a ResourceClaim or a ResourceClaimTemplate in the resourceClaims field of the Pod specification. Then, request a specific claim by name in the resources.claims fi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6034"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/dra-example-job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\nAllocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6035"}
{"instruction": "Write a yaml example for allocate devices to workloads with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\nAllocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6036"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\nAllocate Devices to Workloads with DRA | Try the following troubleshooting steps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6037"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\nAllocate Devices to Workloads with DRA | To delete your resource claims, run one of the following commands:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6038"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\nAllocate Devices to Workloads with DRA | Delete the ResourceClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6039"}
{"instruction": "Write a bash example for allocate devices to workloads with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\nAllocate Devices to Workloads with DRA |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-resources/allocate-devices-dra/", "id": "k8s_00479_code_6040"}
{"instruction": "Provide a tutorial on using source ip", "response": "Using Source IPApplications running in a Kubernetes cluster find and communicate with each other, and the outside world, through the Service abstraction. This document explains what happens to the source IP of packets sent to different types of Services, and how you can toggle this behavior according to your needs.Before you beginTerminologyThis document makes use of the following terms:NATNetwork address translationSource NATReplacing the source IP on a packet; in this page, that usually means replacing with the IP address of a node.Destination NATReplacing the destination IP on a packet; in this page, that usually means replacing with the IP address of a PodVIPA virtual IP address, such as the one assigned to every Service in Kuberneteskube-proxyA network daemon that orchestrates Service VIP management on every nodePrerequisitesYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesThe examples use a small nginx webserver that echoes back the source IP of requests it receives through an HTTP header. You can create it as follows:Note:The image in the following command only runs on AMD64 architectures.kubectl create deployment source-ip-app --image=registry.k8s.io/echoserver:1.10 The output is:deployment.apps/source-ip-app created ObjectivesExpose a simple application through various types of ServicesUnderstand how each Service type handles source IP NATUnderstand the tradeoffs involved in preserving source IPSource IP for Services with Type=ClusterIPPackets sent to ClusterIP from within the cluster are never source NAT'd if you're running kube-proxy in iptables mode, (the default). You can query the kube-proxy mode by fetching http://localhost:10249/proxyMode on the node where kube-proxy is running.kubectl get nodes The output is similar to this:NAME STATUS ROLES AGE VERSION kubernetes-node-6jst Ready <none> 2h v1.13.0 kubernetes-node-cx31 Ready <none> 2h v1.13.0 kubernetes-node-jj1t Ready <none> 2h v1.13.0 Get the proxy mode on one of the nodes (kube-proxy listens on port 10249):# Run this in a shell on the node you want to query. curl http://localhost:10249/proxyMode The output is:iptables You can test source IP preservation by creating a Service over the source IP app:kubectl expose deployment source-ip-app --name=clusterip --port=80 --target-port=8080 The output is:service/clusterip exposed kubectl get svc clusterip The output is similar to:NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE clusterip ClusterIP 10.0.170.92 <none> 80/TCP 51s And hitting the ClusterIP from a pod in the same cluster:kubectl run busybox -it --image=busybox:1.28 --restart=Never --rm The output is similar to this:Waiting for pod default/busybox to be running, status is Pending, pod ready: false If you don't see a command prompt, try pressing enter. You can then run a command inside that Pod:# Run this inside the terminal from \"kubectl run\" ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue link/ether 0a:58:0a:f4:03:08 brd ff:ff:ff:ff:ff:ff inet 10.244.3.8/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::188a:84ff:feb0:26a5/64 scope link valid_lft forever preferred_lft forever …then use wget to query the local webserver# Replace \"10.0.170.92\" with the IPv4 address of the Service named \"clusterip\" wget -qO - 10.0.170.92 CLIENT VALUES: client_address=10.244.3.8 command=GET ... The client_address is always th", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment source-ip-app --image=registry.k8s.io/echoserver:1.10\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6042"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=clusterip --port=80 --target-port=8080\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6043"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get svc clusterip\n```\n\nUsing Source IP | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6044"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox -it --image=busybox:1.28 --restart=Never --rm\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6045"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=nodeport --port=80 --target-port=8080 --type=NodePort\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6046"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc nodeport -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6047"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=loadbalancer --port=80 --target-port=8080 --type=LoadBalancer\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6048"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6049"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc loadbalancer -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\nUsing Source IP | You should immediately see the service.spec.healthCheckNodePort field allocated by Kubernetes:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6050"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer -o yaml | grep -i healthCheckNodePort\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6051"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -o wide -l app=source-ip-app\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6052"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc -l app=source-ip-app\n```\n\nUsing Source IP | Delete the Deployment, ReplicaSet and Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6053"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment source-ip-app\n```\n\nUsing Source IP |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6054"}
{"instruction": "Write a yaml example for using source ip", "response": "Here's a yaml example:\n\n```yaml\nhealthCheckNodePort: 32122\n```\n\nUsing Source IP | The service.spec.healthCheckNodePort field points to a port on every node serving the health check at /healthz. You can test this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6055"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment source-ip-app --image=registry.k8s.io/echoserver:1.10\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6056"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=clusterip --port=80 --target-port=8080\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6057"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get svc clusterip\n```\n\nUsing Source IP | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6058"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox -it --image=busybox:1.28 --restart=Never --rm\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6059"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=nodeport --port=80 --target-port=8080 --type=NodePort\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6060"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc nodeport -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6061"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=loadbalancer --port=80 --target-port=8080 --type=LoadBalancer\n```\n\nUsing Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6062"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6063"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc loadbalancer -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\nUsing Source IP | You should immediately see the service.spec.healthCheckNodePort field allocated by Kubernetes:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6064"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer -o yaml | grep -i healthCheckNodePort\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6065"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -o wide -l app=source-ip-app\n```\n\nUsing Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6066"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc -l app=source-ip-app\n```\n\nUsing Source IP | Delete the Deployment, ReplicaSet and Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6067"}
{"instruction": "Write a bash example for using source ip", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment source-ip-app\n```\n\nUsing Source IP |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/source-ip/", "id": "k8s_00480_code_6068"}
{"instruction": "Explain updating reference documentation in Kubernetes", "response": "Updating Reference DocumentationThe topics in this section document how to generate the Kubernetes reference guides.To build the reference documentation, see the following guide:Generating Reference Documentation QuickstartContributing to the Upstream Kubernetes CodeGenerating Reference Documentation for the Kubernetes APIGenerating Reference Documentation for kubectl CommandsGenerating Reference Documentation for MetricsGenerating Reference Pages for Kubernetes Components and Tools", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/", "id": "k8s_00481"}
{"instruction": "Explain the Kubernetes concept: Service Accounts", "response": "Service AccountsLearn about ServiceAccount objects in Kubernetes.This page introduces the ServiceAccount object in Kubernetes, providing information about how service accounts work, use cases, limitations, alternatives, and links to resources for additional guidance.What are service accounts?A service account is a type of non-human account that, in Kubernetes, provides a distinct identity in a Kubernetes cluster. Application Pods, system components, and entities inside and outside the cluster can use a specific ServiceAccount's credentials to identify as that ServiceAccount. This identity is useful in various situations, including authenticating to the API server or implementing identity-based security policies.Service accounts exist as ServiceAccount objects in the API server. Service accounts have the following properties:Namespaced: Each service account is bound to a Kubernetes namespace. Every namespace gets a default ServiceAccount upon creation.Lightweight: Service accounts exist in the cluster and are defined in the Kubernetes API. You can quickly create service accounts to enable specific tasks.Portable: A configuration bundle for a complex containerized workload might include service account definitions for the system's components. The lightweight nature of service accounts and the namespaced identities make the configurations portable.Service accounts are different from user accounts, which are authenticated human users in the cluster. By default, user accounts don't exist in the Kubernetes API server; instead, the API server treats user identities as opaque data. You can authenticate as a user account using multiple methods. Some Kubernetes distributions might add custom extension APIs to represent user accounts in the API server.Comparison between service accounts and usersDescriptionServiceAccountUser or groupLocationKubernetes API (ServiceAccount object)ExternalAccess controlKubernetes RBAC or other authorization mechanismsKubernetes RBAC or other identity and access management mechanismsIntended useWorkloads, automationPeopleDefault service accountsWhen you create a cluster, Kubernetes automatically creates a ServiceAccount object named default for every namespace in your cluster. The default service accounts in each namespace get no permissions by default other than the default API discovery permissions that Kubernetes grants to all authenticated principals if role-based access control (RBAC) is enabled. If you delete the default ServiceAccount object in a namespace, the control plane replaces it with a new one.If you deploy a Pod in a namespace, and you don't manually assign a ServiceAccount to the Pod, Kubernetes assigns the default ServiceAccount for that namespace to the Pod.Use cases for Kubernetes service accountsAs a general guideline, you can use service accounts to provide identities in the following scenarios:Your Pods need to communicate with the Kubernetes API server, for example in situations such as the following:Providing read-only access to sensitive information stored in Secrets.Granting cross-namespace access, such as allowing a Pod in namespace example to read, list, and watch for Lease objects in the kube-node-lease namespace.Your Pods need to communicate with an external service. For example, a workload Pod requires an identity for a commercially available cloud API, and the commercial provider allows configuring a suitable trust relationship.Authenticating to a private image registry using an imagePullSecret.An external service needs to communicate with the Kubernetes API server. For example, authenticating to the cluster as part of a CI/CD pipeline.You use third-party security software in your cluster that relies on the ServiceAccount identity of different Pods to group those Pods into different contexts.How to use service accountsTo use a Kubernetes service account, you do the following:Create a ServiceAccount object using a Kubernetes client like kubectl or a manifest that defines the o", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/security/service-accounts/", "id": "k8s_00482"}
{"instruction": "Write a yaml example for service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\nService Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/security/service-accounts/", "id": "k8s_00482_code_6071"}
{"instruction": "Write a yaml example for service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\nService Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/security/service-accounts/", "id": "k8s_00482_code_6072"}
{"instruction": "Write a yaml example for service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\nService Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/security/service-accounts/", "id": "k8s_00482_code_6073"}
{"instruction": "What is the reference documentation for kubectl create clusterrole?", "response": "kubectl create clusterroleSynopsisCreate a cluster role.kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none] Examples # Create a cluster role named \"pod-reader\" that allows user to perform \"get\", \"watch\" and \"list\" on pods kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods # Create a cluster role named \"pod-reader\" with ResourceName specified kubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod # Create a cluster role named \"foo\" with API Group specified kubectl create clusterrole foo --verb=get,list,watch --resource=rs.apps # Create a cluster role named \"foo\" with SubResource specified kubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status # Create a cluster role name \"foo\" with NonResourceURL specified kubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/* # Create a cluster role name \"monitoring\" with AggregationRule specified kubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\" Options--aggregation-rule <comma-separated 'key=value' pairs>An aggregation label selector for combining ClusterRoles.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for clusterrole--non-resource-url stringsA partial url that user should have access to.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--resource stringsResource that the rule applies to--resource-name stringsResource in the white list that the rule applies to, repeat this flag for multiple items--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.--verb stringsVerb that applies to the resources contained in the ruleParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--clien", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_clusterrole/", "id": "k8s_00483"}
{"instruction": "Write a bash example for kubectl create clusterrole", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\nkubectl create clusterrole | An aggregation label selector for combining ClusterRoles.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_clusterrole/", "id": "k8s_00483_code_6075"}
{"instruction": "Write a bash example for kubectl create clusterrole", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\nkubectl create clusterrole | An aggregation label selector for combining ClusterRoles.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_clusterrole/", "id": "k8s_00483_code_6076"}
{"instruction": "How do you install and set up kubectl on windows in Kubernetes?", "response": "Install and Set Up kubectl on WindowsBefore you beginYou must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.34 client can communicate with v1.33, v1.34, and v1.35 control planes. Using the latest compatible version of kubectl helps avoid unforeseen issues.Install kubectl on WindowsThe following methods exist for installing kubectl on Windows:Install kubectl binary on Windows (via direct download or curl)Install on Windows using Chocolatey, Scoop, or wingetInstall kubectl binary on Windows (via direct download or curl)You have two options for installing kubectl on your Windows deviceDirect download:Download the latest 1.34 patch release binary directly for your specific architecture by visiting the Kubernetes release page. Be sure to select the correct binary for your architecture (e.g., amd64, arm64, etc.).Using curl:If you have curl installed, use this command:curl.exe -LO \"https://dl.k8s.io/release/v1.34.0/bin/windows/amd64/kubectl.exe\" Note:To find out the latest stable version (for example, for scripting), take a look at https://dl.k8s.io/release/stable.txt.Validate the binary (optional)Download the kubectl checksum file:curl.exe -LO \"https://dl.k8s.io/v1.34.0/bin/windows/amd64/kubectl.exe.sha256\" Validate the kubectl binary against the checksum file:Using Command Prompt to manually compare CertUtil's output to the checksum file downloaded:CertUtil -hashfile kubectl.exe SHA256 type kubectl.exe.sha256 Using PowerShell to automate the verification using the -eq operator to get a True or False result: $(Get-FileHash -Algorithm SHA256 .\\kubectl.exe).Hash -eq $(Get-Content .\\kubectl.exe.sha256) Append or prepend the kubectl binary folder to your PATH environment variable.Test to ensure the version of kubectl is the same as downloaded:kubectl version --client Or use this for detailed view of version:kubectl version --client --output=yaml Note:Docker Desktop for Windows adds its own version of kubectl to PATH. If you have installed Docker Desktop before, you may need to place your PATH entry before the one added by the Docker Desktop installer or remove the Docker Desktop's kubectl.Install on Windows using Chocolatey, Scoop, or wingetTo install kubectl on Windows you can use either Chocolatey package manager, Scoop command-line installer, or winget package manager.choco install kubernetes-cli scoop install kubectl winget install -e --id Kubernetes.kubectl Test to ensure the version you installed is up-to-date:kubectl version --client Navigate to your home directory:# If you're using cmd.exe, run: cd %USERPROFILE% cd ~ Create the .kube directory:mkdir .kube Change to the .kube directory you just created:cd .kube Configure kubectl to use a remote Kubernetes cluster:New-Item config -type file Note:Edit the config file with a text editor of your choice, such as Notepad.Verify kubectl configurationIn order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cluster. By default, kubectl configuration is located at ~/.kube/config.Check that kubectl is properly configured by getting the cluster state:kubectl cluster-info If you see a URL response, kubectl is correctly configured to access your cluster.If you see a message similar to the following, kubectl is not configured correctly or is not able to connect to a Kubernetes cluster.The connection to the server <server-name:port> was refused - did you specify the right host or port? For example, if you are intending to run a Kubernetes cluster on your laptop (locally), you will need a tool like Minikube to be installed first and then re-run the commands stated above.If kubectl cluster-info returns the url response but you can't access your cluster, to check whether it is configured properly, use:kubectl cluster-info dump Troubleshooting the 'No Auth Provider Found' error messageIn Kubernetes 1.26, ku", "category": "tasks", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on Windows | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6078"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\nInstall and Set Up kubectl on Windows | To install kubectl on Windows you can use either Chocolatey package manager, Scoop command-line installer, or winget package manager.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6079"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on Windows | Navigate to your home directory:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6080"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nInstall and Set Up kubectl on Windows | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6081"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell | Out-String | Invoke-Expression\n```\n\nInstall and Set Up kubectl on Windows | This command will regenerate the auto-completion script on every PowerShell start up. You can also add the generated script directly to your $PROFILE file.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6082"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell >> $PROFILE\n```\n\nInstall and Set Up kubectl on Windows | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6083"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\nInstall and Set Up kubectl on Windows | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6084"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell\n```\n\nInstall and Set Up kubectl on Windows | To do so in all your shell sessions, add the following line to your $PROFILE file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6085"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on Windows | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6086"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\nInstall and Set Up kubectl on Windows | To install kubectl on Windows you can use either Chocolatey package manager, Scoop command-line installer, or winget package manager.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6087"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on Windows | Navigate to your home directory:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6088"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nInstall and Set Up kubectl on Windows | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6089"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell | Out-String | Invoke-Expression\n```\n\nInstall and Set Up kubectl on Windows | This command will regenerate the auto-completion script on every PowerShell start up. You can also add the generated script directly to your $PROFILE file.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6090"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell >> $PROFILE\n```\n\nInstall and Set Up kubectl on Windows | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6091"}
{"instruction": "Write a bash example for install and set up kubectl on windows", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\nInstall and Set Up kubectl on Windows | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/", "id": "k8s_00484_code_6092"}
{"instruction": "What is the reference documentation for kubectl config get-clusters?", "response": "kubectl config get-clustersSynopsisDisplay clusters defined in the kubeconfig.kubectl config get-clusters [flags] Examples # List the clusters that kubectl knows about kubectl config get-clusters Options-h, --helphelp for get-clustersParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-clusters/", "id": "k8s_00485"}
{"instruction": "Write a bash example for kubectl config get-clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters [flags]\n```\n\nkubectl config get-clusters | help for get-clusters", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-clusters/", "id": "k8s_00485_code_6094"}
{"instruction": "Write a bash example for kubectl config get-clusters", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters [flags]\n```\n\nkubectl config get-clusters | help for get-clusters", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-clusters/", "id": "k8s_00485_code_6095"}
{"instruction": "What is the reference documentation for localobjectreference?", "response": "LocalObjectReferenceLocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.import \"k8s.io/api/core/v1\"LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.name (string)Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#namesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/local-object-reference/", "id": "k8s_00486"}
{"instruction": "What is the reference documentation for kubectl explain?", "response": "kubectl explainSynopsisDescribe fields and structure of various resources.This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier: &lt;type&gt;.&lt;fieldName&gt;[.&lt;fieldName&gt;] Information about each field is retrieved from the server in OpenAPI format.Use \"kubectl api-resources\" for a complete list of supported resources.kubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2] Examples # Get the documentation of the resource and its fields kubectl explain pods # Get all the fields in the resource kubectl explain pods --recursive # Get the explanation for deployment in supported api versions kubectl explain deployments --api-version=apps/v1 # Get the documentation of a specific field of a resource kubectl explain pods.spec.containers # Get the documentation of resources in different format kubectl explain deployment --output=plaintext-openapiv2 Options--api-version stringGet different explanations for particular API version (API group/version)-h, --helphelp for explain-o, --output string Default: \"plaintext\"Format in which to render the schema (plaintext, plaintext-openapiv2)--recursivePrint the fields of fields (Currently only 1 level deep)Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_explain/", "id": "k8s_00487"}
{"instruction": "Write a bash example for kubectl explain", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2]\n```\n\nkubectl explain | Get different explanations for particular API version (API group/version)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_explain/", "id": "k8s_00487_code_6098"}
{"instruction": "Write a bash example for kubectl explain", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2]\n```\n\nkubectl explain | Get different explanations for particular API version (API group/version)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_explain/", "id": "k8s_00487_code_6099"}
{"instruction": "Explain the Kubernetes concept: ReplicaSet", "response": "ReplicaSetA ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. Usually, you define a Deployment and let that Deployment manage ReplicaSets automatically.A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. As such, it is often used to guarantee the availability of a specified number of identical Pods.How a ReplicaSet worksA ReplicaSet is defined with fields, including a selector that specifies how to identify Pods it can acquire, a number of replicas indicating how many Pods it should be maintaining, and a pod template specifying the data of new Pods it should create to meet the number of replicas criteria. A ReplicaSet then fulfills its purpose by creating and deleting Pods as needed to reach the desired number. When a ReplicaSet needs to create new Pods, it uses its Pod template.A ReplicaSet is linked to its Pods via the Pods' metadata.ownerReferences field, which specifies what resource the current object is owned by. All Pods acquired by a ReplicaSet have their owning ReplicaSet's identifying information within their ownerReferences field. It's through this link that the ReplicaSet knows of the state of the Pods it is maintaining and plans accordingly.A ReplicaSet identifies new Pods to acquire by using its selector. If there is a Pod that has no OwnerReference or the OwnerReference is not a Controller and it matches a ReplicaSet's selector, it will be immediately acquired by said ReplicaSet.When to use a ReplicaSetA ReplicaSet ensures that a specified number of pod replicas are running at any given time. However, a Deployment is a higher-level concept that manages ReplicaSets and provides declarative updates to Pods along with a lot of other useful features. Therefore, we recommend using Deployments instead of directly using ReplicaSets, unless you require custom update orchestration or don't require updates at all.This actually means that you may never need to manipulate ReplicaSet objects: use a Deployment instead, and define your application in the spec section.Examplecontrollers/frontend.yaml apiVersion: apps/v1 kind: ReplicaSet metadata: name: frontend labels: app: guestbook tier: frontend spec: # modify replicas according to your case replicas: 3 selector: matchLabels: tier: frontend template: metadata: labels: tier: frontend spec: containers: - name: php-redis image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5 Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.kubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml You can then get the current ReplicaSets deployed:kubectl get rs And see the frontend one you created:NAME DESIRED CURRENT READY AGE frontend 3 3 3 6s You can also check on the state of the ReplicaSet:kubectl describe rs/frontend And you will see output similar to:Name: frontend Namespace: default Selector: tier=frontend Labels: app=guestbook tier=frontend Annotations: <none> Replicas: 3 current / 3 desired Pods Status: 3 Running / 0 Waiting / 0 Succeeded / 0 Failed Pod Template: Labels: tier=frontend Containers: php-redis: Image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5 Port: <none> Host Port: <none> Environment: <none> Mounts: <none> Volumes: <none> Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal SuccessfulCreate 13s replicaset-controller Created pod: frontend-gbgfx Normal SuccessfulCreate 13s replicaset-controller Created pod: frontend-rwz57 Normal SuccessfulCreate 13s replicaset-controller Created pod: frontend-wkl7w And lastly you can check for the Pods brought up:kubectl get pods You should see Pod information similar to:NAME READY STATUS RESTARTS AGE frontend-gbgfx 1/1 Running 0 10m frontend-rwz57 1/1 Running 0 10m frontend-wkl7w 1/1 Running 0 10m You can also verify that the owner reference of these pods is set to the frontend ReplicaSet. ", "category": "concepts", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\nReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6101"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\nReplicaSet | You can then get the current ReplicaSets deployed:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6102"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl describe rs/frontend\n```\n\nReplicaSet | And you will see output similar to:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6103"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods frontend-gbgfx -o yaml\n```\n\nReplicaSet | The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6104"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\nReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6105"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\nReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6106"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\nReplicaSet | The new Pods will be acquired by the ReplicaSet, and then immediately terminated as the ReplicaSet would be over its desired count.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6107"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\nReplicaSet | And then create the ReplicaSet however:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6108"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\nReplicaSet | You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the number of its new Pods and the original matches its desired count. As fetching the", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6109"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Foreground\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\nReplicaSet | You can delete a ReplicaSet without affecting any of its Pods using kubectl delete with the --cascade=orphan option. When using the REST API or the client-go library, you must set propagationPolicy to", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6110"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Orphan\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\nReplicaSet | Once the original is deleted, you can create a new ReplicaSet to replace it. As long as the old and new .spec.selector are the same, then the new one will adopt the old Pods. However, it will not make", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6111"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\nReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6112"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/hpa-rs.yaml\n```\n\nReplicaSet | Alternatively, you can use the kubectl autoscale command to accomplish the same (and it's easier!)", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6113"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50\n```\n\nReplicaSet | Deployment is an object which can own ReplicaSets and update them and their Pods via declarative, server-side rolling updates. While ReplicaSets can be used independently, today they're mainly used by", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6114"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\nReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6115"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\nReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6116"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\nReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6117"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\nmatchLabels:\n  tier: frontend\n```\n\nReplicaSet | In the ReplicaSet, .spec.template.metadata.labels must match spec.selector, or it will be rejected by the API.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6118"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\nReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6119"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/frontend.yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\nReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6120"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\nReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6121"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\nReplicaSet | You can then get the current ReplicaSets deployed:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6122"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl describe rs/frontend\n```\n\nReplicaSet | And you will see output similar to:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6123"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods frontend-gbgfx -o yaml\n```\n\nReplicaSet | The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6124"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\nReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6125"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\npods/pod-rs.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\nReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6126"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\nReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6127"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\nReplicaSet | The new Pods will be acquired by the ReplicaSet, and then immediately terminated as the ReplicaSet would be over its desired count.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6128"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\nReplicaSet | And then create the ReplicaSet however:", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6129"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\nReplicaSet | You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the number of its new Pods and the original matches its desired count. As fetching the", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6130"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Foreground\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\nReplicaSet | You can delete a ReplicaSet without affecting any of its Pods using kubectl delete with the --cascade=orphan option. When using the REST API or the client-go library, you must set propagationPolicy to", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6131"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Orphan\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\nReplicaSet | Once the original is deleted, you can create a new ReplicaSet to replace it. As long as the old and new .spec.selector are the same, then the new one will adopt the old Pods. However, it will not make", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6132"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/hpa-rs.yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\nReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6133"}
{"instruction": "Write a yaml example for replicaset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\nReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6134"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/hpa-rs.yaml\n```\n\nReplicaSet | Alternatively, you can use the kubectl autoscale command to accomplish the same (and it's easier!)", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6135"}
{"instruction": "Write a bash example for replicaset", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50\n```\n\nReplicaSet | Deployment is an object which can own ReplicaSets and update them and their Pods via declarative, server-side rolling updates. While ReplicaSets can be used independently, today they're mainly used by", "category": "concepts_code", "subcategory": "workloads-controllers", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/", "id": "k8s_00488_code_6136"}
{"instruction": "How do you configure a pod to use a configmap in Kubernetes?", "response": "Configure a Pod to Use a ConfigMapMany applications rely on configuration which is used during either application initialization or runtime. Most times, there is a requirement to adjust values assigned to configuration parameters. ConfigMaps are a Kubernetes mechanism that let you inject configuration data into application pods.The ConfigMap concept allow you to decouple configuration artifacts from image content to keep containerized applications portable. For example, you can download and run the same container image to spin up containers for the purposes of local development, system test, or running a live end-user workload.This page provides a series of usage examples demonstrating how to create ConfigMaps and configure Pods using data stored in ConfigMaps.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou need to have the wget tool installed. If you have a different tool such as curl, and you do not have wget, you will need to adapt the step that downloads example data.Create a ConfigMapYou can use either kubectl create configmap or a ConfigMap generator in kustomization.yaml to create a ConfigMap.Create a ConfigMap using kubectl create configmapUse the kubectl create configmap command to create ConfigMaps from directories, files, or literal values:kubectl create configmap <map-name> <data-source> where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS subdomain name.When you are creating a ConfigMap based on a file, the key in the <data-source> defaults to the basename of the file, and the value defaults to the file content.You can use kubectl describe or kubectl get to retrieve information about a ConfigMap.Create a ConfigMap from a directoryYou can use kubectl create configmap to create a ConfigMap from multiple files in the same directory. When you are creating a ConfigMap based on a directory, kubectl identifies files whose filename is a valid key in the directory and packages each of those files into the new ConfigMap. Any directory entries except regular files are ignored (for example: subdirectories, symlinks, devices, pipes, and more).Note:Each filename being used for ConfigMap creation must consist of only acceptable characters, which are: letters (A to Z and a to z), digits (0 to 9), '-', '_', or '.'. If you use kubectl create configmap with a directory where any of the file names contains an unacceptable character, the kubectl command may fail.The kubectl command does not print an error when it encounters an invalid filename.Create the local directory:mkdir -p configure-pod-container/configmap/ Now, download the sample configuration and create the ConfigMap:# Download the sample files into `configure-pod-container/configmap/` directory wget https://kubernetes.io/examples/configmap/game.properties -O configure-pod-container/configmap/game.properties wget https://kubernetes.io/examples/configmap/ui.properties -O configure-pod-container/configmap/ui.properties # Create the ConfigMap kubectl create configmap game-config --from-file=configure-pod-container/configmap/ The above command packages each file, in this case, game.properties and ui.properties in the configure-pod-container/configmap/ directory into the game-config ConfigMap. You can display details of the ConfigMap using the following command:kubectl describe configmaps game-config The output is similar to this:Name: game-config Namespace: default Labels: <none> Annotations: <none> Data ==== game.properties: ---- enemies=aliens live", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap <map-name> <data-source>\n```\n\nConfigure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6138"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6139"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6140"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\nConfigure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6141"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6142"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\nConfigure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6143"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties\n```\n\nConfigure a Pod to Use a ConfigMap | You can display details of the game-config-2 ConfigMap using the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6144"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6145"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-env-file \\\n       --from-env-file=configure-pod-container/configmap/game-env-file.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce a ConfigMap. View the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6146"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap game-config-env-file -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | the output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6147"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\nConfigure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6148"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap config-multi-env-files \\\n        --from-env-file=configure-pod-container/configmap/game-env-file.properties \\\n        --from-env-file=configure-pod-container/configmap/ui-env-file.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6149"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap config-multi-env-files -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6150"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\nConfigure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6151"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=<my-key-name>=<path-to-file>\n```\n\nConfigure a Pod to Use a ConfigMap | where <my-key-name> is the key you want to use in the ConfigMap and <path-to-file> is the location of the data source file you want the key to represent.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6152"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6153"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config-3 -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6154"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\nConfigure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6155"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm\n```\n\nConfigure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6156"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps special-config -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6157"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\nConfigure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6158"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\nConfigure a Pod to Use a ConfigMap | and also:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6159"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps/game-config-4-m9dm2f92bt\n```\n\nConfigure a Pod to Use a ConfigMap | Notice that the generated ConfigMap name has a suffix appended by hashing the contents. This ensures that a new ConfigMap is generated each time the content is modified.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6160"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\nConfigure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6161"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very\n```\n\nConfigure a Pod to Use a ConfigMap | Assign the special.how value defined in the ConfigMap to the SPECIAL_LEVEL_KEY environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6162"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6163"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-single-configmap-env-variable.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variable SPECIAL_LEVEL_KEY=very.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6164"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6165"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6166"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6167"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-multiple-configmap-env-variable.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL_KEY=very and LOG_LEVEL=INFO.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6168"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\nkubectl delete configmap special-config\nkubectl delete configmap env-config\n```\n\nConfigure a Pod to Use a ConfigMap | Create a ConfigMap containing multiple key-value pairs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6169"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6170"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Use envFrom to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6171"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6172"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-envFrom.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL=very and SPECIAL_TYPE=charm.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6173"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | You can use ConfigMap-defined environment variables in the command and args of a container using the $(VAR_NAME) Kubernetes substitution syntax.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6174"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6175"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valueFrom.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | That pod produces the following output from the test-container container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6176"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod\n```\n\nConfigure a Pod to Use a ConfigMap | Once you're happy to move on, delete that Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6177"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | As explained in Create ConfigMaps from files, when you create a ConfigMap using --from-file, the filename becomes a key stored in the data section of the ConfigMap. The file contents become the key's", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6178"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6179"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Add the ConfigMap name under the volumes section of the Pod specification. This adds the ConfigMap data to the directory specified as volumeMounts.mountPath (in this case, /etc/config). The command se", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6180"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6181"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | When the pod runs, the command ls /etc/config/ produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6182"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | Use the path field to specify the desired file path for specific ConfigMap items. In this case, the SPECIAL_LEVEL item will be mounted in the config-volume volume at /etc/config/keys.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6183"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6184"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume-specific-key.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | When the pod runs, the command cat /etc/config/keys produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6185"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | You can project keys to specific paths. Refer to the corresponding section in the Secrets guide for the syntax.You can set POSIX permissions for keys. Refer to the corresponding section in the Secrets", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6186"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\nConfigure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6187"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6188"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6189"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\nConfigure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6190"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | Use the kubectl create configmap command to create ConfigMaps from directories, files, or literal values:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6191"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | Use the kubectl create configmap command to create ConfigMaps from directories, files, or literal values:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6192"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6193"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | Each filename being used for ConfigMap creation must consist of only acceptable characters, which are: letters (A to Z and a to z), digits (0 to 9), '-', '_', or '.'. If you use kubectl create configm", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6194"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | The kubectl command does not print an error when it encounters an invalid filename.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6195"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\nConfigure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6196"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | For example,", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6197"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\nConfigure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6198"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\nConfigure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6199"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config-3 -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6200"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\nConfigure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6201"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6202"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\nConfigure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6203"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\n---\n# kustomization.yaml contents for creating a ConfigMap from literals\nconfigMapGenerator:\n- name: special-config-2\n  literals:\n  - special.how=very\n  - special.type=charm\n```\n\nConfigure a Pod to Use a ConfigMap | Apply the kustomization directory to create the ConfigMap object:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6204"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\nConfigure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6205"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6206"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6207"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6208"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6209"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6210"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6211"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6212"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6213"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6214"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\nConfigure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6215"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap -o jsonpath='{.binaryData}' <name>\n```\n\nConfigure a Pod to Use a ConfigMap | Pods can load data from a ConfigMap that uses either data or binaryData.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6216"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6217"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6218"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\nConfigure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6219"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nrm kustomization.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | If you created a directory configure-pod-container and no longer need it, you should remove that too, or move it into the trash can / deleted files location.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6220"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nrm -r configure-pod-container\n```\n\nConfigure a Pod to Use a ConfigMap |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6221"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\nConfigure a Pod to Use a ConfigMap | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6222"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap <map-name> <data-source>\n```\n\nConfigure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6223"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6224"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6225"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\nConfigure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6226"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6227"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\nConfigure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6228"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties\n```\n\nConfigure a Pod to Use a ConfigMap | You can display details of the game-config-2 ConfigMap using the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6229"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6230"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-env-file \\\n       --from-env-file=configure-pod-container/configmap/game-env-file.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce a ConfigMap. View the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6231"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap game-config-env-file -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | the output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6232"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\nConfigure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6233"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap config-multi-env-files \\\n        --from-env-file=configure-pod-container/configmap/game-env-file.properties \\\n        --from-env-file=configure-pod-container/configmap/ui-env-file.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6234"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap config-multi-env-files -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6235"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\nConfigure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6236"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=<my-key-name>=<path-to-file>\n```\n\nConfigure a Pod to Use a ConfigMap | where <my-key-name> is the key you want to use in the ConfigMap and <path-to-file> is the location of the data source file you want the key to represent.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6237"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties\n```\n\nConfigure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6238"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\nConfigure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6239"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm\n```\n\nConfigure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6240"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps special-config -o yaml\n```\n\nConfigure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6241"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\nConfigure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6242"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\nConfigure a Pod to Use a ConfigMap | and also:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6243"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps/game-config-4-m9dm2f92bt\n```\n\nConfigure a Pod to Use a ConfigMap | Notice that the generated ConfigMap name has a suffix appended by hashing the contents. This ensures that a new ConfigMap is generated each time the content is modified.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6244"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\nConfigure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6245"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very\n```\n\nConfigure a Pod to Use a ConfigMap | Assign the special.how value defined in the ConfigMap to the SPECIAL_LEVEL_KEY environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6246"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/pod-single-configmap-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6247"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6248"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-single-configmap-env-variable.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variable SPECIAL_LEVEL_KEY=very.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6249"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmaps.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6250"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6251"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6252"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/pod-multiple-configmap-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6253"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6254"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-multiple-configmap-env-variable.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL_KEY=very and LOG_LEVEL=INFO.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6255"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\nkubectl delete configmap special-config\nkubectl delete configmap env-config\n```\n\nConfigure a Pod to Use a ConfigMap | Create a ConfigMap containing multiple key-value pairs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6256"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmap-multikeys.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6257"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6258"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Use envFrom to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6259"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-envFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6260"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6261"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-envFrom.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL=very and SPECIAL_TYPE=charm.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6262"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | You can use ConfigMap-defined environment variables in the command and args of a container using the $(VAR_NAME) Kubernetes substitution syntax.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6263"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-env-var-valueFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6264"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6265"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valueFrom.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | That pod produces the following output from the test-container container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6266"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod\n```\n\nConfigure a Pod to Use a ConfigMap | Once you're happy to move on, delete that Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6267"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | As explained in Create ConfigMaps from files, when you create a ConfigMap using --from-file, the filename becomes a key stored in the data section of the ConfigMap. The file contents become the key's", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6268"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmap-multikeys.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6269"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\nConfigure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6270"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | Add the ConfigMap name under the volumes section of the Pod specification. This adds the ConfigMap data to the directory specified as volumeMounts.mountPath (in this case, /etc/config). The command se", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6271"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-volume.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6272"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6273"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | When the pod runs, the command ls /etc/config/ produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6274"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | Use the path field to specify the desired file path for specific ConfigMap items. In this case, the SPECIAL_LEVEL item will be mounted in the config-volume volume at /etc/config/keys.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6275"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-volume-specific-key.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6276"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6277"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume-specific-key.yaml\n```\n\nConfigure a Pod to Use a ConfigMap | When the pod runs, the command cat /etc/config/keys produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6278"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\nConfigure a Pod to Use a ConfigMap | You can project keys to specific paths. Refer to the corresponding section in the Secrets guide for the syntax.You can set POSIX permissions for keys. Refer to the corresponding section in the Secrets", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6279"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\nConfigure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6280"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6281"}
{"instruction": "Write a yaml example for configure a pod to use a configmap", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\nConfigure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6282"}
{"instruction": "Write a bash example for configure a pod to use a configmap", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\nConfigure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/", "id": "k8s_00489_code_6283"}
{"instruction": "How do you configure service accounts for pods in Kubernetes?", "response": "Configure Service Accounts for PodsKubernetes offers two distinct ways for clients that run within your cluster, or that otherwise have a relationship to your cluster's control plane to authenticate to the API server.A service account provides an identity for processes that run in a Pod, and maps to a ServiceAccount object. When you authenticate to the API server, you identify yourself as a particular user. Kubernetes recognises the concept of a user, however, Kubernetes itself does not have a User API.This task guide is about ServiceAccounts, which do exist in the Kubernetes API. The guide shows you some ways to configure ServiceAccounts for Pods.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesUse the default service account to access the API serverWhen Pods contact the API server, Pods authenticate as a particular ServiceAccount (for example, default). There is always at least one ServiceAccount in each namespace.Every Kubernetes namespace contains at least one ServiceAccount: the default ServiceAccount for that namespace, named default. If you do not specify a ServiceAccount when you create a Pod, Kubernetes automatically assigns the ServiceAccount named default in that namespace.You can fetch the details for a Pod you have created. For example:kubectl get pods/<podname> -o yaml In the output, you see a field spec.serviceAccountName. Kubernetes automatically sets that value if you don't specify it when you create a Pod.An application running inside a Pod can access the Kubernetes API using automatically mounted service account credentials. See accessing the Cluster to learn more.When a Pod authenticates as a ServiceAccount, its level of access depends on the authorization plugin and policy in use.The API credentials are automatically revoked when the Pod is deleted, even if finalizers are in place. In particular, the API credentials are revoked 60 seconds beyond the .metadata.deletionTimestamp set on the Pod (the deletion timestamp is typically the time that the delete request was accepted plus the Pod's termination grace period).Opt out of API credential automountingIf you don't want the kubelet to automatically mount a ServiceAccount's API credentials, you can opt out of the default behavior. You can opt out of automounting API credentials on /var/run/secrets/kubernetes.io/serviceaccount/token for a service account by setting automountServiceAccountToken: false on the ServiceAccount:For example:apiVersion: v1 kind: ServiceAccount metadata: name: build-robot automountServiceAccountToken: false ... You can also opt out of automounting API credentials for a particular Pod:apiVersion: v1 kind: Pod metadata: name: my-pod spec: serviceAccountName: build-robot automountServiceAccountToken: false ... If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.Use more than one ServiceAccountEvery namespace has at least one ServiceAccount: the default ServiceAccount resource, called default. You can list all ServiceAccount resources in your current namespace with:kubectl get serviceaccounts The output is similar to this:NAME SECRETS AGE default 1 1d You can create additional ServiceAccount objects like this:kubectl apply -f - <<EOF apiVersion: v1 kind: ServiceAccount metadata: name: build-robot EOF The name of a ServiceAccount object must be a valid DNS subdomain name.If you get a complete dump of the service account object, like this:kubectl get serviceaccounts/build-robot -o yaml The output is similar to this:apiVersion: v1 kind: ServiceAccount metadata: creationTimestamp: 2019-0", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/<podname> -o yaml\n```\n\nConfigure Service Accounts for Pods | In the output, you see a field spec.serviceAccountName. Kubernetes automatically sets that value if you don't specify it when you create a Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6285"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\nConfigure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6286"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\nConfigure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6287"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6288"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nEOF\n```\n\nConfigure Service Accounts for Pods | The name of a ServiceAccount object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6289"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts/build-robot -o yaml\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6290"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\nConfigure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6291"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete serviceaccount/build-robot\n```\n\nConfigure Service Accounts for Pods | Suppose you have an existing service account named \"build-robot\" as mentioned earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6292"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot\n```\n\nConfigure Service Accounts for Pods | The output from that command is a token that you can use to authenticate as that ServiceAccount. You can request a specific token duration using the --duration command line argument to kubectl create", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6293"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot --bound-object-kind Node --bound-object-name node-001 --bound-object-uid 123...456\n```\n\nConfigure Service Accounts for Pods | The token will be valid until it expires or either the associated Node or service account are deleted.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6294"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\nEOF\n```\n\nConfigure Service Accounts for Pods | If you view the Secret using:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6295"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get secret/build-robot-secret -o yaml\n```\n\nConfigure Service Accounts for Pods | you can see that the Secret now contains an API token for the \"build-robot\" ServiceAccount.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6296"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe secrets/build-robot-secret\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6297"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry myregistrykey --docker-server=<registry name> \\\n        --docker-username=DUMMY_USERNAME --docker-password=DUMMY_DOCKER_PASSWORD \\\n        --docker-email=DUMMY_DOCKER_EMAIL\n```\n\nConfigure Service Accounts for Pods | Verify it has been created.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6298"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets myregistrykey\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6299"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl patch serviceaccount default -p '{\"imagePullSecrets\": [{\"name\": \"myregistrykey\"}]}'\n```\n\nConfigure Service Accounts for Pods | You can achieve the same outcome by editing the object manually:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6300"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl edit serviceaccount/default\n```\n\nConfigure Service Accounts for Pods | The output of the sa.yaml file is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6301"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\nConfigure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6302"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\nConfigure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6303"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=<registry name>/nginx --restart=Never\nkubectl get pod nginx -o=jsonpath='{.spec.imagePullSecrets[0].name}{\"\\n\"}'\n```\n\nConfigure Service Accounts for Pods | The output is:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6304"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\nConfigure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6305"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/pod-projected-svc-token.yaml\n```\n\nConfigure Service Accounts for Pods | The kubelet will: request and store the token on behalf of the Pod; make the token available to the Pod at a configurable file path; and refresh the token as it approaches expiration. The kubelet proa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6306"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\nConfigure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6307"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\nConfigure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6308"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\nConfigure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6309"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccount build-robot -o yaml\n```\n\nConfigure Service Accounts for Pods | You can't see the build-robot-secret Secret in the ServiceAccount API objects .secrets field because that field is only populated with auto-generated Secrets.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6310"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\nConfigure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6311"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\nConfigure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6312"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"aud\": [  # matches the requested audiences, or the API server's default audiences when none are explicitly requested\n    \"https://kubernetes.default.svc\"\n  ],\n  \"exp\": 1731613413,\n  \"iat\": 1700077413,\n  \"iss\": \"https://kubernetes.default.svc\",  # matches the first value passed to the --service-account-issuer flag\n  \"jti\": \"ea28ed49-2e11-4280-9ec5-bc3d1d84661a\", \n  \"kubernetes.io\": {\n    \"namespace\": \"kube-system\",\n    \"node\": {\n      \"name\": \"127.0.0.1\",\n      \"uid\": \"58456cb0-dd00-45ed-b797-5578fdceaced\"\n    },\n    \"pod\": {\n      \"name\": \"coredns-69cbfb9798-jv9gn\",\n      \"uid\": \"778a530c-b3f4-47c0-9cd5-ab018fb64f33\"\n    },\n    \"serviceaccount\": {\n      \"name\": \"coredns\",\n      \"uid\": \"a087d5a0-e1dd-43ec-93ac-f13d89cd13af\"\n    },\n    \"warnafter\": 1700081020\n  },\n  \"nbf\": 1700077413,\n  \"sub\": \"system:serviceaccount:kube-system:coredns\"\n}\n```\n\nConfigure Service Accounts for Pods | To provide a Pod with a token with an audience of vault and a validity duration of two hours, you could define a Pod manifest that is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6313"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\nConfigure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6314"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/<podname> -o yaml\n```\n\nConfigure Service Accounts for Pods | In the output, you see a field spec.serviceAccountName. Kubernetes automatically sets that value if you don't specify it when you create a Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6315"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\nConfigure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6316"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\nConfigure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6317"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6318"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nEOF\n```\n\nConfigure Service Accounts for Pods | The name of a ServiceAccount object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6319"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts/build-robot -o yaml\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6320"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\nConfigure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6321"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete serviceaccount/build-robot\n```\n\nConfigure Service Accounts for Pods | Suppose you have an existing service account named \"build-robot\" as mentioned earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6322"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot\n```\n\nConfigure Service Accounts for Pods | The output from that command is a token that you can use to authenticate as that ServiceAccount. You can request a specific token duration using the --duration command line argument to kubectl create", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6323"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot --bound-object-kind Node --bound-object-name node-001 --bound-object-uid 123...456\n```\n\nConfigure Service Accounts for Pods | The token will be valid until it expires or either the associated Node or service account are deleted.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6324"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\nEOF\n```\n\nConfigure Service Accounts for Pods | If you view the Secret using:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6325"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get secret/build-robot-secret -o yaml\n```\n\nConfigure Service Accounts for Pods | you can see that the Secret now contains an API token for the \"build-robot\" ServiceAccount.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6326"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe secrets/build-robot-secret\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6327"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry myregistrykey --docker-server=<registry name> \\\n        --docker-username=DUMMY_USERNAME --docker-password=DUMMY_DOCKER_PASSWORD \\\n        --docker-email=DUMMY_DOCKER_EMAIL\n```\n\nConfigure Service Accounts for Pods | Verify it has been created.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6328"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets myregistrykey\n```\n\nConfigure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6329"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl patch serviceaccount default -p '{\"imagePullSecrets\": [{\"name\": \"myregistrykey\"}]}'\n```\n\nConfigure Service Accounts for Pods | You can achieve the same outcome by editing the object manually:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6330"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl edit serviceaccount/default\n```\n\nConfigure Service Accounts for Pods | The output of the sa.yaml file is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6331"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\nConfigure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6332"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\nConfigure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6333"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=<registry name>/nginx --restart=Never\nkubectl get pod nginx -o=jsonpath='{.spec.imagePullSecrets[0].name}{\"\\n\"}'\n```\n\nConfigure Service Accounts for Pods | The output is:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6334"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\npods/pod-projected-svc-token.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\nConfigure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6335"}
{"instruction": "Write a yaml example for configure service accounts for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\nConfigure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6336"}
{"instruction": "Write a bash example for configure service accounts for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/pod-projected-svc-token.yaml\n```\n\nConfigure Service Accounts for Pods | The kubelet will: request and store the token on behalf of the Pod; make the token available to the Pod at a configurable file path; and refresh the token as it approaches expiration. The kubelet proa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", "id": "k8s_00490_code_6337"}
{"instruction": "What is the reference documentation for networkpolicy?", "response": "NetworkPolicyNetworkPolicy describes what network traffic is allowed for a set of Pods.apiVersion: networking.k8s.io/v1import \"k8s.io/api/networking/v1\"NetworkPolicyNetworkPolicy describes what network traffic is allowed for a set of PodsapiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (NetworkPolicySpec)spec represents the specification of the desired behavior for this NetworkPolicy.NetworkPolicySpecNetworkPolicySpec provides the specification of a NetworkPolicypodSelector (LabelSelector)podSelector selects the pods to which this NetworkPolicy object applies. The array of rules is applied to any pods selected by this field. An empty selector matches all pods in the policy's namespace. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is optional. If it is not specified, it defaults to an empty selector.policyTypes ([]string)Atomic: will be replaced during a mergepolicyTypes is a list of rule types that the NetworkPolicy relates to. Valid options are [\"Ingress\"], [\"Egress\"], or [\"Ingress\", \"Egress\"]. If this field is not specified, it will default based on the existence of ingress or egress rules; policies that contain an egress section are assumed to affect egress, and all policies (whether or not they contain an ingress section) are assumed to affect ingress. If you want to write an egress-only policy, you must explicitly specify policyTypes [ \"Egress\" ]. Likewise, if you want to write a policy that specifies that no egress is allowed, you must specify a policyTypes value that include \"Egress\" (since such a policy would not include an egress section and would otherwise default to just [ \"Ingress\" ]). This field is beta-level in 1.8ingress ([]NetworkPolicyIngressRule)Atomic: will be replaced during a mergeingress is a list of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default)NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.ingress.from ([]NetworkPolicyPeer)Atomic: will be replaced during a mergefrom is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of fields are allowedingress.from.ipBlock (IPBlock)ipBlock defines policy on a particular IPBlock. If this field is set then neither of the other fields can be.IPBlock describes a particular CIDR (Ex. \"192.168.1.0/24\",\"2001:db8::/64\") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule.ingress.from.ipBlock.cidr (string), requiredcidr is a string representing the IPBlock Valid examples are \"192.168.1.0/24\" or \"2001:db8::/64\"ingress.from.ipBlock.except ([]string)Atomic: will be replaced during a mergeexcept is a slice of CIDRs that should not be included within an IPBlock Valid examples are \"192.168.1.0/24\" or \"2001:db8::/64\" Except values will b", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/network-policy-v1/", "id": "k8s_00491"}
{"instruction": "Write a yaml example for networkpolicy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\nNetworkPolicy | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/network-policy-v1/", "id": "k8s_00491_code_6339"}
{"instruction": "What is the reference documentation for replicationcontroller?", "response": "ReplicationControllerReplicationController represents the configuration of a replication controller.apiVersion: v1import \"k8s.io/api/core/v1\"ReplicationControllerReplicationController represents the configuration of a replication controller.apiVersion: v1kind: ReplicationControllermetadata (ObjectMeta)If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (ReplicationControllerSpec)Spec defines the specification of the desired behavior of the replication controller. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (ReplicationControllerStatus)Status is the most recently observed status of the replication controller. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusReplicationControllerSpecReplicationControllerSpec is the specification of a replication controller.selector (map[string]string)Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectorstemplate (PodTemplateSpec)Template is the object that describes the pod that will be created if insufficient replicas are detected. This takes precedence over a TemplateRef. The only allowed template.spec.restartPolicy value is \"Always\". More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-templatereplicas (int32)Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontrollerminReadySeconds (int32)Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)ReplicationControllerStatusReplicationControllerStatus represents the current status of a replication controller.replicas (int32), requiredReplicas is the most recently observed number of replicas. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontrolleravailableReplicas (int32)The number of available replicas (ready for at least minReadySeconds) for this replication controller.readyReplicas (int32)The number of ready replicas for this replication controller.fullyLabeledReplicas (int32)The number of pods that have labels matching the labels of the pod template of the replication controller.conditions ([]ReplicationControllerCondition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeRepresents the latest available observations of a replication controller's current state.ReplicationControllerCondition describes the state of a replication controller at a certain point.conditions.status (string), requiredStatus of the condition, one of True, False, Unknown.conditions.type (string), requiredType of replication controller condition.conditions.lastTransitionTime (Time)The last time the condition transitioned from one status to another.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.conditions.message (string)A human readable message indicating details about the transit", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/replication-controller-v1/", "id": "k8s_00492"}
{"instruction": "What is the reference documentation for replicaset?", "response": "ReplicaSetReplicaSet ensures that a specified number of pod replicas are running at any given time.apiVersion: apps/v1import \"k8s.io/api/apps/v1\"ReplicaSetReplicaSet ensures that a specified number of pod replicas are running at any given time.apiVersion: apps/v1kind: ReplicaSetmetadata (ObjectMeta)If the Labels of a ReplicaSet are empty, they are defaulted to be the same as the Pod(s) that the ReplicaSet manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (ReplicaSetSpec)Spec defines the specification of the desired behavior of the ReplicaSet. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (ReplicaSetStatus)Status is the most recently observed status of the ReplicaSet. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusReplicaSetSpecReplicaSetSpec is the specification of a ReplicaSet.selector (LabelSelector), requiredSelector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectorstemplate (PodTemplateSpec)Template is the object that describes the pod that will be created if insufficient replicas are detected. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#pod-templatereplicas (int32)Replicas is the number of desired pods. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicasetminReadySeconds (int32)Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)ReplicaSetStatusReplicaSetStatus represents the current status of a ReplicaSet.replicas (int32), requiredReplicas is the most recently observed number of non-terminating pods. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicasetavailableReplicas (int32)The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.readyReplicas (int32)The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.terminatingReplicas (int32)The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.fullyLabeledReplicas (int32)The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.conditions ([]ReplicaSetCondition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeRepresents the latest available observations of a replica set's current state.ReplicaSetCondition describes the state of a replica set at a certain point.conditions.status (string), requiredStatus of the condition, one of True, False, Unknown.conditions.type (string), requiredType of replica set condition.conditions.lastTransitionTime (Time)The last time the condition transitioned from one status to another.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.conditions.message (string)A human readable message indicating details about the transition.conditions.reason (string)The reason for the condition's last transition.observedGeneration (int64)ObservedGeneration reflects the generation o", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/replica-set-v1/", "id": "k8s_00493"}
{"instruction": "What is the reference documentation for certificates and certificate signing requests?", "response": "Certificates and Certificate Signing RequestsKubernetes certificate and trust bundle APIs enable automation of X.509 credential provisioning by providing a programmatic interface for clients of the Kubernetes API to request and obtain X.509 certificates from a Certificate Authority (CA).There is also experimental (alpha) support for distributing trust bundles.Certificate signing requestsFEATURE STATE: Kubernetes v1.19 [stable]A CertificateSigningRequest (CSR) resource is used to request that a certificate be signed by a denoted signer, after which the request may be approved or denied before finally being signed.Request signing processThe CertificateSigningRequest resource type allows a client to ask for an X.509 certificate be issued, based on a signing request. The CertificateSigningRequest object includes a PEM-encoded PKCS#10 signing request in the spec.request field. The CertificateSigningRequest denotes the signer (the recipient that the request is being made to) using the spec.signerName field. Note that spec.signerName is a required key after API version certificates.k8s.io/v1. In Kubernetes v1.22 and later, clients may optionally set the spec.expirationSeconds field to request a particular lifetime for the issued certificate. The minimum valid value for this field is 600, i.e. ten minutes.Once created, a CertificateSigningRequest must be approved before it can be signed. Depending on the signer selected, a CertificateSigningRequest may be automatically approved by a controller. Otherwise, a CertificateSigningRequest must be manually approved either via the REST API (or client-go) or by running kubectl certificate approve. Likewise, a CertificateSigningRequest may also be denied, which tells the configured signer that it must not sign the request.For certificates that have been approved, the next step is signing. The relevant signing controller first validates that the signing conditions are met and then creates a certificate. The signing controller then updates the CertificateSigningRequest, storing the new certificate into the status.certificate field of the existing CertificateSigningRequest object. The status.certificate field is either empty or contains a X.509 certificate, encoded in PEM format. The CertificateSigningRequest status.certificate field is empty until the signer does this.Once the status.certificate field has been populated, the request has been completed and clients can now fetch the signed certificate PEM data from the CertificateSigningRequest resource. The signers can instead deny certificate signing if the approval conditions are not met.In order to reduce the number of old CertificateSigningRequest resources left in a cluster, a garbage collection controller runs periodically. The garbage collection removes CertificateSigningRequests that have not changed state for some duration:Approved requests: automatically deleted after 1 hourDenied requests: automatically deleted after 1 hourFailed requests: automatically deleted after 1 hourPending requests: automatically deleted after 24 hoursAll requests: automatically deleted after the issued certificate has expiredCertificate signing authorizationTo allow creating a CertificateSigningRequest and retrieving any CertificateSigningRequest:Verbs: create, get, list, watch, group: certificates.k8s.io, resource: certificatesigningrequestsFor example:access/certificate-signing-request/clusterrole-create.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: csr-creator rules: - apiGroups: - certificates.k8s.io resources: - certificatesigningrequests verbs: - create - get - list - watch To allow approving a CertificateSigningRequest:Verbs: get, list, watch, group: certificates.k8s.io, resource: certificatesigningrequestsVerbs: update, group: certificates.k8s.io, resource: certificatesigningrequests/approvalVerbs: approve, group: certificates.k8s.io, resource: signers, resourceName: <signerNameDomain>/<signerNamePath> or <signerNameDom", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\nCertificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6343"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\nCertificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6344"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\nCertificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6345"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  certificate: \"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JS...\"\n```\n\nCertificates and Certificate Signing Requests | Before a signer issues a certificate based on a CertificateSigningRequest, the signer typically checks that the issuance for that CSR has been approved.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6346"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <certificate-signing-request-name>\n```\n\nCertificates and Certificate Signing Requests | Likewise, to deny a CSR:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6347"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny <certificate-signing-request-name>\n```\n\nCertificates and Certificate Signing Requests | Users of the REST API can approve CSRs by submitting an UPDATE request to the approval subresource of the CSR to be approved. For example, you could write an operator that watches for a particular kin", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6348"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Approved by my custom approver controller\n    reason: ApprovedByMyPolicy # You can set this to any string\n    type: Approved\n```\n\nCertificates and Certificate Signing Requests | For Denied CSRs:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6349"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Denied by my custom approver controller\n    reason: DeniedByMyPolicy # You can set this to any string\n    type: Denied\n```\n\nCertificates and Certificate Signing Requests | It's usual to set status.conditions.reason to a machine-friendly reason code using TitleCase; this is a convention but you can set it to anything you like. If you want to add a note for human consumpt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6350"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl get clustertrustbundles --as='system:serviceaccount:mynamespace:default'\n```\n\nCertificates and Certificate Signing Requests | Signer-linked ClusterTrustBundles are associated with a signer name, like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6351"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: example.com:mysigner:foo\nspec:\n  signerName: example.com/mysigner\n  trustBundle: \"<... PEM data ...>\"\n```\n\nCertificates and Certificate Signing Requests | These ClusterTrustBundles are intended to be maintained by a signer-specific controller in the cluster, so they have several security features:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6352"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: foo\nspec:\n  # no signerName specified, so the field is blank\n  trustBundle: \"<... PEM data ...>\"\n```\n\nCertificates and Certificate Signing Requests | They are primarily intended for cluster configuration use cases. Each signer-unlinked ClusterTrustBundle is an independent object, in contrast to the customary grouping behavior of signer-linked Clust", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6353"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\nCertificates and Certificate Signing Requests | For certificates that have been approved, the next step is signing. The relevant signing controller first validates that the signing conditions are met and then creates a certificate. The signing cont", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6354"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\nCertificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6355"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\nCertificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6356"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\nCertificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6357"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  certificate: \"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JS...\"\n```\n\nCertificates and Certificate Signing Requests | Before a signer issues a certificate based on a CertificateSigningRequest, the signer typically checks that the issuance for that CSR has been approved.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6358"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\nCertificates and Certificate Signing Requests | To approve a CSR with kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6359"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny\n```\n\nCertificates and Certificate Signing Requests | To approve a CSR with kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6360"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Approved by my custom approver controller\n    reason: ApprovedByMyPolicy # You can set this to any string\n    type: Approved\n```\n\nCertificates and Certificate Signing Requests | For Denied CSRs:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6361"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Denied by my custom approver controller\n    reason: DeniedByMyPolicy # You can set this to any string\n    type: Denied\n```\n\nCertificates and Certificate Signing Requests | It's usual to set status.conditions.reason to a machine-friendly reason code using TitleCase; this is a convention but you can set it to anything you like. If you want to add a note for human consumpt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6362"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl get clustertrustbundles --as='system:serviceaccount:mynamespace:default'\n```\n\nCertificates and Certificate Signing Requests | Signer-linked ClusterTrustBundles are associated with a signer name, like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6363"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: example.com:mysigner:foo\nspec:\n  signerName: example.com/mysigner\n  trustBundle: \"<... PEM data ...>\"\n```\n\nCertificates and Certificate Signing Requests | These ClusterTrustBundles are intended to be maintained by a signer-specific controller in the cluster, so they have several security features:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6364"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: foo\nspec:\n  # no signerName specified, so the field is blank\n  trustBundle: \"<... PEM data ...>\"\n```\n\nCertificates and Certificate Signing Requests | They are primarily intended for cluster configuration use cases. Each signer-unlinked ClusterTrustBundle is an independent object, in contrast to the customary grouping behavior of signer-linked Clust", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6365"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\naccess/certificate-signing-request/clusterrole-create.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\nCertificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6366"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\nCertificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6367"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\naccess/certificate-signing-request/clusterrole-approve.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\nCertificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6368"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\nCertificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6369"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\naccess/certificate-signing-request/clusterrole-sign.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\nCertificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6370"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\nCertificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6371"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  certificate: \"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JS...\"\n```\n\nCertificates and Certificate Signing Requests | Before a signer issues a certificate based on a CertificateSigningRequest, the signer typically checks that the issuance for that CSR has been approved.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6372"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <certificate-signing-request-name>\n```\n\nCertificates and Certificate Signing Requests | Likewise, to deny a CSR:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6373"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny <certificate-signing-request-name>\n```\n\nCertificates and Certificate Signing Requests | Users of the REST API can approve CSRs by submitting an UPDATE request to the approval subresource of the CSR to be approved. For example, you could write an operator that watches for a particular kin", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6374"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Approved by my custom approver controller\n    reason: ApprovedByMyPolicy # You can set this to any string\n    type: Approved\n```\n\nCertificates and Certificate Signing Requests | For Denied CSRs:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6375"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Denied by my custom approver controller\n    reason: DeniedByMyPolicy # You can set this to any string\n    type: Denied\n```\n\nCertificates and Certificate Signing Requests | It's usual to set status.conditions.reason to a machine-friendly reason code using TitleCase; this is a convention but you can set it to anything you like. If you want to add a note for human consumpt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6376"}
{"instruction": "Write a bash example for certificates and certificate signing requests", "response": "Here's a bash example:\n\n```bash\nkubectl get clustertrustbundles --as='system:serviceaccount:mynamespace:default'\n```\n\nCertificates and Certificate Signing Requests | Signer-linked ClusterTrustBundles are associated with a signer name, like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6377"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: example.com:mysigner:foo\nspec:\n  signerName: example.com/mysigner\n  trustBundle: \"<... PEM data ...>\"\n```\n\nCertificates and Certificate Signing Requests | These ClusterTrustBundles are intended to be maintained by a signer-specific controller in the cluster, so they have several security features:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6378"}
{"instruction": "Write a yaml example for certificates and certificate signing requests", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: foo\nspec:\n  # no signerName specified, so the field is blank\n  trustBundle: \"<... PEM data ...>\"\n```\n\nCertificates and Certificate Signing Requests | They are primarily intended for cluster configuration use cases. Each signer-unlinked ClusterTrustBundle is an independent object, in contrast to the customary grouping behavior of signer-linked Clust", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/", "id": "k8s_00494_code_6379"}
{"instruction": "Explain the Kubernetes concept: Labels and Selectors", "response": "Labels and SelectorsLabels are key/value pairs that are attached to objects such as Pods. Labels are intended to be used to specify identifying attributes of objects that are meaningful and relevant to users, but do not directly imply semantics to the core system. Labels can be used to organize and to select subsets of objects. Labels can be attached to objects at creation time and subsequently added and modified at any time. Each object can have a set of key/value labels defined. Each Key must be unique for a given object.\"metadata\": { \"labels\": { \"key1\" : \"value1\", \"key2\" : \"value2\" } } Labels allow for efficient queries and watches and are ideal for use in UIs and CLIs. Non-identifying information should be recorded using annotations.MotivationLabels enable users to map their own organizational structures onto system objects in a loosely coupled fashion, without requiring clients to store these mappings.Service deployments and batch processing pipelines are often multi-dimensional entities (e.g., multiple partitions or deployments, multiple release tracks, multiple tiers, multiple micro-services per tier). Management often requires cross-cutting operations, which breaks encapsulation of strictly hierarchical representations, especially rigid hierarchies determined by the infrastructure rather than by users.Example labels:\"release\" : \"stable\", \"release\" : \"canary\"\"environment\" : \"dev\", \"environment\" : \"qa\", \"environment\" : \"production\"\"tier\" : \"frontend\", \"tier\" : \"backend\", \"tier\" : \"cache\"\"partition\" : \"customerA\", \"partition\" : \"customerB\"\"track\" : \"daily\", \"track\" : \"weekly\"These are examples of commonly used labels; you are free to develop your own conventions. Keep in mind that label Key must be unique for a given object.Syntax and character setLabels are key/value pairs. Valid label keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/).If the prefix is omitted, the label Key is presumed to be private to the user. Automated system components (e.g. kube-scheduler, kube-controller-manager, kube-apiserver, kubectl, or other third-party automation) which add labels to end-user objects must specify a prefix.The kubernetes.io/ and k8s.io/ prefixes are reserved for Kubernetes core components.Valid label value:must be 63 characters or less (can be empty),unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),could contain dashes (-), underscores (_), dots (.), and alphanumerics between.For example, here's a manifest for a Pod that has two labels environment: production and app: nginx:apiVersion: v1 kind: Pod metadata: name: label-demo labels: environment: production app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Label selectorsUnlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).Via a label selector, the client/user can identify a set of objects. The label selector is the core grouping primitive in Kubernetes.The API currently supports two types of selectors: equality-based and set-based. A label selector can be made of multiple requirements which are comma-separated. In the case of multiple requirements, all must be satisfied so the comma separator acts as a logical AND (&&) operator.The semantics of empty or non-specified selectors are dependent on the context, and API types that use selectors should document the validity and meaning of them.Note:For some API types, such as ReplicaSets, the label selectors of two instances must not overlap within a namespace, or the controller can see that as", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nLabels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6381"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\nLabels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6382"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\nLabels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6383"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\nLabels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6384"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\nLabels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6385"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\nLabels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6386"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6387"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6388"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\nLabels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6389"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\nLabels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6390"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nLabels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6391"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\nLabels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6392"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  component: redis\n```\n\nLabels and Selectors | This selector (respectively in json or yaml format) is equivalent to component=redis or component in (redis).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6393"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n    component: redis\n  matchExpressions:\n    - { key: tier, operator: In, values: [cache] }\n    - { key: environment, operator: NotIn, values: [dev] }\n```\n\nLabels and Selectors | matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6394"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: frontend\n```\n\nLabels and Selectors | while the Redis master and replica would have different tier labels, and perhaps even an additional role label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6395"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: master\n```\n\nLabels and Selectors | and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6396"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: replica\n```\n\nLabels and Selectors | The labels allow for slicing and dicing the resources along any dimension specified by a label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6397"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nLabels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6398"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\nLabels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6399"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\nLabels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6400"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\nLabels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6401"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\nLabels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6402"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\nLabels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6403"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6404"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6405"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\nLabels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6406"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\nLabels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/", "id": "k8s_00495_code_6407"}
{"instruction": "What is the reference documentation for labelselector?", "response": "LabelSelectorA label selector is a label query over a set of resources.import \"k8s.io/apimachinery/pkg/apis/meta/v1\"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.matchExpressions ([]LabelSelectorRequirement)Atomic: will be replaced during a mergematchExpressions is a list of label selector requirements. The requirements are ANDed.A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.matchExpressions.key (string), requiredkey is the label key that the selector applies to.matchExpressions.operator (string), requiredoperator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.matchExpressions.values ([]string)Atomic: will be replaced during a mergevalues is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.matchLabels (map[string]string)matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/label-selector/", "id": "k8s_00496"}
{"instruction": "Explain viewing site analytics in Kubernetes", "response": "Viewing Site AnalyticsThis page contains information about the kubernetes.io analytics dashboard.View the dashboard.This dashboard is built using Google Looker Studio and shows information collected on kubernetes.io using Google Analytics 4 since August 2022.Using the dashboardBy default, the dashboard shows all collected analytics for the past 30 days. Use the date selector to see data from a different date range. Other filtering options allow you to view data based on user location, the device used to access the site, the translation of the docs used, and more.If you notice an issue with this dashboard, or would like to request any improvements, please open an issue.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/analytics/", "id": "k8s_00497"}
{"instruction": "How do you configure quotas for api objects in Kubernetes?", "response": "Configure Quotas for API ObjectsThis page shows how to configure quotas for API objects, including PersistentVolumeClaims and Services. A quota restricts the number of objects, of a particular type, that can be created in a namespace. You specify quotas in a ResourceQuota object.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace quota-object-example Create a ResourceQuotaHere is the configuration file for a ResourceQuota object:admin/resource/quota-objects.yaml apiVersion: v1 kind: ResourceQuota metadata: name: object-quota-demo spec: hard: persistentvolumeclaims: \"1\" services.loadbalancers: \"2\" services.nodeports: \"0\" Create the ResourceQuota:kubectl apply -f https://k8s.io/examples/admin/resource/quota-objects.yaml --namespace=quota-object-example View detailed information about the ResourceQuota:kubectl get resourcequota object-quota-demo --namespace=quota-object-example --output=yaml The output shows that in the quota-object-example namespace, there can be at most one PersistentVolumeClaim, at most two Services of type LoadBalancer, and no Services of type NodePort.status: hard: persistentvolumeclaims: \"1\" services.loadbalancers: \"2\" services.nodeports: \"0\" used: persistentvolumeclaims: \"0\" services.loadbalancers: \"0\" services.nodeports: \"0\" Create a PersistentVolumeClaimHere is the configuration file for a PersistentVolumeClaim object:admin/resource/quota-objects-pvc.yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-quota-demo spec: storageClassName: manual accessModes: - ReadWriteOnce resources: requests: storage: 3Gi Create the PersistentVolumeClaim:kubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc.yaml --namespace=quota-object-example Verify that the PersistentVolumeClaim was created:kubectl get persistentvolumeclaims --namespace=quota-object-example The output shows that the PersistentVolumeClaim exists and has status Pending:NAME STATUS pvc-quota-demo Pending Attempt to create a second PersistentVolumeClaimHere is the configuration file for a second PersistentVolumeClaim:admin/resource/quota-objects-pvc-2.yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-quota-demo-2 spec: storageClassName: manual accessModes: - ReadWriteOnce resources: requests: storage: 4Gi Attempt to create the second PersistentVolumeClaim:kubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc-2.yaml --namespace=quota-object-example The output shows that the second PersistentVolumeClaim was not created, because it would have exceeded the quota for the namespace.persistentvolumeclaims \"pvc-quota-demo-2\" is forbidden: exceeded quota: object-quota-demo, requested: persistentvolumeclaims=1, used: persistentvolumeclaims=1, limited: persistentvolumeclaims=1 NotesThese are the strings used to identify API resources that can be constrained by quotas:StringAPI Object\"pods\"Pod\"services\"Service\"replicationcontrollers\"ReplicationController\"resourcequotas\"ResourceQuota\"secrets\"Secret\"configmaps\"ConfigMap\"persistentvolumeclaims\"PersistentVolumeClaim\"services.nodeports\"Service of type NodePort\"services.loadbalancers\"Service of type LoadBalancerClean upDelete your namespace:kubectl delete namespace quota-object-example What's nextFor cluster administratorsConfigure Default Memory Requests and Limits for a NamespaceConfigure Default CPU Requests and Limits for a NamespaceConfigure Minimum and Maximum Memory Con", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-object-example\n```\n\nConfigure Quotas for API Objects | Here is the configuration file for a ResourceQuota object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6411"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\nConfigure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6412"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects.yaml --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6413"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota object-quota-demo --namespace=quota-object-example --output=yaml\n```\n\nConfigure Quotas for API Objects | The output shows that in the quota-object-example namespace, there can be at most one PersistentVolumeClaim, at most two Services of type LoadBalancer, and no Services of type NodePort.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6414"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6415"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc.yaml --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | Verify that the PersistentVolumeClaim was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6416"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl get persistentvolumeclaims --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | The output shows that the PersistentVolumeClaim exists and has status Pending:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6417"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\nConfigure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6418"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc-2.yaml --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | The output shows that the second PersistentVolumeClaim was not created, because it would have exceeded the quota for the namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6419"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-object-example\n```\n\nConfigure Quotas for API Objects | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6420"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\nConfigure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6421"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n  used:\n    persistentvolumeclaims: \"0\"\n    services.loadbalancers: \"0\"\n    services.nodeports: \"0\"\n```\n\nConfigure Quotas for API Objects | Here is the configuration file for a PersistentVolumeClaim object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6422"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6423"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\nConfigure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6424"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-object-example\n```\n\nConfigure Quotas for API Objects | Here is the configuration file for a ResourceQuota object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6425"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-objects.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\nConfigure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6426"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\nConfigure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6427"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects.yaml --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6428"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota object-quota-demo --namespace=quota-object-example --output=yaml\n```\n\nConfigure Quotas for API Objects | The output shows that in the quota-object-example namespace, there can be at most one PersistentVolumeClaim, at most two Services of type LoadBalancer, and no Services of type NodePort.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6429"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-objects-pvc.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6430"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\nConfigure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6431"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc.yaml --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | Verify that the PersistentVolumeClaim was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6432"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl get persistentvolumeclaims --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | The output shows that the PersistentVolumeClaim exists and has status Pending:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6433"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-objects-pvc-2.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\nConfigure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6434"}
{"instruction": "Write a yaml example for configure quotas for api objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\nConfigure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6435"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc-2.yaml --namespace=quota-object-example\n```\n\nConfigure Quotas for API Objects | The output shows that the second PersistentVolumeClaim was not created, because it would have exceeded the quota for the namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6436"}
{"instruction": "Write a bash example for configure quotas for api objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-object-example\n```\n\nConfigure Quotas for API Objects | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/quota-api-object/", "id": "k8s_00498_code_6437"}
{"instruction": "How do you debug services in Kubernetes?", "response": "Debug ServicesAn issue that comes up rather frequently for new installations of Kubernetes is that a Service is not working properly. You've run your Pods through a Deployment (or other workload controller) and created a Service, but you get no response when you try to access it. This document will hopefully help you to figure out what's going wrong.Running commands in a PodFor many steps here you will want to see what a Pod running in the cluster sees. The simplest way to do this is to run an interactive busybox Pod:kubectl run -it --rm --restart=Never busybox --image=gcr.io/google-containers/busybox sh Note:If you don't see a command prompt, try pressing enter.If you already have a running Pod that you prefer to use, you can run a command in it using:kubectl exec <POD-NAME> -c <CONTAINER-NAME> -- <COMMAND> SetupFor the purposes of this walk-through, let's run some Pods. Since you're probably debugging your own Service you can substitute your own details, or you can follow along and get a second data point.kubectl create deployment hostnames --image=registry.k8s.io/serve_hostname deployment.apps/hostnames created kubectl commands will print the type and name of the resource created or mutated, which can then be used in subsequent commands.Let's scale the deployment to 3 replicas.kubectl scale deployment hostnames --replicas=3 deployment.apps/hostnames scaled Note that this is the same as if you had started the Deployment with the following YAML:apiVersion: apps/v1 kind: Deployment metadata: labels: app: hostnames name: hostnames spec: selector: matchLabels: app: hostnames replicas: 3 template: metadata: labels: app: hostnames spec: containers: - name: hostnames image: registry.k8s.io/serve_hostname The label \"app\" is automatically set by kubectl create deployment to the name of the Deployment.You can confirm your Pods are running:kubectl get pods -l app=hostnames NAME READY STATUS RESTARTS AGE hostnames-632524106-bbpiw 1/1 Running 0 2m hostnames-632524106-ly40y 1/1 Running 0 2m hostnames-632524106-tlaok 1/1 Running 0 2m You can also confirm that your Pods are serving. You can get the list of Pod IP addresses and test them directly.kubectl get pods -l app=hostnames \\ -o go-template='{{range .items}}{{.status.podIP}}{{\"\\n\"}}{{end}}' 10.244.0.5 10.244.0.6 10.244.0.7 The example container used for this walk-through serves its own hostname via HTTP on port 9376, but if you are debugging your own app, you'll want to use whatever port number your Pods are listening on.From within a pod:for ep in 10.244.0.5:9376 10.244.0.6:9376 10.244.0.7:9376; do wget -qO- $ep done This should produce something like:hostnames-632524106-bbpiw hostnames-632524106-ly40y hostnames-632524106-tlaok If you are not getting the responses you expect at this point, your Pods might not be healthy or might not be listening on the port you think they are. You might find kubectl logs to be useful for seeing what is happening, or perhaps you need to kubectl exec directly into your Pods and debug from there.Assuming everything has gone to plan so far, you can start to investigate why your Service doesn't work.Does the Service exist?The astute reader will have noticed that you did not actually create a Service yet - that is intentional. This is a step that sometimes gets forgotten, and is the first thing to check.What would happen if you tried to access a non-existent Service? If you have another Pod that consumes this Service by name you would get something like:wget -O- hostnames Resolving hostnames (hostnames)... failed: Name or service not known. wget: unable to resolve host address 'hostnames' The first thing to check is whether that Service actually exists:kubectl get svc hostnames No resources found. Error from server (NotFound): services \"hostnames\" not found Let's create the Service. As before, this is for the walk-through - you can use your own Service's details here.kubectl expose deployment hostnames --port=80 --target-port=9376 service/hostnames exposed ", "category": "tasks", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl run -it --rm --restart=Never busybox --image=gcr.io/google-containers/busybox sh\n```\n\nDebug Services | If you already have a running Pod that you prefer to use, you can run a command in it using:", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6439"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl exec <POD-NAME> -c <CONTAINER-NAME> -- <COMMAND>\n```\n\nDebug Services | For the purposes of this walk-through, let's run some Pods. Since you're probably debugging your own Service you can substitute your own details, or you can follow along and get a second data point.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6440"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hostnames --image=registry.k8s.io/serve_hostname\n```\n\nDebug Services | kubectl commands will print the type and name of the resource created or mutated, which can then be used in subsequent commands.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6441"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment hostnames --replicas=3\n```\n\nDebug Services | Note that this is the same as if you had started the Deployment with the following YAML:", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6442"}
{"instruction": "Write a yaml example for debug services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    matchLabels:\n      app: hostnames\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hostnames\n    spec:\n      containers:\n      - name: hostnames\n        image: registry.k8s.io/serve_hostname\n```\n\nDebug Services | The label \"app\" is automatically set by kubectl create deployment to the name of the Deployment.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6443"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\nDebug Services | You can also confirm that your Pods are serving. You can get the list of Pod IP addresses and test them directly.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6444"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames \\\n    -o go-template='{{range .items}}{{.status.podIP}}{{\"\\n\"}}{{end}}'\n```\n\nDebug Services | The example container used for this walk-through serves its own hostname via HTTP on port 9376, but if you are debugging your own app, you'll want to use whatever port number your Pods are listening o", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6445"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\nDebug Services | Let's create the Service. As before, this is for the walk-through - you can use your own Service's details here.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6446"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hostnames --port=80 --target-port=9376\n```\n\nDebug Services | And read it back:", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6447"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\nDebug Services | Now you know that the Service exists.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6448"}
{"instruction": "Write a yaml example for debug services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    app: hostnames\n  ports:\n  - name: default\n    protocol: TCP\n    port: 80\n    targetPort: 9376\n```\n\nDebug Services | In order to highlight the full range of configuration, the Service you created here uses a different port number than the Pods. For many real-world Services, these values might be the same.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6449"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get service hostnames -o json\n```\n\nDebug Services | If you got this far, you have confirmed that your Service is correctly defined and is resolved by DNS. Now let's check that the Pods you ran are actually being selected by the Service.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6450"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\nDebug Services | The -l app=hostnames argument is a label selector configured on the Service.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6451"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=hostnames\n\nNAME              ADDRESSTYPE   PORTS   ENDPOINTS\nhostnames-ytpni   IPv4          9376    10.244.0.5,10.244.0.6,10.244.0.7\n```\n\nDebug Services | This confirms that the EndpointSlice controller has found the correct Pods for your Service. If the ENDPOINTS column is <none>, you should check that the spec.selector field of your Service actually s", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6452"}
{"instruction": "Write a yaml example for debug services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    matchLabels:\n      app: hostnames\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hostnames\n    spec:\n      containers:\n      - name: hostnames\n        image: registry.k8s.io/serve_hostname\n```\n\nDebug Services | The label \"app\" is automatically set by kubectl create deployment to the name of the Deployment.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6453"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\nDebug Services | You can confirm your Pods are running:", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6454"}
{"instruction": "Write a yaml example for debug services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    app: hostnames\n  ports:\n  - name: default\n    protocol: TCP\n    port: 80\n    targetPort: 9376\n```\n\nDebug Services | In order to highlight the full range of configuration, the Service you created here uses a different port number than the Pods. For many real-world Services, these values might be the same.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6455"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl exec <POD-NAME> -c <CONTAINER-NAME> -- <COMMAND>\n```\n\nDebug Services | For the purposes of this walk-through, let's run some Pods. Since you're probably debugging your own Service you can substitute your own details, or you can follow along and get a second data point.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6456"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hostnames --image=registry.k8s.io/serve_hostname\n```\n\nDebug Services | kubectl commands will print the type and name of the resource created or mutated, which can then be used in subsequent commands.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6457"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment hostnames --replicas=3\n```\n\nDebug Services | Note that this is the same as if you had started the Deployment with the following YAML:", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6458"}
{"instruction": "Write a yaml example for debug services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    matchLabels:\n      app: hostnames\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hostnames\n    spec:\n      containers:\n      - name: hostnames\n        image: registry.k8s.io/serve_hostname\n```\n\nDebug Services | The label \"app\" is automatically set by kubectl create deployment to the name of the Deployment.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6459"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\nDebug Services | You can also confirm that your Pods are serving. You can get the list of Pod IP addresses and test them directly.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6460"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames \\\n    -o go-template='{{range .items}}{{.status.podIP}}{{\"\\n\"}}{{end}}'\n```\n\nDebug Services | The example container used for this walk-through serves its own hostname via HTTP on port 9376, but if you are debugging your own app, you'll want to use whatever port number your Pods are listening o", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6461"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\nDebug Services | Let's create the Service. As before, this is for the walk-through - you can use your own Service's details here.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6462"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hostnames --port=80 --target-port=9376\n```\n\nDebug Services | And read it back:", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6463"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\nDebug Services | Now you know that the Service exists.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6464"}
{"instruction": "Write a yaml example for debug services", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    app: hostnames\n  ports:\n  - name: default\n    protocol: TCP\n    port: 80\n    targetPort: 9376\n```\n\nDebug Services | In order to highlight the full range of configuration, the Service you created here uses a different port number than the Pods. For many real-world Services, these values might be the same.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6465"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get service hostnames -o json\n```\n\nDebug Services | If you got this far, you have confirmed that your Service is correctly defined and is resolved by DNS. Now let's check that the Pods you ran are actually being selected by the Service.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6466"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\nDebug Services | The -l app=hostnames argument is a label selector configured on the Service.", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6467"}
{"instruction": "Write a bash example for debug services", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=hostnames\n\nNAME              ADDRESSTYPE   PORTS   ENDPOINTS\nhostnames-ytpni   IPv4          9376    10.244.0.5,10.244.0.6,10.244.0.7\n```\n\nDebug Services | This confirms that the EndpointSlice controller has found the correct Pods for your Service. If the ENDPOINTS column is <none>, you should check that the spec.selector field of your Service actually s", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-service/", "id": "k8s_00499_code_6468"}
{"instruction": "How do you configuring a cgroup driver in Kubernetes?", "response": "Configuring a cgroup driverThis page explains how to configure the kubelet's cgroup driver to match the container runtime cgroup driver for kubeadm clusters.Before you beginYou should be familiar with the Kubernetes container runtime requirements.Configuring the container runtime cgroup driverThe Container runtimes page explains that the systemd driver is recommended for kubeadm based setups instead of the kubelet's default cgroupfs driver, because kubeadm manages the kubelet as a systemd service.The page also provides details on how to set up a number of different container runtimes with the systemd driver by default.Configuring the kubelet cgroup driverkubeadm allows you to pass a KubeletConfiguration structure during kubeadm init. This KubeletConfiguration can include the cgroupDriver field which controls the cgroup driver of the kubelet.Note:In v1.22 and later, if the user does not set the cgroupDriver field under KubeletConfiguration, kubeadm defaults it to systemd.In Kubernetes v1.28, you can enable automatic detection of the cgroup driver as an alpha feature. See systemd cgroup driver for more details.A minimal example of configuring the field explicitly:# kubeadm-config.yaml kind: ClusterConfiguration apiVersion: kubeadm.k8s.io/v1beta4 kubernetesVersion: v1.21.0 --- kind: KubeletConfiguration apiVersion: kubelet.config.k8s.io/v1beta1 cgroupDriver: systemd Such a configuration file can then be passed to the kubeadm command:kubeadm init --config kubeadm-config.yaml Note:Kubeadm uses the same KubeletConfiguration for all nodes in the cluster. The KubeletConfiguration is stored in a ConfigMap object under the kube-system namespace.Executing the sub commands init, join and upgrade would result in kubeadm writing the KubeletConfiguration as a file under /var/lib/kubelet/config.yaml and passing it to the local node kubelet.On each node, kubeadm detects the CRI socket and stores its details into the /var/lib/kubelet/instance-config.yaml file. When executing the init, join, or upgrade subcommands, kubeadm patches the containerRuntimeEndpoint value from this instance configuration into /var/lib/kubelet/config.yaml.Using the cgroupfs driverTo use cgroupfs and to prevent kubeadm upgrade from modifying the KubeletConfiguration cgroup driver on existing setups, you must be explicit about its value. This applies to a case where you do not wish future versions of kubeadm to apply the systemd driver by default.See the below section on \"Modify the kubelet ConfigMap\" for details on how to be explicit about the value.If you wish to configure a container runtime to use the cgroupfs driver, you must refer to the documentation of the container runtime of your choice.Migrating to the systemd driverTo change the cgroup driver of an existing kubeadm cluster from cgroupfs to systemd in-place, a similar procedure to a kubelet upgrade is required. This must include both steps outlined below.Note:Alternatively, it is possible to replace the old nodes in the cluster with new ones that use the systemd driver. This requires executing only the first step below before joining the new nodes and ensuring the workloads can safely move to the new nodes before deleting the old nodes.Modify the kubelet ConfigMapCall kubectl edit cm kubelet-config -n kube-system.Either modify the existing cgroupDriver value or add a new field that looks like this:cgroupDriver: systemd This field must be present under the kubelet: section of the ConfigMap.Update the cgroup driver on all nodesFor each node in the cluster:Drain the node using kubectl drain <node-name> --ignore-daemonsetsStop the kubelet using systemctl stop kubeletStop the container runtimeModify the container runtime cgroup driver to systemdSet cgroupDriver: systemd in /var/lib/kubelet/config.yamlStart the container runtimeStart the kubelet using systemctl start kubeletUncordon the node using kubectl uncordon <node-name>Execute these steps on nodes one at a time to ensure workloads have sufficient time to schedu", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500"}
{"instruction": "Write a yaml example for configuring a cgroup driver", "response": "Here's a yaml example:\n\n```yaml\n# kubeadm-config.yaml\nkind: ClusterConfiguration\napiVersion: kubeadm.k8s.io/v1beta4\nkubernetesVersion: v1.21.0\n---\nkind: KubeletConfiguration\napiVersion: kubelet.config.k8s.io/v1beta1\ncgroupDriver: systemd\n```\n\nConfiguring a cgroup driver | Such a configuration file can then be passed to the kubeadm command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500_code_6470"}
{"instruction": "Write a yaml example for configuring a cgroup driver", "response": "Here's a yaml example:\n\n```yaml\n# kubeadm-config.yaml\nkind: ClusterConfiguration\napiVersion: kubeadm.k8s.io/v1beta4\nkubernetesVersion: v1.21.0\n---\nkind: KubeletConfiguration\napiVersion: kubelet.config.k8s.io/v1beta1\ncgroupDriver: systemd\n```\n\nConfiguring a cgroup driver | Such a configuration file can then be passed to the kubeadm command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500_code_6471"}
{"instruction": "Write a bash example for configuring a cgroup driver", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm kubelet-config -n kube-system\n```\n\nConfiguring a cgroup driver | Either modify the existing cgroupDriver value or add a new field that looks like this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500_code_6472"}
{"instruction": "Write a yaml example for configuring a cgroup driver", "response": "Here's a yaml example:\n\n```yaml\ncgroupDriver: systemd\n```\n\nConfiguring a cgroup driver | This field must be present under the kubelet: section of the ConfigMap.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500_code_6473"}
{"instruction": "Write a bash example for configuring a cgroup driver", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node-name> --ignore-daemonsets\n```\n\nConfiguring a cgroup driver | Execute these steps on nodes one at a time to ensure workloads have sufficient time to schedule on different nodes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500_code_6474"}
{"instruction": "Write a bash example for configuring a cgroup driver", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-name>\n```\n\nConfiguring a cgroup driver | Execute these steps on nodes one at a time to ensure workloads have sufficient time to schedule on different nodes.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500_code_6475"}
{"instruction": "Write a yaml example for configuring a cgroup driver", "response": "Here's a yaml example:\n\n```yaml\n# kubeadm-config.yaml\nkind: ClusterConfiguration\napiVersion: kubeadm.k8s.io/v1beta4\nkubernetesVersion: v1.21.0\n---\nkind: KubeletConfiguration\napiVersion: kubelet.config.k8s.io/v1beta1\ncgroupDriver: systemd\n```\n\nConfiguring a cgroup driver | Such a configuration file can then be passed to the kubeadm command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/", "id": "k8s_00500_code_6476"}
{"instruction": "Explain the Kubernetes concept: Network Plugins", "response": "Network PluginsKubernetes (version 1.3 through to the latest 1.34, and likely onwards) lets you use Container Network Interface (CNI) plugins for cluster networking. You must use a CNI plugin that is compatible with your cluster and that suits your needs. Different plugins are available (both open- and closed- source) in the wider Kubernetes ecosystem.A CNI plugin is required to implement the Kubernetes network model.You must use a CNI plugin that is compatible with the v0.4.0 or later releases of the CNI specification. The Kubernetes project recommends using a plugin that is compatible with the v1.0.0 CNI specification (plugins can be compatible with multiple spec versions).InstallationA Container Runtime, in the networking context, is a daemon on a node configured to provide CRI Services for kubelet. In particular, the Container Runtime must be configured to load the CNI plugins required to implement the Kubernetes network model.Note:Prior to Kubernetes 1.24, the CNI plugins could also be managed by the kubelet using the cni-bin-dir and network-plugin command-line parameters. These command-line parameters were removed in Kubernetes 1.24, with management of the CNI no longer in scope for kubelet.See Troubleshooting CNI plugin-related errors if you are facing issues following the removal of dockershim.For specific information about how a Container Runtime manages the CNI plugins, see the documentation for that Container Runtime, for example:containerdCRI-OFor specific information about how to install and manage a CNI plugin, see the documentation for that plugin or networking provider.Network Plugin RequirementsLoopback CNIIn addition to the CNI plugin installed on the nodes for implementing the Kubernetes network model, Kubernetes also requires the container runtimes to provide a loopback interface lo, which is used for each sandbox (pod sandboxes, vm sandboxes, ...). Implementing the loopback interface can be accomplished by re-using the CNI loopback plugin. or by developing your own code to achieve this (see this example from CRI-O).Support hostPortThe CNI networking plugin supports hostPort. You can use the official portmap plugin offered by the CNI plugin team or use your own plugin with portMapping functionality.If you want to enable hostPort support, you must specify portMappings capability in your cni-conf-dir. For example:{ \"name\": \"k8s-pod-network\", \"cniVersion\": \"0.4.0\", \"plugins\": [ { \"type\": \"calico\", \"log_level\": \"info\", \"datastore_type\": \"kubernetes\", \"nodename\": \"127.0.0.1\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"usePodCidr\" }, \"policy\": { \"type\": \"k8s\" }, \"kubernetes\": { \"kubeconfig\": \"/etc/cni/net.d/calico-kubeconfig\" } }, { \"type\": \"portmap\", \"capabilities\": {\"portMappings\": true}, \"externalSetMarkChain\": \"KUBE-MARK-MASQ\" } ] } Support traffic shapingExperimental FeatureThe CNI networking plugin also supports pod ingress and egress traffic shaping. You can use the official bandwidth plugin offered by the CNI plugin team or use your own plugin with bandwidth control functionality.If you want to enable traffic shaping support, you must add the bandwidth plugin to your CNI configuration file (default /etc/cni/net.d) and ensure that the binary is included in your CNI bin dir (default /opt/cni/bin).{ \"name\": \"k8s-pod-network\", \"cniVersion\": \"0.4.0\", \"plugins\": [ { \"type\": \"calico\", \"log_level\": \"info\", \"datastore_type\": \"kubernetes\", \"nodename\": \"127.0.0.1\", \"ipam\": { \"type\": \"host-local\", \"subnet\": \"usePodCidr\" }, \"policy\": { \"type\": \"k8s\" }, \"kubernetes\": { \"kubeconfig\": \"/etc/cni/net.d/calico-kubeconfig\" } }, { \"type\": \"bandwidth\", \"capabilities\": {\"bandwidth\": true} } ] } Now you can add the kubernetes.io/ingress-bandwidth and kubernetes.io/egress-bandwidth annotations to your Pod. For example:apiVersion: v1 kind: Pod metadata: annotations: kubernetes.io/ingress-bandwidth: 1M kubernetes.io/egress-bandwidth: 1M ... What's nextLearn more about Cluster NetworkingLearn more about Network PoliciesLearn about t", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/", "id": "k8s_00501"}
{"instruction": "Write a yaml example for network plugins", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubernetes.io/ingress-bandwidth: 1M\n    kubernetes.io/egress-bandwidth: 1M\n...\n```\n\nNetwork Plugins |", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/", "id": "k8s_00501_code_6478"}
{"instruction": "Write a yaml example for network plugins", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubernetes.io/ingress-bandwidth: 1M\n    kubernetes.io/egress-bandwidth: 1M\n...\n```\n\nNetwork Plugins |", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/", "id": "k8s_00501_code_6479"}
{"instruction": "Write a yaml example for network plugins", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubernetes.io/ingress-bandwidth: 1M\n    kubernetes.io/egress-bandwidth: 1M\n...\n```\n\nNetwork Plugins |", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/", "id": "k8s_00501_code_6480"}
{"instruction": "How do you define environment variable values using an init container in Kubernetes?", "response": "Define Environment Variable Values Using An Init ContainerFEATURE STATE: Kubernetes v1.34 [alpha] (enabled by default: false)This page show how to configure environment variables for containers in a Pod via file.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be version v1.34.To check the version, enter kubectl version.How the design worksIn this exercise, you will create a Pod that sources environment variables from files, projecting these values into the running container.pods/inject/envars-file-container.yaml apiVersion: v1 kind: Pod metadata: name: envfile-test-pod spec: initContainers: - name: setup-envfile image: nginx command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env'] volumeMounts: - name: config mountPath: /data containers: - name: use-envfile image: nginx command: [ \"/bin/sh\", \"-c\", \"env\" ] env: - name: DB_ADDRESS valueFrom: fileKeyRef: path: config.env volumeName: config key: DB_ADDRESS optional: false restartPolicy: Never volumes: - name: config emptyDir: {}In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment variable key through the fileKeyRef field without needing to mount the volume. When optional field is set to false, the specified key in fileKeyRef must exist in the environment variables file.The volume will only be mounted to the container that writes to the file (initContainer), while the consumer container that consumes the environment variable will not have the volume mounted.The env file format adheres to the kubernetes env file standard.During container initialization, the kubelet retrieves environment variables from specified files in the emptyDir volume and exposes them to the container.Note:All container types (initContainers, regular containers, sidecars containers, and ephemeral containers) support environment variable loading from files.While these environment variables can store sensitive information, emptyDir volumes don't provide the same protection mechanisms as dedicated Secret objects. Therefore, exposing confidential environment variables to containers through this feature is not considered a security best practice.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/inject/envars-file-container.yaml Verify that the container in the Pod is running:# If the new Pod isn't yet healthy, rerun this command a few times. kubectl get pods Check container logs for environment variables:kubectl logs dapi-test-pod -c use-envfile | grep DB_ADDRESS The output shows the values of selected environment variables:DB_ADDRESS=address Env File SyntaxThe format of Kubernetes env files originates from .env files.In a shell environment, .env files are typically loaded using the source .env command.For Kubernetes, the defined env file format adheres to stricter syntax rules:Blank Lines: Blank lines are ignored.Leading Spaces: Leading spaces on all lines are ignored.Variable Declaration: Variables must be declared as VAR=VAL. Spaces surrounding = and trailing spaces are ignored.VAR=VAL → VAL Comments: Lines beginning with # are treated as comments and ignored.# comment VAR=VAL → VAL VAR=VAL # not a comment → VAL # not a comment Line Continuation: A backslash (\\) at the end of a variable declaration line indicates the value continues on the next line. The lines are joined with a single space.VAR=VAL \\ VAL2 → VAL VAL2 What's nextLearn more about environment variables.Read Defining Environment Variables for a Conta", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502"}
{"instruction": "Write a yaml example for define environment variable values using an init container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\nDefine Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6482"}
{"instruction": "Write a bash example for define environment variable values using an init container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars-file-container.yaml\n```\n\nDefine Environment Variable Values Using An Init Container | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6483"}
{"instruction": "Write a bash example for define environment variable values using an init container", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod -c use-envfile | grep DB_ADDRESS\n```\n\nDefine Environment Variable Values Using An Init Container | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6484"}
{"instruction": "Write a yaml example for define environment variable values using an init container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\nDefine Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6485"}
{"instruction": "Write a yaml example for define environment variable values using an init container", "response": "Here's a yaml example:\n\n```yaml\npods/inject/envars-file-container.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\nDefine Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6486"}
{"instruction": "Write a yaml example for define environment variable values using an init container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\nDefine Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6487"}
{"instruction": "Write a bash example for define environment variable values using an init container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars-file-container.yaml\n```\n\nDefine Environment Variable Values Using An Init Container | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6488"}
{"instruction": "Write a bash example for define environment variable values using an init container", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod -c use-envfile | grep DB_ADDRESS\n```\n\nDefine Environment Variable Values Using An Init Container | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-via-file/", "id": "k8s_00502_code_6489"}
{"instruction": "How do you control topology management policies on a node in Kubernetes?", "response": "Control Topology Management Policies on a nodeFEATURE STATE: Kubernetes v1.27 [stable]An increasing number of systems leverage a combination of CPUs and hardware accelerators to support latency-critical execution and high-throughput parallel computation. These include workloads in fields such as telecommunications, scientific computing, machine learning, financial services and data analytics. Such hybrid systems comprise a high performance environment.In order to extract the best performance, optimizations related to CPU isolation, memory and device locality are required. However, in Kubernetes, these optimizations are handled by a disjoint set of components.Topology Manager is a kubelet component that aims to coordinate the set of components that are responsible for these optimizations.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.18.To check the version, enter kubectl version.How topology manager worksPrior to the introduction of Topology Manager, the CPU and Device Manager in Kubernetes make resource allocation decisions independently of each other. This can result in undesirable allocations on multiple-socketed systems, and performance/latency sensitive applications will suffer due to these undesirable allocations. Undesirable in this case meaning, for example, CPUs and devices being allocated from different NUMA Nodes, thus incurring additional latency.The Topology Manager is a kubelet component, which acts as a source of truth so that other kubelet components can make topology aligned resource allocation choices.The Topology Manager provides an interface for components, called Hint Providers, to send and receive topology information. The Topology Manager has a set of node level policies which are explained below.The Topology Manager receives topology information from the Hint Providers as a bitmask denoting NUMA Nodes available and a preferred allocation indication. The Topology Manager policies perform a set of operations on the hints provided and converge on the hint determined by the policy to give the optimal result. If an undesirable hint is stored, the preferred field for the hint will be set to false. In the current policies preferred is the narrowest preferred mask. The selected hint is stored as part of the Topology Manager. Depending on the policy configured, the pod can be accepted or rejected from the node based on the selected hint. The hint is then stored in the Topology Manager for use by the Hint Providers when making the resource allocation decisions.Windows SupportFEATURE STATE: Kubernetes v1.32 [alpha] (enabled by default: false)The Topology Manager support can be enabled on Windows by using the WindowsCPUAndMemoryAffinity feature gate and it requires support in the container runtime.Topology manager scopes and policiesThe Topology Manager currently:aligns Pods of all QoS classes.aligns the requested resources that Hint Provider provides topology hints for.If these conditions are met, the Topology Manager will align the requested resources.In order to customize how this alignment is carried out, the Topology Manager provides two distinct options: scope and policy.The scope defines the granularity at which you would like resource alignment to be performed, for example, at the pod or container level. And the policy defines the actual policy used to carry out the alignment, for example, best-effort, restricted, and single-numa-node. Details on the various scopes and policies available today can be found below.Note:To align CPU resources with other requested reso", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/", "id": "k8s_00503"}
{"instruction": "Write a yaml example for control topology management policies on a node", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n```\n\nControl Topology Management Policies on a node | This pod runs in the BestEffort QoS class because no resource requests or limits are specified.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/", "id": "k8s_00503_code_6491"}
{"instruction": "Write a yaml example for control topology management policies on a node", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nControl Topology Management Policies on a node | This pod runs in the Burstable QoS class because requests are less than limits.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/", "id": "k8s_00503_code_6492"}
{"instruction": "Write a yaml example for control topology management policies on a node", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n```\n\nControl Topology Management Policies on a node | This pod with integer CPU request runs in the Guaranteed QoS class because requests are equal to limits.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/", "id": "k8s_00503_code_6493"}
{"instruction": "Write a yaml example for control topology management policies on a node", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n```\n\nControl Topology Management Policies on a node | This pod with sharing CPU request runs in the Guaranteed QoS class because requests are equal to limits.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/", "id": "k8s_00503_code_6494"}
{"instruction": "Write a yaml example for control topology management policies on a node", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        example.com/deviceA: \"1\"\n        example.com/deviceB: \"1\"\n      requests:\n        example.com/deviceA: \"1\"\n        example.com/deviceB: \"1\"\n```\n\nControl Topology Management Policies on a node | This pod runs in the BestEffort QoS class because there are no CPU and memory requests.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/", "id": "k8s_00503_code_6495"}
{"instruction": "Explain the Kubernetes concept: Good practices for Dynamic Resource Allocation as a Cluster Admin", "response": "Good practices for Dynamic Resource Allocation as a Cluster AdminThis page describes good practices when configuring a Kubernetes cluster utilizing Dynamic Resource Allocation (DRA). These instructions are for cluster administrators.Separate permissions to DRA related APIsDRA is orchestrated through a number of different APIs. Use authorization tools (like RBAC, or another solution) to control access to the right APIs depending on the persona of your user.In general, DeviceClasses and ResourceSlices should be restricted to admins and the DRA drivers. Cluster operators that will be deploying Pods with claims will need access to ResourceClaim and ResourceClaimTemplate APIs; both of these APIs are namespace scoped.DRA driver deployment and maintenanceDRA drivers are third-party applications that run on each node of your cluster to interface with the hardware of that node and Kubernetes' native DRA components. The installation procedure depends on the driver you choose, but is likely deployed as a DaemonSet to all or a selection of the nodes (using node selectors or similar mechanisms) in your cluster.Use drivers with seamless upgrade if availableDRA drivers implement the kubeletplugin package interface. Your driver may support seamless upgrades by implementing a property of this interface that allows two versions of the same DRA driver to coexist for a short time. This is only available for kubelet versions 1.33 and above and may not be supported by your driver for heterogeneous clusters with attached nodes running older versions of Kubernetes - check your driver's documentation to be sure.If seamless upgrades are available for your situation, consider using it to minimize scheduling delays when your driver updates.If you cannot use seamless upgrades, during driver downtime for upgrades you may observe that:Pods cannot start unless the claims they depend on were already prepared for use.Cleanup after the last pod which used a claim gets delayed until the driver is available again. The pod is not marked as terminated. This prevents reusing the resources used by the pod for other pods.Running pods will continue to run.Confirm your DRA driver exposes a liveness probe and utilize itYour DRA driver likely implements a gRPC socket for healthchecks as part of DRA driver good practices. The easiest way to utilize this grpc socket is to configure it as a liveness probe for the DaemonSet deploying your DRA driver. Your driver's documentation or deployment tooling may already include this, but if you are building your configuration separately or not running your DRA driver as a Kubernetes pod, be sure that your orchestration tooling restarts the DRA driver on failed healthchecks to this grpc socket. Doing so will minimize any accidental downtime of the DRA driver and give it more opportunities to self heal, reducing scheduling delays or troubleshooting time.When draining a node, drain the DRA driver as late as possibleThe DRA driver is responsible for unpreparing any devices that were allocated to Pods, and if the DRA driver is drained before Pods with claims have been deleted, it will not be able to finalize its cleanup. If you implement custom drain logic for nodes, consider checking that there are no allocated/reserved ResourceClaim or ResourceClaimTemplates before terminating the DRA driver itself.Monitor and tune components for higher load, especially in high scale environmentsControl plane component kube-scheduler and the internal ResourceClaim controller orchestrated by the component kube-controller-manager do the heavy lifting during scheduling of Pods with claims based on metadata stored in the DRA APIs. Compared to non-DRA scheduled Pods, the number of API server calls, memory, and CPU utilization needed by these components is increased for Pods using DRA claims. In addition, node local components like the DRA driver and kubelet utilize DRA APIs to allocated the hardware request at Pod sandbox creation time. Especially in high sca", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/dra/", "id": "k8s_00504"}
{"instruction": "What is the reference documentation for kubectl rollout restart?", "response": "kubectl rollout restartSynopsisRestart a resource. Resource rollout will be restarted. kubectl rollout restart RESOURCE Examples # Restart all deployments in the test-namespace namespace kubectl rollout restart deployment -n test-namespace # Restart a deployment kubectl rollout restart deployment/nginx # Restart a daemon set kubectl rollout restart daemonset/abc # Restart deployments with the app=nginx label kubectl rollout restart deployment --selector=app=nginx Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--field-manager string Default: \"kubectl-rollout\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for restart-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_restart/", "id": "k8s_00505"}
{"instruction": "Write a bash example for kubectl rollout restart", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart RESOURCE\n```\n\nkubectl rollout restart | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_restart/", "id": "k8s_00505_code_6498"}
{"instruction": "Write a bash example for kubectl rollout restart", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart RESOURCE\n```\n\nkubectl rollout restart | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_restart/", "id": "k8s_00505_code_6499"}
{"instruction": "How do you troubleshooting clusters in Kubernetes?", "response": "Troubleshooting ClustersDebugging common cluster issues.This doc is about cluster troubleshooting; we assume you have already ruled out your application as the root cause of the problem you are experiencing. See the application troubleshooting guide for tips on application debugging. You may also visit the troubleshooting overview document for more information.For troubleshooting kubectl, refer to Troubleshooting kubectl.Listing your clusterThe first thing to debug in your cluster is if your nodes are all registered correctly.Run the following command:kubectl get nodes And verify that all of the nodes you expect to see are present and that they are all in the Ready state.To get detailed information about the overall health of your cluster, you can run:kubectl cluster-info dump Example: debugging a down/unreachable nodeSometimes when debugging it can be useful to look at the status of a node -- for example, because you've noticed strange behavior of a Pod that's running on the node, or to find out why a Pod won't schedule onto the node. As with Pods, you can use kubectl describe node and kubectl get node -o yaml to retrieve detailed information about nodes. For example, here's what you'll see if a node is down (disconnected from the network, or kubelet dies and won't restart, etc.). Notice the events that show the node is NotReady, and also notice that the pods are no longer running (they are evicted after five minutes of NotReady status).kubectl get nodes NAME STATUS ROLES AGE VERSION kube-worker-1 NotReady <none> 1h v1.23.3 kubernetes-node-bols Ready <none> 1h v1.23.3 kubernetes-node-st6x Ready <none> 1h v1.23.3 kubernetes-node-unaj Ready <none> 1h v1.23.3 kubectl describe node kube-worker-1 Name: kube-worker-1 Roles: <none> Labels: beta.kubernetes.io/arch=amd64 beta.kubernetes.io/os=linux kubernetes.io/arch=amd64 kubernetes.io/hostname=kube-worker-1 kubernetes.io/os=linux node.alpha.kubernetes.io/ttl: 0 volumes.kubernetes.io/controller-managed-attach-detach: true CreationTimestamp: Thu, 17 Feb 2022 16:46:30 -0500 Taints: node.kubernetes.io/unreachable:NoExecute node.kubernetes.io/unreachable:NoSchedule Unschedulable: false Lease: HolderIdentity: kube-worker-1 AcquireTime: <unset> RenewTime: Thu, 17 Feb 2022 17:13:09 -0500 Conditions: Type Status LastHeartbeatTime LastTransitionTime Reason Message ---- ------ ----------------- ------------------ ------ ------- NetworkUnavailable False Thu, 17 Feb 2022 17:09:13 -0500 Thu, 17 Feb 2022 17:09:13 -0500 WeaveIsUp Weave pod has set this MemoryPressure Unknown Thu, 17 Feb 2022 17:12:40 -0500 Thu, 17 Feb 2022 17:13:52 -0500 NodeStatusUnknown Kubelet stopped posting node status. DiskPressure Unknown Thu, 17 Feb 2022 17:12:40 -0500 Thu, 17 Feb 2022 17:13:52 -0500 NodeStatusUnknown Kubelet stopped posting node status. PIDPressure Unknown Thu, 17 Feb 2022 17:12:40 -0500 Thu, 17 Feb 2022 17:13:52 -0500 NodeStatusUnknown Kubelet stopped posting node status. Ready Unknown Thu, 17 Feb 2022 17:12:40 -0500 Thu, 17 Feb 2022 17:13:52 -0500 NodeStatusUnknown Kubelet stopped posting node status. Addresses: InternalIP: 192.168.0.113 Hostname: kube-worker-1 Capacity: cpu: 2 ephemeral-storage: 15372232Ki hugepages-2Mi: 0 memory: 2025188Ki pods: 110 Allocatable: cpu: 2 ephemeral-storage: 14167048988 hugepages-2Mi: 0 memory: 1922788Ki pods: 110 System Info: Machine ID: 9384e2927f544209b5d7b67474bbf92b System UUID: aa829ca9-73d7-064d-9019-df07404ad448 Boot ID: 5a295a03-aaca-4340-af20-1327fa5dab5c Kernel Version: 5.13.0-28-generic OS Image: Ubuntu 21.10 Operating System: linux Architecture: amd64 Container Runtime Version: containerd://1.5.9 Kubelet Version: v1.23.3 Kube-Proxy Version: v1.23.3 Non-terminated Pods: (4 in total) Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits Age --------- ---- ------------ ---------- --------------- ------------- --- default nginx-deployment-67d4bdd6f5-cx2nz 500m (25%) 500m (25%) 128Mi (6%) 128Mi (6%) 23m default nginx-deployment-67d4bdd6f5-w6kd7 500m ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nTroubleshooting Clusters | Sometimes when debugging it can be useful to look at the status of a node -- for example, because you've noticed strange behavior of a Pod that's running on the node, or to find out why a Pod won't sc", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6501"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl describe node kube-worker-1\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6502"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl get node kube-worker-1 -o yaml\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6503"}
{"instruction": "Write a yaml example for troubleshooting clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\nmetadata:\n  annotations:\n    node.alpha.kubernetes.io/ttl: \"0\"\n    volumes.kubernetes.io/controller-managed-attach-detach: \"true\"\n  creationTimestamp: \"2022-02-17T21:46:30Z\"\n  labels:\n    beta.kubernetes.io/arch: amd64\n    beta.kubernetes.io/os: linux\n    kubernetes.io/arch: amd64\n    kubernetes.io/hostname: kube-worker-1\n    kubernetes.io/os: linux\n  name: kube-worker-1\n  resourceVersion: \"4026\"\n  uid: 98efe7cb-2978-4a0b-842a-1a7bf12c05f8\nspec: {}\nstatus:\n  addresses:\n  - address: 192.168.0.113\n    type: InternalIP\n  - address: kube-worker-1\n    type: Hostname\n  allocatable:\n    cpu: \"2\"\n    ephemeral-storage: \"14167048988\"\n    hugepages-2Mi: \"0\"\n    memory: 1922788Ki\n    pods: \"110\"\n  capacity:\n    cpu: \"2\"\n    ephemeral-storage: 15372232Ki\n    hugepages-2Mi: \"0\"\n    memory: 2025188Ki\n    pods: \"110\"\n  conditions:\n  - lastHeartbeatTime: \"2022-02-17T22:20:32Z\"\n    lastTransitionTime: \"2022-02-17T22:20:32Z\"\n    message: Weave pod has set this\n    reason: WeaveIsUp\n    status: \"False\"\n    type: NetworkUnavailable\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient memory available\n    reason: KubeletHasSufficientMemory\n    status: \"False\"\n    type: MemoryPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has no disk pressure\n    reason: KubeletHasNoDiskPressure\n    status: \"False\"\n    type: DiskPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient PID available\n    reason: KubeletHasSufficientPID\n    status: \"False\"\n    type: PIDPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:15:15Z\"\n    message: kubelet is posting ready status\n    reason: KubeletReady\n    status: \"True\"\n    type: Ready\n  daemonEndpoints:\n    kubeletEndpoint:\n      Port: 10250\n  nodeInfo:\n    architecture: amd64\n    bootID: 22333234-7a6b-44d4-9ce1-67e31dc7e369\n    containerRuntimeVersion: containerd://1.5.9\n    kernelVersion: 5.13.0-28-generic\n    kubeProxyVersion: v1.23.3\n    kubeletVersion: v1.23.3\n    machineID: 9384e2927f544209b5d7b67474bbf92b\n    operatingSystem: linux\n    osImage: Ubuntu 21.10\n    systemUUID: aa829ca9-73d7-064d-9019-df07404ad448\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6504"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl describe node\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6505"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl get node -o yaml\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6506"}
{"instruction": "Write a yaml example for troubleshooting clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\nmetadata:\n  annotations:\n    node.alpha.kubernetes.io/ttl: \"0\"\n    volumes.kubernetes.io/controller-managed-attach-detach: \"true\"\n  creationTimestamp: \"2022-02-17T21:46:30Z\"\n  labels:\n    beta.kubernetes.io/arch: amd64\n    beta.kubernetes.io/os: linux\n    kubernetes.io/arch: amd64\n    kubernetes.io/hostname: kube-worker-1\n    kubernetes.io/os: linux\n  name: kube-worker-1\n  resourceVersion: \"4026\"\n  uid: 98efe7cb-2978-4a0b-842a-1a7bf12c05f8\nspec: {}\nstatus:\n  addresses:\n  - address: 192.168.0.113\n    type: InternalIP\n  - address: kube-worker-1\n    type: Hostname\n  allocatable:\n    cpu: \"2\"\n    ephemeral-storage: \"14167048988\"\n    hugepages-2Mi: \"0\"\n    memory: 1922788Ki\n    pods: \"110\"\n  capacity:\n    cpu: \"2\"\n    ephemeral-storage: 15372232Ki\n    hugepages-2Mi: \"0\"\n    memory: 2025188Ki\n    pods: \"110\"\n  conditions:\n  - lastHeartbeatTime: \"2022-02-17T22:20:32Z\"\n    lastTransitionTime: \"2022-02-17T22:20:32Z\"\n    message: Weave pod has set this\n    reason: WeaveIsUp\n    status: \"False\"\n    type: NetworkUnavailable\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient memory available\n    reason: KubeletHasSufficientMemory\n    status: \"False\"\n    type: MemoryPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has no disk pressure\n    reason: KubeletHasNoDiskPressure\n    status: \"False\"\n    type: DiskPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient PID available\n    reason: KubeletHasSufficientPID\n    status: \"False\"\n    type: PIDPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:15:15Z\"\n    message: kubelet is posting ready status\n    reason: KubeletReady\n    status: \"True\"\n    type: Ready\n  daemonEndpoints:\n    kubeletEndpoint:\n      Port: 10250\n  nodeInfo:\n    architecture: amd64\n    bootID: 22333234-7a6b-44d4-9ce1-67e31dc7e369\n    containerRuntimeVersion: containerd://1.5.9\n    kernelVersion: 5.13.0-28-generic\n    kubeProxyVersion: v1.23.3\n    kubeletVersion: v1.23.3\n    machineID: 9384e2927f544209b5d7b67474bbf92b\n    operatingSystem: linux\n    osImage: Ubuntu 21.10\n    systemUUID: aa829ca9-73d7-064d-9019-df07404ad448\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6507"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nTroubleshooting Clusters | Sometimes when debugging it can be useful to look at the status of a node -- for example, because you've noticed strange behavior of a Pod that's running on the node, or to find out why a Pod won't sc", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6508"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl describe node kube-worker-1\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6509"}
{"instruction": "Write a bash example for troubleshooting clusters", "response": "Here's a bash example:\n\n```bash\nkubectl get node kube-worker-1 -o yaml\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6510"}
{"instruction": "Write a yaml example for troubleshooting clusters", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\nmetadata:\n  annotations:\n    node.alpha.kubernetes.io/ttl: \"0\"\n    volumes.kubernetes.io/controller-managed-attach-detach: \"true\"\n  creationTimestamp: \"2022-02-17T21:46:30Z\"\n  labels:\n    beta.kubernetes.io/arch: amd64\n    beta.kubernetes.io/os: linux\n    kubernetes.io/arch: amd64\n    kubernetes.io/hostname: kube-worker-1\n    kubernetes.io/os: linux\n  name: kube-worker-1\n  resourceVersion: \"4026\"\n  uid: 98efe7cb-2978-4a0b-842a-1a7bf12c05f8\nspec: {}\nstatus:\n  addresses:\n  - address: 192.168.0.113\n    type: InternalIP\n  - address: kube-worker-1\n    type: Hostname\n  allocatable:\n    cpu: \"2\"\n    ephemeral-storage: \"14167048988\"\n    hugepages-2Mi: \"0\"\n    memory: 1922788Ki\n    pods: \"110\"\n  capacity:\n    cpu: \"2\"\n    ephemeral-storage: 15372232Ki\n    hugepages-2Mi: \"0\"\n    memory: 2025188Ki\n    pods: \"110\"\n  conditions:\n  - lastHeartbeatTime: \"2022-02-17T22:20:32Z\"\n    lastTransitionTime: \"2022-02-17T22:20:32Z\"\n    message: Weave pod has set this\n    reason: WeaveIsUp\n    status: \"False\"\n    type: NetworkUnavailable\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient memory available\n    reason: KubeletHasSufficientMemory\n    status: \"False\"\n    type: MemoryPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has no disk pressure\n    reason: KubeletHasNoDiskPressure\n    status: \"False\"\n    type: DiskPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient PID available\n    reason: KubeletHasSufficientPID\n    status: \"False\"\n    type: PIDPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:15:15Z\"\n    message: kubelet is posting ready status\n    reason: KubeletReady\n    status: \"True\"\n    type: Ready\n  daemonEndpoints:\n    kubeletEndpoint:\n      Port: 10250\n  nodeInfo:\n    architecture: amd64\n    bootID: 22333234-7a6b-44d4-9ce1-67e31dc7e369\n    containerRuntimeVersion: containerd://1.5.9\n    kernelVersion: 5.13.0-28-generic\n    kubeProxyVersion: v1.23.3\n    kubeletVersion: v1.23.3\n    machineID: 9384e2927f544209b5d7b67474bbf92b\n    operatingSystem: linux\n    osImage: Ubuntu 21.10\n    systemUUID: aa829ca9-73d7-064d-9019-df07404ad448\n```\n\nTroubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/", "id": "k8s_00506_code_6511"}
{"instruction": "What is the reference documentation for kubernetes custom metrics (v1beta2)?", "response": "Kubernetes Custom Metrics (v1beta2)Package v1beta2 is the v1beta2 version of the custom_metrics API.Resource TypesMetricListOptionsMetricValueMetricValueListMetricListOptionsMetricListOptions is used to select metrics by their label selectorsFieldDescriptionapiVersionstringcustom.metrics.k8s.io/v1beta2kindstringMetricListOptionslabelSelectorstringA selector to restrict the list of returned objects by their labels. Defaults to everything.metricLabelSelectorstringA selector to restrict the list of returned metrics by their labelsMetricValueAppears in:MetricValueListMetricValue is the metric value for some objectFieldDescriptionapiVersionstringcustom.metrics.k8s.io/v1beta2kindstringMetricValuedescribedObject [Required]core/v1.ObjectReferencea reference to the described objectmetric [Required]MetricIdentifierNo description provided.timestamp [Required]meta/v1.Timeindicates the time at which the metrics were producedwindowSeconds [Required]int64indicates the window ([Timestamp-Window, Timestamp]) from which these metrics were calculated, when returning rate metrics calculated from cumulative metrics (or zero for non-calculated instantaneous metrics).value [Required]k8s.io/apimachinery/pkg/api/resource.Quantitythe value of the metric for thisMetricValueListMetricValueList is a list of values for a given metric for some set of objectsFieldDescriptionapiVersionstringcustom.metrics.k8s.io/v1beta2kindstringMetricValueListmetadata [Required]meta/v1.ListMetaNo description provided.items [Required][]MetricValuethe value of the metric across the described objectsMetricIdentifierAppears in:MetricValueMetricIdentifier identifies a metric by name and, optionally, selectorFieldDescriptionname [Required]stringname is the name of the given metricselectormeta/v1.LabelSelectorselector represents the label selector that could be used to select this metric, and will generally just be the selector passed in to the query used to fetch this metric. When left blank, only the metric's Name will be used to gather metrics.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/external-api/custom-metrics.v1beta2/", "id": "k8s_00507"}
{"instruction": "What is the reference documentation for kube-apiserver configuration (v1alpha1)?", "response": "kube-apiserver Configuration (v1alpha1)Package v1alpha1 is the v1alpha1 version of the API.Resource TypesAdmissionConfigurationAuthenticationConfigurationAuthorizationConfigurationEgressSelectorConfigurationTracingConfigurationTracingConfigurationAppears in:KubeletConfigurationTracingConfigurationTracingConfiguration provides versioned configuration for OpenTelemetry tracing clients.FieldDescriptionendpointstringEndpoint of the collector this component will report traces to. The connection is insecure, and does not currently support TLS. Recommended is unset, and endpoint is the otlp grpc default, localhost:4317.samplingRatePerMillionint32SamplingRatePerMillion is the number of samples to collect per million spans. Recommended is unset. If unset, sampler respects its parent span's sampling rate, but otherwise never samples.AdmissionConfigurationAdmissionConfiguration provides versioned configuration for admission controllers.FieldDescriptionapiVersionstringapiserver.k8s.io/v1alpha1kindstringAdmissionConfigurationplugins[]AdmissionPluginConfigurationPlugins allows specifying a configuration per admission control plugin.AuthenticationConfigurationAuthenticationConfiguration provides versioned configuration for authentication.FieldDescriptionapiVersionstringapiserver.k8s.io/v1alpha1kindstringAuthenticationConfigurationjwt [Required][]JWTAuthenticatorjwt is a list of authenticator to authenticate Kubernetes users using JWT compliant tokens. The authenticator will attempt to parse a raw ID token, verify it's been signed by the configured issuer. The public key to verify the signature is discovered from the issuer's public endpoint using OIDC discovery. For an incoming token, each JWT authenticator will be attempted in the order in which it is specified in this list. Note however that other authenticators may run before or after the JWT authenticators. The specific position of JWT authenticators in relation to other authenticators is neither defined nor stable across releases. Since each JWT authenticator must have a unique issuer URL, at most one JWT authenticator will attempt to cryptographically validate the token.The minimum valid JWT payload must contain the following claims: { \"iss\": \"https://issuer.example.com\", \"aud\": [\"audience\"], \"exp\": 1234567890, \"\": \"username\" }anonymous [Required]AnonymousAuthConfigIf present --anonymous-auth must not be setAuthorizationConfigurationFieldDescriptionapiVersionstringapiserver.k8s.io/v1alpha1kindstringAuthorizationConfigurationauthorizers [Required][]AuthorizerConfigurationAuthorizers is an ordered list of authorizers to authorize requests against. This is similar to the --authorization-modes kube-apiserver flag Must be at least one.EgressSelectorConfigurationEgressSelectorConfiguration provides versioned configuration for egress selector clients.FieldDescriptionapiVersionstringapiserver.k8s.io/v1alpha1kindstringEgressSelectorConfigurationegressSelections [Required][]EgressSelectionconnectionServices contains a list of egress selection client configurationsTracingConfigurationTracingConfiguration provides versioned configuration for tracing clients.FieldDescriptionapiVersionstringapiserver.k8s.io/v1alpha1kindstringTracingConfigurationTracingConfiguration [Required]TracingConfiguration(Members of TracingConfiguration are embedded into this type.)Embed the component config tracing configuration structAdmissionPluginConfigurationAppears in:AdmissionConfigurationAdmissionPluginConfiguration provides the configuration for a single plug-in.FieldDescriptionname [Required]stringName is the name of the admission controller. It must match the registered admission plugin name.pathstringPath is the path to a configuration file that contains the plugin's configurationconfigurationk8s.io/apimachinery/pkg/runtime.UnknownConfiguration is an embedded configuration object to be used as the plugin's configuration. If present, it will be used instead of the path to the configuration file.AnonymousAuthConditi", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/apiserver-config.v1alpha1/", "id": "k8s_00508"}
{"instruction": "What is the reference documentation for kubectl options?", "response": "kubectl optionsSynopsisPrint the list of flags inherited by all commandskubectl options [flags] Examples # Print flags inherited by all commands kubectl options Options-h, --helphelp for optionsParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_options/", "id": "k8s_00509"}
{"instruction": "Write a bash example for kubectl options", "response": "Here's a bash example:\n\n```bash\nkubectl options [flags]\n```\n\nkubectl options | help for options", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_options/", "id": "k8s_00509_code_6515"}
{"instruction": "Write a bash example for kubectl options", "response": "Here's a bash example:\n\n```bash\nkubectl options [flags]\n```\n\nkubectl options | help for options", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_options/", "id": "k8s_00509_code_6516"}
{"instruction": "How do you install and set up kubectl on macos in Kubernetes?", "response": "Install and Set Up kubectl on macOSBefore you beginYou must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.34 client can communicate with v1.33, v1.34, and v1.35 control planes. Using the latest compatible version of kubectl helps avoid unforeseen issues.Install kubectl on macOSThe following methods exist for installing kubectl on macOS:Install kubectl on macOSInstall kubectl binary with curl on macOSInstall with Homebrew on macOSInstall with Macports on macOSVerify kubectl configurationOptional kubectl configurations and pluginsEnable shell autocompletionInstall kubectl convert pluginInstall kubectl binary with curl on macOSDownload the latest release: curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl\" curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl\" Note:To download a specific version, replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) portion of the command with the specific version.For example, to download version 1.34.0 on Intel macOS, type:curl -LO \"https://dl.k8s.io/release/v1.34.0/bin/darwin/amd64/kubectl\" And for macOS on Apple Silicon, type:curl -LO \"https://dl.k8s.io/release/v1.34.0/bin/darwin/arm64/kubectl\" Validate the binary (optional)Download the kubectl checksum file: curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl.sha256\" curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256\" Validate the kubectl binary against the checksum file:echo \"$(cat kubectl.sha256) kubectl\" | shasum -a 256 --check If valid, the output is:kubectl: OK If the check fails, shasum exits with nonzero status and prints output similar to:kubectl: FAILED shasum: WARNING: 1 computed checksum did NOT match Note:Download the same version of the binary and checksum.Make the kubectl binary executable.chmod +x ./kubectl Move the kubectl binary to a file location on your system PATH.sudo mv ./kubectl /usr/local/bin/kubectl sudo chown root: /usr/local/bin/kubectl Note:Make sure /usr/local/bin is in your PATH environment variable.Test to ensure the version you installed is up-to-date:kubectl version --client Or use this for detailed view of version:kubectl version --client --output=yaml After installing and validating kubectl, delete the checksum file:rm kubectl.sha256 Install with Homebrew on macOSIf you are on macOS and using Homebrew package manager, you can install kubectl with Homebrew.Run the installation command:brew install kubectl orbrew install kubernetes-cli Test to ensure the version you installed is up-to-date:kubectl version --client Install with Macports on macOSIf you are on macOS and using Macports package manager, you can install kubectl with Macports.Run the installation command:sudo port selfupdate sudo port install kubectl Test to ensure the version you installed is up-to-date:kubectl version --client Verify kubectl configurationIn order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cluster. By default, kubectl configuration is located at ~/.kube/config.Check that kubectl is properly configured by getting the cluster state:kubectl cluster-info If you see a URL response, kubectl is correctly configured to access your cluster.If you see a message similar to the following, kubectl is not configured correctly or is not able to connect to a Kubernetes cluster.The connection to the server <server-name:port> was refused - did you specify the right host or port? For example, if you are intending to run a Kubernetes cluster on your laptop (locally), you will need a tool like Minikube to be installed first and then re-run the commands stated above.If kubectl cluster-info returns the url ", "category": "tasks", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on macOS | Make the kubectl binary executable.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6518"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6519"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\nInstall and Set Up kubectl on macOS | After installing and validating kubectl, delete the checksum file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6520"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | If you are on macOS and using Macports package manager, you can install kubectl with Macports.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6521"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | In order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cl", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6522"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nInstall and Set Up kubectl on macOS | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6523"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash >/usr/local/etc/bash_completion.d/kubectl\n```\n\nInstall and Set Up kubectl on macOS | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6524"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\nInstall and Set Up kubectl on macOS | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6525"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on macOS | Make kubectl-convert binary executable", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6526"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\nInstall and Set Up kubectl on macOS | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6527"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl\"\n```\n\nInstall and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6528"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl\"\n```\n\nInstall and Set Up kubectl on macOS | To download a specific version, replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) portion of the command with the specific version.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6529"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/v1.34.0/bin/darwin/amd64/kubectl\"\n```\n\nInstall and Set Up kubectl on macOS | And for macOS on Apple Silicon, type:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6530"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/v1.34.0/bin/darwin/arm64/kubectl\"\n```\n\nInstall and Set Up kubectl on macOS | Validate the binary (optional)", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6531"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl.sha256\"\n```\n\nInstall and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6532"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256\"\n```\n\nInstall and Set Up kubectl on macOS | Validate the kubectl binary against the checksum file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6533"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl.sha256)  kubectl\" | shasum -a 256 --check\n```\n\nInstall and Set Up kubectl on macOS | If valid, the output is:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6534"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nsudo mv ./kubectl /usr/local/bin/kubectl\nsudo chown root: /usr/local/bin/kubectl\n```\n\nInstall and Set Up kubectl on macOS | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6535"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6536"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nbrew install kubernetes-cli\n```\n\nInstall and Set Up kubectl on macOS | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6537"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | If you are on macOS and using Macports package manager, you can install kubectl with Macports.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6538"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nsudo port selfupdate\nsudo port install kubectl\n```\n\nInstall and Set Up kubectl on macOS | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6539"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | In order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cl", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6540"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash\n```\n\nInstall and Set Up kubectl on macOS | However, the kubectl completion script depends on bash-completion which you thus have to previously install.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6541"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\necho $BASH_VERSION $SHELL\n```\n\nInstall and Set Up kubectl on macOS | Homebrew usually installs it at /usr/local/bin/bash.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6542"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nbrew install bash-completion@2\n```\n\nInstall and Set Up kubectl on macOS | As stated in the output of this command, add the following to your ~/.bash_profile file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6543"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nbrew_etc=\"$(brew --prefix)/etc\" && [[ -r \"${brew_etc}/profile.d/bash_completion.sh\" ]] && . \"${brew_etc}/profile.d/bash_completion.sh\"\n```\n\nInstall and Set Up kubectl on macOS | Reload your shell and verify that bash-completion v2 is correctly installed with type _init_completion.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6544"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\necho 'source <(kubectl completion bash)' >>~/.bash_profile\n```\n\nInstall and Set Up kubectl on macOS | Add the completion script to the /usr/local/etc/bash_completion.d directory:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6545"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash >/usr/local/etc/bash_completion.d/kubectl\n```\n\nInstall and Set Up kubectl on macOS | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6546"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\necho 'alias k=kubectl' >>~/.bash_profile\necho 'complete -o default -F __start_kubectl k' >>~/.bash_profile\n```\n\nInstall and Set Up kubectl on macOS | If you installed kubectl with Homebrew (as explained here), then the kubectl completion script should already be in /usr/local/etc/bash_completion.d/kubectl. In that case, you don't need to do anythin", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6547"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish\n```\n\nInstall and Set Up kubectl on macOS | To do so in all your shell sessions, add the following line to your ~/.config/fish/config.fish file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6548"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh\n```\n\nInstall and Set Up kubectl on macOS | To do so in all your shell sessions, add the following to your ~/.zshrc file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6549"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert\"\n```\n\nInstall and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6550"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert\"\n```\n\nInstall and Set Up kubectl on macOS | Validate the binary (optional)", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6551"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert.sha256\"\n```\n\nInstall and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256\"", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6552"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256\"\n```\n\nInstall and Set Up kubectl on macOS | Validate the kubectl-convert binary against the checksum file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6553"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl-convert.sha256)  kubectl-convert\" | shasum -a 256 --check\n```\n\nInstall and Set Up kubectl on macOS | If valid, the output is:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6554"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nchmod +x ./kubectl-convert\n```\n\nInstall and Set Up kubectl on macOS | Move the kubectl-convert binary to a file location on your system PATH.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6555"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nsudo mv ./kubectl-convert /usr/local/bin/kubectl-convert\nsudo chown root: /usr/local/bin/kubectl-convert\n```\n\nInstall and Set Up kubectl on macOS | Verify plugin is successfully installed", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6556"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nrm kubectl-convert kubectl-convert.sha256\n```\n\nInstall and Set Up kubectl on macOS | Depending on how you installed kubectl, use one of the following methods.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6557"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on macOS | Make the kubectl binary executable.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6558"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6559"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\nInstall and Set Up kubectl on macOS | After installing and validating kubectl, delete the checksum file:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6560"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | If you are on macOS and using Macports package manager, you can install kubectl with Macports.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6561"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\nInstall and Set Up kubectl on macOS | In order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cl", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6562"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\nInstall and Set Up kubectl on macOS | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6563"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash >/usr/local/etc/bash_completion.d/kubectl\n```\n\nInstall and Set Up kubectl on macOS | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6564"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\nInstall and Set Up kubectl on macOS | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6565"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\nInstall and Set Up kubectl on macOS | Make kubectl-convert binary executable", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6566"}
{"instruction": "Write a bash example for install and set up kubectl on macos", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\nInstall and Set Up kubectl on macOS | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/", "id": "k8s_00510_code_6567"}
{"instruction": "Explain the Kubernetes concept: Role Based Access Control Good Practices", "response": "Role Based Access Control Good PracticesPrinciples and practices for good RBAC design for cluster operators.Kubernetes RBAC is a key security control to ensure that cluster users and workloads have only the access to resources required to execute their roles. It is important to ensure that, when designing permissions for cluster users, the cluster administrator understands the areas where privilege escalation could occur, to reduce the risk of excessive access leading to security incidents.The good practices laid out here should be read in conjunction with the general RBAC documentation.General good practiceLeast privilegeIdeally, minimal RBAC rights should be assigned to users and service accounts. Only permissions explicitly required for their operation should be used. While each cluster will be different, some general rules that can be applied are :Assign permissions at the namespace level where possible. Use RoleBindings as opposed to ClusterRoleBindings to give users rights only within a specific namespace.Avoid providing wildcard permissions when possible, especially to all resources. As Kubernetes is an extensible system, providing wildcard access gives rights not just to all object types that currently exist in the cluster, but also to all object types which are created in the future.Administrators should not use cluster-admin accounts except where specifically needed. Providing a low privileged account with impersonation rights can avoid accidental modification of cluster resources.Avoid adding users to the system:masters group. Any user who is a member of this group bypasses all RBAC rights checks and will always have unrestricted superuser access, which cannot be revoked by removing RoleBindings or ClusterRoleBindings. As an aside, if a cluster is using an authorization webhook, membership of this group also bypasses that webhook (requests from users who are members of that group are never sent to the webhook)Minimize distribution of privileged tokensIdeally, pods shouldn't be assigned service accounts that have been granted powerful permissions (for example, any of the rights listed under privilege escalation risks). In cases where a workload requires powerful permissions, consider the following practices:Limit the number of nodes running powerful pods. Ensure that any DaemonSets you run are necessary and are run with least privilege to limit the blast radius of container escapes.Avoid running powerful pods alongside untrusted or publicly-exposed ones. Consider using Taints and Toleration, NodeAffinity, or PodAntiAffinity to ensure pods don't run alongside untrusted or less-trusted Pods. Pay special attention to situations where less-trustworthy Pods are not meeting the Restricted Pod Security Standard.HardeningKubernetes defaults to providing access which may not be required in every cluster. Reviewing the RBAC rights provided by default can provide opportunities for security hardening. In general, changes should not be made to rights provided to system: accounts some options to harden cluster rights exist:Review bindings for the system:unauthenticated group and remove them where possible, as this gives access to anyone who can contact the API server at a network level.Avoid the default auto-mounting of service account tokens by setting automountServiceAccountToken: false. For more details, see using default service account token. Setting this value for a Pod will overwrite the service account setting, workloads which require service account tokens can still mount them.Periodic reviewIt is vital to periodically review the Kubernetes RBAC settings for redundant entries and possible privilege escalations. If an attacker is able to create a user account with the same name as a deleted user, they can automatically inherit all the rights of the deleted user, especially the rights assigned to that user.Kubernetes RBAC - privilege escalation risksWithin Kubernetes RBAC there are a number of privileges which, if granted, ", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/rbac-good-practices/", "id": "k8s_00511"}
{"instruction": "Write a bash example for role based access control good practices", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets -A -o yaml\n```\n\nRole Based Access Control Good Practices | Permission to create workloads (either Pods, or workload resources that manage Pods) in a namespace implicitly grants access to many other resources in that namespace, such as Secrets, ConfigMaps, and", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/rbac-good-practices/", "id": "k8s_00511_code_6569"}
{"instruction": "Explain the Kubernetes concept: Namespaces", "response": "NamespacesIn Kubernetes, namespaces provide a mechanism for isolating groups of resources within a single cluster. Names of resources need to be unique within a namespace, but not across namespaces. Namespace-based scoping is applicable only for namespaced objects (e.g. Deployments, Services, etc.) and not for cluster-wide objects (e.g. StorageClass, Nodes, PersistentVolumes, etc.).When to Use Multiple NamespacesNamespaces are intended for use in environments with many users spread across multiple teams, or projects. For clusters with a few to tens of users, you should not need to create or think about namespaces at all. Start using namespaces when you need the features they provide.Namespaces provide a scope for names. Names of resources need to be unique within a namespace, but not across namespaces. Namespaces cannot be nested inside one another and each Kubernetes resource can only be in one namespace.Namespaces are a way to divide cluster resources between multiple users (via resource quota).It is not necessary to use multiple namespaces to separate slightly different resources, such as different versions of the same software: use labels to distinguish resources within the same namespace.Note:For a production cluster, consider not using the default namespace. Instead, make other namespaces and use those.Initial namespacesKubernetes starts with four initial namespaces:defaultKubernetes includes this namespace so that you can start using your new cluster without first creating a namespace.kube-node-leaseThis namespace holds Lease objects associated with each node. Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.kube-publicThis namespace is readable by all clients (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.kube-systemThe namespace for objects created by the Kubernetes system.Working with NamespacesCreation and deletion of namespaces are described in the Admin Guide documentation for namespaces.Note:Avoid creating namespaces with the prefix kube-, since it is reserved for Kubernetes system namespaces.Viewing namespacesYou can list the current namespaces in a cluster using:kubectl get namespace NAME STATUS AGE default Active 1d kube-node-lease Active 1d kube-public Active 1d kube-system Active 1d Setting the namespace for a requestTo set the namespace for a current request, use the --namespace flag.For example:kubectl run nginx --image=nginx --namespace=<insert-namespace-name-here> kubectl get pods --namespace=<insert-namespace-name-here> Setting the namespace preferenceYou can permanently save the namespace for all subsequent kubectl commands in that context.kubectl config set-context --current --namespace=<insert-namespace-name-here> # Validate it kubectl config view --minify | grep namespace: Namespaces and DNSWhen you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>, it will resolve to the service which is local to a namespace. This is useful for using the same configuration across multiple namespaces such as Development, Staging and Production. If you want to reach across namespaces, you need to use the fully qualified domain name (FQDN).As a result, all namespace names must be valid RFC 1123 DNS labels.Warning:By creating namespaces with the same name as public top-level domains, Services in these namespaces can have short DNS names that overlap with public DNS records. Workloads from any namespace performing a DNS lookup without a trailing dot will be redirected to those services, taking precedence over public DNS.To mitigate this, limit privileges for creating namespaces to trusted users. If required, you could ad", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", "id": "k8s_00512"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\nNamespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", "id": "k8s_00512_code_6571"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\nNamespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", "id": "k8s_00512_code_6572"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\nNamespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", "id": "k8s_00512_code_6573"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\nNamespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", "id": "k8s_00512_code_6574"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\nNamespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", "id": "k8s_00512_code_6575"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\nNamespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", "id": "k8s_00512_code_6576"}
{"instruction": "Explain the Kubernetes concept: Application Security Checklist", "response": "Application Security ChecklistBaseline guidelines around ensuring application security on Kubernetes, aimed at application developersThis checklist aims to provide basic guidelines on securing applications running in Kubernetes from a developer's perspective. This list is not meant to be exhaustive and is intended to evolve over time.On how to read and use this document:The order of topics does not reflect an order of priority.Some checklist items are detailed in the paragraph below the list of each section.This checklist assumes that a developer is a Kubernetes cluster user who interacts with namespaced scope objects.Caution:Checklists are not sufficient for attaining a good security posture on their own. A good security posture requires constant attention and improvement, but a checklist can be the first step on the never-ending journey towards security preparedness. Some recommendations in this checklist may be too restrictive or too lax for your specific security needs. Since Kubernetes security is not \"one size fits all\", each category of checklist items should be evaluated on its merits.Base security hardeningThe following checklist provides base security hardening recommendations that would apply to most applications deploying to Kubernetes.Application design Follow the right security principles when designing applications. Application configured with appropriate QoS class through resource request and limits. Memory limit is set for the workloads with a limit equal to or greater than the request. CPU limit might be set on sensitive workloads.Service account Avoid using the default ServiceAccount. Instead, create ServiceAccounts for each workload or microservice. automountServiceAccountToken should be set to false unless the pod specifically requires access to the Kubernetes API to operate.Pod-level securityContext recommendations Set runAsNonRoot: true. Configure the container to execute as a less privileged user (for example, using runAsUser and runAsGroup), and configure appropriate permissions on files or directories inside the container image. Optionally add a supplementary group with fsGroup to access persistent volumes. The application deploys into a namespace that enforces an appropriate Pod security standard. If you cannot control this enforcement for the cluster(s) where the application is deployed, take this into account either through documentation or additional defense in depth.Container-level securityContext recommendations Disable privilege escalations using allowPrivilegeEscalation: false. Configure the root filesystem to be read-only with readOnlyRootFilesystem: true. Avoid running privileged containers (set privileged: false). Drop all capabilities from the containers and add back only specific ones that are needed for operation of the container.Role Based Access Control (RBAC) Permissions such as create, patch, update and delete should be only granted if necessary. Avoid creating RBAC permissions to create or update roles which can lead to privilege escalation. Review bindings for the system:unauthenticated group and remove them where possible, as this gives access to anyone who can contact the API server at a network level.The create, update and delete verbs should be permitted judiciously. The patch verb if allowed on a Namespace can allow users to update labels on the namespace or deployments which can increase the attack surface.For sensitive workloads, consider providing a recommended ValidatingAdmissionPolicy that further restricts the permitted write actions.Image security Using an image scanning tool to scan an image before deploying containers in the Kubernetes cluster. Use container signing to validate the container image signature before deploying to the Kubernetes cluster.Network policies Configure NetworkPolicies to only allow expected ingress and egress traffic from the pods.Make sure that your cluster provides and enforces NetworkPolicy. If you are writing an application that users will ", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/application-security-checklist/", "id": "k8s_00513"}
{"instruction": "How do you monitoring, logging, and debugging in Kubernetes?", "response": "Monitoring, Logging, and DebuggingSet up monitoring and logging to troubleshoot a cluster, or debug a containerized application.Sometimes things go wrong. This guide helps you gather the relevant information and resolve issues. It has four sections:Debugging your application - Useful for users who are deploying code into Kubernetes and wondering why it is not working.Debugging your cluster - Useful for cluster administrators and operators troubleshooting issues with the Kubernetes cluster itself.Logging in Kubernetes - Useful for cluster administrators who want to set up and manage logging in Kubernetes.Monitoring in Kubernetes - Useful for cluster administrators who want to enable monitoring in a Kubernetes cluster.You should also check the known issues for the release you're using.Getting helpIf your problem isn't answered by any of the guides above, there are variety of ways for you to get help from the Kubernetes community.QuestionsThe documentation on this site has been structured to provide answers to a wide range of questions. Concepts explain the Kubernetes architecture and how each component works, while Setup provides practical instructions for getting started. Tasks show how to accomplish commonly used tasks, and Tutorials are more comprehensive walkthroughs of real-world, industry-specific, or end-to-end development scenarios. The Reference section provides detailed documentation on the Kubernetes API and command-line interfaces (CLIs), such as kubectl.Help! My question isn't covered! I need help now!Stack Exchange, Stack Overflow, or Server FaultIf you have questions related to software development for your containerized app, you can ask those on Stack Overflow.If you have Kubernetes questions related to cluster management or configuration, you can ask those on Server Fault.There are also several more specific Stack Exchange network sites which might be the right place to ask Kubernetes questions in areas such as DevOps, Software Engineering, or InfoSec.Someone else from the community may have already asked a similar question or may be able to help with your problem.The Kubernetes team will also monitor posts tagged Kubernetes. If there aren't any existing questions that help, please ensure that your question is on-topic on Stack Overflow, Server Fault, or the Stack Exchange Network site you're asking on, and read through the guidance on how to ask a new question, before asking a new one!SlackMany people from the Kubernetes community hang out on Kubernetes Slack in the #kubernetes-users channel. Slack requires registration; you can request an invitation, and registration is open to everyone). Feel free to come and ask any and all questions. Once registered, access the Kubernetes organisation in Slack via your web browser or via Slack's own dedicated app.Once you are registered, browse the growing list of channels for various subjects of interest. For example, people new to Kubernetes may also want to join the #kubernetes-novice channel. As another example, developers should join the #kubernetes-contributors channel.There are also many country specific / local language channels. Feel free to join these channels for localized support and info:Country / language specific Slack channelsCountryChannelsChina#cn-users, #cn-eventsFinland#fi-usersFrance#fr-users, #fr-eventsGermany#de-users, #de-eventsIndia#in-users, #in-eventsItaly#it-users, #it-eventsJapan#jp-users, #jp-eventsKorea#kr-usersNetherlands#nl-usersNorway#norw-usersPoland#pl-usersRussia#ru-usersSpain#es-usersSweden#se-usersTurkey#tr-users, #tr-eventsForumYou're welcome to join the official Kubernetes Forum: discuss.kubernetes.io.Bugs and feature requestsIf you have what looks like a bug, or you would like to make a feature request, please use the GitHub issue tracking system.Before you file an issue, please search existing issues to see if your issue is already covered.If filing a bug, please include detailed information about how to reproduce the problem, such", "category": "tasks", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/", "id": "k8s_00514"}
{"instruction": "How do you customizing dns service in Kubernetes?", "response": "Customizing DNS ServiceThis page explains how to configure your DNS Pod(s) and customize the DNS resolution process in your cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour cluster must be running the CoreDNS add-on.Your Kubernetes server must be at or later than version v1.12.To check the version, enter kubectl version.IntroductionDNS is a built-in Kubernetes service launched automatically using the addon manager cluster add-on.Note:The CoreDNS Service is named kube-dns in the metadata.name field.The intent is to ensure greater interoperability with workloads that relied on the legacy kube-dns Service name to resolve addresses internal to the cluster. Using a Service named kube-dns abstracts away the implementation detail of which DNS provider is running behind that common name.If you are running CoreDNS as a Deployment, it will typically be exposed as a Kubernetes Service with a static IP address. The kubelet passes DNS resolver information to each container with the --cluster-dns=<dns-service-ip> flag.DNS names also need domains. You configure the local domain in the kubelet with the flag --cluster-domain=<default-local-domain>.The DNS server supports forward lookups (A and AAAA records), port lookups (SRV records), reverse IP address lookups (PTR records), and more. For more information, see DNS for Services and Pods.If a Pod's dnsPolicy is set to default, it inherits the name resolution configuration from the node that the Pod runs on. The Pod's DNS resolution should behave the same as the node. But see Known issues.If you don't want this, or if you want a different DNS config for pods, you can use the kubelet's --resolv-conf flag. Set this flag to \"\" to prevent Pods from inheriting DNS. Set it to a valid file path to specify a file other than /etc/resolv.conf for DNS inheritance.CoreDNSCoreDNS is a general-purpose authoritative DNS server that can serve as cluster DNS, complying with the DNS specifications.CoreDNS ConfigMap optionsCoreDNS is a DNS server that is modular and pluggable, with plugins adding new functionalities. The CoreDNS server can be configured by maintaining a Corefile, which is the CoreDNS configuration file. As a cluster administrator, you can modify the ConfigMap for the CoreDNS Corefile to change how DNS service discovery behaves for that cluster.In Kubernetes, CoreDNS is installed with the following default Corefile configuration:apiVersion: v1 kind: ConfigMap metadata: name: coredns namespace: kube-system data: Corefile: | .:53 { errors health { lameduck 5s } ready kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa ttl 30 } prometheus :9153 forward . /etc/resolv.conf cache 30 loop reload loadbalance } The Corefile configuration includes the following plugins of CoreDNS:errors: Errors are logged to stdout.health: Health of CoreDNS is reported to http://localhost:8080/health. In this extended syntax lameduck will make the process unhealthy then wait for 5 seconds before the process is shut down.ready: An HTTP endpoint on port 8181 will return 200 OK, when all plugins that are able to signal readiness have done so.kubernetes: CoreDNS will reply to DNS queries based on IP of the Services and Pods. You can find more details about this plugin on the CoreDNS website.ttl allows you to set a custom TTL for responses. The default is 5 seconds. The minimum TTL allowed is 0 seconds, and the maximum is capped at 3600 seconds. Setting TTL to 0 will prevent records from being cached.The pods insecure option is provided for backward compatibility with kube-dns.You can use ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/", "id": "k8s_00515"}
{"instruction": "Write a yaml example for customizing dns service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health {\n            lameduck 5s\n        }\n        ready\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n            pods insecure\n            fallthrough in-addr.arpa ip6.arpa\n            ttl 30\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\nCustomizing DNS Service | The Corefile configuration includes the following plugins of CoreDNS:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/", "id": "k8s_00515_code_6580"}
{"instruction": "Write a yaml example for customizing dns service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n           pods insecure\n           fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . 172.16.0.1\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n    consul.local:53 {\n        errors\n        cache 30\n        forward . 10.150.0.1\n    }\n```\n\nCustomizing DNS Service |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/", "id": "k8s_00515_code_6581"}
{"instruction": "Write a yaml example for customizing dns service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health {\n            lameduck 5s\n        }\n        ready\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n            pods insecure\n            fallthrough in-addr.arpa ip6.arpa\n            ttl 30\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\nCustomizing DNS Service | The Corefile configuration includes the following plugins of CoreDNS:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/", "id": "k8s_00515_code_6582"}
{"instruction": "Write a yaml example for customizing dns service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n           pods insecure\n           fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . 172.16.0.1\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n    consul.local:53 {\n        errors\n        cache 30\n        forward . 10.150.0.1\n    }\n```\n\nCustomizing DNS Service |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/", "id": "k8s_00515_code_6583"}
{"instruction": "Write a yaml example for customizing dns service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health {\n            lameduck 5s\n        }\n        ready\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n            pods insecure\n            fallthrough in-addr.arpa ip6.arpa\n            ttl 30\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\nCustomizing DNS Service | The Corefile configuration includes the following plugins of CoreDNS:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/", "id": "k8s_00515_code_6584"}
{"instruction": "Write a yaml example for customizing dns service", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n           pods insecure\n           fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . 172.16.0.1\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n    consul.local:53 {\n        errors\n        cache 30\n        forward . 10.150.0.1\n    }\n```\n\nCustomizing DNS Service |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/", "id": "k8s_00515_code_6585"}
{"instruction": "How do you debugging kubernetes nodes with kubectl in Kubernetes?", "response": "Debugging Kubernetes Nodes With KubectlThis page shows how to debug a node running on the Kubernetes cluster using kubectl debug command.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.2.To check the version, enter kubectl version.You need to have permission to create Pods and to assign those new Pods to arbitrary nodes. You also need to be authorized to create Pods that access filesystems from the host.Debugging a Node using kubectl debug nodeUse the kubectl debug node command to deploy a Pod to a Node that you want to troubleshoot. This command is helpful in scenarios where you can't access your Node by using an SSH connection. When the Pod is created, the Pod opens an interactive shell on the Node. To create an interactive shell on a Node named “mynode”, run:kubectl debug node/mynode -it --image=ubuntu Creating debugging pod node-debugger-mynode-pdx84 with container debugger on node mynode. If you don't see a command prompt, try pressing enter. root@mynode:/# The debug command helps to gather information and troubleshoot issues. Commands that you might use include ip, ifconfig, nc, ping, and ps and so on. You can also install other tools, such as mtr, tcpdump, and curl, from the respective package manager.Note:The debug commands may differ based on the image the debugging pod is using and these commands might need to be installed.The debugging Pod can access the root filesystem of the Node, mounted at /host in the Pod. If you run your kubelet in a filesystem namespace, the debugging Pod sees the root for that namespace, not for the entire node. For a typical Linux node, you can look at the following paths to find relevant logs:/host/var/log/kubelet.logLogs from the kubelet, responsible for running containers on the node./host/var/log/kube-proxy.logLogs from kube-proxy, which is responsible for directing traffic to Service endpoints./host/var/log/containerd.logLogs from the containerd process running on the node./host/var/log/syslogShows general messages and information regarding the system./host/var/log/kern.logShows kernel logs.When creating a debugging session on a Node, keep in mind that:kubectl debug automatically generates the name of the new pod, based on the name of the node.The root filesystem of the Node will be mounted at /host.Although the container runs in the host IPC, Network, and PID namespaces, the pod isn't privileged. This means that reading some process information might fail because access to that information is restricted to superusers. For example, chroot /host will fail. If you need a privileged pod, create it manually or use the --profile=sysadmin flag.By applying Debugging Profiles, you can set specific properties such as securityContext to a debugging Pod.Cleaning upWhen you finish using the debugging Pod, delete it:kubectl get pods NAME READY STATUS RESTARTS AGE node-debugger-mynode-pdx84 0/1 Completed 0 8m1s # Change the pod name accordingly kubectl delete pod node-debugger-mynode-pdx84 --now pod \"node-debugger-mynode-pdx84\" deleted Note:The kubectl debug node command won't work if the Node is down (disconnected from the network, or kubelet dies and won't restart, etc.). Check debugging a down/unreachable node in that case.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/kubectl-node-debug/", "id": "k8s_00516"}
{"instruction": "Write a bash example for debugging kubernetes nodes with kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\nDebugging Kubernetes Nodes With Kubectl | The debug command helps to gather information and troubleshoot issues. Commands that you might use include ip, ifconfig, nc, ping, and ps and so on. You can also install other tools, such as mtr, tcpd", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/kubectl-node-debug/", "id": "k8s_00516_code_6587"}
{"instruction": "Write a bash example for debugging kubernetes nodes with kubectl", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\nDebugging Kubernetes Nodes With Kubectl | The debug command helps to gather information and troubleshoot issues. Commands that you might use include ip, ifconfig, nc, ping, and ps and so on. You can also install other tools, such as mtr, tcpd", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/kubectl-node-debug/", "id": "k8s_00516_code_6588"}
{"instruction": "Explain writing a new topic in Kubernetes", "response": "Writing a new topicThis page shows how to create a new topic for the Kubernetes docs.Before you beginCreate a fork of the Kubernetes documentation repository as described in Open a PR.Choosing a page typeAs you prepare to write a new topic, think about the page type that would fit your content the best:Guidelines for choosing a page typeTypeDescriptionConceptA concept page explains some aspect of Kubernetes. For example, a concept page might describe the Kubernetes Deployment object and explain the role it plays as an application while it is deployed, scaled, and updated. Typically, concept pages don't include sequences of steps, but instead provide links to tasks or tutorials. For an example of a concept topic, see Nodes.TaskA task page shows how to do a single thing. The idea is to give readers a sequence of steps that they can actually do as they read the page. A task page can be short or long, provided it stays focused on one area. In a task page, it is OK to blend brief explanations with the steps to be performed, but if you need to provide a lengthy explanation, you should do that in a concept topic. Related task and concept topics should link to each other. For an example of a short task page, see Configure a Pod to Use a Volume for Storage. For an example of a longer task page, see Configure Liveness and Readiness ProbesTutorialA tutorial page shows how to accomplish a goal that ties together several Kubernetes features. A tutorial might provide several sequences of steps that readers can actually do as they read the page. Or it might provide explanations of related pieces of code. For example, a tutorial could provide a walkthrough of a code sample. A tutorial can include brief explanations of the Kubernetes features that are being tied together, but should link to related concept topics for deep explanations of individual features.Creating a new pageUse a content type for each new page that you write. The docs site provides templates or Hugo archetypes to create new content pages. To create a new type of page, run hugo new with the path to the file you want to create. For example:hugo new docs/concepts/my-first-concept.md Choosing a title and filenameChoose a title that has the keywords you want search engines to find. Create a filename that uses the words in your title separated by hyphens. For example, the topic with title Using an HTTP Proxy to Access the Kubernetes API has filename http-proxy-access-api.md. You don't need to put \"kubernetes\" in the filename, because \"kubernetes\" is already in the URL for the topic, for example: /docs/tasks/extend-kubernetes/http-proxy-access-api/ Adding the topic title to the front matterIn your topic, put a title field in the front matter. The front matter is the YAML block that is between the triple-dashed lines at the top of the page. Here's an example:--- title: Using an HTTP Proxy to Access the Kubernetes API --- Choosing a directoryDepending on your page type, put your new file in a subdirectory of one of these:/content/en/docs/tasks//content/en/docs/tutorials//content/en/docs/concepts/You can put your file in an existing subdirectory, or you can create a new subdirectory.Placing your topic in the table of contentsThe table of contents is built dynamically using the directory structure of the documentation source. The top-level directories under /content/en/docs/ create top-level navigation, and subdirectories each have entries in the table of contents.Each subdirectory has a file _index.md, which represents the \"home\" page for a given subdirectory's content. The _index.md does not need a template. It can contain overview content about the topics in the subdirectory.Other files in a directory are sorted alphabetically by default. This is almost never the best order. To control the relative sorting of topics in a subdirectory, set the weight: front-matter key to an integer. Typically, we use multiples of 10, to account for adding topics later. For instance, a topic with weig", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/write-new-topic/", "id": "k8s_00517"}
{"instruction": "Write a bash example for writing a new topic", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/storage/gce-volume.yaml\n```\n\nWriting a new topic | For an example of a topic that uses this technique, see Running a Single-Instance Stateful Application.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/write-new-topic/", "id": "k8s_00517_code_6590"}
{"instruction": "Write a bash example for writing a new topic", "response": "Here's a bash example:\n\n```bash\nkubectl get deploy mydeployment -o json | jq '.status'\n```\n\nWriting a new topic | Another way to include code in your topic is to create a new, complete sample file (or group of sample files) and then reference the sample from your topic. Use this method to include sample YAML file", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/write-new-topic/", "id": "k8s_00517_code_6591"}
{"instruction": "Write a bash example for writing a new topic", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/storage/gce-volume.yaml\n```\n\nWriting a new topic | For an example of a topic that uses this technique, see Running a Single-Instance Stateful Application.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/write-new-topic/", "id": "k8s_00517_code_6592"}
{"instruction": "Explain the Kubernetes concept: Workloads", "response": "WorkloadsUnderstand Pods, the smallest deployable compute object in Kubernetes, and the higher-level abstractions that help you to run them.A workload is an application running on Kubernetes. Whether your workload is a single component or several that work together, on Kubernetes you run it inside a set of pods. In Kubernetes, a Pod represents a set of running containers on your cluster.Kubernetes pods have a defined lifecycle. For example, once a pod is running in your cluster then a critical fault on the node where that pod is running means that all the pods on that node fail. Kubernetes treats that level of failure as final: you would need to create a new Pod to recover, even if the node later becomes healthy.However, to make life considerably easier, you don't need to manage each Pod directly. Instead, you can use workload resources that manage a set of pods on your behalf. These resources configure controllers that make sure the right number of the right kind of pod are running, to match the state you specified.Kubernetes provides several built-in workload resources:Deployment and ReplicaSet (replacing the legacy resource ReplicationController). Deployment is a good fit for managing a stateless application workload on your cluster, where any Pod in the Deployment is interchangeable and can be replaced if needed.StatefulSet lets you run one or more related Pods that do track state somehow. For example, if your workload records data persistently, you can run a StatefulSet that matches each Pod with a PersistentVolume. Your code, running in the Pods for that StatefulSet, can replicate data to other Pods in the same StatefulSet to improve overall resilience.DaemonSet defines Pods that provide facilities that are local to nodes. Every time you add a node to your cluster that matches the specification in a DaemonSet, the control plane schedules a Pod for that DaemonSet onto the new node. Each pod in a DaemonSet performs a job similar to a system daemon on a classic Unix / POSIX server. A DaemonSet might be fundamental to the operation of your cluster, such as a plugin to run cluster networking, it might help you to manage the node, or it could provide optional behavior that enhances the container platform you are running.Job and CronJob provide different ways to define tasks that run to completion and then stop. You can use a Job to define a task that runs to completion, just once. You can use a CronJob to run the same Job multiple times according a schedule.In the wider Kubernetes ecosystem, you can find third-party workload resources that provide additional behaviors. Using a custom resource definition, you can add in a third-party workload resource if you want a specific behavior that's not part of Kubernetes' core. For example, if you wanted to run a group of Pods for your application but stop work unless all the Pods are available (perhaps for some high-throughput distributed task), then you can implement or install an extension that does provide that feature.What's nextAs well as reading about each API kind for workload management, you can read how to do specific tasks:Run a stateless application using a DeploymentRun a stateful application either as a single instance or as a replicated setRun automated tasks with a CronJobTo learn about Kubernetes' mechanisms for separating code from configuration, visit Configuration.There are two supporting concepts that provide backgrounds about how Kubernetes manages pods for applications:Garbage collection tidies up objects from your cluster after their owning resource has been removed.The time-to-live after finished controller removes Jobs once a defined time has passed since they completed.Once your application is running, you might want to make it available on the internet as a Service or, for web application only, using an Ingress.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/", "id": "k8s_00518"}
{"instruction": "What is the reference documentation for kubectl certificate deny?", "response": "kubectl certificate denySynopsisDeny a certificate signing request.kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requester.kubectl certificate deny (-f FILENAME | NAME) Examples # Deny CSR 'csr-sqgzp' kubectl certificate deny csr-sqgzp Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update--forceUpdate the CSR even if it is already denied.-h, --helphelp for deny-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used t", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/kubectl_certificate_deny/", "id": "k8s_00519"}
{"instruction": "Write a bash example for kubectl certificate deny", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny (-f FILENAME | NAME)\n```\n\nkubectl certificate deny | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/kubectl_certificate_deny/", "id": "k8s_00519_code_6595"}
{"instruction": "Write a bash example for kubectl certificate deny", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny (-f FILENAME | NAME)\n```\n\nkubectl certificate deny | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/kubectl_certificate_deny/", "id": "k8s_00519_code_6596"}
{"instruction": "What is the reference documentation for service resources?", "response": "Service ResourcesServiceService is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.EndpointsEndpoints is a collection of endpoints that implement the actual service.EndpointSliceEndpointSlice represents a set of service endpoints.IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.IngressClassIngressClass represents the class of the Ingress, referenced by the Ingress Spec.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/", "id": "k8s_00520"}
{"instruction": "What is the reference documentation for validating admission policy?", "response": "Validating Admission PolicyFEATURE STATE: Kubernetes v1.30 [stable]This page provides an overview of Validating Admission Policy.What is Validating Admission Policy?Validating admission policies offer a declarative, in-process alternative to validating admission webhooks.Validating admission policies use the Common Expression Language (CEL) to declare the validation rules of a policy. Validation admission policies are highly configurable, enabling policy authors to define policies that can be parameterized and scoped to resources as needed by cluster administrators.What Resources Make a PolicyA policy is generally made up of three resources:The ValidatingAdmissionPolicy describes the abstract logic of a policy (think: \"this policy makes sure a particular label is set to a particular value\").A parameter resource provides information to a ValidatingAdmissionPolicy to make it a concrete statement (think \"the owner label must be set to something that ends in .company.com\"). A native type such as ConfigMap or a CRD defines the schema of a parameter resource. ValidatingAdmissionPolicy objects specify what Kind they are expecting for their parameter resource.A ValidatingAdmissionPolicyBinding links the above resources together and provides scoping. If you only want to require an owner label to be set for Pods, the binding is where you would specify this restriction.At least a ValidatingAdmissionPolicy and a corresponding ValidatingAdmissionPolicyBinding must be defined for a policy to have an effect.If a ValidatingAdmissionPolicy does not need to be configured via parameters, simply leave spec.paramKind in ValidatingAdmissionPolicy not specified.Getting Started with Validating Admission PolicyValidating Admission Policy is part of the cluster control-plane. You should write and deploy them with great caution. The following describes how to quickly experiment with Validating Admission Policy.Creating a ValidatingAdmissionPolicyThe following is an example of a ValidatingAdmissionPolicy.validatingadmissionpolicy/basic-example-policy.yaml apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingAdmissionPolicy metadata: name: \"demo-policy.example.com\" spec: failurePolicy: Fail matchConstraints: resourceRules: - apiGroups: [\"apps\"] apiVersions: [\"v1\"] operations: [\"CREATE\", \"UPDATE\"] resources: [\"deployments\"] validations: - expression: \"object.spec.replicas <= 5\"spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the spec.failurePolicy field.Note:You can quickly test CEL expressions in CEL Playground.To configure a validating admission policy for use in a cluster, a binding is required. The following is an example of a ValidatingAdmissionPolicyBinding.:validatingadmissionpolicy/basic-example-binding.yaml apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingAdmissionPolicyBinding metadata: name: \"demo-binding-test.example.com\" spec: policyName: \"demo-policy.example.com\" validationActions: [Deny] matchResources: namespaceSelector: matchLabels: environment: test When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:ValidatingAdmissionPolicy 'demo-policy.example.com' with binding 'demo-binding-test.example.com' denied request: failed expression: object.spec.replicas <= 5 The above provides a simple example of using ValidatingAdmissionPolicy without a parameter configured.Validation actionsEach ValidatingAdmissionPolicyBinding must specify one or more validationActions to declare how validations of a policy are enforced.The supported validationActions are:Deny: Validation failure results in a denied request.Warn: Validation failure is reported to the request client as a warning.Audit: Validation failure is included in the audit event for the API request.For example, to both warn clients about a validation failu", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\nValidating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6599"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6600"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\nValidating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6601"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6602"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\nValidating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6603"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\nValidating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6604"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\nValidating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6605"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: example-binding\nspec:\n  policyName: example-policy\n  paramRef:\n    selector:\n      matchLabels:\n        environment: test\n    parameterNotFoundAction: Allow\n  validationActions:\n  - Deny\n```\n\nValidating Admission Policy | failurePolicy defines how mis-configurations and CEL expressions evaluating to error from the admission policy are handled. Allowed values are Ignore or Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6606"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\nValidating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6607"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\nValidating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6608"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\nValidating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6609"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\nValidating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6610"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6611"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6612"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\nValidating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6613"}
{"instruction": "Write a bash example for validating admission policy", "response": "Here's a bash example:\n\n```bash\nkubectl create deploy --image=dev.example.com/nginx invalid\n```\n\nValidating Admission Policy | The error message is similar to this.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6614"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\nValidating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6615"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6616"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidationActions: [Warn, Audit]\n```\n\nValidating Admission Policy | Deny and Warn may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6617"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\nValidating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6618"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6619"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\nValidating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6620"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\nValidating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6621"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\nValidating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6622"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: example-binding\nspec:\n  policyName: example-policy\n  paramRef:\n    selector:\n      matchLabels:\n        environment: test\n    parameterNotFoundAction: Allow\n  validationActions:\n  - Deny\n```\n\nValidating Admission Policy | failurePolicy defines how mis-configurations and CEL expressions evaluating to error from the admission policy are handled. Allowed values are Ignore or Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6623"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\nValidating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6624"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\nValidating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6625"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\nValidating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6626"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\nValidating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6627"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6628"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n  typeChecking:\n    expressionWarnings:\n    - fieldRef: spec.validations[0].expression\n      warning: |-\n        apps/v1, Kind=Deployment: ERROR: <input>:1:7: undefined field 'replicas'\n         | object.replicas > 1\n         | ......^\n```\n\nValidating Admission Policy | If multiple resources are matched in spec.matchConstraints, all of matched resources will be checked against. For example, the following policy definition", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6629"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6630"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n  typeChecking:\n    expressionWarnings:\n    - fieldRef: spec.validations[0].expression\n      warning: |-\n        apps/v1, Kind=Deployment: ERROR: <input>:1:7: undefined field 'replicas'\n         | object.replicas > 1\n         | ......^\n        apps/v1, Kind=ReplicaSet: ERROR: <input>:1:7: undefined field 'replicas'\n         | object.replicas > 1\n         | ......^\n```\n\nValidating Admission Policy | Type Checking has the following limitation:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6631"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  variables:\n    - name: foo\n      expression: \"'foo' in object.spec.metadata.labels ? object.spec.metadata.labels['foo'] : 'default'\"\n  validations:\n    - expression: variables.foo == 'bar'\n```\n\nValidating Admission Policy | A variable is lazily evaluated when it is first referred. Any error that occurs during the evaluation will be reported during the evaluation of the referring expression. Both the result and potential", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6632"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\nValidating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6633"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/basic-example-policy.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\nValidating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6634"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\nValidating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6635"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/basic-example-binding.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6636"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6637"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/policy-with-param.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\nValidating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6638"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\nValidating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6639"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/binding-with-param.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6640"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\nValidating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6641"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/replicalimit-param.yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\nValidating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6642"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\nValidating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6643"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/binding-with-param-prod.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\nValidating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6644"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\nValidating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6645"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/replicalimit-param-prod.yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\nValidating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6646"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\nValidating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6647"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: example-binding\nspec:\n  policyName: example-policy\n  paramRef:\n    selector:\n      matchLabels:\n        environment: test\n    parameterNotFoundAction: Allow\n  validationActions:\n  - Deny\n```\n\nValidating Admission Policy | failurePolicy defines how mis-configurations and CEL expressions evaluating to error from the admission policy are handled. Allowed values are Ignore or Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6648"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/failure-policy-ignore.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\nValidating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6649"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\nValidating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6650"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\naccess/validating-admission-policy-match-conditions.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\nValidating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6651"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\nValidating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6652"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\naccess/validating-admission-policy-audit-annotation.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\nValidating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6653"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\nValidating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6654"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\naccess/deployment-replicas-policy.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\nValidating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6655"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\nValidating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6656"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/typechecking.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6657"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6658"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/typechecking-multiple-match.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6659"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\nValidating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6660"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\naccess/image-matches-namespace-environment.policy.yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\nValidating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6661"}
{"instruction": "Write a yaml example for validating admission policy", "response": "Here's a yaml example:\n\n```yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\nValidating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6662"}
{"instruction": "Write a bash example for validating admission policy", "response": "Here's a bash example:\n\n```bash\nkubectl create deploy --image=dev.example.com/nginx invalid\n```\n\nValidating Admission Policy | The error message is similar to this.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/", "id": "k8s_00521_code_6663"}
{"instruction": "Provide a tutorial on running multiple instances of your app", "response": "Running Multiple Instances of Your AppObjectivesScale an existing app manually using kubectl.Scaling an applicationYou can create from the start a Deployment with multiple instances using the --replicas parameter for the kubectl create deployment command.Previously we created a Deployment, and then exposed it publicly via a Service. The Deployment created only one Pod for running our application. When traffic increases, we will need to scale the application to keep up with user demand.If you haven't worked through the earlier sections, start from Using minikube to create a cluster.Scaling is accomplished by changing the number of replicas in a Deployment.Note:If you are trying this after the previous section, then you may have deleted the service you created, or have created a Service of type: NodePort. In this section, it is assumed that a service with type: LoadBalancer is created for the kubernetes-bootcamp Deployment.If you have not deleted the Service created in the previous section, first delete that Service and then run the following command to create a new Service with its type set to LoadBalancer:kubectl expose deployment/kubernetes-bootcamp --type=\"LoadBalancer\" --port 8080 Scaling overviewScaling is accomplished by changing the number of replicas in a Deployment.Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling will increase the number of Pods to the new desired state. Kubernetes also supports autoscaling of Pods, but it is outside of the scope of this tutorial. Scaling to zero is also possible, and it will terminate all Pods of the specified Deployment.Running multiple instances of an application will require a way to distribute the traffic to all of them. Services have an integrated load-balancer that will distribute network traffic to all Pods of an exposed Deployment. Services will monitor continuously the running Pods using endpoints, to ensure the traffic is sent only to available Pods.Once you have multiple instances of an application running, you would be able to do Rolling updates without downtime. We'll cover that in the", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"LoadBalancer\" --port 8080\n```\n\nRunning Multiple Instances of Your App | Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling will increase the number of Pods to the new desired state. Kubernetes also supports a", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6665"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nRunning Multiple Instances of Your App | The output should be similar to:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6666"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=4\n```\n\nRunning Multiple Instances of Your App | To list your Deployments once again, use get deployments:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6667"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nRunning Multiple Instances of Your App | The change was applied, and we have 4 instances of the application available. Next, let’s check if the number of Pods changed:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6668"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nRunning Multiple Instances of Your App | There are 4 Pods now, with different IP addresses. The change was registered in the Deployment events log. To check that, use the describe subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6669"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments/kubernetes-bootcamp\n```\n\nRunning Multiple Instances of Your App | You can also view in the output of this command that there are 4 replicas now.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6670"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\nRunning Multiple Instances of Your App | Create an environment variable called NODE_PORT that has a value as the Node port:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6671"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=2\n```\n\nRunning Multiple Instances of Your App | List the Deployments to check if the change was applied with the get deployments subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6672"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nRunning Multiple Instances of Your App | The number of replicas decreased to 2. List the number of Pods, with get pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6673"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nRunning Multiple Instances of Your App | This confirms that 2 Pods were terminated.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6674"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"LoadBalancer\" --port 8080\n```\n\nRunning Multiple Instances of Your App | Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling will increase the number of Pods to the new desired state. Kubernetes also supports a", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6675"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nRunning Multiple Instances of Your App | The output should be similar to:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6676"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=4\n```\n\nRunning Multiple Instances of Your App | To list your Deployments once again, use get deployments:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6677"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nRunning Multiple Instances of Your App | The change was applied, and we have 4 instances of the application available. Next, let’s check if the number of Pods changed:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6678"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nRunning Multiple Instances of Your App | There are 4 Pods now, with different IP addresses. The change was registered in the Deployment events log. To check that, use the describe subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6679"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments/kubernetes-bootcamp\n```\n\nRunning Multiple Instances of Your App | You can also view in the output of this command that there are 4 replicas now.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6680"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\nRunning Multiple Instances of Your App | Create an environment variable called NODE_PORT that has a value as the Node port:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6681"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=2\n```\n\nRunning Multiple Instances of Your App | List the Deployments to check if the change was applied with the get deployments subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6682"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nRunning Multiple Instances of Your App | The number of replicas decreased to 2. List the number of Pods, with get pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6683"}
{"instruction": "Write a bash example for running multiple instances of your app", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nRunning Multiple Instances of Your App | This confirms that 2 Pods were terminated.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/scale/scale-intro/", "id": "k8s_00522_code_6684"}
{"instruction": "What is the reference documentation for kubectl create secret?", "response": "kubectl create secretSynopsisCreate a secret with specified type.A docker-registry type secret is for accessing a container registry.A generic type secret indicate an Opaque secret type.A tls type secret holds TLS certificate and its associated key.kubectl create secret (docker-registry | generic | tls) Options-h, --helphelp for secretParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl create - Create a resource from a file or from stdinkubectl create secret docker-registry - Create a secret for use with a Docker registrykubectl create secret generic - Create a secret from a local file, directory, or literal valuekubectl create secret tls - Create a TLS secretThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret/", "id": "k8s_00523"}
{"instruction": "Write a bash example for kubectl create secret", "response": "Here's a bash example:\n\n```bash\nkubectl create secret (docker-registry | generic | tls)\n```\n\nkubectl create secret | help for secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret/", "id": "k8s_00523_code_6686"}
{"instruction": "Write a bash example for kubectl create secret", "response": "Here's a bash example:\n\n```bash\nkubectl create secret (docker-registry | generic | tls)\n```\n\nkubectl create secret | help for secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret/", "id": "k8s_00523_code_6687"}
{"instruction": "What is the reference documentation for status?", "response": "StatusStatus is a return value for calls that don't return other objects.import \"k8s.io/apimachinery/pkg/apis/meta/v1\"Status is a return value for calls that don't return other objects.apiVersion (string)APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resourcescode (int32)Suggested HTTP return code for this status, 0 if not set.details (StatusDetails)Atomic: will be replaced during a mergeExtended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.details.causes ([]StatusCause)Atomic: will be replaced during a mergeThe Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.details.causes.field (string)The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.Examples: \"name\" - the field \"name\" on the current resource \"items[0].name\" - the field \"name\" on the first array entry in \"items\"details.causes.message (string)A human-readable description of the cause of the error. This field may be presented as-is to a reader.details.causes.reason (string)A machine-readable description of the cause of the error. If this value is empty there is no information available.details.group (string)The group attribute of the resource associated with the status StatusReason.details.kind (string)The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsdetails.name (string)The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).details.retryAfterSeconds (int32)If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.details.uid (string)UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uidskind (string)Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsmessage (string)A human-readable description of the status of this operation.metadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsreason (string)A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.status (string)Status of the operation. One of: ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/status/", "id": "k8s_00524"}
{"instruction": "What is the reference documentation for kubectl debug?", "response": "kubectl debugSynopsisDebug cluster resources using interactive debugging containers.'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resource is specified.The action taken by 'debug' varies depending on what resource is specified. Supported actions include:Workload: Create a copy of an existing pod with certain attributes changed, for example changing the image tag to a new version.Workload: Add an ephemeral container to an already running pod, for example to add debugging utilities without restarting the pod.Node: Create a new pod that runs in the node's host namespaces and can access the node's filesystem.Note: When a non-root user is configured for the entire target Pod, some capabilities granted by debug profile may not work.kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ] Examples # Create an interactive debugging session in pod mypod and immediately attach to it. kubectl debug mypod -it --image=busybox # Create an interactive debugging session for the pod in the file pod.yaml and immediately attach to it. # (requires the EphemeralContainers feature to be enabled in the cluster) kubectl debug -f pod.yaml -it --image=busybox # Create a debug container named debugger using a custom automated debugging image. kubectl debug --image=myproj/debug-tools -c debugger mypod # Create a copy of mypod adding a debug container and attach to it kubectl debug mypod -it --image=busybox --copy-to=my-debugger # Create a copy of mypod changing the command of mycontainer kubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh # Create a copy of mypod changing all container images to busybox kubectl debug mypod --copy-to=my-debugger --set-image=*=busybox # Create a copy of mypod adding a debug container and changing container images kubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug # Create an interactive debugging session on a node and immediately attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at /host kubectl debug node/mynode -it --image=busybox Options--arguments-onlyIf specified, everything after -- will be passed to the new container as Args instead of Command.--attachIf true, wait for the container to start running, and then attach as if 'kubectl attach ...' were called. Default false, unless '-i/--stdin' is set, in which case the default is true.-c, --container stringContainer name to use for debug container.--copy-to stringCreate a copy of the target Pod with this name.--custom stringPath to a JSON or YAML file containing a partial container spec to customize built-in debug profiles.--env stringToString Default: []Environment variables to set in the container.-f, --filename stringsidentifying the resource to debug-h, --helphelp for debug--image stringContainer image to use for debug container.--image-pull-policy stringThe image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server.--keep-annotationsIf true, keep the original pod annotations.(This flag only works when used with '--copy-to')--keep-init-containers Default: trueRun the init containers for the pod. Defaults to true.(This flag only works when used with '--copy-to')--keep-labelsIf true, keep the original pod labels.(This flag only works when used with '--copy-to')--keep-livenessIf true, keep the original pod liveness probes.(This flag only works when used with '--copy-to')--keep-readinessIf true, keep the original pod readiness probes.(This flag only works when used with '--copy-to')--keep-startupIf true, keep the original startup probes.(This flag only works when used with '--copy-to')--profile string Default: \"legacy\"Options are \"legacy\", \"general\", \"baseline\", \"netadmin\", \"restricted\" or \"sysadmin\".-q, --quietIf true, suppress informational messages.--rep", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/", "id": "k8s_00525"}
{"instruction": "Write a bash example for kubectl debug", "response": "Here's a bash example:\n\n```bash\nkubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]\n```\n\nkubectl debug | If specified, everything after -- will be passed to the new container as Args instead of Command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/", "id": "k8s_00525_code_6690"}
{"instruction": "Write a bash example for kubectl debug", "response": "Here's a bash example:\n\n```bash\nkubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]\n```\n\nkubectl debug | If specified, everything after -- will be passed to the new container as Args instead of Command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/", "id": "k8s_00525_code_6691"}
{"instruction": "What is the reference documentation for dynamic admission control?", "response": "Dynamic Admission ControlIn addition to compiled-in admission plugins, admission plugins can be developed as extensions and run as webhooks configured at runtime. This page describes how to build, configure, use, and monitor admission webhooks.What are admission webhooks?Admission webhooks are HTTP callbacks that receive admission requests and do something with them. You can define two types of admission webhooks, validating admission webhook and mutating admission webhook. Mutating admission webhooks are invoked first, and can modify objects sent to the API server to enforce custom defaults. After all object modifications are complete, and after the incoming object is validated by the API server, validating admission webhooks are invoked and can reject requests to enforce custom policies.Note:Admission webhooks that need to guarantee they see the final state of the object in order to enforce policy should use a validating admission webhook, since objects can be modified after being seen by mutating webhooks.Experimenting with admission webhooksAdmission webhooks are essentially part of the cluster control-plane. You should write and deploy them with great caution. Please read the user guides for instructions if you intend to write/deploy production-grade admission webhooks. In the following, we describe how to quickly experiment with admission webhooks.PrerequisitesEnsure that MutatingAdmissionWebhook and ValidatingAdmissionWebhook admission controllers are enabled. Here is a recommended set of admission controllers to enable in general.Ensure that the admissionregistration.k8s.io/v1 API is enabled.Write an admission webhook serverPlease refer to the implementation of the admission webhook server that is validated in a Kubernetes e2e test. The webhook handles the AdmissionReview request sent by the API servers, and sends back its decision as an AdmissionReview object in the same version it received.See the webhook request section for details on the data sent to webhooks.See the webhook response section for the data expected from webhooks.The example admission webhook server leaves the ClientAuth field empty, which defaults to NoClientCert. This means that the webhook server does not authenticate the identity of the clients, supposedly API servers. If you need mutual TLS or other ways to authenticate the clients, see how to authenticate API servers.Deploy the admission webhook serviceThe webhook server in the e2e test is deployed in the Kubernetes cluster, via the deployment API. The test also creates a service as the front-end of the webhook server. See code.You may also deploy your webhooks outside of the cluster. You will need to update your webhook configurations accordingly.Configure admission webhooks on the flyYou can dynamically configure what resources are subject to what admission webhooks via ValidatingWebhookConfiguration or MutatingWebhookConfiguration.The following is an example ValidatingWebhookConfiguration, a mutating webhook configuration is similar. See the webhook configuration section for details about each config field.apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: \"pod-policy.example.com\" webhooks: - name: \"pod-policy.example.com\" rules: - apiGroups: [\"\"] apiVersions: [\"v1\"] operations: [\"CREATE\"] resources: [\"pods\"] scope: \"Namespaced\" clientConfig: service: namespace: \"example-namespace\" name: \"example-service\" caBundle: <CA_BUNDLE> admissionReviewVersions: [\"v1\"] sideEffects: None timeoutSeconds: 5 Note:You must replace the <CA_BUNDLE> in the above example by a valid CA bundle which is a PEM-encoded (field value is Base64 encoded) CA bundle for validating the webhook's server certificate.The scope field specifies if only cluster-scoped resources (\"Cluster\") or namespace-scoped resources (\"Namespaced\") will match this rule. \"∗\" means that there are no scope restrictions.Note:When using clientConfig.service, the server cert must be valid for <svc_name>.<", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nmetadata:\n  name: \"pod-policy.example.com\"\nwebhooks:\n- name: \"pod-policy.example.com\"\n  rules:\n  - apiGroups:   [\"\"]\n    apiVersions: [\"v1\"]\n    operations:  [\"CREATE\"]\n    resources:   [\"pods\"]\n    scope:       \"Namespaced\"\n  clientConfig:\n    service:\n      namespace: \"example-namespace\"\n      name: \"example-service\"\n    caBundle: <CA_BUNDLE>\n  admissionReviewVersions: [\"v1\"]\n  sideEffects: None\n  timeoutSeconds: 5\n```\n\nDynamic Admission Control | The scope field specifies if only cluster-scoped resources (\"Cluster\") or namespace-scoped resources (\"Namespaced\") will match this rule. \"∗\" means that there are no scope restrictions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6693"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\nDynamic Admission Control | # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1 apiVersion: apiserver.k8s.io/v1alpha1 kind: AdmissionConfiguration plugins: - name: ValidatingAdmissionWebhook configuration: # Depre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6694"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1\napiVersion: apiserver.k8s.io/v1alpha1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\nDynamic Admission Control | For more information about AdmissionConfiguration, see the AdmissionConfiguration (v1) reference. See the webhook configuration section for details about each config field.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6695"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n# name should be set to the DNS name of the service or the host (including port) of the URL the webhook is configured to speak to.\n# If a non-443 port is used for services, it must be included in the name when configuring 1.16+ API servers.\n#\n# For a webhook configured to speak to a service on the default port (443), specify the DNS name of the service:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For a webhook configured to speak to a service on non-default port (e.g. 8443), specify the DNS name and port of the service in 1.16+:\n# - name: webhook1.ns1.svc:8443\n#   user: ...\n# and optionally create a second stanza using only the DNS name of the service for compatibility with 1.15 API servers:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For webhooks configured to speak to a URL, match the host (and port) specified in the webhook's URL. Examples:\n# A webhook with `url: https://www.example.com`:\n# - name: www.example.com\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:443`:\n# - name: www.example.com:443\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:8443`:\n# - name: www.example.com:8443\n#   user: ...\n#\n- name: 'webhook1.ns1.svc'\n  user:\n    client-certificate-data: \"<pem encoded certificate>\"\n    client-key-data: \"<pem encoded key>\"\n# The `name` supports using * to wildcard-match prefixing segments.\n- name: '*.webhook-company.org'\n  user:\n    password: \"<password>\"\n    username: \"<name>\"\n# '*' is the default match.\n- name: '*'\n  user:\n    token: \"<token>\"\n```\n\nDynamic Admission Control | Of course you need to set up the webhook server to handle these authentication requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6696"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  admissionReviewVersions: [\"v1\", \"v1beta1\"]\n```\n\nDynamic Admission Control | admissionReviewVersions is a required field when creating webhook configurations. Webhooks are required to support at least one AdmissionReview version understood by the current and previous API serve", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6697"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\n...\nwebhooks:\n- name: my-webhook.example.com\n  rules:\n  - operations: [\"CREATE\", \"UPDATE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\", \"v1beta1\"]\n    resources: [\"deployments\", \"replicasets\"]\n    scope: \"Namespaced\"\n  ...\n```\n\nDynamic Admission Control | Match create requests for all resources (but not subresources) in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6698"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"*\"\n```\n\nDynamic Admission Control | Match update requests for all status subresources in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6699"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"UPDATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*/status\"]\n        scope: \"*\"\n```\n\nDynamic Admission Control | Webhooks may optionally limit which requests are intercepted based on the labels of the objects they would be sent, by specifying an objectSelector. If specified, the objectSelector is evaluated again", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6700"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  objectSelector:\n    matchLabels:\n      foo: bar\n  rules:\n  - operations: [\"CREATE\"]\n    apiGroups: [\"*\"]\n    apiVersions: [\"*\"]\n    resources: [\"*\"]\n    scope: \"*\"\n```\n\nDynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6701"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: runlevel\n          operator: NotIn\n          values: [\"0\",\"1\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\nDynamic Admission Control | This example shows a validating webhook that matches a CREATE of any namespaced resource inside a namespace that is associated with the \"environment\" of \"prod\" or \"staging\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6702"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: environment\n          operator: In\n          values: [\"prod\",\"staging\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\nDynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6703"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  matchPolicy: Equivalent\n  rules:\n  - operations: [\"CREATE\",\"UPDATE\",\"DELETE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\"]\n    resources: [\"deployments\"]\n    scope: \"Namespaced\"\n```\n\nDynamic Admission Control | The matchPolicy for an admission webhooks defaults to Equivalent.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6704"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['*']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Ignore' # Fail-open (optional)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'exclude-leases' # Each match condition must have a unique name\n        expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n      - name: 'exclude-kubelet-requests'\n        expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n      - name: 'rbac' # Skip RBAC requests, which are handled by the second webhook.\n        expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  \n  # This example illustrates the use of the 'authorizer'. The authorization check is more expensive\n  # than a simple expression, so in this example it is scoped to only RBAC requests by using a second\n  # webhook. Both webhooks can be served by the same endpoint.\n  - name: rbac.my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['rbac.authorization.k8s.io']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Fail' # Fail-closed (the default)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'breakglass'\n        # Skip requests made by users authorized to 'breakglass' on this webhook.\n        # The 'breakglass' API verb does not need to exist outside this check.\n        expression: '!authorizer.group(\"admissionregistration.k8s.io\").resource(\"validatingwebhookconfigurations\").name(\"my-webhook.example.com\").check(\"breakglass\").allowed()'\n```\n\nDynamic Admission Control | Match conditions have access to the following CEL variables:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6705"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n```\n\nDynamic Admission Control | The service stanza inside clientConfig is a reference to the service for this webhook. If the webhook is running within the cluster, then you should use service instead of url. The service namespace a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6706"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    caBundle: <CA_BUNDLE>\n    service:\n      namespace: my-service-namespace\n      name: my-service-name\n      path: /my-path\n      port: 1234\n```\n\nDynamic Admission Control | Webhooks typically operate only on the content of the AdmissionReview sent to them. Some webhooks, however, make out-of-band changes as part of processing admission requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6707"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    sideEffects: NoneOnDryRun\n```\n\nDynamic Admission Control | Because webhooks add to API request latency, they should evaluate as quickly as possible. timeoutSeconds allows configuring how long the API server should wait for a webhook to respond before treating", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6708"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    timeoutSeconds: 2\n```\n\nDynamic Admission Control | The timeout for an admission webhook defaults to 10 seconds.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6709"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  reinvocationPolicy: IfNeeded\n```\n\nDynamic Admission Control | Mutating webhooks must be idempotent, able to successfully process an object they have already admitted and potentially modified. This is true for all mutating admission webhooks, since any change the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6710"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  failurePolicy: Fail\n```\n\nDynamic Admission Control | The default failurePolicy for an admission webhooks is Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6711"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nmetadata:\n  name: \"pod-policy.example.com\"\nwebhooks:\n- name: \"pod-policy.example.com\"\n  rules:\n  - apiGroups:   [\"\"]\n    apiVersions: [\"v1\"]\n    operations:  [\"CREATE\"]\n    resources:   [\"pods\"]\n    scope:       \"Namespaced\"\n  clientConfig:\n    service:\n      namespace: \"example-namespace\"\n      name: \"example-service\"\n    caBundle: <CA_BUNDLE>\n  admissionReviewVersions: [\"v1\"]\n  sideEffects: None\n  timeoutSeconds: 5\n```\n\nDynamic Admission Control | The scope field specifies if only cluster-scoped resources (\"Cluster\") or namespace-scoped resources (\"Namespaced\") will match this rule. \"∗\" means that there are no scope restrictions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6712"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\nDynamic Admission Control | # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1 apiVersion: apiserver.k8s.io/v1alpha1 kind: AdmissionConfiguration plugins: - name: ValidatingAdmissionWebhook configuration: # Depre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6713"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1\napiVersion: apiserver.k8s.io/v1alpha1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\nDynamic Admission Control | For more information about AdmissionConfiguration, see the AdmissionConfiguration (v1) reference. See the webhook configuration section for details about each config field.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6714"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n# name should be set to the DNS name of the service or the host (including port) of the URL the webhook is configured to speak to.\n# If a non-443 port is used for services, it must be included in the name when configuring 1.16+ API servers.\n#\n# For a webhook configured to speak to a service on the default port (443), specify the DNS name of the service:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For a webhook configured to speak to a service on non-default port (e.g. 8443), specify the DNS name and port of the service in 1.16+:\n# - name: webhook1.ns1.svc:8443\n#   user: ...\n# and optionally create a second stanza using only the DNS name of the service for compatibility with 1.15 API servers:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For webhooks configured to speak to a URL, match the host (and port) specified in the webhook's URL. Examples:\n# A webhook with `url: https://www.example.com`:\n# - name: www.example.com\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:443`:\n# - name: www.example.com:443\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:8443`:\n# - name: www.example.com:8443\n#   user: ...\n#\n- name: 'webhook1.ns1.svc'\n  user:\n    client-certificate-data: \"<pem encoded certificate>\"\n    client-key-data: \"<pem encoded key>\"\n# The `name` supports using * to wildcard-match prefixing segments.\n- name: '*.webhook-company.org'\n  user:\n    password: \"<password>\"\n    username: \"<name>\"\n# '*' is the default match.\n- name: '*'\n  user:\n    token: \"<token>\"\n```\n\nDynamic Admission Control | Of course you need to set up the webhook server to handle these authentication requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6715"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  admissionReviewVersions: [\"v1\", \"v1beta1\"]\n```\n\nDynamic Admission Control | admissionReviewVersions is a required field when creating webhook configurations. Webhooks are required to support at least one AdmissionReview version understood by the current and previous API serve", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6716"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"admission.k8s.io/v1\",\n  \"kind\": \"AdmissionReview\",\n  \"request\": {\n    # Random uid uniquely identifying this admission call\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n\n    # Fully-qualified group/version/kind of the incoming object\n    \"kind\": {\n      \"group\": \"autoscaling\",\n      \"version\": \"v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # Fully-qualified group/version/kind of the resource being modified\n    \"resource\": {\n      \"group\": \"apps\",\n      \"version\": \"v1\",\n      \"resource\": \"deployments\"\n    },\n\n    # Subresource, if the request is to a subresource\n    \"subResource\": \"scale\",\n\n    # Fully-qualified group/version/kind of the incoming object in the original request to the API server\n    # This only differs from `kind` if the webhook specified `matchPolicy: Equivalent` and the original\n    # request to the API server was converted to a version the webhook registered for\n    \"requestKind\": {\n      \"group\": \"autoscaling\",\n      \"version\": \"v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # Fully-qualified group/version/kind of the resource being modified in the original request to the API server\n    # This only differs from `resource` if the webhook specified `matchPolicy: Equivalent` and the original\n    # request to the API server was converted to a version the webhook registered for\n    \"requestResource\": {\n      \"group\": \"apps\",\n      \"version\": \"v1\",\n      \"resource\": \"deployments\"\n    },\n\n    # Subresource, if the request is to a subresource\n    # This only differs from `subResource` if the webhook specified `matchPolicy: Equivalent` and the original\n    # request to the API server was converted to a version the webhook registered for\n    \"requestSubResource\": \"scale\",\n\n    # Name of the resource being modified\n    \"name\": \"my-deployment\",\n\n    # Namespace of the resource being modified, if the resource is namespaced (or is a Namespace object)\n    \"namespace\": \"my-namespace\",\n\n    # operation can be CREATE, UPDATE, DELETE, or CONNECT\n    \"operation\": \"UPDATE\",\n\n    \"userInfo\": {\n      # Username of the authenticated user making the request to the API server\n      \"username\": \"admin\",\n\n      # UID of the authenticated user making the request to the API server\n      \"uid\": \"014fbff9a07c\",\n\n      # Group memberships of the authenticated user making the request to the API server\n      \"groups\": [\n        \"system:authenticated\",\n        \"my-admin-group\"\n      ],\n\n      # Arbitrary extra info associated with the user making the request to the API server\n      # This is populated by the API server authentication layer\n      \"extra\": {\n        \"some-key\": [\n          \"some-value1\",\n          \"some-value2\"\n        ]\n      }\n    },\n\n    # object is the new object being admitted. It is null for DELETE operations\n    \"object\": {\n      \"apiVersion\": \"autoscaling/v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # oldObject is the existing object. It is null for CREATE and CONNECT operations\n    \"oldObject\": {\n      \"apiVersion\": \"autoscaling/v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # options contain the options for the operation being admitted, like meta.k8s.io/v1 CreateOptions,\n    # UpdateOptions, or DeleteOptions. It is null for CONNECT operations\n    \"options\": {\n      \"apiVersion\": \"meta.k8s.io/v1\",\n      \"kind\": \"UpdateOptions\"\n    },\n\n    # dryRun indicates the API request is running in dry run mode and will not be persisted\n    # Webhooks with side effects should avoid actuating those side effects when dryRun is true\n    \"dryRun\": false\n  }\n}\n```\n\nDynamic Admission Control | Webhooks respond with a 200 HTTP status code, Content-Type: application/json, and a body containing an AdmissionReview object (in the same version they were sent), with the response stanza populated,", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6717"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\n...\nwebhooks:\n- name: my-webhook.example.com\n  rules:\n  - operations: [\"CREATE\", \"UPDATE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\", \"v1beta1\"]\n    resources: [\"deployments\", \"replicasets\"]\n    scope: \"Namespaced\"\n  ...\n```\n\nDynamic Admission Control | Match create requests for all resources (but not subresources) in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6718"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"*\"\n```\n\nDynamic Admission Control | Match update requests for all status subresources in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6719"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"UPDATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*/status\"]\n        scope: \"*\"\n```\n\nDynamic Admission Control | Webhooks may optionally limit which requests are intercepted based on the labels of the objects they would be sent, by specifying an objectSelector. If specified, the objectSelector is evaluated again", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6720"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  objectSelector:\n    matchLabels:\n      foo: bar\n  rules:\n  - operations: [\"CREATE\"]\n    apiGroups: [\"*\"]\n    apiVersions: [\"*\"]\n    resources: [\"*\"]\n    scope: \"*\"\n```\n\nDynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6721"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: runlevel\n          operator: NotIn\n          values: [\"0\",\"1\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\nDynamic Admission Control | This example shows a validating webhook that matches a CREATE of any namespaced resource inside a namespace that is associated with the \"environment\" of \"prod\" or \"staging\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6722"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: environment\n          operator: In\n          values: [\"prod\",\"staging\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\nDynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6723"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  matchPolicy: Equivalent\n  rules:\n  - operations: [\"CREATE\",\"UPDATE\",\"DELETE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\"]\n    resources: [\"deployments\"]\n    scope: \"Namespaced\"\n```\n\nDynamic Admission Control | The matchPolicy for an admission webhooks defaults to Equivalent.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6724"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['*']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Ignore' # Fail-open (optional)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'exclude-leases' # Each match condition must have a unique name\n        expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n      - name: 'exclude-kubelet-requests'\n        expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n      - name: 'rbac' # Skip RBAC requests, which are handled by the second webhook.\n        expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  \n  # This example illustrates the use of the 'authorizer'. The authorization check is more expensive\n  # than a simple expression, so in this example it is scoped to only RBAC requests by using a second\n  # webhook. Both webhooks can be served by the same endpoint.\n  - name: rbac.my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['rbac.authorization.k8s.io']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Fail' # Fail-closed (the default)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'breakglass'\n        # Skip requests made by users authorized to 'breakglass' on this webhook.\n        # The 'breakglass' API verb does not need to exist outside this check.\n        expression: '!authorizer.group(\"admissionregistration.k8s.io\").resource(\"validatingwebhookconfigurations\").name(\"my-webhook.example.com\").check(\"breakglass\").allowed()'\n```\n\nDynamic Admission Control | Match conditions have access to the following CEL variables:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6725"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n```\n\nDynamic Admission Control | The service stanza inside clientConfig is a reference to the service for this webhook. If the webhook is running within the cluster, then you should use service instead of url. The service namespace a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6726"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    caBundle: <CA_BUNDLE>\n    service:\n      namespace: my-service-namespace\n      name: my-service-name\n      path: /my-path\n      port: 1234\n```\n\nDynamic Admission Control | Webhooks typically operate only on the content of the AdmissionReview sent to them. Some webhooks, however, make out-of-band changes as part of processing admission requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6727"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    sideEffects: NoneOnDryRun\n```\n\nDynamic Admission Control | Because webhooks add to API request latency, they should evaluate as quickly as possible. timeoutSeconds allows configuring how long the API server should wait for a webhook to respond before treating", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6728"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    timeoutSeconds: 2\n```\n\nDynamic Admission Control | The timeout for an admission webhook defaults to 10 seconds.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6729"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  reinvocationPolicy: IfNeeded\n```\n\nDynamic Admission Control | Mutating webhooks must be idempotent, able to successfully process an object they have already admitted and potentially modified. This is true for all mutating admission webhooks, since any change the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6730"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  failurePolicy: Fail\n```\n\nDynamic Admission Control | The default failurePolicy for an admission webhooks is Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6731"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# the audit event recorded\n{\n    \"kind\": \"Event\",\n    \"apiVersion\": \"audit.k8s.io/v1\",\n    \"annotations\": {\n        \"mutation.webhook.admission.k8s.io/round_1_index_2\": \"{\\\"configuration\\\":\\\"my-mutating-webhook-configuration.example.com\\\",\\\"webhook\\\":\\\"my-webhook.example.com\\\",\\\"mutated\\\": false}\"\n        # other annotations\n        ...\n    }\n    # other fields\n    ...\n}\n```\n\nDynamic Admission Control | The following annotation gets recorded for a webhook being invoked in the first round. The webhook is ordered the first in the mutating webhook chain, and mutated the request object during the invocat", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6732"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# the annotation value deserialized\n{\n    \"configuration\": \"my-mutating-webhook-configuration.example.com\",\n    \"webhook\": \"my-webhook.example.com\",\n    \"mutated\": false\n}\n```\n\nDynamic Admission Control | The following annotation gets recorded for a webhook being invoked in the first round. The webhook is ordered the first in the mutating webhook chain, and mutated the request object during the invocat", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6733"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# the audit event recorded\n{\n    \"kind\": \"Event\",\n    \"apiVersion\": \"audit.k8s.io/v1\",\n    \"annotations\": {\n        \"mutation.webhook.admission.k8s.io/round_0_index_0\": \"{\\\"configuration\\\":\\\"my-mutating-webhook-configuration.example.com\\\",\\\"webhook\\\":\\\"my-webhook-always-mutate.example.com\\\",\\\"mutated\\\": true}\"\n        # other annotations\n        ...\n    }\n    # other fields\n    ...\n}\n```\n\nDynamic Admission Control | At Request audit level or higher, an annotation with key patch.webhook.admission.k8s.io/round_{round idx}_index_{order idx} gets logged with JSON payload indicating a webhook gets invoked for given re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6734"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# the annotation value deserialized\n{\n    \"configuration\": \"my-mutating-webhook-configuration.example.com\",\n    \"webhook\": \"my-webhook-always-mutate.example.com\",\n    \"mutated\": true\n}\n```\n\nDynamic Admission Control | At Request audit level or higher, an annotation with key patch.webhook.admission.k8s.io/round_{round idx}_index_{order idx} gets logged with JSON payload indicating a webhook gets invoked for given re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6735"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# the audit event recorded\n{\n    \"kind\": \"Event\",\n    \"apiVersion\": \"audit.k8s.io/v1\",\n    \"annotations\": {\n        \"patch.webhook.admission.k8s.io/round_1_index_3\": \"{\\\"configuration\\\":\\\"my-other-mutating-webhook-configuration.example.com\\\",\\\"webhook\\\":\\\"my-webhook-always-mutate.example.com\\\",\\\"patch\\\":[{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/data/mutation-stage\\\",\\\"value\\\":\\\"yes\\\"}],\\\"patchType\\\":\\\"JSONPatch\\\"}\"\n        # other annotations\n        ...\n    }\n    # other fields\n    ...\n}\n```\n\nDynamic Admission Control | The API server exposes Prometheus metrics from the /metrics endpoint, which can be used for monitoring and diagnosing API server status. The following metrics record status related to admission webhoo", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6736"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# the annotation value deserialized\n{\n    \"configuration\": \"my-other-mutating-webhook-configuration.example.com\",\n    \"webhook\": \"my-webhook-always-mutate.example.com\",\n    \"patchType\": \"JSONPatch\",\n    \"patch\": [\n        {\n            \"op\": \"add\",\n            \"path\": \"/data/mutation-stage\",\n            \"value\": \"yes\"\n        }\n    ]\n}\n```\n\nDynamic Admission Control | The API server exposes Prometheus metrics from the /metrics endpoint, which can be used for monitoring and diagnosing API server status. The following metrics record status related to admission webhoo", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6737"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nmetadata:\n  name: \"pod-policy.example.com\"\nwebhooks:\n- name: \"pod-policy.example.com\"\n  rules:\n  - apiGroups:   [\"\"]\n    apiVersions: [\"v1\"]\n    operations:  [\"CREATE\"]\n    resources:   [\"pods\"]\n    scope:       \"Namespaced\"\n  clientConfig:\n    service:\n      namespace: \"example-namespace\"\n      name: \"example-service\"\n    caBundle: <CA_BUNDLE>\n  admissionReviewVersions: [\"v1\"]\n  sideEffects: None\n  timeoutSeconds: 5\n```\n\nDynamic Admission Control | The scope field specifies if only cluster-scoped resources (\"Cluster\") or namespace-scoped resources (\"Namespaced\") will match this rule. \"∗\" means that there are no scope restrictions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6738"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\nDynamic Admission Control | # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1 apiVersion: apiserver.k8s.io/v1alpha1 kind: AdmissionConfiguration plugins: - name: ValidatingAdmissionWebhook configuration: # Depre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6739"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1\napiVersion: apiserver.k8s.io/v1alpha1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\nDynamic Admission Control | For more information about AdmissionConfiguration, see the AdmissionConfiguration (v1) reference. See the webhook configuration section for details about each config field.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6740"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n# name should be set to the DNS name of the service or the host (including port) of the URL the webhook is configured to speak to.\n# If a non-443 port is used for services, it must be included in the name when configuring 1.16+ API servers.\n#\n# For a webhook configured to speak to a service on the default port (443), specify the DNS name of the service:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For a webhook configured to speak to a service on non-default port (e.g. 8443), specify the DNS name and port of the service in 1.16+:\n# - name: webhook1.ns1.svc:8443\n#   user: ...\n# and optionally create a second stanza using only the DNS name of the service for compatibility with 1.15 API servers:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For webhooks configured to speak to a URL, match the host (and port) specified in the webhook's URL. Examples:\n# A webhook with `url: https://www.example.com`:\n# - name: www.example.com\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:443`:\n# - name: www.example.com:443\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:8443`:\n# - name: www.example.com:8443\n#   user: ...\n#\n- name: 'webhook1.ns1.svc'\n  user:\n    client-certificate-data: \"<pem encoded certificate>\"\n    client-key-data: \"<pem encoded key>\"\n# The `name` supports using * to wildcard-match prefixing segments.\n- name: '*.webhook-company.org'\n  user:\n    password: \"<password>\"\n    username: \"<name>\"\n# '*' is the default match.\n- name: '*'\n  user:\n    token: \"<token>\"\n```\n\nDynamic Admission Control | Of course you need to set up the webhook server to handle these authentication requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6741"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  admissionReviewVersions: [\"v1\", \"v1beta1\"]\n```\n\nDynamic Admission Control | admissionReviewVersions is a required field when creating webhook configurations. Webhooks are required to support at least one AdmissionReview version understood by the current and previous API serve", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6742"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\n...\nwebhooks:\n- name: my-webhook.example.com\n  rules:\n  - operations: [\"CREATE\", \"UPDATE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\", \"v1beta1\"]\n    resources: [\"deployments\", \"replicasets\"]\n    scope: \"Namespaced\"\n  ...\n```\n\nDynamic Admission Control | Match create requests for all resources (but not subresources) in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6743"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"*\"\n```\n\nDynamic Admission Control | Match update requests for all status subresources in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6744"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"UPDATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*/status\"]\n        scope: \"*\"\n```\n\nDynamic Admission Control | Webhooks may optionally limit which requests are intercepted based on the labels of the objects they would be sent, by specifying an objectSelector. If specified, the objectSelector is evaluated again", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6745"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  objectSelector:\n    matchLabels:\n      foo: bar\n  rules:\n  - operations: [\"CREATE\"]\n    apiGroups: [\"*\"]\n    apiVersions: [\"*\"]\n    resources: [\"*\"]\n    scope: \"*\"\n```\n\nDynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6746"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: runlevel\n          operator: NotIn\n          values: [\"0\",\"1\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\nDynamic Admission Control | This example shows a validating webhook that matches a CREATE of any namespaced resource inside a namespace that is associated with the \"environment\" of \"prod\" or \"staging\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6747"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: environment\n          operator: In\n          values: [\"prod\",\"staging\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\nDynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6748"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  matchPolicy: Equivalent\n  rules:\n  - operations: [\"CREATE\",\"UPDATE\",\"DELETE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\"]\n    resources: [\"deployments\"]\n    scope: \"Namespaced\"\n```\n\nDynamic Admission Control | The matchPolicy for an admission webhooks defaults to Equivalent.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6749"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['*']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Ignore' # Fail-open (optional)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'exclude-leases' # Each match condition must have a unique name\n        expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n      - name: 'exclude-kubelet-requests'\n        expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n      - name: 'rbac' # Skip RBAC requests, which are handled by the second webhook.\n        expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  \n  # This example illustrates the use of the 'authorizer'. The authorization check is more expensive\n  # than a simple expression, so in this example it is scoped to only RBAC requests by using a second\n  # webhook. Both webhooks can be served by the same endpoint.\n  - name: rbac.my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['rbac.authorization.k8s.io']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Fail' # Fail-closed (the default)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'breakglass'\n        # Skip requests made by users authorized to 'breakglass' on this webhook.\n        # The 'breakglass' API verb does not need to exist outside this check.\n        expression: '!authorizer.group(\"admissionregistration.k8s.io\").resource(\"validatingwebhookconfigurations\").name(\"my-webhook.example.com\").check(\"breakglass\").allowed()'\n```\n\nDynamic Admission Control | Match conditions have access to the following CEL variables:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6750"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n```\n\nDynamic Admission Control | The service stanza inside clientConfig is a reference to the service for this webhook. If the webhook is running within the cluster, then you should use service instead of url. The service namespace a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6751"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    caBundle: <CA_BUNDLE>\n    service:\n      namespace: my-service-namespace\n      name: my-service-name\n      path: /my-path\n      port: 1234\n```\n\nDynamic Admission Control | Webhooks typically operate only on the content of the AdmissionReview sent to them. Some webhooks, however, make out-of-band changes as part of processing admission requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6752"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    sideEffects: NoneOnDryRun\n```\n\nDynamic Admission Control | Because webhooks add to API request latency, they should evaluate as quickly as possible. timeoutSeconds allows configuring how long the API server should wait for a webhook to respond before treating", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6753"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    timeoutSeconds: 2\n```\n\nDynamic Admission Control | The timeout for an admission webhook defaults to 10 seconds.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6754"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  reinvocationPolicy: IfNeeded\n```\n\nDynamic Admission Control | Mutating webhooks must be idempotent, able to successfully process an object they have already admitted and potentially modified. This is true for all mutating admission webhooks, since any change the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6755"}
{"instruction": "Write a yaml example for dynamic admission control", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  failurePolicy: Fail\n```\n\nDynamic Admission Control | The default failurePolicy for an admission webhooks is Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/", "id": "k8s_00526_code_6756"}
{"instruction": "What is the reference documentation for kube-scheduler?", "response": "kube-schedulerSynopsisThe Kubernetes scheduler is a control plane process which assigns Pods to Nodes. The scheduler determines which Nodes are valid placements for each Pod in the scheduling queue according to constraints and available resources. The scheduler then ranks each valid Node and binds the Pod to a suitable Node. Multiple different schedulers may be used within a cluster; kube-scheduler is the reference implementation. See scheduling for more information about scheduling and the kube-scheduler component.kube-scheduler [flags] Options--allow-metric-labels stringToString Default: []The map from metric-label to value allow-list of this label. The key's format is <MetricName>,<LabelName>. The value's format is <allowed_value>,<allowed_value>...e.g. metric1,label1='v1,v2,v3', metric1,label2='v1,v2,v3' metric2,label1='v1,v2,v3'.--allow-metric-labels-manifest stringThe path to the manifest file that contains the allow-list mapping. The format of the file is the same as the flag --allow-metric-labels. Note that the flag --allow-metric-labels will override the manifest file.--authentication-kubeconfig stringkubeconfig file pointing at the 'core' kubernetes server with enough rights to create tokenreviews.authentication.k8s.io. This is optional. If empty, all token requests are considered to be anonymous and no client CA is looked up in the cluster.--authentication-skip-lookupIf false, the authentication-kubeconfig will be used to lookup missing authentication configuration from the cluster.--authentication-token-webhook-cache-ttl duration Default: 10sThe duration to cache responses from the webhook token authenticator.--authentication-tolerate-lookup-failure Default: trueIf true, failures to look up missing authentication configuration from the cluster are not considered fatal. Note that this can result in authentication that treats all requests as anonymous.--authorization-always-allow-paths strings Default: \"/healthz,/readyz,/livez\"A list of HTTP paths to skip during authorization, i.e. these are authorized without contacting the 'core' kubernetes server.--authorization-kubeconfig stringkubeconfig file pointing at the 'core' kubernetes server with enough rights to create subjectaccessreviews.authorization.k8s.io. This is optional. If empty, all requests not skipped by authorization are forbidden.--authorization-webhook-cache-authorized-ttl duration Default: 10sThe duration to cache 'authorized' responses from the webhook authorizer.--authorization-webhook-cache-unauthorized-ttl duration Default: 10sThe duration to cache 'unauthorized' responses from the webhook authorizer.--bind-address string Default: 0.0.0.0The IP address on which to listen for the --secure-port port. The associated interface(s) must be reachable by the rest of the cluster, and by CLI/web clients. If blank or an unspecified address (0.0.0.0 or ::), all interfaces and IP address families will be used.--cert-dir stringThe directory where the TLS certs are located. If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.--client-ca-file stringIf set, any request presenting a client certificate signed by one of the authorities in the client-ca-file is authenticated with an identity corresponding to the CommonName of the client certificate.--config stringThe path to the configuration file.--contention-profiling Default: trueDEPRECATED: enable block profiling, if profiling is enabled. This parameter is ignored if a config file is specified in --config.--disable-http2-servingIf true, HTTP2 serving will be disabled [default=false]--disabled-metrics stringsThis flag provides an escape hatch for misbehaving metrics. You must provide the fully qualified metric name in order to disable it. Disclaimer: disabling metrics is higher in precedence than showing hidden metrics.--emulated-version stringsThe versions different components emulate their capabilities (APIs, features, ...) of.If set, the component will emulate the behavior of this ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/", "id": "k8s_00527"}
{"instruction": "How do you use cascading deletion in a cluster in Kubernetes?", "response": "Use Cascading Deletion in a ClusterThis page shows you how to specify the type of cascading deletion to use in your cluster during garbage collection.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou also need to create a sample Deployment to experiment with the different types of cascading deletion. You will need to recreate the Deployment for each type.Check owner references on your podsCheck that the ownerReferences field is present on your pods:kubectl get pods -l app=nginx --output=yaml The output has an ownerReferences field similar to this:apiVersion: v1 ... ownerReferences: - apiVersion: apps/v1 blockOwnerDeletion: true controller: true kind: ReplicaSet name: nginx-deployment-6b474476c4 uid: 4fdcd81c-bd5d-41f7-97af-3a3b759af9a7 ... Use foreground cascading deletionBy default, Kubernetes uses background cascading deletion to delete dependents of an object. You can switch to foreground cascading deletion using either kubectl or the Kubernetes API, depending on the Kubernetes version your cluster runs.To check the version, enter kubectl version.You can delete objects using foreground cascading deletion using kubectl or the Kubernetes API.Using kubectlRun the following command:kubectl delete deployment nginx-deployment --cascade=foreground Using the Kubernetes APIStart a local proxy session:kubectl proxy --port=8080 Use curl to trigger deletion:curl -X DELETE localhost:8080/apis/apps/v1/namespaces/default/deployments/nginx-deployment \\ -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Foreground\"}' \\ -H \"Content-Type: application/json\" The output contains a foregroundDeletion finalizer like this:\"kind\": \"Deployment\", \"apiVersion\": \"apps/v1\", \"metadata\": { \"name\": \"nginx-deployment\", \"namespace\": \"default\", \"uid\": \"d1ce1b02-cae8-4288-8a53-30e84d8fa505\", \"resourceVersion\": \"1363097\", \"creationTimestamp\": \"2021-07-08T20:24:37Z\", \"deletionTimestamp\": \"2021-07-08T20:27:39Z\", \"finalizers\": [ \"foregroundDeletion\" ] ... Use background cascading deletionCreate a sample Deployment.Use either kubectl or the Kubernetes API to delete the Deployment, depending on the Kubernetes version your cluster runs.To check the version, enter kubectl version.You can delete objects using background cascading deletion using kubectl or the Kubernetes API.Kubernetes uses background cascading deletion by default, and does so even if you run the following commands without the --cascade flag or the propagationPolicy argument.Using kubectlRun the following command:kubectl delete deployment nginx-deployment --cascade=background Using the Kubernetes APIStart a local proxy session:kubectl proxy --port=8080 Use curl to trigger deletion:curl -X DELETE localhost:8080/apis/apps/v1/namespaces/default/deployments/nginx-deployment \\ -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Background\"}' \\ -H \"Content-Type: application/json\" The output is similar to this:\"kind\": \"Status\", \"apiVersion\": \"v1\", ... \"status\": \"Success\", \"details\": { \"name\": \"nginx-deployment\", \"group\": \"apps\", \"kind\": \"deployments\", \"uid\": \"cc9eefb9-2d49-4445-b1c1-d261c9396456\" } Delete owner objects and orphan dependentsBy default, when you tell Kubernetes to delete an object, the controller also deletes dependent objects. You can make Kubernetes orphan these dependents using kubectl or the Kubernetes API, depending on the Kubernetes version your cluster runs.To check the version, enter kubectl version.Using kubectlRun the following command:kubectl delete deployment nginx-deployment --cascade=orphan Using the Kubernetes APIStart a local proxy session:kubectl proxy --port=8080", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx --output=yaml\n```\n\nUse Cascading Deletion in a Cluster | The output has an ownerReferences field similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6759"}
{"instruction": "Write a yaml example for use cascading deletion in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n    ...\n    ownerReferences:\n    - apiVersion: apps/v1\n      blockOwnerDeletion: true\n      controller: true\n      kind: ReplicaSet\n      name: nginx-deployment-6b474476c4\n      uid: 4fdcd81c-bd5d-41f7-97af-3a3b759af9a7\n    ...\n```\n\nUse Cascading Deletion in a Cluster | By default, Kubernetes uses background cascading deletion to delete dependents of an object. You can switch to foreground cascading deletion using either kubectl or the Kubernetes API, depending on th", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6760"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=foreground\n```\n\nUse Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6761"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6762"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=background\n```\n\nUse Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6763"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6764"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=orphan\n```\n\nUse Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6765"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6766"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nUse Cascading Deletion in a Cluster |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6767"}
{"instruction": "Write a yaml example for use cascading deletion in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n    ...\n    ownerReferences:\n    - apiVersion: apps/v1\n      blockOwnerDeletion: true\n      controller: true\n      kind: ReplicaSet\n      name: nginx-deployment-6b474476c4\n      uid: 4fdcd81c-bd5d-41f7-97af-3a3b759af9a7\n    ...\n```\n\nUse Cascading Deletion in a Cluster | By default, Kubernetes uses background cascading deletion to delete dependents of an object. You can switch to foreground cascading deletion using either kubectl or the Kubernetes API, depending on th", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6768"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx --output=yaml\n```\n\nUse Cascading Deletion in a Cluster | The output has an ownerReferences field similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6769"}
{"instruction": "Write a yaml example for use cascading deletion in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n    ...\n    ownerReferences:\n    - apiVersion: apps/v1\n      blockOwnerDeletion: true\n      controller: true\n      kind: ReplicaSet\n      name: nginx-deployment-6b474476c4\n      uid: 4fdcd81c-bd5d-41f7-97af-3a3b759af9a7\n    ...\n```\n\nUse Cascading Deletion in a Cluster | By default, Kubernetes uses background cascading deletion to delete dependents of an object. You can switch to foreground cascading deletion using either kubectl or the Kubernetes API, depending on th", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6770"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=foreground\n```\n\nUse Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6771"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6772"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=background\n```\n\nUse Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6773"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6774"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=orphan\n```\n\nUse Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6775"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nUse Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6776"}
{"instruction": "Write a bash example for use cascading deletion in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nUse Cascading Deletion in a Cluster |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/", "id": "k8s_00528_code_6777"}
{"instruction": "How do you migrate replicated control plane to use cloud controller manager in Kubernetes?", "response": "Migrate Replicated Control Plane To Use Cloud Controller ManagerThe cloud-controller-manager is a Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.By decoupling the interoperability logic between Kubernetes and the underlying cloud infrastructure, the cloud-controller-manager component enables cloud providers to release features at a different pace compared to the main Kubernetes project.BackgroundAs part of the cloud provider extraction effort, all cloud specific controllers must be moved out of the kube-controller-manager. All existing clusters that run cloud controllers in the kube-controller-manager must migrate to instead run the controllers in a cloud provider specific cloud-controller-manager.Leader Migration provides a mechanism in which HA clusters can safely migrate \"cloud specific\" controllers between the kube-controller-manager and the cloud-controller-manager via a shared resource lock between the two components while upgrading the replicated control plane. For a single-node control plane, or if unavailability of controller managers can be tolerated during the upgrade, Leader Migration is not needed and this guide can be ignored.Leader Migration can be enabled by setting --enable-leader-migration on kube-controller-manager or cloud-controller-manager. Leader Migration only applies during the upgrade and can be safely disabled or left enabled after the upgrade is complete.This guide walks you through the manual process of upgrading the control plane from kube-controller-manager with built-in cloud provider to running both kube-controller-manager and cloud-controller-manager. If you use a tool to deploy and manage the cluster, please refer to the documentation of the tool and the cloud provider for specific instructions of the migration.Before you beginIt is assumed that the control plane is running Kubernetes version N and to be upgraded to version N + 1. Although it is possible to migrate within the same version, ideally the migration should be performed as part of an upgrade so that changes of configuration can be aligned to each release. The exact versions of N and N + 1 depend on each cloud provider. For example, if a cloud provider builds a cloud-controller-manager to work with Kubernetes 1.24, then N can be 1.23 and N + 1 can be 1.24.The control plane nodes should run kube-controller-manager with Leader Election enabled, which is the default. As of version N, an in-tree cloud provider must be set with --cloud-provider flag and cloud-controller-manager should not yet be deployed.The out-of-tree cloud provider must have built a cloud-controller-manager with Leader Migration implementation. If the cloud provider imports k8s.io/cloud-provider and k8s.io/controller-manager of version v0.21.0 or later, Leader Migration will be available. However, for version before v0.22.0, Leader Migration is alpha and requires feature gate ControllerManagerLeaderMigration to be enabled in cloud-controller-manager.This guide assumes that kubelet of each control plane node starts kube-controller-manager and cloud-controller-manager as static pods defined by their manifests. If the components run in a different setting, please adjust the steps accordingly.For authorization, this guide assumes that the cluster uses RBAC. If another authorization mode grants permissions to kube-controller-manager and cloud-controller-manager components, please grant the needed access in a way that matches the mode.Grant access to Migration LeaseThe default permissions of the controller manager allow only accesses to their main Lease. In order for the migration to work, accesses to another Lease are required.You can grant kube-controller-manager full access to the leases API by modifying the system::leader-locking-k", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529"}
{"instruction": "Write a bash example for migrate replicated control plane to use cloud controller manager", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-kube-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | Do the same to the system::leader-locking-cloud-controller-manager role.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6779"}
{"instruction": "Write a bash example for migrate replicated control plane to use cloud controller manager", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-cloud-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | Leader Migration optionally takes a configuration file representing the state of controller-to-manager assignment. At this moment, with in-tree cloud provider, kube-controller-manager runs route, serv", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6780"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: kube-controller-manager\n  - name: service\n    component: kube-controller-manager\n  - name: cloud-node-lifecycle\n    component: kube-controller-manager\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | Alternatively, because the controllers can run under either controller managers, setting component to * for both sides makes the configuration file consistent between both parties of the migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6781"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | On each control plane node, save the content to /etc/leadermigration.conf, and update the manifest of kube-controller-manager so that the file is mounted inside the container at the same location. Als", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6782"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: cloud-controller-manager\n  - name: service\n    component: cloud-controller-manager\n  - name: cloud-node-lifecycle\n    component: cloud-controller-manager\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | When creating control plane nodes of version N + 1, the content should be deployed to /etc/leadermigration.conf. The manifest of cloud-controller-manager should be updated to mount the configuration f", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6783"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version, with nodeipam\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n  - name: nodeipam\n-   component: *\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6784"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: kube-controller-manager\n  - name: service\n    component: kube-controller-manager\n  - name: cloud-node-lifecycle\n    component: kube-controller-manager\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | Alternatively, because the controllers can run under either controller managers, setting component to * for both sides makes the configuration file consistent between both parties of the migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6785"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | On each control plane node, save the content to /etc/leadermigration.conf, and update the manifest of kube-controller-manager so that the file is mounted inside the container at the same location. Als", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6786"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: cloud-controller-manager\n  - name: service\n    component: cloud-controller-manager\n  - name: cloud-node-lifecycle\n    component: cloud-controller-manager\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | When creating control plane nodes of version N + 1, the content should be deployed to /etc/leadermigration.conf. The manifest of cloud-controller-manager should be updated to mount the configuration f", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6787"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version, with nodeipam\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n  - name: nodeipam\n-   component: *\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6788"}
{"instruction": "Write a bash example for migrate replicated control plane to use cloud controller manager", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-kube-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | Do the same to the system::leader-locking-cloud-controller-manager role.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6789"}
{"instruction": "Write a bash example for migrate replicated control plane to use cloud controller manager", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-cloud-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | Leader Migration optionally takes a configuration file representing the state of controller-to-manager assignment. At this moment, with in-tree cloud provider, kube-controller-manager runs route, serv", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6790"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: kube-controller-manager\n  - name: service\n    component: kube-controller-manager\n  - name: cloud-node-lifecycle\n    component: kube-controller-manager\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | Alternatively, because the controllers can run under either controller managers, setting component to * for both sides makes the configuration file consistent between both parties of the migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6791"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | On each control plane node, save the content to /etc/leadermigration.conf, and update the manifest of kube-controller-manager so that the file is mounted inside the container at the same location. Als", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6792"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: cloud-controller-manager\n  - name: service\n    component: cloud-controller-manager\n  - name: cloud-node-lifecycle\n    component: cloud-controller-manager\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager | When creating control plane nodes of version N + 1, the content should be deployed to /etc/leadermigration.conf. The manifest of cloud-controller-manager should be updated to mount the configuration f", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6793"}
{"instruction": "Write a yaml example for migrate replicated control plane to use cloud controller manager", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version, with nodeipam\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n  - name: nodeipam\n-   component: *\n```\n\nMigrate Replicated Control Plane To Use Cloud Controller Manager |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/controller-manager-leader-migration/", "id": "k8s_00529_code_6794"}
{"instruction": "What is the reference documentation for client libraries?", "response": "Client LibrariesThis page contains an overview of the client libraries for using the Kubernetes API from various programming languages.To write applications using the Kubernetes REST API, you do not need to implement the API calls and request/response types yourself. You can use a client library for the programming language you are using.Client libraries often handle common tasks such as authentication for you. Most client libraries can discover and use the Kubernetes Service Account to authenticate if the API client is running inside the Kubernetes cluster, or can understand the kubeconfig file format to read the credentials and the API Server address.Officially-supported Kubernetes client librariesThe following client libraries are officially maintained by Kubernetes SIG API Machinery.LanguageClient LibrarySample ProgramsCgithub.com/kubernetes-client/cbrowsedotnetgithub.com/kubernetes-client/csharpbrowseGogithub.com/kubernetes/client-go/browseHaskellgithub.com/kubernetes-client/haskellbrowseJavagithub.com/kubernetes-client/javabrowseJavaScriptgithub.com/kubernetes-client/javascriptbrowsePerlgithub.com/kubernetes-client/perl/browsePythongithub.com/kubernetes-client/python/browseRubygithub.com/kubernetes-client/ruby/browseCommunity-maintained client librariesNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.The following Kubernetes API client libraries are provided and maintained by their authors, not the Kubernetes team.LanguageClient LibraryClojuregithub.com/yanatan16/clj-kubernetes-apiDotNetgithub.com/tonnyeremin/kubernetes_genDotNet (RestSharp)github.com/masroorhasan/Kubernetes.DotNetElixirgithub.com/obmarg/kazanElixirgithub.com/coryodaniel/k8sJava (OSGi)bitbucket.org/amdatulabs/amdatu-kubernetesJava (Fabric8, OSGi)github.com/fabric8io/kubernetes-clientJavagithub.com/manusa/yakcLispgithub.com/brendandburns/cl-k8sLispgithub.com/xh4/cubeNode.js (TypeScript)github.com/Goyoo/node-k8s-clientNode.jsgithub.com/ajpauwels/easy-k8sNode.jsgithub.com/godaddy/kubernetes-clientNode.jsgithub.com/tenxcloud/node-kubernetes-clientPerlmetacpan.org/pod/Net::KubernetesPHPgithub.com/allansun/kubernetes-php-clientPHPgithub.com/maclof/kubernetes-clientPHPgithub.com/travisghansen/kubernetes-client-phpPHPgithub.com/renoki-co/php-k8sPythongithub.com/cloudcoil/cloudcoilPythongithub.com/fiaas/k8sPythongithub.com/gtsystem/lightkubePythongithub.com/kr8s-org/kr8sPythongithub.com/mnubo/kubernetes-pyPythongithub.com/tomplus/kubernetes_asyncioPythongithub.com/Frankkkkk/pykormRubygithub.com/abonas/kubeclientRubygithub.com/k8s-ruby/k8s-rubyRubygithub.com/kontena/k8s-clientRustgithub.com/kube-rs/kubeRustgithub.com/ynqa/kubernetes-rustScalagithub.com/hagay3/skuberScalagithub.com/hnaderi/scala-k8sScalagithub.com/joan38/kubernetes-clientSwiftgithub.com/swiftkube/clientItems on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/client-libraries/", "id": "k8s_00530"}
{"instruction": "What is the reference documentation for instrumentation?", "response": "InstrumentationKubernetes Component SLI MetricsHigh-level indicators for measuring the reliability and performance of Kubernetes components.CRI Pod & Container MetricsCollection of Pod & Container metrics via the CRI.Node metrics dataMechanisms for accessing metrics at node, volume, pod and container level, as seen by the kubelet.Understand Pressure Stall Information (PSI) MetricsDetailed explanation of Pressure Stall Information (PSI) metrics and how to use them to identify resource pressure in Kubernetes.Kubernetes z-pagesProvides runtime diagnostics for Kubernetes components, offering insights into component runtime status and configuration flags.Kubernetes Metrics ReferenceDetails of the metric data that Kubernetes components export.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/", "id": "k8s_00531"}
{"instruction": "How do you configure default cpu requests and limits for a namespace in Kubernetes?", "response": "Configure Default CPU Requests and Limits for a NamespaceDefine a default CPU resource limits for a namespace, so that every new Pod in that namespace has a CPU resource limit configured.This page shows how to configure default CPU requests and limits for a namespace.A Kubernetes cluster can be divided into namespaces. If you create a Pod within a namespace that has a default CPU limit, and any container in that Pod does not specify its own CPU limit, then the control plane assigns the default CPU limit to that container.Kubernetes assigns a default CPU request, but only under certain conditions that are explained later in this page.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.If you're not already familiar with what Kubernetes means by 1.0 CPU, read meaning of CPU.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace default-cpu-example Create a LimitRange and a PodHere's a manifest for an example LimitRange. The manifest specifies a default CPU request and a default CPU limit.admin/resource/cpu-defaults.yaml apiVersion: v1 kind: LimitRange metadata: name: cpu-limit-range spec: limits: - default: cpu: 1 defaultRequest: cpu: 0.5 type: Container Create the LimitRange in the default-cpu-example namespace:kubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults.yaml --namespace=default-cpu-example Now if you create a Pod in the default-cpu-example namespace, and any container in that Pod does not specify its own values for CPU request and CPU limit, then the control plane applies default values: a CPU request of 0.5 and a default CPU limit of 1.Here's a manifest for a Pod that has one container. The container does not specify a CPU request and limit.admin/resource/cpu-defaults-pod.yaml apiVersion: v1 kind: Pod metadata: name: default-cpu-demo spec: containers: - name: default-cpu-demo-ctr image: nginx Create the Pod.kubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod.yaml --namespace=default-cpu-example View the Pod's specification:kubectl get pod default-cpu-demo --output=yaml --namespace=default-cpu-example The output shows that the Pod's only container has a CPU request of 500m cpu (which you can read as “500 millicpu”), and a CPU limit of 1 cpu. These are the default values specified by the LimitRange.containers: - image: nginx imagePullPolicy: Always name: default-cpu-demo-ctr resources: limits: cpu: \"1\" requests: cpu: 500m What if you specify a container's limit, but not its request?Here's a manifest for a Pod that has one container. The container specifies a CPU limit, but not a request:admin/resource/cpu-defaults-pod-2.yaml apiVersion: v1 kind: Pod metadata: name: default-cpu-demo-2 spec: containers: - name: default-cpu-demo-2-ctr image: nginx resources: limits: cpu: \"1\" Create the Pod:kubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-2.yaml --namespace=default-cpu-example View the specification of the Pod that you created:kubectl get pod default-cpu-demo-2 --output=yaml --namespace=default-cpu-example The output shows that the container's CPU request is set to match its CPU limit. Notice that the container was not assigned the default CPU request value of 0.5 cpu:resources: limits: cpu: \"1\" requests: cpu: \"1\" What if you specify a container's request, but not its limit?Here's an example manifest for a Pod that has one container. The container specifies a CPU request, but not a limit:admin/resource/cpu-defaults-pod-3.yaml ap", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default CPU request and a default CPU limit.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6798"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6799"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Now if you create a Pod in the default-cpu-example namespace, and any container in that Pod does not specify its own values for CPU request and CPU limit, then the control plane applies default values", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6800"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6801"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6802"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo --output=yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | The output shows that the Pod's only container has a CPU request of 500m cpu (which you can read as “500 millicpu”), and a CPU limit of 1 cpu. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6803"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6804"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-2.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6805"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-2 --output=yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to match its CPU limit. Notice that the container was not assigned the default CPU request value of 0.5 cpu:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6806"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6807"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-3.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6808"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-3 --output=yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to the value you specified at the time you created the Pod (in other words: it matches the manifest). However, the same container's CPU limit i", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6809"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6810"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6811"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6812"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6813"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-2 --output=yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to match its CPU limit. Notice that the container was not assigned the default CPU request value of 0.5 cpu:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6814"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6815"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-3 --output=yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to the value you specified at the time you created the Pod (in other words: it matches the manifest). However, the same container's CPU limit i", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6816"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default CPU request and a default CPU limit.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6817"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6818"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6819"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Now if you create a Pod in the default-cpu-example namespace, and any container in that Pod does not specify its own values for CPU request and CPU limit, then the control plane applies default values", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6820"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6821"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6822"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6823"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo --output=yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | The output shows that the Pod's only container has a CPU request of 500m cpu (which you can read as “500 millicpu”), and a CPU limit of 1 cpu. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6824"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6825"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6826"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-2.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6827"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6828"}
{"instruction": "Write a yaml example for configure default cpu requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6829"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-3.yaml --namespace=default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6830"}
{"instruction": "Write a bash example for configure default cpu requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-cpu-example\n```\n\nConfigure Default CPU Requests and Limits for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/cpu-default-namespace/", "id": "k8s_00532_code_6831"}
{"instruction": "Explain the Kubernetes concept: Scheduler Performance Tuning", "response": "Scheduler Performance TuningFEATURE STATE: Kubernetes v1.14 [beta]kube-scheduler is the Kubernetes default scheduler. It is responsible for placement of Pods on Nodes in a cluster.Nodes in a cluster that meet the scheduling requirements of a Pod are called feasible Nodes for the Pod. The scheduler finds feasible Nodes for a Pod and then runs a set of functions to score the feasible Nodes, picking a Node with the highest score among the feasible ones to run the Pod. The scheduler then notifies the API server about this decision in a process called Binding.This page explains performance tuning optimizations that are relevant for large Kubernetes clusters.In large clusters, you can tune the scheduler's behaviour balancing scheduling outcomes between latency (new Pods are placed quickly) and accuracy (the scheduler rarely makes poor placement decisions).You configure this tuning setting via kube-scheduler setting percentageOfNodesToScore. This KubeSchedulerConfiguration setting determines a threshold for scheduling nodes in your cluster.Setting the thresholdThe percentageOfNodesToScore option accepts whole numeric values between 0 and 100. The value 0 is a special number which indicates that the kube-scheduler should use its compiled-in default. If you set percentageOfNodesToScore above 100, kube-scheduler acts as if you had set a value of 100.To change the value, edit the kube-scheduler configuration file and then restart the scheduler. In many cases, the configuration file can be found at /etc/kubernetes/config/kube-scheduler.yaml.After you have made this change, you can runkubectl get pods -n kube-system | grep kube-scheduler to verify that the kube-scheduler component is healthy.Node scoring thresholdTo improve scheduling performance, the kube-scheduler can stop looking for feasible nodes once it has found enough of them. In large clusters, this saves time compared to a naive approach that would consider every node.You specify a threshold for how many nodes are enough, as a whole number percentage of all the nodes in your cluster. The kube-scheduler converts this into an integer number of nodes. During scheduling, if the kube-scheduler has identified enough feasible nodes to exceed the configured percentage, the kube-scheduler stops searching for more feasible nodes and moves on to the scoring phase.How the scheduler iterates over Nodes describes the process in detail.Default thresholdIf you don't specify a threshold, Kubernetes calculates a figure using a linear formula that yields 50% for a 100-node cluster and yields 10% for a 5000-node cluster. The lower bound for the automatic value is 5%.This means that the kube-scheduler always scores at least 5% of your cluster no matter how large the cluster is, unless you have explicitly set percentageOfNodesToScore to be smaller than 5.If you want the scheduler to score all nodes in your cluster, set percentageOfNodesToScore to 100.ExampleBelow is an example configuration that sets percentageOfNodesToScore to 50%.apiVersion: kubescheduler.config.k8s.io/v1alpha1 kind: KubeSchedulerConfiguration algorithmSource: provider: DefaultProvider ... percentageOfNodesToScore: 50 Tuning percentageOfNodesToScorepercentageOfNodesToScore must be a value between 1 and 100 with the default value being calculated based on the cluster size. There is also a hardcoded minimum value of 100 nodes.Note:In clusters with less than 100 feasible nodes, the scheduler still checks all the nodes because there are not enough feasible nodes to stop the scheduler's search early.In a small cluster, if you set a low value for percentageOfNodesToScore, your change will have no or little effect, for a similar reason.If your cluster has several hundred Nodes or fewer, leave this configuration option at its default value. Making changes is unlikely to improve the scheduler's performance significantly.An important detail to consider when setting this value is that when a smaller number of nodes in a cluster are checked for", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/", "id": "k8s_00533"}
{"instruction": "Write a bash example for scheduler performance tuning", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system | grep kube-scheduler\n```\n\nScheduler Performance Tuning | to verify that the kube-scheduler component is healthy.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/", "id": "k8s_00533_code_6833"}
{"instruction": "Write a yaml example for scheduler performance tuning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1alpha1\nkind: KubeSchedulerConfiguration\nalgorithmSource:\n  provider: DefaultProvider\n\n...\n\npercentageOfNodesToScore: 50\n```\n\nScheduler Performance Tuning | percentageOfNodesToScore must be a value between 1 and 100 with the default value being calculated based on the cluster size. There is also a hardcoded minimum value of 100 nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/", "id": "k8s_00533_code_6834"}
{"instruction": "Write a bash example for scheduler performance tuning", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system | grep kube-scheduler\n```\n\nScheduler Performance Tuning | to verify that the kube-scheduler component is healthy.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/", "id": "k8s_00533_code_6835"}
{"instruction": "Write a yaml example for scheduler performance tuning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1alpha1\nkind: KubeSchedulerConfiguration\nalgorithmSource:\n  provider: DefaultProvider\n\n...\n\npercentageOfNodesToScore: 50\n```\n\nScheduler Performance Tuning | percentageOfNodesToScore must be a value between 1 and 100 with the default value being calculated based on the cluster size. There is also a hardcoded minimum value of 100 nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/", "id": "k8s_00533_code_6836"}
{"instruction": "Write a bash example for scheduler performance tuning", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system | grep kube-scheduler\n```\n\nScheduler Performance Tuning | to verify that the kube-scheduler component is healthy.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/", "id": "k8s_00533_code_6837"}
{"instruction": "Write a yaml example for scheduler performance tuning", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1alpha1\nkind: KubeSchedulerConfiguration\nalgorithmSource:\n  provider: DefaultProvider\n\n...\n\npercentageOfNodesToScore: 50\n```\n\nScheduler Performance Tuning | percentageOfNodesToScore must be a value between 1 and 100 with the default value being calculated based on the cluster size. There is also a hardcoded minimum value of 100 nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/", "id": "k8s_00533_code_6838"}
{"instruction": "How do you building a basic daemonset in Kubernetes?", "response": "Building a Basic DaemonSetThis page demonstrates how to build a basic DaemonSet that runs a Pod on every node in a Kubernetes cluster. It covers a simple use case of mounting a file from the host, logging its contents using an init container, and utilizing a pause container.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesA Kubernetes cluster with at least two nodes (one control plane node and one worker node) to demonstrate the behavior of DaemonSets.Define the DaemonSetIn this task, a basic DaemonSet is created which ensures that the copy of a Pod is scheduled on every node. The Pod will use an init container to read and log the contents of /etc/machine-id from the host, while the main container will be a pause container, which keeps the Pod running.application/basic-daemonset.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: example-daemonset spec: selector: matchLabels: app.kubernetes.io/name: example template: metadata: labels: app.kubernetes.io/name: example spec: containers: - name: pause image: registry.k8s.io/pause initContainers: - name: log-machine-id image: busybox:1.37 command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log'] volumeMounts: - name: machine-id mountPath: /etc/machine-id readOnly: true - name: log-dir mountPath: /var/log volumes: - name: machine-id hostPath: path: /etc/machine-id type: File - name: log-dir hostPath: path: /var/logCreate a DaemonSet based on the (YAML) manifest:kubectl apply -f https://k8s.io/examples/application/basic-daemonset.yaml Once applied, you can verify that the DaemonSet is running a Pod on every node in the cluster:kubectl get pods -o wide The output will list one Pod per node, similar to:NAME READY STATUS RESTARTS AGE IP NODE example-daemonset-xxxxx 1/1 Running 0 5m x.x.x.x node-1 example-daemonset-yyyyy 1/1 Running 0 5m x.x.x.x node-2 You can inspect the contents of the logged /etc/machine-id file by checking the log directory mounted from the host:kubectl exec <pod-name> -- cat /var/log/machine-id.log Where <pod-name> is the name of one of your Pods.Cleaning upTo delete the DaemonSet, run this command:kubectl delete --cascade=foreground --ignore-not-found --now daemonsets/example-daemonset This simple DaemonSet example introduces key components like init containers and host path volumes, which can be expanded upon for more advanced use cases. For more details refer to DaemonSet.What's nextSee Performing a rolling update on a DaemonSetSee Creating a DaemonSet to adopt existing DaemonSet pods", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534"}
{"instruction": "Write a yaml example for building a basic daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\nBuilding a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6840"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/basic-daemonset.yaml\n```\n\nBuilding a Basic DaemonSet | Once applied, you can verify that the DaemonSet is running a Pod on every node in the cluster:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6841"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nBuilding a Basic DaemonSet | The output will list one Pod per node, similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6842"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod-name> -- cat /var/log/machine-id.log\n```\n\nBuilding a Basic DaemonSet | Where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6843"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl delete --cascade=foreground --ignore-not-found --now daemonsets/example-daemonset\n```\n\nBuilding a Basic DaemonSet | This simple DaemonSet example introduces key components like init containers and host path volumes, which can be expanded upon for more advanced use cases. For more details refer to DaemonSet.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6844"}
{"instruction": "Write a yaml example for building a basic daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\nBuilding a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6845"}
{"instruction": "Write a yaml example for building a basic daemonset", "response": "Here's a yaml example:\n\n```yaml\napplication/basic-daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\nBuilding a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6846"}
{"instruction": "Write a yaml example for building a basic daemonset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\nBuilding a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6847"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/basic-daemonset.yaml\n```\n\nBuilding a Basic DaemonSet | Once applied, you can verify that the DaemonSet is running a Pod on every node in the cluster:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6848"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nBuilding a Basic DaemonSet | The output will list one Pod per node, similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6849"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod-name> -- cat /var/log/machine-id.log\n```\n\nBuilding a Basic DaemonSet | Where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6850"}
{"instruction": "Write a bash example for building a basic daemonset", "response": "Here's a bash example:\n\n```bash\nkubectl delete --cascade=foreground --ignore-not-found --now daemonsets/example-daemonset\n```\n\nBuilding a Basic DaemonSet | This simple DaemonSet example introduces key components like init containers and host path volumes, which can be expanded upon for more advanced use cases. For more details refer to DaemonSet.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-daemon/create-daemon-set/", "id": "k8s_00534_code_6851"}
{"instruction": "Explain issue wranglers in Kubernetes", "response": "Issue WranglersAlongside the PR Wrangler, formal approvers, reviewers and members of SIG Docs take week-long shifts triaging and categorising issues for the repository.DutiesEach day in a week-long shift the Issue Wrangler will be responsible for:Triaging and tagging incoming issues daily. See Triage and categorize issues for guidelines on how SIG Docs uses metadata.Keeping an eye on stale & rotten issues within the kubernetes/website repository.Maintenance of the Issues board.RequirementsMust be an active member of the Kubernetes organization.A minimum of 15 non-trivial contributions to Kubernetes (of which a certain amount should be directed towards kubernetes/website).Performing the role in an informal capacity already.Helpful Prow commands for wranglersBelow are some commonly used commands for Issue Wranglers:# reopen an issue /reopen # transfer issues that don't fit in k/website to another repository /transfer[-issue] # change the state of rotten issues /remove-lifecycle rotten # change the state of stale issues /remove-lifecycle stale # assign sig to an issue /sig <sig_name> # add specific area /area <area_name> # for beginner friendly issues /good-first-issue # issues that needs help /help wanted # tagging issue as support specific /kind support # to accept triaging for an issue /triage accepted # closing an issue we won't be working on and haven't fixed yet /close not-planned To find more Prow commands, refer to the Command Help documentation.When to close IssuesFor an open source project to succeed, good issue management is crucial. But it is also critical to resolve issues in order to maintain the repository and communicate clearly with contributors and users.Close issues when:A similar issue is reported more than once. You will first need to tag it as /triage duplicate; link it to the main issue & then close it. It is also advisable to direct the users to the original issue.It is very difficult to understand and address the issue presented by the author with the information provided. However, encourage the user to provide more details or reopen the issue if they can reproduce it later.The same functionality is implemented elsewhere. One can close this issue and direct user to the appropriate place.The reported issue is not currently planned or aligned with the project's goals.If the issue appears to be spam and is clearly unrelated.If the issue is related to an external limitation or dependency and is beyond the control of the project.To close an issue, leave a /close comment on the issue.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/participate/issue-wrangler/", "id": "k8s_00535"}
{"instruction": "Write a bash example for issue wranglers", "response": "Here's a bash example:\n\n```bash\n# reopen an issue\n/reopen\n\n# transfer issues that don't fit in k/website to another repository\n/transfer[-issue]\n\n# change the state of rotten issues\n/remove-lifecycle rotten\n\n# change the state of stale issues\n/remove-lifecycle stale\n\n# assign sig to an issue\n/sig <sig_name>\n\n# add specific area\n/area <area_name>\n\n# for beginner friendly issues\n/good-first-issue\n\n# issues that needs help\n/help wanted\n\n# tagging issue as support specific\n/kind support\n\n# to accept triaging for an issue\n/triage accepted\n\n# closing an issue we won't be working on and haven't fixed yet\n/close not-planned\n```\n\nIssue Wranglers | To find more Prow commands, refer to the Command Help documentation.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/participate/issue-wrangler/", "id": "k8s_00535_code_6853"}
{"instruction": "Explain options for highly available topology in Kubernetes", "response": "Options for Highly Available TopologyThis page explains the two options for configuring the topology of your highly available (HA) Kubernetes clusters.You can set up an HA cluster:With stacked control plane nodes, where etcd nodes are colocated with control plane nodesWith external etcd nodes, where etcd runs on separate nodes from the control planeYou should carefully consider the advantages and disadvantages of each topology before setting up an HA cluster.Note:kubeadm bootstraps the etcd cluster statically. Read the etcd Clustering Guide for more details.Stacked etcd topologyA stacked HA cluster is a topology where the distributed data storage cluster provided by etcd is stacked on top of the cluster formed by the nodes managed by kubeadm that run control plane components.Each control plane node runs an instance of the kube-apiserver, kube-scheduler, and kube-controller-manager. The kube-apiserver is exposed to worker nodes using a load balancer.Each control plane node creates a local etcd member and this etcd member communicates only with the kube-apiserver of this node. The same applies to the local kube-controller-manager and kube-scheduler instances.This topology couples the control planes and etcd members on the same nodes. It is simpler to set up than a cluster with external etcd nodes, and simpler to manage for replication.However, a stacked cluster runs the risk of failed coupling. If one node goes down, both an etcd member and a control plane instance are lost, and redundancy is compromised. You can mitigate this risk by adding more control plane nodes.You should therefore run a minimum of three stacked control plane nodes for an HA cluster.This is the default topology in kubeadm. A local etcd member is created automatically on control plane nodes when using kubeadm init and kubeadm join --control-plane.External etcd topologyAn HA cluster with external etcd is a topology where the distributed data storage cluster provided by etcd is external to the cluster formed by the nodes that run control plane components.Like the stacked etcd topology, each control plane node in an external etcd topology runs an instance of the kube-apiserver, kube-scheduler, and kube-controller-manager. And the kube-apiserver is exposed to worker nodes using a load balancer. However, etcd members run on separate hosts, and each etcd host communicates with the kube-apiserver of each control plane node.This topology decouples the control plane and etcd member. It therefore provides an HA setup where losing a control plane instance or an etcd member has less impact and does not affect the cluster redundancy as much as the stacked HA topology.However, this topology requires twice the number of hosts as the stacked HA topology. A minimum of three hosts for control plane nodes and three hosts for etcd nodes are required for an HA cluster with this topology.What's nextSet up a highly available cluster with kubeadm", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/ha-topology/", "id": "k8s_00536"}
{"instruction": "Explain the Kubernetes concept: Windows containers in Kubernetes", "response": "Windows containers in KubernetesWindows applications constitute a large portion of the services and applications that run in many organizations. Windows containers provide a way to encapsulate processes and package dependencies, making it easier to use DevOps practices and follow cloud native patterns for Windows applications.Organizations with investments in Windows-based applications and Linux-based applications don't have to look for separate orchestrators to manage their workloads, leading to increased operational efficiencies across their deployments, regardless of operating system.Windows nodes in KubernetesTo enable the orchestration of Windows containers in Kubernetes, include Windows nodes in your existing Linux cluster. Scheduling Windows containers in Pods on Kubernetes is similar to scheduling Linux-based containers.In order to run Windows containers, your Kubernetes cluster must include multiple operating systems. While you can only run the control plane on Linux, you can deploy worker nodes running either Windows or Linux.Windows nodes are supported provided that the operating system is Windows Server 2019 or Windows Server 2022.This document uses the term Windows containers to mean Windows containers with process isolation. Kubernetes does not support running Windows containers with Hyper-V isolation.Compatibility and limitationsSome node features are only available if you use a specific container runtime; others are not available on Windows nodes, including:HugePages: not supported for Windows containersPrivileged containers: not supported for Windows containers. HostProcess Containers offer similar functionality.TerminationGracePeriod: requires containerDNot all features of shared namespaces are supported. See API compatibility for more details.See Windows OS version compatibility for details on the Windows versions that Kubernetes is tested against.From an API and kubectl perspective, Windows containers behave in much the same way as Linux-based containers. However, there are some notable differences in key functionality which are outlined in this section.Comparison with LinuxKey Kubernetes elements work the same way in Windows as they do in Linux. This section refers to several key workload abstractions and how they map to Windows.PodsA Pod is the basic building block of Kubernetes–the smallest and simplest unit in the Kubernetes object model that you create or deploy. You may not deploy Windows and Linux containers in the same Pod. All containers in a Pod are scheduled onto a single Node where each Node represents a specific platform and architecture. The following Pod capabilities, properties and events are supported with Windows containers:Single or multiple containers per Pod with process isolation and volume sharingPod status fieldsReadiness, liveness, and startup probespostStart & preStop container lifecycle hooksConfigMap, Secrets: as environment variables or volumesemptyDir volumesNamed pipe host mountsResource limitsOS field:The .spec.os.name field should be set to windows to indicate that the current Pod uses Windows containers.If you set the .spec.os.name field to windows, you must not set the following fields in the .spec of that Pod:spec.hostPIDspec.hostIPCspec.securityContext.seLinuxOptionsspec.securityContext.seccompProfilespec.securityContext.fsGroupspec.securityContext.fsGroupChangePolicyspec.securityContext.sysctlsspec.shareProcessNamespacespec.securityContext.runAsUserspec.securityContext.runAsGroupspec.securityContext.supplementalGroupsspec.containers[*].securityContext.seLinuxOptionsspec.containers[*].securityContext.seccompProfilespec.containers[*].securityContext.capabilitiesspec.containers[*].securityContext.readOnlyRootFilesystemspec.containers[*].securityContext.privilegedspec.containers[*].securityContext.allowPrivilegeEscalationspec.containers[*].securityContext.procMountspec.containers[*].securityContext.runAsUserspec.containers[*].securityContext.runAsGroupIn the above list, wil", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/windows/intro/", "id": "k8s_00537"}
{"instruction": "How do you attach handlers to container lifecycle events in Kubernetes?", "response": "Attach Handlers to Container Lifecycle EventsThis page shows how to attach handlers to Container lifecycle events. Kubernetes supports the postStart and preStop events. Kubernetes sends the postStart event immediately after a Container is started, and it sends the preStop event immediately before the Container is terminated. A Container may specify one handler per event.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Define postStart and preStop handlersIn this exercise, you create a Pod that has one Container. The Container has handlers for the postStart and preStop events.Here is the configuration file for the Pod:pods/lifecycle-events.yaml apiVersion: v1 kind: Pod metadata: name: lifecycle-demo spec: containers: - name: lifecycle-demo-container image: nginx lifecycle: postStart: exec: command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"] preStop: exec: command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"] In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the Container is being terminated because of a failure.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/lifecycle-events.yaml Verify that the Container in the Pod is running:kubectl get pod lifecycle-demo Get a shell into the Container running in your Pod:kubectl exec -it lifecycle-demo -- /bin/bash In your shell, verify that the postStart handler created the message file:root@lifecycle-demo:/# cat /usr/share/message The output shows the text written by the postStart handler:Hello from the postStart handler DiscussionKubernetes sends the postStart event immediately after the Container is created. There is no guarantee, however, that the postStart handler is called before the Container's entrypoint is called. The postStart handler runs asynchronously relative to the Container's code, but Kubernetes' management of the container blocks until the postStart handler completes. The Container's status is not set to RUNNING until the postStart handler completes.Kubernetes sends the preStop event immediately before the Container is terminated. Kubernetes' management of the Container blocks until the preStop handler completes, unless the Pod's grace period expires. For more details, see Pod Lifecycle.Note:Kubernetes only sends the preStop event when a Pod or a container in the Pod is terminated. This means that the preStop hook is not invoked when the Pod is completed. About this limitation, please see Container hooks for the detail.What's nextLearn more about Container lifecycle hooks.Learn more about the lifecycle of a Pod.ReferenceLifecycleContainerSee terminationGracePeriodSeconds in PodSpec", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538"}
{"instruction": "Write a yaml example for attach handlers to container lifecycle events", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\nAttach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6857"}
{"instruction": "Write a bash example for attach handlers to container lifecycle events", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/lifecycle-events.yaml\n```\n\nAttach Handlers to Container Lifecycle Events | Verify that the Container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6858"}
{"instruction": "Write a bash example for attach handlers to container lifecycle events", "response": "Here's a bash example:\n\n```bash\nkubectl get pod lifecycle-demo\n```\n\nAttach Handlers to Container Lifecycle Events | Get a shell into the Container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6859"}
{"instruction": "Write a bash example for attach handlers to container lifecycle events", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it lifecycle-demo -- /bin/bash\n```\n\nAttach Handlers to Container Lifecycle Events | In your shell, verify that the postStart handler created the message file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6860"}
{"instruction": "Write a yaml example for attach handlers to container lifecycle events", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\nAttach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6861"}
{"instruction": "Write a bash example for attach handlers to container lifecycle events", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/lifecycle-events.yaml\n```\n\nAttach Handlers to Container Lifecycle Events | Verify that the Container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6862"}
{"instruction": "Write a bash example for attach handlers to container lifecycle events", "response": "Here's a bash example:\n\n```bash\nkubectl get pod lifecycle-demo\n```\n\nAttach Handlers to Container Lifecycle Events | Get a shell into the Container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6863"}
{"instruction": "Write a bash example for attach handlers to container lifecycle events", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it lifecycle-demo -- /bin/bash\n```\n\nAttach Handlers to Container Lifecycle Events | In your shell, verify that the postStart handler created the message file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6864"}
{"instruction": "Write a yaml example for attach handlers to container lifecycle events", "response": "Here's a yaml example:\n\n```yaml\npods/lifecycle-events.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\nAttach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6865"}
{"instruction": "Write a yaml example for attach handlers to container lifecycle events", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\nAttach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/", "id": "k8s_00538_code_6866"}
{"instruction": "Provide a tutorial on performing a rolling update", "response": "Performing a Rolling UpdateObjectivesPerform a rolling update using kubectl.Updating an applicationRolling updates allow Deployments' update to take place with zero downtime by incrementally updating Pods instances with new ones.Users expect applications to be available all the time, and developers are expected to deploy new versions of them several times a day. In Kubernetes this is done with rolling updates. A rolling update allows a Deployment update to take place with zero downtime. It does this by incrementally replacing the current Pods with new ones. The new Pods are scheduled on Nodes with available resources, and Kubernetes waits for those new Pods to start before removing the old Pods.In the previous module we scaled our application to run multiple instances. This is a requirement for performing updates without affecting application availability. By default, the maximum number of Pods that can be unavailable during the update and the maximum number of new Pods that can be created, is one. Both options can be configured to either numbers or percentages (of Pods). In Kubernetes, updates are versioned and any Deployment update can be reverted to a previous (stable) version.Rolling updates overviewIf a Deployment is exposed publicly, the Service will load-balance the traffic only to available Pods during the update.Similar to application Scaling, if a Deployment is exposed publicly, the Service will load-balance the traffic only to available Pods during the update. An available Pod is an instance that is available to the users of the application.Rolling updates allow the following actions:Promote an application from one environment to another (via container image updates)Rollback to previous versionsContinuous Integration and Continuous Delivery of applications with zero downtimeIn the following interactive tutorial, we'll update our application to a new version, and also perform a rollback.Update the version of the appTo list your Deployments, run the get deployments subcommand:kubectl get deployments To list the running Pods, run the get pods subcommand:kubectl get pods To view the current image version of the app, run the describe pods subcommand and look for the Image field:kubectl describe pods To update the image of the application to version 2, use the set image subcommand, followed by the deployment name and the new image version:kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2 The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the get pods subcommand:kubectl get pods Verify an updateFirst, check that the service is running, as you might have deleted it in previous tutorial step, run describe services/kubernetes-bootcamp. If it's missing, you can create it again with:kubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080 Create an environment variable called NODE_PORT that has the value of the Node port assigned:export NODE_PORT=\"$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}')\" echo \"NODE_PORT=$NODE_PORT\"", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nPerforming a Rolling Update | To list the running Pods, run the get pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6868"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | To update the image of the application to version 2, use the set image subcommand, followed by the deployment name and the new image version:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6869"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2\n```\n\nPerforming a Rolling Update | The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the get pods subcomman", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6870"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\nPerforming a Rolling Update | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6871"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployments/kubernetes-bootcamp\n```\n\nPerforming a Rolling Update | To view the current image version of the app, run the describe pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6872"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | In the Image field of the output, verify that you are running the latest image version (v2).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6873"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10\n```\n\nPerforming a Rolling Update | Use get deployments to see the status of the deployment:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6874"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nPerforming a Rolling Update | Notice that the output doesn't list the desired number of available Pods. Run the get pods subcommand to list all Pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6875"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | In the Events section of the output for the affected Pods, notice that the v10 image version did not exist in the repository.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6876"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployments/kubernetes-bootcamp\n```\n\nPerforming a Rolling Update | The rollout undo command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a Deployment.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6877"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | The Deployment is once again using a stable version of the app (v2). The rollback was successful.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6878"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/kubernetes-bootcamp services/kubernetes-bootcamp\n```\n\nPerforming a Rolling Update |", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6879"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nPerforming a Rolling Update | To list the running Pods, run the get pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6880"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | To update the image of the application to version 2, use the set image subcommand, followed by the deployment name and the new image version:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6881"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2\n```\n\nPerforming a Rolling Update | The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the get pods subcomman", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6882"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\nPerforming a Rolling Update | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6883"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployments/kubernetes-bootcamp\n```\n\nPerforming a Rolling Update | To view the current image version of the app, run the describe pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6884"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | In the Image field of the output, verify that you are running the latest image version (v2).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6885"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10\n```\n\nPerforming a Rolling Update | Use get deployments to see the status of the deployment:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6886"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nPerforming a Rolling Update | Notice that the output doesn't list the desired number of available Pods. Run the get pods subcommand to list all Pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6887"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | In the Events section of the output for the affected Pods, notice that the v10 image version did not exist in the repository.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6888"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployments/kubernetes-bootcamp\n```\n\nPerforming a Rolling Update | The rollout undo command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a Deployment.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6889"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\nPerforming a Rolling Update | The Deployment is once again using a stable version of the app (v2). The rollback was successful.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6890"}
{"instruction": "Write a bash example for performing a rolling update", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/kubernetes-bootcamp services/kubernetes-bootcamp\n```\n\nPerforming a Rolling Update |", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/", "id": "k8s_00539_code_6891"}
{"instruction": "How do you safely drain a node in Kubernetes?", "response": "Safely Drain a NodeThis page shows how to safely drain a node, optionally respecting the PodDisruptionBudget you have defined.Before you beginThis task assumes that you have met the following prerequisites:You do not require your applications to be highly available during the node drain, orYou have read about the PodDisruptionBudget concept, and have configured PodDisruptionBudgets for applications that need them.(Optional) Configure a disruption budgetTo ensure that your workloads remain available during maintenance, you can configure a PodDisruptionBudget.If availability is important for any applications that run or could run on the node(s) that you are draining, configure a PodDisruptionBudgets first and then continue following this guide.It is recommended to set AlwaysAllow Unhealthy Pod Eviction Policy to your PodDisruptionBudgets to support eviction of misbehaving applications during a node drain. The default behavior is to wait for the application pods to become healthy before the drain can proceed.Use kubectl drain to remove a node from serviceYou can use kubectl drain to safely evict all of your pods from a node before you perform maintenance on the node (e.g. kernel upgrade, hardware maintenance, etc.). Safe evictions allow the pod's containers to gracefully terminate and will respect the PodDisruptionBudgets you have specified.Note:By default kubectl drain ignores certain system pods on the node that cannot be killed; see the kubectl drain documentation for more details.When kubectl drain returns successfully, that indicates that all of the pods (except the ones excluded as described in the previous paragraph) have been safely evicted (respecting the desired graceful termination period, and respecting the PodDisruptionBudget you have defined). It is then safe to bring down the node by powering down its physical machine or, if running on a cloud platform, deleting its virtual machine.Note:If any new Pods tolerate the node.kubernetes.io/unschedulable taint, then those Pods might be scheduled to the node you have drained. Avoid tolerating that taint other than for DaemonSets.If you or another API user directly set the nodeName field for a Pod (bypassing the scheduler), then the Pod is bound to the specified node and will run there, even though you have drained that node and marked it unschedulable.First, identify the name of the node you wish to drain. You can list all of the nodes in your cluster withkubectl get nodes Next, tell Kubernetes to drain the node:kubectl drain --ignore-daemonsets <node name> If there are pods managed by a DaemonSet, you will need to specify --ignore-daemonsets with kubectl to successfully drain the node. The kubectl drain subcommand on its own does not actually drain a node of its DaemonSet pods: the DaemonSet controller (part of the control plane) immediately replaces missing Pods with new equivalent Pods. The DaemonSet controller also creates Pods that ignore unschedulable taints, which allows the new Pods to launch onto a node that you are draining.Once it returns (without giving an error), you can power down the node (or equivalently, if on a cloud platform, delete the virtual machine backing the node). If you leave the node in the cluster during the maintenance operation, you need to runkubectl uncordon <node name> afterwards to tell Kubernetes that it can resume scheduling new pods onto the node.Draining multiple nodes in parallelThe kubectl drain command should only be issued to a single node at a time. However, you can run multiple kubectl drain commands for different nodes in parallel, in different terminals or in the background. Multiple drain commands running concurrently will still respect the PodDisruptionBudget you specify.For example, if you have a StatefulSet with three replicas and have set a PodDisruptionBudget for that set specifying minAvailable: 2, kubectl drain only evicts a pod from the StatefulSet if all three replicas pods are healthy; if then you issue multiple dra", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/", "id": "k8s_00540"}
{"instruction": "Write a bash example for safely drain a node", "response": "Here's a bash example:\n\n```bash\nkubectl drain --ignore-daemonsets <node name>\n```\n\nSafely Drain a Node | If there are pods managed by a DaemonSet, you will need to specify --ignore-daemonsets with kubectl to successfully drain the node. The kubectl drain subcommand on its own does not actually drain a no", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/", "id": "k8s_00540_code_6893"}
{"instruction": "Write a bash example for safely drain a node", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node name>\n```\n\nSafely Drain a Node | afterwards to tell Kubernetes that it can resume scheduling new pods onto the node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/", "id": "k8s_00540_code_6894"}
{"instruction": "Write a bash example for safely drain a node", "response": "Here's a bash example:\n\n```bash\nkubectl drain --ignore-daemonsets <node name>\n```\n\nSafely Drain a Node | If there are pods managed by a DaemonSet, you will need to specify --ignore-daemonsets with kubectl to successfully drain the node. The kubectl drain subcommand on its own does not actually drain a no", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/", "id": "k8s_00540_code_6895"}
{"instruction": "Write a bash example for safely drain a node", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node name>\n```\n\nSafely Drain a Node | afterwards to tell Kubernetes that it can resume scheduling new pods onto the node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/", "id": "k8s_00540_code_6896"}
{"instruction": "What is the reference documentation for understand pressure stall information (psi) metrics?", "response": "Understand Pressure Stall Information (PSI) MetricsDetailed explanation of Pressure Stall Information (PSI) metrics and how to use them to identify resource pressure in Kubernetes.FEATURE STATE: Kubernetes v1.34 [beta]As a beta feature, Kubernetes lets you configure the kubelet to collect Linux kernel Pressure Stall Information (PSI) for CPU, memory, and I/O usage. The information is collected at node, pod and container level. This feature is enabled by default by setting the KubeletPSI feature gate.PSI metrics are exposed through two different sources:The kubelet's Summary API, which provides PSI data at the node, pod, and container level.The /metrics/cadvisor endpoint on the kubelet, which exposes PSI metrics in the Prometheus format.RequirementsPressure Stall Information requires the following on your Linux nodes:The Linux kernel must be version 4.20 or newer.The kernel must be compiled with the CONFIG_PSI=y option. Most modern distributions enable this by default. You can check your kernel's configuration by running zgrep CONFIG_PSI /proc/config.gz.Some Linux distributions may compile PSI into the kernel but disable it by default. If so, you need to enable it at boot time by adding the psi=1 parameter to the kernel command line.The node must be using cgroup v2.Understanding PSI MetricsPressure Stall Information (PSI) metrics are provided for three resources: CPU, memory, and I/O. They are categorized into two main types of pressure: some and full.some: This value indicates that some tasks (one or more) are stalled on a resource. For example, if some tasks are waiting for I/O, this metric will increase. This can be an early indicator of resource contention.full: This value indicates that all non-idle tasks are stalled on a resource simultaneously. This signifies a more severe resource shortage, where the entire system is unable to make progress.Each pressure type provides four metrics: avg10, avg60, avg300, and total. The avg values represent the percentage of wall-clock time that tasks were stalled over 10-second, 60-second, and 3-minute moving averages. The total value is a cumulative counter in microseconds showing the total time tasks have been stalled.Example ScenariosYou can use a simple Pod with a stress-testing tool to generate resource pressure and observe the PSI metrics. The following examples use the agnhost container image, which includes the stress tool.Generating CPU PressureCreate a Pod that generates CPU pressure using the stress utility. This workload will put a heavy load on one CPU core.Create a file named cpu-pressure-pod.yaml:apiVersion: v1 kind: Pod metadata: name: cpu-pressure-pod spec: restartPolicy: Never containers: - name: cpu-stress image: registry.k8s.io/e2e-test-images/agnhost:2.47 args: - \"stress\" - \"--cpus\" - \"1\" resources: limits: cpu: \"500m\" requests: cpu: \"500m\" Apply it to your cluster: kubectl apply -f cpu-pressure-pod.yamlObserving CPU PressureAfter the Pod is running, you can observe the CPU pressure through either the Summary API or the Prometheus metrics endpoint.Using the Summary API:Watch the summary stats for your node. In a separate terminal, run:# Replace <node-name> with the name of a node in your cluster kubectl get --raw \"/api/v1/nodes/<node-name>/proxy/stats/summary\" | jq '.pods[] | select(.podRef.name | contains(\"cpu-pressure-pod\"))' You will see the some PSI metrics for CPU increase in the summary API output. The avg10 value for some pressure should rise above zero, indicating that tasks are spending time stalled on the CPU.Using the Prometheus metrics endpoint:Query the /metrics/cadvisor endpoint to see the container_pressure_cpu_waiting_seconds_total metric.# Replace <node-name> with the name of the node where the pod is running kubectl get --raw \"/api/v1/nodes/<node-name>/proxy/metrics/cadvisor\" | \\ grep 'container_pressure_cpu_waiting_seconds_total{container=\"cpu-stress\"' The output should show an increasing value, indicating that the container is spending time stalle", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: cpu-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    args:\n    - \"stress\"\n    - \"--cpus\"\n    - \"1\"\n    resources:\n      limits:\n        cpu: \"500m\"\n      requests:\n        cpu: \"500m\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f cpu-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6898"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-pressure-pod\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | This example creates a Pod that continuously writes to files in the container's writable layer, causing the kernel's page cache to grow and forcing memory reclamation, which generates pressure.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6899"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: memory-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n    - \"i=0; while true; do dd if=/dev/zero of=testfile.$i bs=1M count=50 &>/dev/null; i=$(((i+1)%5)); sleep 0.1; done\"\n    resources:\n      limits:\n        memory: \"200M\"\n      requests:\n        memory: \"200M\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f memory-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6900"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-pressure-pod\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | This Pod generates I/O pressure by repeatedly writing a file to disk and using sync to flush the data from memory, which creates I/O stalls.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6901"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: io-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: io-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n      - \"while true; do dd if=/dev/zero of=testfile bs=1M count=128 &>/dev/null; sync; rm testfile &>/dev/null; done\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply this to your cluster: kubectl apply -f io-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6902"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod io-pressure-pod\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | The task pages for Troubleshooting Clusters discuss how to use a metrics pipeline that rely on these data.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6903"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: cpu-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    args:\n    - \"stress\"\n    - \"--cpus\"\n    - \"1\"\n    resources:\n      limits:\n        cpu: \"500m\"\n      requests:\n        cpu: \"500m\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f cpu-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6904"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cpu-pressure-pod.yaml\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | After the Pod is running, you can observe the CPU pressure through either the Summary API or the Prometheus metrics endpoint.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6905"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: memory-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n    - \"i=0; while true; do dd if=/dev/zero of=testfile.$i bs=1M count=50 &>/dev/null; i=$(((i+1)%5)); sleep 0.1; done\"\n    resources:\n      limits:\n        memory: \"200M\"\n      requests:\n        memory: \"200M\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f memory-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6906"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f memory-pressure-pod.yaml\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Using the Summary API:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6907"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: io-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: io-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n      - \"while true; do dd if=/dev/zero of=testfile bs=1M count=128 &>/dev/null; sync; rm testfile &>/dev/null; done\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply this to your cluster: kubectl apply -f io-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6908"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f io-pressure-pod.yaml\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Using the Summary API:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6909"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: cpu-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    args:\n    - \"stress\"\n    - \"--cpus\"\n    - \"1\"\n    resources:\n      limits:\n        cpu: \"500m\"\n      requests:\n        cpu: \"500m\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f cpu-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6910"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-pressure-pod\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | This example creates a Pod that continuously writes to files in the container's writable layer, causing the kernel's page cache to grow and forcing memory reclamation, which generates pressure.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6911"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: memory-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n    - \"i=0; while true; do dd if=/dev/zero of=testfile.$i bs=1M count=50 &>/dev/null; i=$(((i+1)%5)); sleep 0.1; done\"\n    resources:\n      limits:\n        memory: \"200M\"\n      requests:\n        memory: \"200M\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f memory-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6912"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-pressure-pod\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | This Pod generates I/O pressure by repeatedly writing a file to disk and using sync to flush the data from memory, which creates I/O stalls.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6913"}
{"instruction": "Write a yaml example for understand pressure stall information (psi) metrics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: io-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: io-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n      - \"while true; do dd if=/dev/zero of=testfile bs=1M count=128 &>/dev/null; sync; rm testfile &>/dev/null; done\"\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | Apply this to your cluster: kubectl apply -f io-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6914"}
{"instruction": "Write a bash example for understand pressure stall information (psi) metrics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod io-pressure-pod\n```\n\nUnderstand Pressure Stall Information (PSI) Metrics | The task pages for Troubleshooting Clusters discuss how to use a metrics pipeline that rely on these data.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/", "id": "k8s_00541_code_6915"}
{"instruction": "What is the reference documentation for patch?", "response": "PatchPatch is provided to give a concrete name and type to the Kubernetes PATCH request body.import \"k8s.io/apimachinery/pkg/apis/meta/v1\"Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/patch/", "id": "k8s_00542"}
{"instruction": "What is the reference documentation for kubectl create role?", "response": "kubectl create roleSynopsisCreate a role with single rule.kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none] Examples # Create a role named \"pod-reader\" that allows user to perform \"get\", \"watch\" and \"list\" on pods kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods # Create a role named \"pod-reader\" with ResourceName specified kubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod # Create a role named \"foo\" with API Group specified kubectl create role foo --verb=get,list,watch --resource=rs.apps # Create a role named \"foo\" with SubResource specified kubectl create role foo --verb=get,list,watch --resource=pods,pods/status Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for role-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--resource stringsResource that the rule applies to--resource-name stringsResource in the white list that the rule applies to, repeat this flag for multiple items--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.--verb stringsVerb that applies to the resources contained in the ruleParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabl", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_role/", "id": "k8s_00543"}
{"instruction": "Write a bash example for kubectl create role", "response": "Here's a bash example:\n\n```bash\nkubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\nkubectl create role | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_role/", "id": "k8s_00543_code_6918"}
{"instruction": "Write a bash example for kubectl create role", "response": "Here's a bash example:\n\n```bash\nkubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\nkubectl create role | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_role/", "id": "k8s_00543_code_6919"}
{"instruction": "What is the reference documentation for kubectl replace?", "response": "kubectl replaceSynopsisReplace a resource by file name or stdin.JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by $ kubectl get TYPE NAME -o yaml kubectl replace -f FILENAME Examples # Replace a pod using the data in pod.json kubectl replace -f ./pod.json # Replace a pod based on the JSON passed into stdin cat pod.json | kubectl replace -f - # Update a single-container pod's image version (tag) to v4 kubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f - # Force replace, delete and then re-create the resource kubectl replace --force -f ./pod.json Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--cascade string[=\"background\"] Default: \"background\"Must be \"background\", \"orphan\", or \"foreground\". Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-replace\"Name of the manager used to track field ownership.-f, --filename stringsThe files that contain the configurations to replace.--forceIf true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation.--grace-period int Default: -1Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion).-h, --helphelp for replace-k, --kustomize stringProcess a kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--raw stringRaw URI to PUT to the server. Uses the transport specified by the kubeconfig file.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--subresource stringIf specified, replace will operate on the subresource of the requested object.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--timeout durationThe length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.--waitIf true, wait for resources to be gone before returning. This waits for finalizers.Parent Options Inherited--as s", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_replace/", "id": "k8s_00544"}
{"instruction": "Write a bash example for kubectl replace", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\nkubectl replace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_replace/", "id": "k8s_00544_code_6921"}
{"instruction": "Write a bash example for kubectl replace", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\nkubectl replace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_replace/", "id": "k8s_00544_code_6922"}
{"instruction": "How do you adding linux worker nodes in Kubernetes?", "response": "Adding Linux worker nodesThis page explains how to add Linux worker nodes to a kubeadm cluster.Before you beginEach joining worker node has installed the required components from Installing kubeadm, such as, kubeadm, the kubelet and a container runtime.A running kubeadm cluster created by kubeadm init and following the steps in the document Creating a cluster with kubeadm.You need superuser access to the node.Adding Linux worker nodesTo add new Linux worker nodes to your cluster do the following for each machine:Connect to the machine by using SSH or another method.Run the command that was output by kubeadm init. For example:sudo kubeadm join --token <token> <control-plane-host>:<control-plane-port> --discovery-token-ca-cert-hash sha256:<hash> Additional information for kubeadm joinNote:To specify an IPv6 tuple for <control-plane-host>:<control-plane-port>, IPv6 address must be enclosed in square brackets, for example: [2001:db8::101]:2073.If you do not have the token, you can get it by running the following command on the control plane node:# Run this on a control plane node sudo kubeadm token list The output is similar to this:TOKEN TTL EXPIRES USAGES DESCRIPTION EXTRA GROUPS 8ewj1p.9r9hcjoqgajrj4gi 23h 2018-06-12T02:51:28Z authentication, The default bootstrap system: signing token generated by bootstrappers: 'kubeadm init'. kubeadm: default-node-token By default, node join tokens expire after 24 hours. If you are joining a node to the cluster after the current token has expired, you can create a new token by running the following command on the control plane node:# Run this on a control plane node sudo kubeadm token create The output is similar to this:5didvk.d09sbcov8ph2amjw To print a kubeadm join command while also generating a new token you can use:sudo kubeadm token create --print-join-command If you don't have the value of --discovery-token-ca-cert-hash, you can get it by running the following commands on the control plane node:# Run this on a control plane node sudo cat /etc/kubernetes/pki/ca.crt | openssl x509 -pubkey | openssl rsa -pubin -outform der 2>/dev/null | \\ openssl dgst -sha256 -hex | sed 's/^.* //' The output is similar to:8cb2de97839780a412b93877f8507ad6c94f73add17d5d7058e91741c9d5ec78 The output of the kubeadm join command should look something like:[preflight] Running pre-flight checks ... (log output of join workflow) ... Node join complete: * Certificate signing request sent to control-plane and response received. * Kubelet informed of new secure connection details. Run 'kubectl get nodes' on control-plane to see this machine join. A few seconds later, you should notice this node in the output from kubectl get nodes. (for example, run kubectl on a control plane node).Note:As the cluster nodes are usually initialized sequentially, the CoreDNS Pods are likely to all run on the first control plane node. To provide higher availability, please rebalance the CoreDNS Pods with kubectl -n kube-system rollout restart deployment coredns after at least one new node is joined.What's nextSee how to add Windows worker nodes.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-linux-nodes/", "id": "k8s_00545"}
{"instruction": "Write a bash example for adding linux worker nodes", "response": "Here's a bash example:\n\n```bash\nsudo kubeadm join --token <token> <control-plane-host>:<control-plane-port> --discovery-token-ca-cert-hash sha256:<hash>\n```\n\nAdding Linux worker nodes | If you do not have the token, you can get it by running the following command on the control plane node:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-linux-nodes/", "id": "k8s_00545_code_6924"}
{"instruction": "Write a bash example for adding linux worker nodes", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token list\n```\n\nAdding Linux worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-linux-nodes/", "id": "k8s_00545_code_6925"}
{"instruction": "Write a bash example for adding linux worker nodes", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token create\n```\n\nAdding Linux worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-linux-nodes/", "id": "k8s_00545_code_6926"}
{"instruction": "Write a bash example for adding linux worker nodes", "response": "Here's a bash example:\n\n```bash\nsudo kubeadm token create --print-join-command\n```\n\nAdding Linux worker nodes | If you don't have the value of --discovery-token-ca-cert-hash, you can get it by running the following commands on the control plane node:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-linux-nodes/", "id": "k8s_00545_code_6927"}
{"instruction": "Write a bash example for adding linux worker nodes", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo cat /etc/kubernetes/pki/ca.crt | openssl x509 -pubkey  | openssl rsa -pubin -outform der 2>/dev/null | \\\n   openssl dgst -sha256 -hex | sed 's/^.* //'\n```\n\nAdding Linux worker nodes | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-linux-nodes/", "id": "k8s_00545_code_6928"}
{"instruction": "Write a bash example for adding linux worker nodes", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system rollout restart deployment coredns\n```\n\nAdding Linux worker nodes |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-linux-nodes/", "id": "k8s_00545_code_6929"}
{"instruction": "What is the reference documentation for kubeadm certs?", "response": "kubeadm certskubeadm certs provides utilities for managing certificates. For more details on how these commands can be used, see Certificate Management with kubeadm.kubeadm certsA collection of operations for operating Kubernetes certificates.SynopsisCommands related to handling Kubernetes certificateskubeadm certs [flags] Options-h, --helphelp for certsOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm certs renewYou can renew all Kubernetes certificates using the all subcommand or renew them selectively. For more details see Manual certificate renewal.SynopsisRenew certificates for a Kubernetes clusterkubeadm certs renew [flags] Options-h, --helphelp for renewOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.Renew all available certificatesSynopsisRenew all known certificates necessary to run the control plane. Renewals are run unconditionally, regardless of expiration date. Renewals can also be run individually for more control.kubeadm certs renew all [flags] Options--cert-dir string Default: \"/etc/kubernetes/pki\"The path where to save the certificates--config stringPath to a kubeadm configuration file.-h, --helphelp for all--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisRenew the certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself.Renewals run unconditionally, regardless of certificate expiration date; extra attributes such as SANs will be based on the existing file/certificates, there is no need to resupply them.Renewal by default tries to use the certificate authority in the local PKI managed by kubeadm; as alternative it is possible to use K8s certificate API for certificate renewal, or as a last option, to generate a CSR request.After renewal, in order to make changes effective, is required to restart control-plane components and eventually re-distribute the renewed certificate in case the file is used elsewhere.kubeadm certs renew admin.conf [flags] Options--cert-dir string Default: \"/etc/kubernetes/pki\"The path where to save the certificates--config stringPath to a kubeadm configuration file.-h, --helphelp for admin.conf--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisRenew the certificate the apiserver uses to access etcd.Renewals run unconditionally, regardless of certificate expiration date; extra attributes such as SANs will be based on the existing file/certificates, there is no need to resupply them.Renewal by default tries to use the certificate authority in the local PKI managed by kubeadm; as alternative it is possible to use K8s certificate API for certificate renewal, or as a last option, to generate a CSR request.After renewal, in order to make changes effective, is required to restart control-plane components and eventually re-distribute the renewed certificate in case the file is used elsewhere.kubeadm certs renew apiserver-etcd-client [flags] Options--cert-dir string Default: \"/etc/kubernetes/pki\"The path where to save the certificates--config stringPath to a kubeadm configuration file.-h, --helphelp for apiserver-etcd-client--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-certs/", "id": "k8s_00546"}
{"instruction": "What is the reference documentation for volumeattributesclass?", "response": "VolumeAttributesClassVolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver.apiVersion: storage.k8s.io/v1import \"k8s.io/api/storage/v1\"VolumeAttributesClassVolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver. The class can be specified during dynamic provisioning of PersistentVolumeClaims, and changed in the PersistentVolumeClaim spec after provisioning.apiVersion: storage.k8s.io/v1kind: VolumeAttributesClassmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatadriverName (string), requiredName of the CSI driver This field is immutable.parameters (map[string]string)parameters hold volume attributes defined by the CSI driver. These values are opaque to the Kubernetes and are passed directly to the CSI driver. The underlying storage provider supports changing these attributes on an existing volume, however the parameters field itself is immutable. To invoke a volume update, a new VolumeAttributesClass should be created with new parameters, and the PersistentVolumeClaim should be updated to reference the new VolumeAttributesClass.This field is required and must contain at least one key/value pair. The keys cannot be empty, and the maximum number of parameters is 512, with a cumulative max size of 256K. If the CSI driver rejects invalid parameters, the target PersistentVolumeClaim will be set to an \"Infeasible\" state in the modifyVolumeStatus field.VolumeAttributesClassListVolumeAttributesClassList is a collection of VolumeAttributesClass objects.apiVersion: storage.k8s.io/v1kind: VolumeAttributesClassListmetadata (ListMeta)Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]VolumeAttributesClass), requireditems is the list of VolumeAttributesClass objects.Operationsget read the specified VolumeAttributesClassHTTP RequestGET /apis/storage.k8s.io/v1/volumeattributesclasses/{name}Parametersname (in path): string, requiredname of the VolumeAttributesClasspretty (in query): stringprettyResponse200 (VolumeAttributesClass): OK401: Unauthorizedlist list or watch objects of kind VolumeAttributesClassHTTP RequestGET /apis/storage.k8s.io/v1/volumeattributesclassesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (VolumeAttributesClassList): OK401: Unauthorizedcreate create a VolumeAttributesClassHTTP RequestPOST /apis/storage.k8s.io/v1/volumeattributesclassesParametersbody: VolumeAttributesClass, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (VolumeAttributesClass): OK201 (VolumeAttributesClass): Created202 (VolumeAttributesClass): Accepted401: Unauthorizedupdate replace the specified VolumeAttributesClassHTTP RequestPUT /apis/storage.k8s.io/v1/volumeattributesclasses/{name}Parametersname (in path): string, requiredname of the VolumeAttributesClassbody: VolumeAttributesClass, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (VolumeAttributesClass): OK201 (VolumeAttributesClass): Created401: Unauthorizedpatch partially update the specified VolumeAttributesClassHTTP RequestPATCH /apis/storage.k8s.io/v1/volumeattributesclasses/{name}Parametersname (in path): string, requi", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume-attributes-class-v1/", "id": "k8s_00547"}
{"instruction": "Write a yaml example for volumeattributesclass", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\nVolumeAttributesClass | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume-attributes-class-v1/", "id": "k8s_00547_code_6932"}
{"instruction": "What is the reference documentation for declarative api validation?", "response": "Declarative API ValidationFEATURE STATE: Kubernetes v1.33 [beta]Kubernetes 1.34 includes optional declarative validation for APIs. When enabled, the Kubernetes API server can use this mechanism rather than the legacy approach that relies on hand-written Go code (validation.go files) to ensure that requests against the API are valid. Kubernetes developers, and people extending the Kubernetes API, can define validation rules directly alongside the API type definitions (types.go files). Code authors define pecial comment tags (e.g., +k8s:minimum=0). A code generator (validation-gen) then uses these tags to produce optimized Go code for API validation.While primarily a feature impacting Kubernetes contributors and potentially developers of extension API servers, cluster administrators should understand its behavior, especially during its rollout phases.Declarative validation is being rolled out gradually. In Kubernetes 1.34, the APIs that use declarative validation include:ReplicationControllerNote:For the beta of this feature, Kubernetes is intentionally using a superseded API as a test bed for the change. Future Kubernetes releases may roll this out to more APIs.DeclarativeValidation: (Beta, Default: true) When enabled, the API server runs both the new declarative validation and the old hand-written validation for migrated types/fields. The results are compared internally.DeclarativeValidationTakeover: (Beta, Default: false) This gate determines which validation result is authoritative (i.e., returned to the user and used for admission decisions).Default Behavior (Kubernetes 1.34):With DeclarativeValidation=true and DeclarativeValidationTakeover=false (the default values for the gates), both validation systems run.The results of the hand-written validation are used. The declarative validation runs in a mismatch mode for comparison.Mismatches between the two validation systems are logged by the API server and increment the declarative_validation_mismatch_total metric. This helps developers identify and fix discrepancies during the Beta phase.Cluster upgrades should be safe regarding this feature, as the authoritative validation logic doesn't change by default.Administrators can choose to explicitly enable DeclarativeValidationTakeover=true to make the declarative validation authoritative for migrated fields, typically after verifying stability in their environment (e.g., by monitoring the mismatch metric).Disabling declarative validationAs a cluster administrator, you might consider disabling declarative validation whilst it is still beta, under specific circumstances:Unexpected Validation Behavior: If enabling DeclarativeValidationTakeover leads to unexpected validation errors or allows objects that were previously invalid.Performance Regressions: If monitoring indicates significant latency increases (e.g., in apiserver_request_duration_seconds) correlated with the feature's enablement.High Mismatch Rate: If the declarative_validation_mismatch_total metric shows frequent mismatches, suggesting potential bugs in the declarative rules affecting the cluster's workloads, even if DeclarativeValidationTakeover is false.To revert to only using hand-written validation (as used before Kubernetes v1.33), disable the DeclarativeValidation feature gate, for example via command-line arguments: (--feature-gates=DeclarativeValidation=false). This also implicitly disables the effect of DeclarativeValidationTakeover.Considerations for downgrade and rollbackDisabling the feature acts as a safety mechanism. However, be aware of a potential edge case (considered unlikely due to extensive testing): If a bug in declarative validation (when DeclarativeValidationTakeover=true) incorrectly allowed an invalid object to be persisted, disabling the feature gates might then cause subsequent updates to that specific object to be blocked by the now-authoritative (and correct) hand-written validation. Resolving this might require manual correction of the store", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/declarative-validation/", "id": "k8s_00548"}
{"instruction": "Explain the Kubernetes concept: Ingress", "response": "IngressMake your HTTP (or HTTPS) network service available using a protocol-aware configuration mechanism, that understands web concepts like URIs, hostnames, paths, and more. The Ingress concept lets you map traffic to different backends based on rules you define via the Kubernetes API.FEATURE STATE: Kubernetes v1.19 [stable]An API object that manages external access to the services in a cluster, typically HTTP.Ingress may provide load balancing, SSL termination and name-based virtual hosting.Note:Ingress is frozen. New features are being added to the Gateway API.TerminologyFor clarity, this guide defines the following terms:Node: A worker machine in Kubernetes, part of a cluster.Cluster: A set of Nodes that run containerized applications managed by Kubernetes. For this example, and in most common Kubernetes deployments, nodes in the cluster are not part of the public internet.Edge router: A router that enforces the firewall policy for your cluster. This could be a gateway managed by a cloud provider or a physical piece of hardware.Cluster network: A set of links, logical or physical, that facilitate communication within a cluster according to the Kubernetes networking model.Service: A Kubernetes Service that identifies a set of Pods using label selectors. Unless mentioned otherwise, Services are assumed to have virtual IPs only routable within the cluster network.What is Ingress?Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Traffic routing is controlled by rules defined on the Ingress resource.Here is a simple example where an Ingress sends all its traffic to one Service:Figure. IngressAn Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting. An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic.An Ingress does not expose arbitrary ports or protocols. Exposing services other than HTTP and HTTPS to the internet typically uses a service of type Service.Type=NodePort or Service.Type=LoadBalancer.PrerequisitesYou must have an Ingress controller to satisfy an Ingress. Only creating an Ingress resource has no effect.You may need to deploy an Ingress controller such as ingress-nginx. You can choose from a number of Ingress controllers.Ideally, all Ingress controllers should fit the reference specification. In reality, the various Ingress controllers operate slightly differently.Note:Make sure you review your Ingress controller's documentation to understand the caveats of choosing it.The Ingress resourceA minimal Ingress resource example:service/networking/minimal-ingress.yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: minimal-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: ingressClassName: nginx-example rules: - http: paths: - path: /testpath pathType: Prefix backend: service: name: test port: number: 80 An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying applications, configuring containers, managing resources. Ingress frequently uses annotations to configure some options depending on the Ingress controller, an example of which is the rewrite-target annotation. Different Ingress controllers support different annotations. Review the documentation for your choice of Ingress controller to learn which annotations are supported.The Ingress spec has all the information needed to configure a load balancer or proxy server. Most importantly, it contains a list of rules matched against all incoming requests. Ingress resource only supports rules for directing HTTP(S) traffic.If the ingressClassName is omitted, a default Ingress class should be defined.There are some ingress c", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\nIngress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6935"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\nIngress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6936"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\nIngress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6937"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6938"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\nIngress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6939"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\nIngress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6940"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\nIngress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6941"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\nIngress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6942"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\nIngress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6943"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\nIngress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6944"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\nIngress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6945"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress simple-fanout-example\n```\n\nIngress | The Ingress controller provisions an implementation-specific load balancer that satisfies the Ingress, as long as the Services (service1, service2) exist. When it has done so, you can see the address", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6946"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6947"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\nIngress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6948"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\nIngress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6949"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\nIngress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6950"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\nIngress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6951"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl edit ingress test\n```\n\nIngress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6952"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\nIngress | You can achieve the same outcome by invoking kubectl replace -f on a modified Ingress YAML file.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6953"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\nIngress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6954"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\nIngress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6955"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\nIngress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6956"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6957"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\nIngress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6958"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\nIngress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6959"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\nIngress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6960"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\nIngress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6961"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\nIngress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6962"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\nIngress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6963"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\nIngress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6964"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6965"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\nIngress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6966"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\nIngress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6967"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\nIngress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6968"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - backend:\n          service:\n            name: service1\n            port:\n              number: 80\n        path: /foo\n        pathType: Prefix\n  - host: bar.baz.com\n    http:\n      paths:\n      - backend:\n          service:\n            name: service2\n            port:\n              number: 80\n        path: /foo\n        pathType: Prefix\n..\n```\n\nIngress | After you save your changes, kubectl updates the resource in the API server, which tells the Ingress controller to reconfigure the load balancer.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6969"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/minimal-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\nIngress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6970"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\nIngress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6971"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/ingress-resource-backend.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\nIngress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6972"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\nIngress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6973"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\nIngress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6974"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/ingress-wildcard-host.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6975"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6976"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/external-lb.yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\nIngress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6977"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\nIngress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6978"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\nIngress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6979"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\nIngress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6980"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/default-ingressclass.yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\nIngress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6981"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\nIngress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6982"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/test-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\nIngress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6983"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\nIngress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6984"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\nIngress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6985"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/simple-fanout-example.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\nIngress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6986"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\nIngress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6987"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress simple-fanout-example\n```\n\nIngress | The Ingress controller provisions an implementation-specific load balancer that satisfies the Ingress, as long as the Services (service1, service2) exist. When it has done so, you can see the address", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6988"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/name-virtual-host-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6989"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\nIngress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6990"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/name-virtual-host-ingress-no-third-host.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\nIngress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6991"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\nIngress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6992"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\nIngress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6993"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/tls-example-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\nIngress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6994"}
{"instruction": "Write a yaml example for ingress", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\nIngress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6995"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\nIngress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6996"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl edit ingress test\n```\n\nIngress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6997"}
{"instruction": "Write a bash example for ingress", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\nIngress | You can achieve the same outcome by invoking kubectl replace -f on a modified Ingress YAML file.", "category": "concepts_code", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress/", "id": "k8s_00549_code_6998"}
{"instruction": "What is the reference documentation for job?", "response": "JobJob represents the configuration of a single job.apiVersion: batch/v1import \"k8s.io/api/batch/v1\"JobJob represents the configuration of a single job.apiVersion: batch/v1kind: Jobmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (JobSpec)Specification of the desired behavior of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (JobStatus)Current status of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusJobSpecJobSpec describes how the job execution will look like.Replicastemplate (PodTemplateSpec), requiredDescribes the pod that will be created when executing a job. The only allowed template.spec.restartPolicy values are \"Never\" or \"OnFailure\". More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/parallelism (int32)Specifies the maximum desired number of pods the job should run at any given time. The actual number of pods running in steady state will be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/Lifecyclecompletions (int32)Specifies the desired number of successfully finished pods the job should be run with. Setting to null means that the success of any pod signals the success of all pods, and allows parallelism to have any positive value. Setting to 1 means that parallelism is limited to 1 and the success of that pod signals the success of the job. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/completionMode (string)completionMode specifies how Pod completions are tracked. It can be NonIndexed (default) or Indexed.NonIndexed means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other.Indexed means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is Indexed, .spec.completions must be specified and .spec.parallelism must be less than or equal to 10^5. In addition, The Pod name takes the form $(job-name)-$(index)-$(random-string), the Pod hostname takes the form $(job-name)-$(index).More completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job.backoffLimit (int32)Specifies the number of retries before marking this job failed. Defaults to 6, unless backoffLimitPerIndex (only Indexed Job) is specified. When backoffLimitPerIndex is specified, backoffLimit defaults to 2147483647.activeDeadlineSeconds (int64)Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it; value must be positive integer. If a Job is suspended (at creation or through an update), this timer will effectively be stopped and reset when the Job is resumed again.ttlSecondsAfterFinished (int32)ttlSecondsAfterFinished limits the lifetime of a Job that has finished execution (either Complete or Failed). If this field is set, ttlSecondsAfterFinished after the Job finishes, it is eligible to be automatically deleted. When the Job is being deleted, its lifecycle guarantees (e.g. finalizers) will be honored. If this field is unset, the Job won't be automatically deleted. If this field is set to zero, the Job becomes eligible to be deleted immediately after it finishes.suspend (boolean)suspend specifies whethe", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/job-v1/", "id": "k8s_00550"}
{"instruction": "Explain the Kubernetes concept: Finalizers", "response": "FinalizersFinalizers are namespaced keys that tell Kubernetes to wait until specific conditions are met before it fully deletes resources that are marked for deletion. Finalizers alert controllers to clean up resources the deleted object owned.When you tell Kubernetes to delete an object that has finalizers specified for it, the Kubernetes API marks the object for deletion by populating .metadata.deletionTimestamp, and returns a 202 status code (HTTP \"Accepted\"). The target object remains in a terminating state while the control plane, or other components, take the actions defined by the finalizers. After these actions are complete, the controller removes the relevant finalizers from the target object. When the metadata.finalizers field is empty, Kubernetes considers the deletion complete and deletes the object.You can use finalizers to control garbage collection of resources. For example, you can define a finalizer to clean up related API resources or infrastructure before the controller deletes the object being finalized.You can use finalizers to control garbage collection of objects by alerting controllers to perform specific cleanup tasks before deleting the target resource.Finalizers don't usually specify the code to execute. Instead, they are typically lists of keys on a specific resource similar to annotations. Kubernetes specifies some finalizers automatically, but you can also specify your own.How finalizers workWhen you create a resource using a manifest file, you can specify finalizers in the metadata.finalizers field. When you attempt to delete the resource, the API server handling the delete request notices the values in the finalizers field and does the following:Modifies the object to add a metadata.deletionTimestamp field with the time you started the deletion.Prevents the object from being removed until all items are removed from its metadata.finalizers fieldReturns a 202 status code (HTTP \"Accepted\")The controller managing that finalizer notices the update to the object setting the metadata.deletionTimestamp, indicating deletion of the object has been requested. The controller then attempts to satisfy the requirements of the finalizers specified for that resource. Each time a finalizer condition is satisfied, the controller removes that key from the resource's finalizers field. When the finalizers field is emptied, an object with a deletionTimestamp field set is automatically deleted. You can also use finalizers to prevent deletion of unmanaged resources.A common example of a finalizer is kubernetes.io/pv-protection, which prevents accidental deletion of PersistentVolume objects. When a PersistentVolume object is in use by a Pod, Kubernetes adds the pv-protection finalizer. If you try to delete the PersistentVolume, it enters a Terminating status, but the controller can't delete it because the finalizer exists. When the Pod stops using the PersistentVolume, Kubernetes clears the pv-protection finalizer, and the controller deletes the volume.Note:When you DELETE an object, Kubernetes adds the deletion timestamp for that object and then immediately starts to restrict changes to the .metadata.finalizers field for the object that is now pending deletion. You can remove existing finalizers (deleting an entry from the finalizers list) but you cannot add a new finalizer. You also cannot modify the deletionTimestamp for an object once it is set.After the deletion is requested, you can not resurrect this object. The only way is to delete it and make a new similar object.Note:Custom finalizer names must be publicly qualified finalizer names, such as example.com/finalizer-name. Kubernetes enforces this format; the API server rejects writes to objects where the change does not use qualified finalizer names for any custom finalizer.Owner references, labels, and finalizersLike labels, owner references describe the relationships between objects in Kubernetes, but are used for a different purpose. When a controller manages o", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/", "id": "k8s_00551"}
{"instruction": "What is the reference documentation for resourceclaim?", "response": "ResourceClaimResourceClaim describes a request for access to resources in the cluster, for use by workloads.apiVersion: resource.k8s.io/v1import \"k8s.io/api/resource/v1\"ResourceClaimResourceClaim describes a request for access to resources in the cluster, for use by workloads. For example, if a workload needs an accelerator device with specific properties, this is how that request is expressed. The status stanza tracks whether this claim has been satisfied and what specific resources have been allocated.This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.apiVersion: resource.k8s.io/v1kind: ResourceClaimmetadata (ObjectMeta)Standard object metadataspec (ResourceClaimSpec), requiredSpec describes what is being requested and how to configure it. The spec is immutable.status (ResourceClaimStatus)Status describes whether the claim is ready to use and what has been allocated.ResourceClaimSpecResourceClaimSpec defines what is being requested in a ResourceClaim and how to configure it.devices (DeviceClaim)Devices defines how to request devices.DeviceClaim defines how to request devices with a ResourceClaim.devices.config ([]DeviceClaimConfiguration)Atomic: will be replaced during a mergeThis field holds configuration for multiple potential drivers which could satisfy requests in this claim. It is ignored while allocating the claim.DeviceClaimConfiguration is used for configuration parameters in DeviceClaim.devices.config.opaque (OpaqueDeviceConfiguration)Opaque provides driver-specific configuration parameters.OpaqueDeviceConfiguration contains configuration parameters for a driver in a format defined by the driver vendor.devices.config.opaque.driver (string), requiredDriver is used to determine which kubelet plugin needs to be passed these configuration parameters.An admission policy provided by the driver developer could use this to decide whether it needs to validate them.Must be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver.devices.config.opaque.parameters (RawExtension), requiredParameters can contain arbitrary data. It is the responsibility of the driver developer to handle validation and versioning. Typically this includes self-identification and a version (\"kind\" + \"apiVersion\" for Kubernetes types), with conversion between different versions.The length of the raw data must be smaller or equal to 10 Ki.*RawExtension is used to hold extensions in external versions.To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.// Internal package:type MyAPIObject struct { runtime.TypeMeta `json:\",inline\"` MyPlugin runtime.Object `json:\"myPlugin\"` } type PluginA struct { AOption string `json:\"aOption\"` } // External package:type MyAPIObject struct { runtime.TypeMeta `json:\",inline\"` MyPlugin runtime.RawExtension `json:\"myPlugin\"` } type PluginA struct { AOption string `json:\"aOption\"` } // On the wire, the JSON will look something like this:{ \"kind\":\"MyAPIObject\", \"apiVersion\":\"v1\", \"myPlugin\": { \"kind\":\"PluginA\", \"aOption\":\"foo\", }, } So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)*devices.config.requests ([]string)Atomic: will be replaced during a mergeRequests lists the names of requests where the configuration applies. If empty, it applies to all requests.References to subrequests must include the name of the main request and may include the s", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/resource-claim-v1/", "id": "k8s_00552"}
{"instruction": "Write a yaml example for resourceclaim", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\nResourceClaim | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/resource-claim-v1/", "id": "k8s_00552_code_7002"}
{"instruction": "How do you running kubernetes node components as a non-root user in Kubernetes?", "response": "Running Kubernetes Node Components as a Non-root UserFEATURE STATE: Kubernetes v1.22 [alpha]This document describes how to run Kubernetes Node components such as kubelet, CRI, OCI, and CNI without root privileges, by using a user namespace.This technique is also known as rootless mode.Note:This document describes how to run Kubernetes Node components (and hence pods) as a non-root user.If you are just looking for how to run a pod as a non-root user, see SecurityContext.Before you beginYour Kubernetes server must be at or later than version 1.22.To check the version, enter kubectl version.Enable Cgroup v2Enable systemd with user sessionConfigure several sysctl values, depending on host Linux distributionEnsure that your unprivileged user is listed in /etc/subuid and /etc/subgidEnable the KubeletInUserNamespace feature gateRunning Kubernetes inside Rootless Docker/Podmankindkind supports running Kubernetes inside Rootless Docker or Rootless Podman.See Running kind with Rootless Docker.minikubeminikube also supports running Kubernetes inside Rootless Docker or Rootless Podman.See the Minikube documentation:Rootless DockerRootless PodmanRunning Kubernetes inside Unprivileged ContainersNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.sysboxSysbox is an open-source container runtime (similar to \"runc\") that supports running system-level workloads such as Docker and Kubernetes inside unprivileged containers isolated with the Linux user namespace.See Sysbox Quick Start Guide: Kubernetes-in-Docker for more info.Sysbox supports running Kubernetes inside unprivileged containers without requiring Cgroup v2 and without the KubeletInUserNamespace feature gate. It does this by exposing specially crafted /proc and /sys filesystems inside the container plus several other advanced OS virtualization techniques.Running Rootless Kubernetes directly on a hostNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.K3sK3s experimentally supports rootless mode.See Running K3s with Rootless mode for the usage.UsernetesUsernetes is a reference distribution of Kubernetes that can be installed under $HOME directory without the root privilege.Usernetes supports both containerd and CRI-O as CRI runtimes. Usernetes supports multi-node clusters using Flannel (VXLAN).See the Usernetes repo for the usage.Manually deploy a node that runs the kubelet in a user namespaceThis section provides hints for running Kubernetes in a user namespace manually.Note:This section is intended to be read by developers of Kubernetes distributions, not by end users.Creating a user namespaceThe first step is to create a user namespace.If you are trying to run Kubernetes in a user-namespaced container such as Rootless Docker/Podman or LXC/LXD, you are all set, and you can go to the next subsection.Otherwise you have to create a user namespace by yourself, by calling unshare(2) with CLONE_NEWUSER.A user namespace can be also unshared by using command line tools such as:unshare(1)RootlessKitbecome-rootAfter unsharing the user namespace, you will also have to unshare other namespaces such as mount namespace.You do not need to call chroot() nor pivot_root() after unsharing the mount namespace, however, you have to mount writable filesystems on several directories in the namespace.At least, the following directories need to be writable in the namespace (not outside the namespace):/etc/run/var/logs/var/lib/kubelet/var/lib/cni/var/lib/containerd (for containerd)/var/lib/containers (for CRI-O)Creating ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/", "id": "k8s_00553"}
{"instruction": "Write a yaml example for running kubernetes node components as a non-root user", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  KubeletInUserNamespace: true\n# We use cgroupfs that is delegated by systemd, so we do not use \"systemd\" driver\n# (unless you run another systemd in the namespace)\ncgroupDriver: \"cgroupfs\"\n```\n\nRunning Kubernetes Node Components as a Non-root User | When the KubeletInUserNamespace feature gate is enabled, the kubelet ignores errors that may happen during setting the following sysctl values on the node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/", "id": "k8s_00553_code_7004"}
{"instruction": "Write a yaml example for running kubernetes node components as a non-root user", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\nmode: \"iptables\" # or \"userspace\"\nconntrack:\n# Skip setting sysctl value \"net.netfilter.nf_conntrack_max\"\n  maxPerCore: 0\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_established\"\n  tcpEstablishedTimeout: 0s\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_close\"\n  tcpCloseWaitTimeout: 0s\n```\n\nRunning Kubernetes Node Components as a Non-root User | Most of \"non-local\" volume drivers such as nfs and iscsi do not work. Local volumes like local, hostPath, emptyDir, configMap, secret, and downwardAPI are known to work.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/", "id": "k8s_00553_code_7005"}
{"instruction": "Write a yaml example for running kubernetes node components as a non-root user", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  KubeletInUserNamespace: true\n# We use cgroupfs that is delegated by systemd, so we do not use \"systemd\" driver\n# (unless you run another systemd in the namespace)\ncgroupDriver: \"cgroupfs\"\n```\n\nRunning Kubernetes Node Components as a Non-root User | When the KubeletInUserNamespace feature gate is enabled, the kubelet ignores errors that may happen during setting the following sysctl values on the node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/", "id": "k8s_00553_code_7006"}
{"instruction": "Write a yaml example for running kubernetes node components as a non-root user", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\nmode: \"iptables\" # or \"userspace\"\nconntrack:\n# Skip setting sysctl value \"net.netfilter.nf_conntrack_max\"\n  maxPerCore: 0\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_established\"\n  tcpEstablishedTimeout: 0s\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_close\"\n  tcpCloseWaitTimeout: 0s\n```\n\nRunning Kubernetes Node Components as a Non-root User | Most of \"non-local\" volume drivers such as nfs and iscsi do not work. Local volumes like local, hostPath, emptyDir, configMap, secret, and downwardAPI are known to work.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/", "id": "k8s_00553_code_7007"}
{"instruction": "Write a yaml example for running kubernetes node components as a non-root user", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  KubeletInUserNamespace: true\n# We use cgroupfs that is delegated by systemd, so we do not use \"systemd\" driver\n# (unless you run another systemd in the namespace)\ncgroupDriver: \"cgroupfs\"\n```\n\nRunning Kubernetes Node Components as a Non-root User | When the KubeletInUserNamespace feature gate is enabled, the kubelet ignores errors that may happen during setting the following sysctl values on the node.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/", "id": "k8s_00553_code_7008"}
{"instruction": "Write a yaml example for running kubernetes node components as a non-root user", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\nmode: \"iptables\" # or \"userspace\"\nconntrack:\n# Skip setting sysctl value \"net.netfilter.nf_conntrack_max\"\n  maxPerCore: 0\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_established\"\n  tcpEstablishedTimeout: 0s\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_close\"\n  tcpCloseWaitTimeout: 0s\n```\n\nRunning Kubernetes Node Components as a Non-root User | Most of \"non-local\" volume drivers such as nfs and iscsi do not work. Local volumes like local, hostPath, emptyDir, configMap, secret, and downwardAPI are known to work.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/", "id": "k8s_00553_code_7009"}
{"instruction": "Explain the Kubernetes concept: Node-pressure Eviction", "response": "Node-pressure EvictionNode-pressure eviction is the process by which the kubelet proactively terminates pods to reclaim resource on nodes.The kubelet monitors resources like memory, disk space, and filesystem inodes on your cluster's nodes. When one or more of these resources reach specific consumption levels, the kubelet can proactively fail one or more pods on the node to reclaim resources and prevent starvation.During a node-pressure eviction, the kubelet sets the phase for the selected pods to Failed, and terminates the Pod.Node-pressure eviction is not the same as API-initiated eviction.The kubelet does not respect your configured PodDisruptionBudget or the pod's terminationGracePeriodSeconds. If you use soft eviction thresholds, the kubelet respects your configured eviction-max-pod-grace-period. If you use hard eviction thresholds, the kubelet uses a 0s grace period (immediate shutdown) for termination.Self healing behaviorThe kubelet attempts to reclaim node-level resources before it terminates end-user pods. For example, it removes unused container images when disk resources are starved.If the pods are managed by a workload management object (such as StatefulSet or Deployment) that replaces failed pods, the control plane (kube-controller-manager) creates new pods in place of the evicted pods.Self healing for static podsIf you are running a static pod on a node that is under resource pressure, the kubelet may evict that static Pod. The kubelet then tries to create a replacement, because static Pods always represent an intent to run a Pod on that node.The kubelet takes the priority of the static pod into account when creating a replacement. If the static pod manifest specifies a low priority, and there are higher-priority Pods defined within the cluster's control plane, and the node is under resource pressure, the kubelet may not be able to make room for that static pod. The kubelet continues to attempt to run all static pods even when there is resource pressure on a node.Eviction signals and thresholdsThe kubelet uses various parameters to make eviction decisions, like the following:Eviction signalsEviction thresholdsMonitoring intervalsEviction signalsEviction signals are the current state of a particular resource at a specific point in time. The kubelet uses eviction signals to make eviction decisions by comparing the signals to eviction thresholds, which are the minimum amount of the resource that should be available on the node.The kubelet uses the following eviction signals:Eviction SignalDescriptionLinux Onlymemory.availablememory.available := node.status.capacity[memory] - node.stats.memory.workingSetnodefs.availablenodefs.available := node.stats.fs.availablenodefs.inodesFreenodefs.inodesFree := node.stats.fs.inodesFree•imagefs.availableimagefs.available := node.stats.runtime.imagefs.availableimagefs.inodesFreeimagefs.inodesFree := node.stats.runtime.imagefs.inodesFree•containerfs.availablecontainerfs.available := node.stats.runtime.containerfs.availablecontainerfs.inodesFreecontainerfs.inodesFree := node.stats.runtime.containerfs.inodesFree•pid.availablepid.available := node.stats.rlimit.maxpid - node.stats.rlimit.curproc•In this table, the Description column shows how kubelet gets the value of the signal. Each signal supports either a percentage or a literal value. The kubelet calculates the percentage value relative to the total capacity associated with the signal.Memory signalsOn Linux nodes, the value for memory.available is derived from the cgroupfs instead of tools like free -m. This is important because free -m does not work in a container, and if users use the node allocatable feature, out of resource decisions are made local to the end user Pod part of the cgroup hierarchy as well as the root node. This script or cgroupv2 script reproduces the same set of steps that the kubelet performs to calculate memory.available. The kubelet excludes inactive_file (the number of bytes of file-backed memory on the in", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/", "id": "k8s_00554"}
{"instruction": "Write a yaml example for node-pressure eviction", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nevictionHard:\n  memory.available: \"500Mi\"\n  nodefs.available: \"1Gi\"\n  imagefs.available: \"100Gi\"\nevictionMinimumReclaim:\n  memory.available: \"0Mi\"\n  nodefs.available: \"500Mi\"\n  imagefs.available: \"2Gi\"\n```\n\nNode-pressure Eviction | In this example, if the nodefs.available signal meets the eviction threshold, the kubelet reclaims the resource until the signal reaches the threshold of 1GiB, and then continues to reclaim the minimu", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/", "id": "k8s_00554_code_7011"}
{"instruction": "Write a yaml example for node-pressure eviction", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nevictionHard:\n  memory.available: \"500Mi\"\n  nodefs.available: \"1Gi\"\n  imagefs.available: \"100Gi\"\nevictionMinimumReclaim:\n  memory.available: \"0Mi\"\n  nodefs.available: \"500Mi\"\n  imagefs.available: \"2Gi\"\n```\n\nNode-pressure Eviction | In this example, if the nodefs.available signal meets the eviction threshold, the kubelet reclaims the resource until the signal reaches the threshold of 1GiB, and then continues to reclaim the minimu", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/", "id": "k8s_00554_code_7012"}
{"instruction": "Write a yaml example for node-pressure eviction", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nevictionHard:\n  memory.available: \"500Mi\"\n  nodefs.available: \"1Gi\"\n  imagefs.available: \"100Gi\"\nevictionMinimumReclaim:\n  memory.available: \"0Mi\"\n  nodefs.available: \"500Mi\"\n  imagefs.available: \"2Gi\"\n```\n\nNode-pressure Eviction | In this example, if the nodefs.available signal meets the eviction threshold, the kubelet reclaims the resource until the signal reaches the threshold of 1GiB, and then continues to reclaim the minimu", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/", "id": "k8s_00554_code_7013"}
{"instruction": "What is the reference documentation for kubectl logs?", "response": "kubectl logsSynopsisPrint the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER] Examples # Return snapshot logs from pod nginx with only one container kubectl logs nginx # Return snapshot logs from pod nginx, prefixing each line with the source pod and container name kubectl logs nginx --prefix # Return snapshot logs from pod nginx, limiting output to 500 bytes kubectl logs nginx --limit-bytes=500 # Return snapshot logs from pod nginx, waiting up to 20 seconds for it to start running. kubectl logs nginx --pod-running-timeout=20s # Return snapshot logs from pod nginx with multi containers kubectl logs nginx --all-containers=true # Return snapshot logs from all pods in the deployment nginx kubectl logs deployment/nginx --all-pods=true # Return snapshot logs from all containers in pods defined by label app=nginx kubectl logs -l app=nginx --all-containers=true # Return snapshot logs from all pods defined by label app=nginx, limiting concurrent log requests to 10 pods kubectl logs -l app=nginx --max-log-requests=10 # Return snapshot of previous terminated ruby container logs from pod web-1 kubectl logs -p -c ruby web-1 # Begin streaming the logs from pod nginx, continuing even if errors occur kubectl logs nginx -f --ignore-errors=true # Begin streaming the logs of the ruby container in pod web-1 kubectl logs -f -c ruby web-1 # Begin streaming the logs from all containers in pods defined by label app=nginx kubectl logs -f -l app=nginx --all-containers=true # Display only the most recent 20 lines of output in pod nginx kubectl logs --tail=20 nginx # Show all logs from pod nginx written in the last hour kubectl logs --since=1h nginx # Show all logs with timestamps from pod nginx starting from August 30, 2024, at 06:00:00 UTC kubectl logs nginx --since-time=2024-08-30T06:00:00Z --timestamps=true # Show logs from a kubelet with an expired serving certificate kubectl logs --insecure-skip-tls-verify-backend nginx # Return snapshot logs from first container of a job named hello kubectl logs job/hello # Return snapshot logs from container nginx-1 of a deployment named nginx kubectl logs deployment/nginx -c nginx-1 Options--all-containersGet all containers' logs in the pod(s).--all-podsGet logs from all pod(s). Sets prefix to true.-c, --container stringPrint the logs of this container-f, --followSpecify if the logs should be streamed.-h, --helphelp for logs--ignore-errorsIf watching / following pod logs, allow for any errors that occur to be non-fatal--insecure-skip-tls-verify-backendSkip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired.--limit-bytes intMaximum bytes of logs to return. Defaults to no limit.--max-log-requests int Default: 5Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5.--pod-running-timeout duration Default: 20sThe length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running--prefixPrefix each log line with the log source (pod name and container name)-p, --previousIf true, print the logs for the previous instance of the container in a pod if it exists.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--since durationOnly return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used.--since-time stringOnly return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.--tail int Default: -1Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise 10,", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_logs/", "id": "k8s_00555"}
{"instruction": "Write a bash example for kubectl logs", "response": "Here's a bash example:\n\n```bash\nkubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]\n```\n\nkubectl logs | Get all containers' logs in the pod(s).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_logs/", "id": "k8s_00555_code_7015"}
{"instruction": "Write a bash example for kubectl logs", "response": "Here's a bash example:\n\n```bash\nkubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]\n```\n\nkubectl logs | Get all containers' logs in the pod(s).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_logs/", "id": "k8s_00555_code_7016"}
{"instruction": "Provide a tutorial on statefulset basics", "response": "StatefulSet BasicsThis tutorial provides an introduction to managing applications with StatefulSets. It demonstrates how to create, delete, scale, and update the Pods of StatefulSets.Before you beginBefore you begin this tutorial, you should familiarize yourself with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningThe kubectl command line toolYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou should configure kubectl to use a context that uses the default namespace. If you are using an existing cluster, make sure that it's OK to use that cluster's default namespace to practice. Ideally, practice in a cluster that doesn't run any real workloads.It's also useful to read the concept page about StatefulSets.Note:This tutorial assumes that your cluster is configured to dynamically provision PersistentVolumes. You'll also need to have a default StorageClass. If your cluster is not configured to provision storage dynamically, you will have to manually provision two 1 GiB volumes prior to starting this tutorial and set up your cluster so that those PersistentVolumes map to the PersistentVolumeClaim templates that the StatefulSet defines.ObjectivesStatefulSets are intended to be used with stateful applications and distributed systems. However, the administration of stateful applications and distributed systems on Kubernetes is a broad, complex topic. In order to demonstrate the basic features of a StatefulSet, and not to conflate the former topic with the latter, you will deploy a simple web application using a StatefulSet.After this tutorial, you will be familiar with the following.How to create a StatefulSetHow a StatefulSet manages its PodsHow to delete a StatefulSetHow to scale a StatefulSetHow to update a StatefulSet's PodsCreating a StatefulSetBegin by creating a StatefulSet (and the Service that it relies upon) using the example below. It is similar to the example presented in the StatefulSets concept. It creates a headless Service, nginx, to publish the IP addresses of Pods in the StatefulSet, web.application/web/web.yaml apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: \"nginx\" replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: registry.k8s.io/nginx-slim:0.21 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates: - metadata: name: www spec: accessModes: [ \"ReadWriteOnce\" ] resources: requests: storage: 1Gi You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.# use this terminal to run commands that specify --watch # end this watch when you are asked to start a new watch kubectl get pods --watch -l app=nginx In the second terminal, use kubectl apply to create the headless Service and StatefulSet:kubectl apply -f https://k8s.io/examples/application/web/web.yaml service/nginx created statefulset.apps/web created The command above creates two Pods, each running an NGINX webserver. Get the nginx Service...kubectl get service nginx NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx ClusterIP None <none> 80/TCP 12s ...then get the web StatefulSet, to verify that both were created successfully:kubectl get statefulset web NAME READY AGE web 2/2 37s Ordered Pod creationA StatefulSet defaults to creating its Pods in a s", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7018"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\nStatefulSet Basics | The command above creates two Pods, each running an NGINX webserver. Get the nginx Service...", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7019"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get service nginx\n```\n\nStatefulSet Basics | ...then get the web StatefulSet, to verify that both were created successfully:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7020"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset web\n```\n\nStatefulSet Basics | A StatefulSet defaults to creating its Pods in a strict order.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7021"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nStatefulSet Basics | As mentioned in the StatefulSets concept, the Pods in a StatefulSet have a sticky, unique identity. This identity is based on a unique ordinal index that is assigned to each Pod by the StatefulSet con", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7022"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\nStatefulSet Basics | which starts a new shell. In that new shell, run:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7023"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\nStatefulSet Basics | Wait for the StatefulSet to restart them, and for both Pods to transition to Running and Ready:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7024"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\nStatefulSet Basics | which starts a new shell.In that new shell, run:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7025"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\nStatefulSet Basics | The output is similar to:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7026"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\nStatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for all of the Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7027"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale sts web --replicas=5\n```\n\nStatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for the three additional Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7028"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts web -p '{\"spec\":{\"replicas\":3}}'\n```\n\nStatefulSet Basics | Wait for web-4 and web-3 to transition to Terminating.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7029"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\nStatefulSet Basics | There are still five PersistentVolumeClaims and five PersistentVolumes. When exploring a Pod's stable storage, you saw that the PersistentVolumes mounted to the Pods of a StatefulSet are not deleted w", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7030"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.24\"}]'\n```\n\nStatefulSet Basics | In another terminal, watch the Pods in the StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7031"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.21\"}]'\n```\n\nStatefulSet Basics | Delete a Pod in the StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7032"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-2\n```\n\nStatefulSet Basics | Wait for the replacement web-2 Pod to be Running and Ready:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7033"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\nStatefulSet Basics | Notice that, even though the update strategy is RollingUpdate the StatefulSet restored the Pod with the original container image. This is because the ordinal of the Pod is less than the partition spec", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7034"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\nStatefulSet Basics | When you changed the partition, the StatefulSet controller automatically updated the web-2 Pod because the Pod's ordinal was greater than or equal to the partition.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7035"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-1\n```\n\nStatefulSet Basics | Wait for the web-1 Pod to be Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7036"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-1 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\nStatefulSet Basics | web-1 was restored to its original configuration because the Pod's ordinal was less than the partition. When a partition is specified, all Pods with an ordinal that is greater than or equal to the par", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7037"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"partition\":0}}}}'\n```\n\nStatefulSet Basics | Wait for all of the Pods in the StatefulSet to become Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7038"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"OnDelete\", \"rollingUpdate\": null}}}'\n```\n\nStatefulSet Basics | When you select this update strategy, the StatefulSet controller does not automatically update Pods when a modification is made to the StatefulSet's .spec.template field. You need to manage the rollou", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7039"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web --cascade=orphan\n```\n\nStatefulSet Basics | Get the Pods, to examine their status:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7040"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nStatefulSet Basics | Even though web has been deleted, all of the Pods are still Running and Ready. Delete web-0:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7041"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-0\n```\n\nStatefulSet Basics | Get the StatefulSet's Pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7042"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nStatefulSet Basics | As the web StatefulSet has been deleted, web-0 has not been relaunched.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7043"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\nStatefulSet Basics | Ignore the error. It only indicates that an attempt was made to create the nginx headless Service even though that Service already exists.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7044"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\nStatefulSet Basics | Examine the output of the kubectl get command running in the first terminal, and wait for all of the Pods to transition to Terminating.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7045"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\nStatefulSet Basics | Recreate the StatefulSet and headless Service one more time:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7046"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\nStatefulSet Basics | When all of the StatefulSet's Pods transition to Running and Ready, retrieve the contents of their index.html files:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7047"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\nStatefulSet Basics | ...and the web StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7048"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\nStatefulSet Basics | For some distributed systems, the StatefulSet ordering guarantees are unnecessary and/or undesirable. These systems require only uniqueness and identity.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7049"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7050"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web-parallel.yaml\n```\n\nStatefulSet Basics | Keep the terminal open where you're running the watch. In another terminal window, scale the StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7051"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset/web --replicas=5\n```\n\nStatefulSet Basics | Examine the output of the terminal where the kubectl get command is running. It may look something like", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7052"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete sts web\n# sts is an abbreviation for statefulset\n```\n\nStatefulSet Basics | You can watch kubectl get to see those Pods being deleted.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7053"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc nginx\n```\n\nStatefulSet Basics | Delete the persistent storage media for the PersistentVolumes used in this tutorial.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7054"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc www-web-0 www-web-1 www-web-2 www-web-3 www-web-4\n```\n\nStatefulSet Basics |", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7055"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7056"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/<name>\n```\n\nStatefulSet Basics | You can split updates to a StatefulSet that uses the RollingUpdate strategy into partitions, by specifying .spec.updateStrategy.rollingUpdate.partition.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7057"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7058"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napplication/web/web.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7059"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7060"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\nStatefulSet Basics | The command above creates two Pods, each running an NGINX webserver. Get the nginx Service...", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7061"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get service nginx\n```\n\nStatefulSet Basics | ...then get the web StatefulSet, to verify that both were created successfully:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7062"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset web\n```\n\nStatefulSet Basics | A StatefulSet defaults to creating its Pods in a strict order.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7063"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nStatefulSet Basics | As mentioned in the StatefulSets concept, the Pods in a StatefulSet have a sticky, unique identity. This identity is based on a unique ordinal index that is assigned to each Pod by the StatefulSet con", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7064"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\nStatefulSet Basics | which starts a new shell. In that new shell, run:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7065"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\nStatefulSet Basics | Wait for the StatefulSet to restart them, and for both Pods to transition to Running and Ready:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7066"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\nStatefulSet Basics | which starts a new shell.In that new shell, run:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7067"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\nStatefulSet Basics | The output is similar to:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7068"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\nStatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for all of the Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7069"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale sts web --replicas=5\n```\n\nStatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for the three additional Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7070"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts web -p '{\"spec\":{\"replicas\":3}}'\n```\n\nStatefulSet Basics | Wait for web-4 and web-3 to transition to Terminating.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7071"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\nStatefulSet Basics | There are still five PersistentVolumeClaims and five PersistentVolumes. When exploring a Pod's stable storage, you saw that the PersistentVolumes mounted to the Pods of a StatefulSet are not deleted w", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7072"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.24\"}]'\n```\n\nStatefulSet Basics | In another terminal, watch the Pods in the StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7073"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.21\"}]'\n```\n\nStatefulSet Basics | Delete a Pod in the StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7074"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-2\n```\n\nStatefulSet Basics | Wait for the replacement web-2 Pod to be Running and Ready:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7075"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\nStatefulSet Basics | Notice that, even though the update strategy is RollingUpdate the StatefulSet restored the Pod with the original container image. This is because the ordinal of the Pod is less than the partition spec", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7076"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\nStatefulSet Basics | When you changed the partition, the StatefulSet controller automatically updated the web-2 Pod because the Pod's ordinal was greater than or equal to the partition.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7077"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-1\n```\n\nStatefulSet Basics | Wait for the web-1 Pod to be Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7078"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-1 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\nStatefulSet Basics | web-1 was restored to its original configuration because the Pod's ordinal was less than the partition. When a partition is specified, all Pods with an ordinal that is greater than or equal to the par", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7079"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"partition\":0}}}}'\n```\n\nStatefulSet Basics | Wait for all of the Pods in the StatefulSet to become Running and Ready.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7080"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"OnDelete\", \"rollingUpdate\": null}}}'\n```\n\nStatefulSet Basics | When you select this update strategy, the StatefulSet controller does not automatically update Pods when a modification is made to the StatefulSet's .spec.template field. You need to manage the rollou", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7081"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web --cascade=orphan\n```\n\nStatefulSet Basics | Get the Pods, to examine their status:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7082"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nStatefulSet Basics | Even though web has been deleted, all of the Pods are still Running and Ready. Delete web-0:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7083"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-0\n```\n\nStatefulSet Basics | Get the StatefulSet's Pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7084"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nStatefulSet Basics | As the web StatefulSet has been deleted, web-0 has not been relaunched.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7085"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\nStatefulSet Basics | Ignore the error. It only indicates that an attempt was made to create the nginx headless Service even though that Service already exists.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7086"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\nStatefulSet Basics | Examine the output of the kubectl get command running in the first terminal, and wait for all of the Pods to transition to Terminating.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7087"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\nStatefulSet Basics | Recreate the StatefulSet and headless Service one more time:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7088"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\nStatefulSet Basics | When all of the StatefulSet's Pods transition to Running and Ready, retrieve the contents of their index.html files:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7089"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\nStatefulSet Basics | ...and the web StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7090"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\nStatefulSet Basics | For some distributed systems, the StatefulSet ordering guarantees are unnecessary and/or undesirable. These systems require only uniqueness and identity.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7091"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napplication/web/web-parallel.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7092"}
{"instruction": "Write a yaml example for statefulset basics", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\nStatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7093"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web-parallel.yaml\n```\n\nStatefulSet Basics | Keep the terminal open where you're running the watch. In another terminal window, scale the StatefulSet:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7094"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset/web --replicas=5\n```\n\nStatefulSet Basics | Examine the output of the terminal where the kubectl get command is running. It may look something like", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7095"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete sts web\n# sts is an abbreviation for statefulset\n```\n\nStatefulSet Basics | You can watch kubectl get to see those Pods being deleted.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7096"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc nginx\n```\n\nStatefulSet Basics | Delete the persistent storage media for the PersistentVolumes used in this tutorial.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7097"}
{"instruction": "Write a bash example for statefulset basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc www-web-0 www-web-1 www-web-2 www-web-3 www-web-4\n```\n\nStatefulSet Basics |", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/", "id": "k8s_00556_code_7098"}
{"instruction": "What is the reference documentation for deployment?", "response": "DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1import \"k8s.io/api/apps/v1\"DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1kind: Deploymentmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (DeploymentSpec)Specification of the desired behavior of the Deployment.status (DeploymentStatus)Most recently observed status of the Deployment.DeploymentSpecDeploymentSpec is the specification of the desired behavior of the Deployment.selector (LabelSelector), requiredLabel selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.template (PodTemplateSpec), requiredTemplate describes the pods that will be created. The only allowed template.spec.restartPolicy value is \"Always\".replicas (int32)Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.minReadySeconds (int32)Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)strategy (DeploymentStrategy)Patch strategy: retainKeysThe deployment strategy to use to replace existing pods with new ones.DeploymentStrategy describes how to replace existing pods with new ones.strategy.type (string)Type of deployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.strategy.rollingUpdate (RollingUpdateDeployment)Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.Spec to control the desired behavior of rolling update.strategy.rollingUpdate.maxSurge (IntOrString)The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.strategy.rollingUpdate.maxUnavailable (IntOrString)The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.revisionHistoryLimit (int32)The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.progressDeadlineSeconds (int32)The maximum time in seconds for a deployment to make progress before it is considered to be faile", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/", "id": "k8s_00557"}
{"instruction": "Explain the Kubernetes concept: Ingress Controllers", "response": "Ingress ControllersIn order for an Ingress to work in your cluster, there must be an ingress controller running. You need to select at least one ingress controller and make sure it is set up in your cluster. This page lists common ingress controllers that you can deploy.In order for the Ingress resource to work, the cluster must have an ingress controller running.Unlike other types of controllers which run as part of the kube-controller-manager binary, Ingress controllers are not started automatically with a cluster. Use this page to choose the ingress controller implementation that best fits your cluster.Kubernetes as a project supports and maintains AWS, GCE, and nginx ingress controllers.Additional controllersNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.AKS Application Gateway Ingress Controller is an ingress controller that configures the Azure Application Gateway.Alibaba Cloud MSE Ingress is an ingress controller that configures the Alibaba Cloud Native Gateway, which is also the commercial version of Higress.Apache APISIX ingress controller is an Apache APISIX-based ingress controller.Avi Kubernetes Operator provides L4-L7 load-balancing using VMware NSX Advanced Load Balancer.BFE Ingress Controller is a BFE-based ingress controller.Cilium Ingress Controller is an ingress controller powered by Cilium.The Citrix ingress controller works with Citrix Application Delivery Controller.Contour is an Envoy based ingress controller.Emissary-Ingress API Gateway is an Envoy-based ingress controller.EnRoute is an Envoy based API gateway that can run as an ingress controller.Easegress IngressController is an Easegress based API gateway that can run as an ingress controller.F5 BIG-IP Container Ingress Services for Kubernetes lets you use an Ingress to configure F5 BIG-IP virtual servers.FortiADC Ingress Controller support the Kubernetes Ingress resources and allows you to manage FortiADC objects from KubernetesGloo is an open-source ingress controller based on Envoy, which offers API gateway functionality.HAProxy Ingress is an ingress controller for HAProxy.Higress is an Envoy based API gateway that can run as an ingress controller.The HAProxy Ingress Controller for Kubernetes is also an ingress controller for HAProxy.Istio Ingress is an Istio based ingress controller.The Kong Ingress Controller for Kubernetes is an ingress controller driving Kong Gateway.Kusk Gateway is an OpenAPI-driven ingress controller based on Envoy.The NGINX Ingress Controller for Kubernetes works with the NGINX webserver (as a proxy).The ngrok Kubernetes Ingress Controller is an open source controller for adding secure public access to your K8s services using the ngrok platform.The OCI Native Ingress Controller is an Ingress controller for Oracle Cloud Infrastructure which allows you to manage the OCI Load Balancer.OpenNJet Ingress Controller is a OpenNJet-based ingress controller.The Pomerium Ingress Controller is based on Pomerium, which offers context-aware access policy.Skipper HTTP router and reverse proxy for service composition, including use cases like Kubernetes Ingress, designed as a library to build your custom proxy.The Traefik Kubernetes Ingress provider is an ingress controller for the Traefik proxy.Tyk Operator extends Ingress with Custom Resources to bring API Management capabilities to Ingress. Tyk Operator works with the Open Source Tyk Gateway & Tyk Cloud control plane.Voyager is an ingress controller for HAProxy.Wallarm Ingress Controller is an Ingress Controller that provides WAAP (WAF) and API Security capabilities.Using multiple Ingress controllersYou may deploy any number of ingress controllers using ingress class within a cluster. Note the .metadata.name of your ingress class resourc", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/", "id": "k8s_00558"}
{"instruction": "Explain the Kubernetes concept: Node Resource Managers", "response": "Node Resource ManagersIn order to support latency-critical and high-throughput workloads, Kubernetes offers a suite of Resource Managers. The managers aim to co-ordinate and optimise the alignment of node's resources for pods configured with a specific requirement for CPUs, devices, and memory (hugepages) resources.Hardware topology alignment policiesTopology Manager is a kubelet component that aims to coordinate the set of components that are responsible for these optimizations. The overall resource management process is governed using the policy you specify. To learn more, read Control Topology Management Policies on a Node.Policies for assigning CPUs to PodsFEATURE STATE: Kubernetes v1.26 [stable] (enabled by default: true)Once a Pod is bound to a Node, the kubelet on that node may need to either multiplex the existing hardware (for example, sharing CPUs across multiple Pods) or allocate hardware by dedicating some resource (for example, assigning one of more CPUs for a Pod's exclusive use).By default, the kubelet uses CFS quota to enforce pod CPU limits. When the node runs many CPU-bound pods, the workload can move to different CPU cores depending on whether the pod is throttled and which CPU cores are available at scheduling time. Many workloads are not sensitive to this migration and thus work fine without any intervention.However, in workloads where CPU cache affinity and scheduling latency significantly affect workload performance, the kubelet allows alternative CPU management policies to determine some placement preferences on the node. This is implemented using the CPU Manager and its policy. There are two available policies:none: the none policy explicitly enables the existing default CPU affinity scheme, providing no affinity beyond what the OS scheduler does automatically. Limits on CPU usage for Guaranteed pods and Burstable pods are enforced using CFS quota.static: the static policy allows containers in Guaranteed pods with integer CPU requests access to exclusive CPUs on the node. This exclusivity is enforced using the cpuset cgroup controller.Note:System services such as the container runtime and the kubelet itself can continue to run on these exclusive CPUs. The exclusivity only extends to other pods.CPU Manager doesn't support offlining and onlining of CPUs at runtime.Static policyThe static policy enables finer-grained CPU management and exclusive CPU assignment. This policy manages a shared pool of CPUs that initially contains all CPUs in the node. The amount of exclusively allocatable CPUs is equal to the total number of CPUs in the node minus any CPU reservations set by the kubelet configuration. CPUs reserved by these options are taken, in integer quantity, from the initial shared pool in ascending order by physical core ID. This shared pool is the set of CPUs on which any containers in BestEffort and Burstable pods run. Containers in Guaranteed pods with fractional CPU requests also run on CPUs in the shared pool. Only containers that are part of a Guaranteed pod and have integer CPU requests are assigned exclusive CPUs.Note:The kubelet requires a CPU reservation greater than zero when the static policy is enabled. This is because a zero CPU reservation would allow the shared pool to become empty.As Guaranteed pods whose containers fit the requirements for being statically assigned are scheduled to the node, CPUs are removed from the shared pool and placed in the cpuset for the container. CFS quota is not used to bound the CPU usage of these containers as their usage is bound by the scheduling domain itself. In others words, the number of CPUs in the container cpuset is equal to the integer CPU limit specified in the pod spec. This static assignment increases CPU affinity and decreases context switches due to throttling for the CPU-bound workload.Consider the containers in the following pod specs:spec: containers: - name: nginx image: nginx The pod above runs in the BestEffort QoS class because no reso", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/node-resource-managers/", "id": "k8s_00559"}
{"instruction": "Write a yaml example for node resource managers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n```\n\nNode Resource Managers | The pod above runs in the BestEffort QoS class because no resource requests or limits are specified. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/node-resource-managers/", "id": "k8s_00559_code_7102"}
{"instruction": "Write a yaml example for node resource managers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nNode Resource Managers | The pod above runs in the Burstable QoS class because resource requests do not equal limits and the cpu quantity is not specified. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/node-resource-managers/", "id": "k8s_00559_code_7103"}
{"instruction": "Write a yaml example for node resource managers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n      requests:\n        memory: \"100Mi\"\n        cpu: \"1\"\n```\n\nNode Resource Managers | The pod above runs in the Burstable QoS class because resource requests do not equal limits. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/node-resource-managers/", "id": "k8s_00559_code_7104"}
{"instruction": "Write a yaml example for node resource managers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"2\"\n```\n\nNode Resource Managers | The pod above runs in the Guaranteed QoS class because requests are equal to limits. And the container's resource limit for the CPU resource is an integer greater than or equal to one. The nginx conta", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/node-resource-managers/", "id": "k8s_00559_code_7105"}
{"instruction": "Write a yaml example for node resource managers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"1.5\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"1.5\"\n```\n\nNode Resource Managers | The pod above runs in the Guaranteed QoS class because requests are equal to limits. But the container's resource limit for the CPU resource is a fraction. It runs in the shared pool.", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/node-resource-managers/", "id": "k8s_00559_code_7106"}
{"instruction": "Write a yaml example for node resource managers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n```\n\nNode Resource Managers | The pod above runs in the Guaranteed QoS class because only limits are specified and requests are set equal to limits when not explicitly specified. And the container's resource limit for the CPU reso", "category": "concepts_code", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/policy/node-resource-managers/", "id": "k8s_00559_code_7107"}
{"instruction": "Explain the Kubernetes concept: Overview", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.OverviewKubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.1: Kubernetes Components2: Objects In Kubernetes2.1: Kubernetes Object Management2.2: Object Names and IDs2.3: Labels and Selectors2.4: Namespaces2.5: Annotations2.6: Field Selectors2.7: Finalizers2.8: Owners and Dependents2.9: Recommended Labels3: The Kubernetes APIThis page is an overview of Kubernetes.The name Kubernetes originates from Greek, meaning helmsman or pilot. K8s as an abbreviation results from counting the eight letters between the \"K\" and the \"s\". Google open-sourced the Kubernetes project in 2014. Kubernetes combines over 15 years of Google's experience running production workloads at scale with best-of-breed ideas and practices from the community.Why you need Kubernetes and what it can doContainers are a good way to bundle and run your applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if a container goes down, another container needs to start. Wouldn't it be easier if this behavior was handled by a system?That's how Kubernetes comes to the rescue! Kubernetes provides you with a framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more. For example: Kubernetes can easily manage a canary deployment for your system.Kubernetes provides you with:Service discovery and load balancing Kubernetes can expose a container using the DNS name or using their own IP address. If traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic so that the deployment is stable.Storage orchestration Kubernetes allows you to automatically mount a storage system of your choice, such as local storages, public cloud providers, and more.Automated rollouts and rollbacks You can describe the desired state for your deployed containers using Kubernetes, and it can change the actual state to the desired state at a controlled rate. For example, you can automate Kubernetes to create new containers for your deployment, remove existing containers and adopt all their resources to the new container.Automatic bin packing You provide Kubernetes with a cluster of nodes that it can use to run containerized tasks. You tell Kubernetes how much CPU and memory (RAM) each container needs. Kubernetes can fit containers onto your nodes to make the best use of your resources.Self-healing Kubernetes restarts containers that fail, replaces containers, kills containers that don't respond to your user-defined health check, and doesn't advertise them to clients until they are ready to serve.Secret and configuration management Kubernetes lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys. You can deploy and update secrets and application configuration without rebuilding your container images, and without exposing secrets in your stack configuration.Batch execution In addition to services, Kubernetes can manage your batch and CI workloads, replacing containers that fail, if desired.Horizontal scaling Scale your application up and down with a simple command, with a UI, or automatically based on CPU usage.IPv4/IPv6 dual-stack Allocation of IPv4 and IPv6 addresses to Pods and ServicesDesigned for extensibility Add features to your Kubernetes cluster without changing upstream source code.What Kubernetes is notKubernetes is not a traditional, all-inclusive PaaS (Platform as a Service) system. Since Kubernetes operates at the container level rather than at the hardware level, it provides some generally ap", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7109"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n2 - Objects In Kubernetes | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7110"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image nginx\n```\n\n2.1 - Kubernetes Object Management | Advantages compared to object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7111"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nginx.yaml\n```\n\n2.1 - Kubernetes Object Management | Delete the objects defined in two configuration files:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7112"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f nginx.yaml -f redis.yaml\n```\n\n2.1 - Kubernetes Object Management | Update the objects defined in a configuration file by overwriting the live configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7113"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f nginx.yaml\n```\n\n2.1 - Kubernetes Object Management | Advantages compared to imperative commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7114"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f configs/\nkubectl apply -f configs/\n```\n\n2.1 - Kubernetes Object Management | Recursively process directories:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7115"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl diff -R -f configs/\nkubectl apply -R -f configs/\n```\n\n2.1 - Kubernetes Object Management | Advantages compared to imperative object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7116"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.2 - Object Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7117"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.3 - Labels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7118"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\n2.3 - Labels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7119"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\n2.3 - Labels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7120"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\n2.3 - Labels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7121"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\n2.3 - Labels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7122"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\n2.3 - Labels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7123"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\n2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7124"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\n2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7125"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\n2.3 - Labels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7126"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\n2.3 - Labels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7127"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\n2.4 - Namespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7128"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\n2.4 - Namespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7129"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\n2.4 - Namespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7130"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.5 - Annotations | Field selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7131"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector status.phase=Running\n```\n\n2.6 - Field Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7132"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress --field-selector foo.bar=baz\n```\n\n2.6 - Field Selectors | All custom resource types support the metadata.name and metadata.namespace fields.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7133"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get services  --all-namespaces --field-selector metadata.namespace!=default\n```\n\n2.6 - Field Selectors | As with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7134"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always\n```\n\n2.6 - Field Selectors | You can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7135"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default\n```\n\n2.6 - Field Selectors | Finalizers are namespaced keys that tell Kubernetes to wait until specific conditions are met before it fully deletes resources that are marked for deletion. Finalizers alert controllers to clean up r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7136"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\n2.9 - Recommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7137"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7138"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n2.9 - Recommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7139"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7140"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7141"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7142"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7143"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7144"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.2 - Object Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7145"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.3 - Labels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7146"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\n2.3 - Labels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7147"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  component: redis\n```\n\n2.3 - Labels and Selectors | This selector (respectively in json or yaml format) is equivalent to component=redis or component in (redis).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7148"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n    component: redis\n  matchExpressions:\n    - { key: tier, operator: In, values: [cache] }\n    - { key: environment, operator: NotIn, values: [dev] }\n```\n\n2.3 - Labels and Selectors | matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7149"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: frontend\n```\n\n2.3 - Labels and Selectors | while the Redis master and replica would have different tier labels, and perhaps even an additional role label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7150"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: master\n```\n\n2.3 - Labels and Selectors | and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7151"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: replica\n```\n\n2.3 - Labels and Selectors | The labels allow for slicing and dicing the resources along any dimension specified by a label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7152"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.5 - Annotations | Field selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7153"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector \"\"\n```\n\n2.6 - Field Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7154"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace\n```\n\n2.8 - Owners and Dependents | When you tell Kubernetes to delete a resource, the API server allows the managing controller to process any finalizer rules for the resource. Finalizers prevent accidental deletion of resources your c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7155"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\n2.9 - Recommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7156"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7157"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n2.9 - Recommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7158"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7159"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7160"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7161"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7162"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl apply --dry-run=server\n```\n\n3 - The Kubernetes API | Kubernetes supports publishing a description of its APIs as OpenAPI v3.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7163"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\n{\n    \"paths\": {\n        ...,\n        \"api/v1\": {\n            \"serverRelativeURL\": \"/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF\"\n        },\n        \"apis/admissionregistration.k8s.io/v1\": {\n            \"serverRelativeURL\": \"/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597\"\n        },\n        ....\n    }\n}\n```\n\n3 - The Kubernetes API | The relative URLs are pointing to immutable OpenAPI descriptions, in order to improve client-side caching. The proper HTTP caching headers are also set by the API server for that purpose (Expires to 1", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7164"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7165"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7166"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n2 - Objects In Kubernetes | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7167"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image nginx\n```\n\n2.1 - Kubernetes Object Management | Advantages compared to object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7168"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nginx.yaml\n```\n\n2.1 - Kubernetes Object Management | Delete the objects defined in two configuration files:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7169"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f nginx.yaml -f redis.yaml\n```\n\n2.1 - Kubernetes Object Management | Update the objects defined in a configuration file by overwriting the live configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7170"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f nginx.yaml\n```\n\n2.1 - Kubernetes Object Management | Advantages compared to imperative commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7171"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f configs/\nkubectl apply -f configs/\n```\n\n2.1 - Kubernetes Object Management | Recursively process directories:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7172"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl diff -R -f configs/\nkubectl apply -R -f configs/\n```\n\n2.1 - Kubernetes Object Management | Advantages compared to imperative object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7173"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.2 - Object Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7174"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.3 - Labels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7175"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\n2.3 - Labels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7176"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\n2.3 - Labels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7177"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\n2.3 - Labels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7178"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\n2.3 - Labels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7179"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\n2.3 - Labels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7180"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\n2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7181"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\n2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7182"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\n2.3 - Labels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7183"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\n2.3 - Labels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7184"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\n2.4 - Namespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7185"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\n2.4 - Namespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7186"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\n2.4 - Namespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7187"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n2.5 - Annotations | Field selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7188"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector status.phase=Running\n```\n\n2.6 - Field Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7189"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress --field-selector foo.bar=baz\n```\n\n2.6 - Field Selectors | All custom resource types support the metadata.name and metadata.namespace fields.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7190"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get services  --all-namespaces --field-selector metadata.namespace!=default\n```\n\n2.6 - Field Selectors | As with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7191"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always\n```\n\n2.6 - Field Selectors | You can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7192"}
{"instruction": "Write a bash example for overview", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default\n```\n\n2.6 - Field Selectors | Finalizers are namespaced keys that tell Kubernetes to wait until specific conditions are met before it fully deletes resources that are marked for deletion. Finalizers alert controllers to clean up r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7193"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\n2.9 - Recommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7194"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7195"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n2.9 - Recommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7196"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7197"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7198"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7199"}
{"instruction": "Write a yaml example for overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n2.9 - Recommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/_print/", "id": "k8s_00560_code_7200"}
{"instruction": "What is the reference documentation for kubernetes api health endpoints?", "response": "Kubernetes API health endpointsThe Kubernetes API server provides API endpoints to indicate the current status of the API server. This page describes these API endpoints and explains how you can use them.API endpoints for healthThe Kubernetes API server provides 3 API endpoints (healthz, livez and readyz) to indicate the current status of the API server. The healthz endpoint is deprecated (since Kubernetes v1.16), and you should use the more specific livez and readyz endpoints instead. The livez endpoint can be used with the --livez-grace-period flag to specify the startup duration. For a graceful shutdown you can specify the --shutdown-delay-duration flag with the /readyz endpoint. Machines that check the healthz/livez/readyz of the API server should rely on the HTTP status code. A status code 200 indicates the API server is healthy/live/ready, depending on the called endpoint. The more verbose options shown below are intended to be used by human operators to debug their cluster or understand the state of the API server.The following examples will show how you can interact with the health API endpoints.For all endpoints, you can use the verbose parameter to print out the checks and their status. This can be useful for a human operator to debug the current status of the API server, it is not intended to be consumed by a machine:curl -k https://localhost:6443/livez?verbose or from a remote host with authentication:kubectl get --raw='/readyz?verbose' The output will look like this:[+]ping ok [+]log ok [+]etcd ok [+]poststarthook/start-kube-apiserver-admission-initializer ok [+]poststarthook/generic-apiserver-start-informers ok [+]poststarthook/start-apiextensions-informers ok [+]poststarthook/start-apiextensions-controllers ok [+]poststarthook/crd-informer-synced ok [+]poststarthook/bootstrap-controller ok [+]poststarthook/rbac/bootstrap-roles ok [+]poststarthook/scheduling/bootstrap-system-priority-classes ok [+]poststarthook/start-cluster-authentication-info-controller ok [+]poststarthook/start-kube-aggregator-informers ok [+]poststarthook/apiservice-registration-controller ok [+]poststarthook/apiservice-status-available-controller ok [+]poststarthook/kube-apiserver-autoregistration ok [+]autoregister-completion ok [+]poststarthook/apiservice-openapi-controller ok healthz check passed The Kubernetes API server also supports to exclude specific checks. The query parameters can also be combined like in this example:curl -k 'https://localhost:6443/readyz?verbose&exclude=etcd' The output show that the etcd check is excluded:[+]ping ok [+]log ok [+]etcd excluded: ok [+]poststarthook/start-kube-apiserver-admission-initializer ok [+]poststarthook/generic-apiserver-start-informers ok [+]poststarthook/start-apiextensions-informers ok [+]poststarthook/start-apiextensions-controllers ok [+]poststarthook/crd-informer-synced ok [+]poststarthook/bootstrap-controller ok [+]poststarthook/rbac/bootstrap-roles ok [+]poststarthook/scheduling/bootstrap-system-priority-classes ok [+]poststarthook/start-cluster-authentication-info-controller ok [+]poststarthook/start-kube-aggregator-informers ok [+]poststarthook/apiservice-registration-controller ok [+]poststarthook/apiservice-status-available-controller ok [+]poststarthook/kube-apiserver-autoregistration ok [+]autoregister-completion ok [+]poststarthook/apiservice-openapi-controller ok [+]shutdown ok healthz check passed Individual health checksFEATURE STATE: Kubernetes v1.34 [alpha]Each individual health check exposes an HTTP endpoint and can be checked individually. The schema for the individual health checks is /livez/<healthcheck-name> or /readyz/<healthcheck-name>, where livez and readyz can be used to indicate if you want to check the liveness or the readiness of the API server, respectively. The <healthcheck-name> path can be discovered using the verbose flag from above and take the path between [+] and ok. These individual health checks should not be consumed by machines but can be helpful", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/health-checks/", "id": "k8s_00561"}
{"instruction": "Write a bash example for kubernetes api health endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw='/readyz?verbose'\n```\n\nKubernetes API health endpoints | The output will look like this:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/health-checks/", "id": "k8s_00561_code_7202"}
{"instruction": "Write a bash example for kubernetes api health endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw='/readyz?verbose'\n```\n\nKubernetes API health endpoints | The output will look like this:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/health-checks/", "id": "k8s_00561_code_7203"}
{"instruction": "What is the reference documentation for linux node swap behaviors?", "response": "Linux Node Swap BehaviorsTo allow Kubernetes workloads to use swap, on a Linux node, you must disable the kubelet's default behavior of failing when swap is detected, and specify memory-swap behavior as LimitedSwap:The available choices for swap behavior are:NoSwap(default) Workloads running as Pods on this node do not and cannot use swap. However, processes outside of Kubernetes' scope, such as system daemons (including the kubelet itself!) can utilize swap. This behavior is beneficial for protecting the node from system-level memory spikes, but it does not safeguard the workloads themselves from such spikes.LimitedSwapKubernetes workloads can utilize swap memory. The amount of swap available to a Pod is determined automatically.To learn more, read swap memory management.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/swap-behavior/", "id": "k8s_00562"}
{"instruction": "What is the reference documentation for kubectl set subject?", "response": "kubectl set subjectSynopsisUpdate the user, group, or service account in a role binding or cluster role binding.kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none] Examples # Update a cluster role binding for serviceaccount1 kubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1 # Update a role binding for user1, user2, and group1 kubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1 # Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server kubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml Options--allSelect all resources, in the namespace of the specified resource types--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-set\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files the resource to update the subjects--group stringsGroups to bind to the role-h, --helphelp for subject-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--localIf true, set subject will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--serviceaccount stringsService accounts to bind to the role--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--user stringsUsernames to bind to the roleParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--passwor", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_subject/", "id": "k8s_00563"}
{"instruction": "Write a bash example for kubectl set subject", "response": "Here's a bash example:\n\n```bash\nkubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\nkubectl set subject | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_subject/", "id": "k8s_00563_code_7206"}
{"instruction": "Write a bash example for kubectl set subject", "response": "Here's a bash example:\n\n```bash\nkubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\nkubectl set subject | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_subject/", "id": "k8s_00563_code_7207"}
{"instruction": "What is the reference documentation for managing service accounts?", "response": "Managing Service AccountsA ServiceAccount provides an identity for processes that run in a Pod.A process inside a Pod can use the identity of its associated service account to authenticate to the cluster's API server.For an introduction to service accounts, read configure service accounts.This task guide explains some of the concepts behind ServiceAccounts. The guide also explains how to obtain or revoke tokens that represent ServiceAccounts, and how to (optionally) bind a ServiceAccount's validity to the lifetime of an API object.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo be able to follow these steps exactly, ensure you have a namespace named examplens. If you don't, create one by running:kubectl create namespace examplens User accounts versus service accountsKubernetes distinguishes between the concept of a user account and a service account for a number of reasons:User accounts are for humans. Service accounts are for application processes, which (for Kubernetes) run in containers that are part of pods.User accounts are intended to be global: names must be unique across all namespaces of a cluster. No matter what namespace you look at, a particular username that represents a user represents the same user. In Kubernetes, service accounts are namespaced: two different namespaces can contain ServiceAccounts that have identical names.Typically, a cluster's user accounts might be synchronised from a corporate database, where new user account creation requires special privileges and is tied to complex business processes. By contrast, service account creation is intended to be more lightweight, allowing cluster users to create service accounts for specific tasks on demand. Separating ServiceAccount creation from the steps to onboard human users makes it easier for workloads to follow the principle of least privilege.Auditing considerations for humans and service accounts may differ; the separation makes that easier to achieve.A configuration bundle for a complex system may include definition of various service accounts for components of that system. Because service accounts can be created without many constraints and have namespaced names, such configuration is usually portable.Bound service account tokensServiceAccount tokens can be bound to API objects that exist in the kube-apiserver. This can be used to tie the validity of a token to the existence of another API object. Supported object types are as follows:Pod (used for projected volume mounts, see below)Secret (can be used to allow revoking a token by deleting the Secret)Node (can be used to auto-revoke a token when its Node is deleted; creating new node-bound tokens is GA in v1.33+)When a token is bound to an object, the object's metadata.name and metadata.uid are stored as extra 'private claims' in the issued JWT.When a bound token is presented to the kube-apiserver, the service account authenticator will extract and verify these claims. If the referenced object or the ServiceAccount is pending deletion (for example, due to finalizers), then for any instant that is 60 seconds (or more) after the .metadata.deletionTimestamp date, authentication with that token would fail. If the referenced object no longer exists (or its metadata.uid does not match), the request will not be authenticated.Additional metadata in Pod bound tokensFEATURE STATE: Kubernetes v1.32 [stable] (enabled by default: true)When a service account token is bound to a Pod object, additional metadata is also embedded into the token that indicates the value of the bound pod's spec.nodeName field, and the uid of that N", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace examplens\n```\n\nManaging Service Accounts | Kubernetes distinguishes between the concept of a user account and a service account for a number of reasons:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7209"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl create token my-sa --bound-object-kind=\"Pod\" --bound-object-name=\"test-pod\"\n```\n\nManaging Service Accounts | Copy this token into a new file named tokenreview.yaml:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7210"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nspec:\n  token: <token from step 2>\n```\n\nManaging Service Accounts | Submit this resource to the apiserver for review:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7211"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nmetadata:\n  creationTimestamp: null\nspec:\n  token: <token>\nstatus:\n  audiences:\n  - https://kubernetes.default.svc.cluster.local\n  authenticated: true\n  user:\n    extra:\n      authentication.kubernetes.io/credential-id:\n      - JTI=7ee52be0-9045-4653-aa5e-0da57b8dccdc\n      authentication.kubernetes.io/node-name:\n      - kind-control-plane\n      authentication.kubernetes.io/node-uid:\n      - 497e9d9a-47aa-4930-b0f6-9f2fb574c8c6\n      authentication.kubernetes.io/pod-name:\n      - test-pod\n      authentication.kubernetes.io/pod-uid:\n      - e87dbbd6-3d7e-45db-aafb-72b24627dff5\n    groups:\n    - system:serviceaccounts\n    - system:serviceaccounts:default\n    - system:authenticated\n    uid: f8b4161b-2e2b-11e9-86b7-2afc33b31a7e\n    username: system:serviceaccount:default:my-sa\n```\n\nManaging Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7212"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      sources:\n        - serviceAccountToken:\n            path: token # must match the path the app expects\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\nManaging Service Accounts | That manifest snippet defines a projected volume that consists of three sources. In this case, each source also represents a single path within that volume. The three sources are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7213"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\n  namespace: default\nsecrets:\n  - name: build-robot-secret # usually NOT present for a manually generated token\n```\n\nManaging Service Accounts | Beginning from version 1.29, legacy ServiceAccount tokens that were generated automatically will be marked as invalid if they remain unused for a certain period of time (set to default at one year). T", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7214"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  namespace: default\n  labels:\n    kubernetes.io/legacy-token-last-used: 2022-10-24\n    kubernetes.io/legacy-token-invalid-since: 2023-10-25\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\n```\n\nManaging Service Accounts | A ServiceAccount controller manages the ServiceAccounts inside namespaces, and ensures a ServiceAccount named \"default\" exists in every active namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7215"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      defaultMode: 420 # decimal equivalent of octal 0644\n      sources:\n        - serviceAccountToken:\n            expirationSeconds: 3607\n            path: token\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\nManaging Service Accounts | That manifest snippet defines a projected volume that combines information from three sources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7216"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\nManaging Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7217"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens create -f https://k8s.io/examples/secret/serviceaccount/mysecretname.yaml\n```\n\nManaging Service Accounts | To see the details for that Secret, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7218"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens describe secret mysecretname\n```\n\nManaging Service Accounts | The output is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7219"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret name-of-secret\n```\n\nManaging Service Accounts | Otherwise, first find the Secret for the ServiceAccount.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7220"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"v1\",\"kind\":\"ServiceAccount\",\"metadata\":{\"annotations\":{},\"name\":\"example-automated-thing\",\"namespace\":\"examplens\"}}      \n  creationTimestamp: \"2019-07-21T07:07:07Z\"\n  name: example-automated-thing\n  namespace: examplens\n  resourceVersion: \"777\"\n  selfLink: /api/v1/namespaces/examplens/serviceaccounts/example-automated-thing\n  uid: f23fd170-66f2-4697-b049-e1e266b7f835\nsecrets:\n  - name: example-automated-thing-token-zyxwv\n```\n\nManaging Service Accounts | Then, delete the Secret you now know the name of:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7221"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens delete secret/example-automated-thing-token-zyxwv\n```\n\nManaging Service Accounts | Short lived ServiceAccount tokens automatically expire after the time-limit specified during their creation. There is no central record of tokens issued, so there is no way to revoke individual tokens", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7222"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace examplens\n```\n\nManaging Service Accounts |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7223"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nspec:\n  token: <token from step 2>\n```\n\nManaging Service Accounts | Submit this resource to the apiserver for review:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7224"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nmetadata:\n  creationTimestamp: null\nspec:\n  token: <token>\nstatus:\n  audiences:\n  - https://kubernetes.default.svc.cluster.local\n  authenticated: true\n  user:\n    extra:\n      authentication.kubernetes.io/credential-id:\n      - JTI=7ee52be0-9045-4653-aa5e-0da57b8dccdc\n      authentication.kubernetes.io/node-name:\n      - kind-control-plane\n      authentication.kubernetes.io/node-uid:\n      - 497e9d9a-47aa-4930-b0f6-9f2fb574c8c6\n      authentication.kubernetes.io/pod-name:\n      - test-pod\n      authentication.kubernetes.io/pod-uid:\n      - e87dbbd6-3d7e-45db-aafb-72b24627dff5\n    groups:\n    - system:serviceaccounts\n    - system:serviceaccounts:default\n    - system:authenticated\n    uid: f8b4161b-2e2b-11e9-86b7-2afc33b31a7e\n    username: system:serviceaccount:default:my-sa\n```\n\nManaging Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7225"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl get tokenreview\n```\n\nManaging Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7226"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      sources:\n        - serviceAccountToken:\n            path: token # must match the path the app expects\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\nManaging Service Accounts | That manifest snippet defines a projected volume that consists of three sources. In this case, each source also represents a single path within that volume. The three sources are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7227"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\n  namespace: default\nsecrets:\n  - name: build-robot-secret # usually NOT present for a manually generated token\n```\n\nManaging Service Accounts | Beginning from version 1.29, legacy ServiceAccount tokens that were generated automatically will be marked as invalid if they remain unused for a certain period of time (set to default at one year). T", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7228"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  namespace: default\n  labels:\n    kubernetes.io/legacy-token-last-used: 2022-10-24\n    kubernetes.io/legacy-token-invalid-since: 2023-10-25\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\n```\n\nManaging Service Accounts | A ServiceAccount controller manages the ServiceAccounts inside namespaces, and ensures a ServiceAccount named \"default\" exists in every active namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7229"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      defaultMode: 420 # decimal equivalent of octal 0644\n      sources:\n        - serviceAccountToken:\n            expirationSeconds: 3607\n            path: token\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\nManaging Service Accounts | That manifest snippet defines a projected volume that combines information from three sources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7230"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\nManaging Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7231"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"v1\",\"kind\":\"ServiceAccount\",\"metadata\":{\"annotations\":{},\"name\":\"example-automated-thing\",\"namespace\":\"examplens\"}}      \n  creationTimestamp: \"2019-07-21T07:07:07Z\"\n  name: example-automated-thing\n  namespace: examplens\n  resourceVersion: \"777\"\n  selfLink: /api/v1/namespaces/examplens/serviceaccounts/example-automated-thing\n  uid: f23fd170-66f2-4697-b049-e1e266b7f835\nsecrets:\n  - name: example-automated-thing-token-zyxwv\n```\n\nManaging Service Accounts | Then, delete the Secret you now know the name of:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7232"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace examplens\n```\n\nManaging Service Accounts | Kubernetes distinguishes between the concept of a user account and a service account for a number of reasons:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7233"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl create token my-sa --bound-object-kind=\"Pod\" --bound-object-name=\"test-pod\"\n```\n\nManaging Service Accounts | Copy this token into a new file named tokenreview.yaml:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7234"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nspec:\n  token: <token from step 2>\n```\n\nManaging Service Accounts | Submit this resource to the apiserver for review:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7235"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nmetadata:\n  creationTimestamp: null\nspec:\n  token: <token>\nstatus:\n  audiences:\n  - https://kubernetes.default.svc.cluster.local\n  authenticated: true\n  user:\n    extra:\n      authentication.kubernetes.io/credential-id:\n      - JTI=7ee52be0-9045-4653-aa5e-0da57b8dccdc\n      authentication.kubernetes.io/node-name:\n      - kind-control-plane\n      authentication.kubernetes.io/node-uid:\n      - 497e9d9a-47aa-4930-b0f6-9f2fb574c8c6\n      authentication.kubernetes.io/pod-name:\n      - test-pod\n      authentication.kubernetes.io/pod-uid:\n      - e87dbbd6-3d7e-45db-aafb-72b24627dff5\n    groups:\n    - system:serviceaccounts\n    - system:serviceaccounts:default\n    - system:authenticated\n    uid: f8b4161b-2e2b-11e9-86b7-2afc33b31a7e\n    username: system:serviceaccount:default:my-sa\n```\n\nManaging Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7236"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      sources:\n        - serviceAccountToken:\n            path: token # must match the path the app expects\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\nManaging Service Accounts | That manifest snippet defines a projected volume that consists of three sources. In this case, each source also represents a single path within that volume. The three sources are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7237"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\n  namespace: default\nsecrets:\n  - name: build-robot-secret # usually NOT present for a manually generated token\n```\n\nManaging Service Accounts | Beginning from version 1.29, legacy ServiceAccount tokens that were generated automatically will be marked as invalid if they remain unused for a certain period of time (set to default at one year). T", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7238"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  namespace: default\n  labels:\n    kubernetes.io/legacy-token-last-used: 2022-10-24\n    kubernetes.io/legacy-token-invalid-since: 2023-10-25\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\n```\n\nManaging Service Accounts | A ServiceAccount controller manages the ServiceAccounts inside namespaces, and ensures a ServiceAccount named \"default\" exists in every active namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7239"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      defaultMode: 420 # decimal equivalent of octal 0644\n      sources:\n        - serviceAccountToken:\n            expirationSeconds: 3607\n            path: token\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\nManaging Service Accounts | That manifest snippet defines a projected volume that combines information from three sources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7240"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\nsecret/serviceaccount/mysecretname.yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\nManaging Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7241"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\nManaging Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7242"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens create -f https://k8s.io/examples/secret/serviceaccount/mysecretname.yaml\n```\n\nManaging Service Accounts | To see the details for that Secret, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7243"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens describe secret mysecretname\n```\n\nManaging Service Accounts | The output is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7244"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret name-of-secret\n```\n\nManaging Service Accounts | Otherwise, first find the Secret for the ServiceAccount.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7245"}
{"instruction": "Write a yaml example for managing service accounts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"v1\",\"kind\":\"ServiceAccount\",\"metadata\":{\"annotations\":{},\"name\":\"example-automated-thing\",\"namespace\":\"examplens\"}}      \n  creationTimestamp: \"2019-07-21T07:07:07Z\"\n  name: example-automated-thing\n  namespace: examplens\n  resourceVersion: \"777\"\n  selfLink: /api/v1/namespaces/examplens/serviceaccounts/example-automated-thing\n  uid: f23fd170-66f2-4697-b049-e1e266b7f835\nsecrets:\n  - name: example-automated-thing-token-zyxwv\n```\n\nManaging Service Accounts | Then, delete the Secret you now know the name of:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7246"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens delete secret/example-automated-thing-token-zyxwv\n```\n\nManaging Service Accounts | Short lived ServiceAccount tokens automatically expire after the time-limit specified during their creation. There is no central record of tokens issued, so there is no way to revoke individual tokens", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7247"}
{"instruction": "Write a bash example for managing service accounts", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace examplens\n```\n\nManaging Service Accounts |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/", "id": "k8s_00564_code_7248"}
{"instruction": "How do you imperative management of kubernetes objects using configuration files in Kubernetes?", "response": "Imperative Management of Kubernetes Objects Using Configuration FilesKubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and manage objects using configuration files.Before you beginInstall kubectl.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Trade-offsThe kubectl tool supports three kinds of object management:Imperative commandsImperative object configurationDeclarative object configurationSee Kubernetes Object Management for a discussion of the advantages and disadvantage of each kind of object management.How to create objectsYou can use kubectl create -f to create an object from a configuration file. Refer to the kubernetes API reference for details.kubectl create -f <filename|url>How to update objectsWarning:Updating objects with the replace command drops all parts of the spec not specified in the configuration file. This should not be used with objects whose specs are partially managed by the cluster, such as Services of type LoadBalancer, where the externalIPs field is managed independently from the configuration file. Independently managed fields must be copied to the configuration file to prevent replace from dropping them.You can use kubectl replace -f to update a live object according to a configuration file.kubectl replace -f <filename|url>How to delete objectsYou can use kubectl delete -f to delete an object that is described in a configuration file.kubectl delete -f <filename|url>Note:If configuration file has specified the generateName field in the metadata section instead of the name field, you cannot delete the object using kubectl delete -f <filename|url>. You will have to use other flags for deleting the object. For example:kubectl delete <type> <name> kubectl delete <type> -l <label> How to view an objectYou can use kubectl get -f to view information about an object that is described in a configuration file.kubectl get -f <filename|url> -o yamlThe -o yaml flag specifies that the full object configuration is printed. Use kubectl get -h to see a list of options.LimitationsThe create, replace, and delete commands work well when each object's configuration is fully defined and recorded in its configuration file. However when a live object is updated, and the updates are not merged into its configuration file, the updates will be lost the next time a replace is executed. This can happen if a controller, such as a HorizontalPodAutoscaler, makes updates directly to a live object. Here's an example:You create an object from a configuration file.Another source updates the object by changing some field.You replace the object from the configuration file. Changes made by the other source in step 2 are lost.If you need to support multiple writers to the same object, you can use kubectl apply to manage the object.Creating and editing an object from a URL without saving the configurationSuppose you have the URL of an object configuration file. You can use kubectl create --edit to make changes to the configuration before the object is created. This is particularly useful for tutorials and tasks that point to a configuration file that could be modified by the reader.kubectl create -f <url> --edit Migrating from imperative commands to imperative object configurationMigrating from imperative commands to imperative object configuration involves several manual steps.Export the live object to a local object configuration file:kubectl get <kind>/<name> -o yaml > <kind>_<name", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete <type> <name>\nkubectl delete <type> -l <label>\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7250"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <url> --edit\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7251"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the object configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7252"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <kind>_<name>.yaml\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | The recommended approach is to define a single, immutable PodTemplate label used only by the controller selector with no other semantic meaning.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7253"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <filename|url>\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl replace -f to update a live object according to a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7254"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <filename|url>\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl delete -f to delete an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7255"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename|url>\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | If configuration file has specified the generateName field in the metadata section instead of the name field, you cannot delete the object using kubectl delete -f <filename|url>. You will have to use", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7256"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename|url>\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7257"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | The -o yaml flag specifies that the full object configuration is printed. Use kubectl get -h to see a list of options.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7258"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7259"}
{"instruction": "Write a yaml example for imperative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n      controller-selector: \"apps/v1/deployment/nginx\"\ntemplate:\n  metadata:\n    labels:\n      controller-selector: \"apps/v1/deployment/nginx\"\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7260"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete <type> <name>\nkubectl delete <type> -l <label>\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7261"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <url> --edit\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7262"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the object configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7263"}
{"instruction": "Write a bash example for imperative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <kind>_<name>.yaml\n```\n\nImperative Management of Kubernetes Objects Using Configuration Files | The recommended approach is to define a single, immutable PodTemplate label used only by the controller selector with no other semantic meaning.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-config/", "id": "k8s_00565_code_7264"}
{"instruction": "What is the reference documentation for kubectl cordon?", "response": "kubectl cordonSynopsisMark node as unschedulable.kubectl cordon NODE Examples # Mark node \"foo\" as unschedulable kubectl cordon foo Options--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.-h, --helphelp for cordon-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cordon/", "id": "k8s_00566"}
{"instruction": "What is the reference documentation for persistentvolume?", "response": "PersistentVolumePersistentVolume (PV) is a storage resource provisioned by an administrator.apiVersion: v1import \"k8s.io/api/core/v1\"PersistentVolumePersistentVolume (PV) is a storage resource provisioned by an administrator. It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumesapiVersion: v1kind: PersistentVolumemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (PersistentVolumeSpec)spec defines a specification of a persistent volume owned by the cluster. Provisioned by an administrator. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumesstatus (PersistentVolumeStatus)status represents the current information/status for the persistent volume. Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumesPersistentVolumeSpecPersistentVolumeSpec is the specification of a persistent volume.accessModes ([]string)Atomic: will be replaced during a mergeaccessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modescapacity (map[string]Quantity)capacity is the description of the persistent volume's resources and capacity. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacityclaimRef (ObjectReference)claimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#bindingmountOptions ([]string)Atomic: will be replaced during a mergemountOptions is the list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-optionsnodeAffinity (VolumeNodeAffinity)nodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume.VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from.nodeAffinity.required (NodeSelector)required specifies hard node constraints that must be met.A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.nodeAffinity.required.nodeSelectorTerms ([]NodeSelectorTerm), requiredAtomic: will be replaced during a mergeRequired. A list of node selector terms. The terms are ORed.A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.nodeAffinity.required.nodeSelectorTerms.matchExpressions ([]NodeSelectorRequirement)Atomic: will be replaced during a mergeA list of node selector requirements by node's labels.nodeAffinity.required.nodeSelectorTerms.matchFields ([]NodeSelectorRequirement)Atomic: will be replaced during a mergeA list of node selector requirements by node's fields.persistentVolumeReclaimPolicy (string)persistentVolumeReclaimPolicy defines what happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaimingstorageClassName (string)storageClassName is the name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.volumeAttributesClassName (string)Name of VolumeAttributesClass to whi", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-v1/", "id": "k8s_00567"}
{"instruction": "What is the reference documentation for kubectl create secret generic?", "response": "kubectl create secret genericSynopsisCreate a secret based on a file, directory, or specified literal value.A single secret may package one or more key/value pairs.When creating a secret based on a file, the key will default to the basename of the file, and the value will default to the file content. If the basename is an invalid key or you wish to chose your own, you may specify an alternate key.When creating a secret based on a directory, each file whose basename is a valid key in the directory will be packaged into the secret. Any directory entries except regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).kubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none] Examples # Create a new secret named my-secret with keys for each file in folder bar kubectl create secret generic my-secret --from-file=path/to/bar # Create a new secret named my-secret with specified keys instead of names on disk kubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub # Create a new secret named my-secret with key1=supersecret and key2=topsecret kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret # Create a new secret named my-secret using a combination of a file and a literal kubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret # Create a new secret named my-secret from env files kubectl create secret generic my-secret --from-env-file=path/to/foo.env --from-env-file=path/to/bar.env Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--append-hashAppend a hash of the secret to its name.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--from-env-file stringsSpecify the path to a file to read lines of key=val pairs to create a secret.--from-file stringsKey files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iterate each named file in the directory that is a valid secret key.--from-literal stringsSpecify a key and literal value to insert in secret (i.e. mykey=somevalue)-h, --helphelp for generic-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--type stringThe type of secret to create--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_generic/", "id": "k8s_00568"}
{"instruction": "Write a bash example for kubectl create secret generic", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\nkubectl create secret generic | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_generic/", "id": "k8s_00568_code_7268"}
{"instruction": "Write a bash example for kubectl create secret generic", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\nkubectl create secret generic | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_generic/", "id": "k8s_00568_code_7269"}
{"instruction": "Explain the Kubernetes concept: Container Lifecycle Hooks", "response": "Container Lifecycle HooksThis page describes how kubelet managed Containers can use the Container lifecycle hook framework to run code triggered by events during their management lifecycle.OverviewAnalogous to many programming language frameworks that have component lifecycle hooks, such as Angular, Kubernetes provides Containers with lifecycle hooks. The hooks enable Containers to be aware of events in their management lifecycle and run code implemented in a handler when the corresponding lifecycle hook is executed.Container hooksThere are two hooks that are exposed to Containers:PostStartThis hook is executed immediately after a container is created. However, there is no guarantee that the hook will execute before the container ENTRYPOINT. No parameters are passed to the handler.PreStopThis hook is called immediately before a container is terminated due to an API request or management event such as a liveness/startup probe failure, preemption, resource contention and others. A call to the PreStop hook fails if the container is already in a terminated or completed state and the hook must complete before the TERM signal to stop the container can be sent. The Pod's termination grace period countdown begins before the PreStop hook is executed, so regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period. No parameters are passed to the handler.A more detailed description of the termination behavior can be found in Termination of Pods.StopSignalThe StopSignal lifecycle can be used to define a stop signal which would be sent to the container when it is stopped. If you set this, it overrides any STOPSIGNAL instruction defined within the container image.A more detailed description of termination behaviour with custom stop signals can be found in Stop Signals.Hook handler implementationsContainers can access a hook by implementing and registering a handler for that hook. There are three types of hook handlers that can be implemented for Containers:Exec - Executes a specific command, such as pre-stop.sh, inside the cgroups and namespaces of the Container. Resources consumed by the command are counted against the Container.HTTP - Executes an HTTP request against a specific endpoint on the Container.Sleep - Pauses the container for a specified duration.Hook handler executionWhen a Container lifecycle management hook is called, the Kubernetes management system executes the handler according to the hook action, httpGet, tcpSocket (deprecated) and sleep are executed by the kubelet process, and exec is executed in the container.The PostStart hook handler call is initiated when a container is created, meaning the container ENTRYPOINT and the PostStart hook are triggered simultaneously. However, if the PostStart hook takes too long to execute or if it hangs, it can prevent the container from transitioning to a running state.PreStop hooks are not executed asynchronously from the signal to stop the Container; the hook must complete its execution before the TERM signal can be sent. If a PreStop hook hangs during execution, the Pod's phase will be Terminating and remain there until the Pod is killed after its terminationGracePeriodSeconds expires. This grace period applies to the total time it takes for both the PreStop hook to execute and for the Container to stop normally. If, for example, terminationGracePeriodSeconds is 60, and the hook takes 55 seconds to complete, and the Container takes 10 seconds to stop normally after receiving the signal, then the Container will be killed before it can stop normally, since terminationGracePeriodSeconds is less than the total time (55+10) it takes for these two things to happen.If either a PostStart or PreStop hook fails, it kills the Container.Users should make their hook handlers as lightweight as possible. There are cases, however, when long running commands make sense, such as when saving state prior to stopping a Container.Hook delive", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/", "id": "k8s_00569"}
{"instruction": "Write a bash example for container lifecycle hooks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod lifecycle-demo\n```\n\nContainer Lifecycle Hooks |", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/", "id": "k8s_00569_code_7271"}
{"instruction": "What is the reference documentation for kubectl exec?", "response": "kubectl execSynopsisExecute a command in a container.kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...] Examples # Get output from running the 'date' command from pod mypod, using the first container by default kubectl exec mypod -- date # Get output from running the 'date' command in ruby-container from pod mypod kubectl exec mypod -c ruby-container -- date # Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client kubectl exec mypod -c ruby-container -i -t -- bash -il # List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (--) to separate your command's flags/arguments # Also note, do not surround your command and its flags/arguments with quotes # unless that is how you would execute it normally (i.e., do ls -t /usr, not \"ls -t /usr\") kubectl exec mypod -i -t -- ls -t /usr # Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default kubectl exec deploy/mydeployment -- date # Get output from running 'date' command from the first pod of the service myservice, using the first container by default kubectl exec svc/myservice -- date Options-c, --container stringContainer name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen-f, --filename stringsto use to exec into the resource-h, --helphelp for exec--pod-running-timeout duration Default: 1m0sThe length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running-q, --quietOnly print output from the remote session-i, --stdinPass stdin to the container-t, --ttyStdin is a TTYParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_exec/", "id": "k8s_00570"}
{"instruction": "Write a bash example for kubectl exec", "response": "Here's a bash example:\n\n```bash\nkubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]\n```\n\nkubectl exec | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_exec/", "id": "k8s_00570_code_7273"}
{"instruction": "Write a bash example for kubectl exec", "response": "Here's a bash example:\n\n```bash\nkubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]\n```\n\nkubectl exec | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_exec/", "id": "k8s_00570_code_7274"}
{"instruction": "Explain blog guidelines in Kubernetes", "response": "Blog guidelinesThese guidelines cover the main Kubernetes blog and the Kubernetes contributor blog.All blog content must also adhere to the overall policy in the content guide.Before you beginMake sure you are familiar with the introduction sections of contributing to Kubernetes blogs, not just to learn about the two official blogs and the differences between them, but also to get an overview of the process.Original contentThe Kubernetes project accepts original content only, in English.Note:The Kubernetes project cannot accept content for the blog if it has already been submitted or published outside of the Kubernetes project.The official blogs are not available as a medium to repurpose existing content from any third party as new content.This restriction even carries across to promoting other Linux Foundation and CNCF projects. Many CNCF projects have their own blog. These are often a better choice for posts about a specific project, even if that other project is designed specifically to work with Kubernetes (or with Linux, etc).Relevant contentArticles must contain content that applies broadly to the Kubernetes community. For example, a submission should focus on upstream Kubernetes as opposed to vendor-specific configurations. For articles submitted to the main blog that are not mirror articles, hyperlinks in the article should commonly be to the official Kubernetes documentation. When making external references, links should be diverse - for example, a submission shouldn't contain only links back to a single company's blog.The official Kubernetes blogs are not the place for vendor pitches or for articles that promote a specific solution from outside Kubernetes.Sometimes this is a delicate balance. You can ask in Slack (#sig-docs-blog) for guidance on whether a post is appropriate for the Kubernetes blog and / or contributor blog - don't hesitate to reach out.The content guide applies unconditionally to blog articles and the PRs that add them. Bear in mind that some restrictions in the guide state that they are only relevant to documentation; those marked restrictions don't apply to blog articles.LocalizationThe website is localized into many languages; English is the “upstream” for all the other localizations. Even if you speak another language and would be happy to provide a localization, that should be in a separate pull request (see languages per PR).Copyright and reuseYou must write original content and you must have permission to license that content to the Cloud Native Computing Foundation (so that the Kubernetes project can legally publish it). This means that not only is direct plagiarism forbidden, you cannot write a blog article if you don't have permission to meet the CNCF copyright license conditions (for example, if your employer has a policy about intellectual property that restricts what you are allowed to do).The license for the blog allows commercial use of the content for commercial purposes, but not the other way around.Special interest groups and working groupsTopics related to participation in or results of Kubernetes SIG activities are always on topic (see the work in the Contributor Comms Team for support on these posts).The project typically mirrors these articles to both blogs.National restrictions on contentThe Kubernetes website has an Internet Content Provider (ICP) licence from the government of China. Although it's unlikely to be a problem, Kubernetes cannot publish articles that would be blocked by the Chinese government's official filtering of internet content.Blog-specific content guidanceAs well as the general style guide, blog articles should (not must) align to the blog-specific style recommendations.The remainder of this page is additional guidance; these are not strict rules that articles must follow, but reviewers are likely to (and should) ask for edits to articles that are obviously not aligned with the recommendations here.Diagrams and illustrationsFor illustrations - including di", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/blog/guidelines/", "id": "k8s_00571"}
{"instruction": "Explain docs smoke test page in Kubernetes", "response": "Shutdown of interactive tutorialsThe interactive tutorials previously on this website have been shut down.Kubernetes is grateful to O'Reilly and Katacoda for many years of helping people take their first steps in learning Kubernetes.The shutdown followed O'Reilly Media's 2019 acquisition of Katacoda.The tutorials ceased to function after the 31st of March, 2023. You are seeing this notice because this particular page has not yet been updated following that shutdown.Docs smoke test pageThis page serves two purposes:Demonstrate how the Kubernetes documentation uses MarkdownProvide a \"smoke test\" document we can use to test HTML, CSS, and template changes that affect the overall documentation.Heading levelsThe above heading is an H2. The page title renders as an H1. The following sections show H3 - H6.### H3 This is in an H3 section. #### H4 This is in an H4 section. ##### H5 This is in an H5 section. ###### H6 This is in an H6 section. Produces:H3This is in an H3 section.H4This is in an H4 section.H5This is in an H5 section.H6This is in an H6 section.Inline elementsInline elements show up within the text of paragraph, list item, admonition, or other block-level element.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Inline text stylesYou can use different text styles in markdown like:- **bold** - _italic_ - ***bold italic*** - ~~strikethrough~~ - <u>underline</u> - _<u>underline italic</u>_ - **<u>underline bold</u>** - ***<u>underline bold italic</u>*** - `monospace text` - **`monospace bold`** Produces:bolditalicbold italicstrikethroughunderlineunderline italicunderline boldunderline bold italicmonospace textmonospace boldListsMarkdown doesn't have strict rules about how to process lists. When we moved from Jekyll to Hugo, we broke some lists. To fix them, keep the following in mind:Make sure you indent sub-list items 2 spaces.To end a list and start another, you need an HTML comment block on a new line between the lists, flush with the left-hand border. The first list won't end otherwise, no matter how many blank lines you put between it and the second.Bullet listsYou can add a bullet list in markdown like:- This is a list item. * This is another list item in the same list. - You can mix `-` and `*`. - To make a sub-item, indent two spaces. - This is a sub-sub-item. Indent two more spaces. - Another sub-item. Produces:This is a list item.This is another list item in the same list.You can mix - and *.To make a sub-item, indent two spaces.This is a sub-sub-item. Indent two more spaces.Another sub-item.Also,This is a new list. With Hugo, you need to use a HTML comment to separate two consecutive lists. The HTML comment needs to be at the left margin.Bullet lists can have paragraphs or block elements within them.Indent the content to be the same as the first line of the bullet point. This paragraph and the code block line up with the first B in Bullet above.ls -l And a sub-list after some block-level contentA bullet list item can contain a numbered list.Numbered sub-list item 1Numbered sub-list item 2Numbered listsThis is a list item.This is another list item in the same list. The number you use in Markdown does not necessarily correlate to the number in the final output. By convention, we keep them in sync.Note:For single-digit numbered lists, using two spaces after the period makes interior block-level content line up better along tab-stops.This is a new list. With Hugo, you need to use an HTML comment to separate two consecutive lists. The HTML comment needs to be at the left margin.Numbered lists can have paragraphs or block elements w", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/test/", "id": "k8s_00572"}
{"instruction": "Write a bash example for docs smoke test page", "response": "Here's a bash example:\n\n```bash\necho 'Tab lists may contain code blocks!'\n```\n\nDocs smoke test page | Header within a tab listNested header tags may also be included.Warning:Headers within tab lists will not appear in the Table of Contents.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/test/", "id": "k8s_00572_code_7277"}
{"instruction": "Explain the Kubernetes concept: Security For Linux Nodes", "response": "Security For Linux NodesThis page describes security considerations and best practices specific to the Linux operating system.Protection for Secret data on nodesOn Linux nodes, memory-backed volumes (such as secret volume mounts, or emptyDir with medium: Memory) are implemented with a tmpfs filesystem.If you have swap configured and use an older Linux kernel (or a current kernel and an unsupported configuration of Kubernetes), memory backed volumes can have data written to persistent storage.The Linux kernel officially supports the noswap option from version 6.3, therefore it is recommended the used kernel version is 6.3 or later, or supports the noswap option via a backport, if swap is enabled on the node.Read swap memory management for more info.", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/linux-security/", "id": "k8s_00573"}
{"instruction": "How do you adding windows worker nodes in Kubernetes?", "response": "Adding Windows worker nodesFEATURE STATE: Kubernetes v1.18 [beta]This page explains how to add Windows worker nodes to a kubeadm cluster.Before you beginA running Windows Server 2022 (or higher) instance with administrative access.A running kubeadm cluster created by kubeadm init and following the steps in the document Creating a cluster with kubeadm.Adding Windows worker nodesNote:To facilitate the addition of Windows worker nodes to a cluster, PowerShell scripts from the repository https://sigs.k8s.io/sig-windows-tools are used.Do the following for each machine:Open a PowerShell session on the machine.Make sure you are Administrator or a privileged user.Then proceed with the steps outlined below.Install containerdNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.To install containerd, first run the following command:curl.exe -LO https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/hostprocess/Install-Containerd.ps1 Then run the following command, but first replace CONTAINERD_VERSION with a recent release from the containerd repository. The version must not have a v prefix. For example, use 1.7.22 instead of v1.7.22:.\\Install-Containerd.ps1 -ContainerDVersion CONTAINERD_VERSION Adjust any other parameters for Install-Containerd.ps1 such as netAdapterName as you need them.Set skipHypervisorSupportCheck if your machine does not support Hyper-V and cannot host Hyper-V isolated containers.If you change the Install-Containerd.ps1 optional parameters CNIBinPath and/or CNIConfigPath you will need to configure the installed Windows CNI plugin with matching values.Install kubeadm and kubeletRun the following commands to install kubeadm and the kubelet:curl.exe -LO https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/hostprocess/PrepareNode.ps1 .\\PrepareNode.ps1 -KubernetesVersion v1.34 Adjust the parameter KubernetesVersion of PrepareNode.ps1 if needed.Run kubeadm joinRun the command that was output by kubeadm init. For example:kubeadm join --token <token> <control-plane-host>:<control-plane-port> --discovery-token-ca-cert-hash sha256:<hash> Additional information about kubeadm joinNote:To specify an IPv6 tuple for <control-plane-host>:<control-plane-port>, IPv6 address must be enclosed in square brackets, for example: [2001:db8::101]:2073.If you do not have the token, you can get it by running the following command on the control plane node:# Run this on a control plane node sudo kubeadm token list The output is similar to this:TOKEN TTL EXPIRES USAGES DESCRIPTION EXTRA GROUPS 8ewj1p.9r9hcjoqgajrj4gi 23h 2018-06-12T02:51:28Z authentication, The default bootstrap system: signing token generated by bootstrappers: 'kubeadm init'. kubeadm: default-node-token By default, node join tokens expire after 24 hours. If you are joining a node to the cluster after the current token has expired, you can create a new token by running the following command on the control plane node:# Run this on a control plane node sudo kubeadm token create The output is similar to this:5didvk.d09sbcov8ph2amjw If you don't have the value of --discovery-token-ca-cert-hash, you can get it by running the following commands on the control plane node:sudo cat /etc/kubernetes/pki/ca.crt | openssl x509 -pubkey | openssl rsa -pubin -outform der 2>/dev/null | \\ openssl dgst -sha256 -hex | sed 's/^.* //' The output is similar to:8cb2de97839780a412b93877f8507ad6c94f73add17d5d7058e91741c9d5ec78 The output of the kubeadm join command should look something like:[preflight] Running pre-flight checks ... (log output of join workflow) ... Node join complete: * Certificate signing request sent to control-plane and response received. * Kubelet informed of new secure connection details. Run 'ku", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/", "id": "k8s_00574"}
{"instruction": "Write a bash example for adding windows worker nodes", "response": "Here's a bash example:\n\n```bash\nkubeadm join --token <token> <control-plane-host>:<control-plane-port> --discovery-token-ca-cert-hash sha256:<hash>\n```\n\nAdding Windows worker nodes | If you do not have the token, you can get it by running the following command on the control plane node:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/", "id": "k8s_00574_code_7280"}
{"instruction": "Write a bash example for adding windows worker nodes", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token list\n```\n\nAdding Windows worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/", "id": "k8s_00574_code_7281"}
{"instruction": "Write a bash example for adding windows worker nodes", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token create\n```\n\nAdding Windows worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/", "id": "k8s_00574_code_7282"}
{"instruction": "Write a bash example for adding windows worker nodes", "response": "Here's a bash example:\n\n```bash\nsudo cat /etc/kubernetes/pki/ca.crt | openssl x509 -pubkey  | openssl rsa -pubin -outform der 2>/dev/null | \\\n   openssl dgst -sha256 -hex | sed 's/^.* //'\n```\n\nAdding Windows worker nodes | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes/", "id": "k8s_00574_code_7283"}
{"instruction": "What is the reference documentation for feature gates?", "response": "Feature GatesThis page contains an overview of the various feature gates an administrator can specify on different Kubernetes components.See feature stages for an explanation of the stages for a feature.OverviewFeature gates are a set of key=value pairs that describe Kubernetes features. You can turn these features on or off using the --feature-gates command line flag on each Kubernetes component.Each Kubernetes component lets you enable or disable a set of feature gates that are relevant to that component. Use -h flag to see a full set of feature gates for all components. To set feature gates for a component, such as kubelet, use the --feature-gates flag assigned to a list of feature pairs:--feature-gates=...,GracefulNodeShutdown=true The following tables are a summary of the feature gates that you can set on different Kubernetes components.The \"Since\" column contains the Kubernetes release when a feature is introduced or its release stage is changed.The \"Until\" column, if not empty, contains the last Kubernetes release in which you can still use a feature gate.If a feature is in the Alpha or Beta state, you can find the feature listed in the Alpha/Beta feature gate table.If a feature is stable you can find all stages for that feature listed in the Graduated/Deprecated feature gate table.The Graduated/Deprecated feature gate table also lists deprecated and withdrawn features.Note:For a reference to old feature gates that are removed, please refer to feature gates removed.Feature gates for Alpha or Beta featuresFeature gates for features in Alpha or Beta statesFeatureDefaultStageSinceUntilAllowParsingUserUIDFromCertAuthfalseAlpha1.33–AllowUnsafeMalformedObjectDeletionfalseAlpha1.32–APIResponseCompressionfalseAlpha1.71.15APIResponseCompressiontrueBeta1.16–APIServerIdentityfalseAlpha1.201.25APIServerIdentitytrueBeta1.26–APIServingWithRoutinefalseAlpha1.30–CBORServingAndStoragefalseAlpha1.32–ClearingNominatedNodeNameAfterBindingfalseAlpha1.341.34CloudControllerManagerWebhookfalseAlpha1.27–ClusterTrustBundlefalseAlpha1.271.32ClusterTrustBundlefalseBeta1.33–ClusterTrustBundleProjectionfalseAlpha1.291.32ClusterTrustBundleProjectionfalseBeta1.33–ComponentFlagzfalseAlpha1.32–ComponentSLIsfalseAlpha1.261.26ComponentSLIstrueBeta1.27–ComponentStatuszfalseAlpha1.32–ConcurrentWatchObjectDecodefalseBeta1.31–ConsistentListFromCachefalseAlpha1.281.30ConsistentListFromCachetrueBeta1.31–ContainerCheckpointfalseAlpha1.251.29ContainerCheckpointtrueBeta1.30–ContainerRestartRulesfalseAlpha1.34–ContainerStopSignalsfalseAlpha1.33–ContextualLoggingfalseAlpha1.24–ContextualLoggingtrueBeta1.30–CoordinatedLeaderElectionfalseAlpha1.311.32CoordinatedLeaderElectionfalseBeta1.33–CPUManagerPolicyAlphaOptionsfalseAlpha1.23–CPUManagerPolicyBetaOptionstrueBeta1.23–CrossNamespaceVolumeDataSourcefalseAlpha1.26–CSIVolumeHealthfalseAlpha1.21–CustomCPUCFSQuotaPeriodfalseAlpha1.12–DeclarativeValidationtrueBeta1.33–DeclarativeValidationTakeoverfalseBeta1.33–DeploymentReplicaSetTerminatingReplicasfalseAlpha1.33–DisableAllocatorDualWritefalseAlpha1.311.32DisableAllocatorDualWritefalseBeta1.33–DRAAdminAccessfalseAlpha1.321.33DRAAdminAccesstrueBeta1.34–DRAConsumableCapacityfalseAlpha1.34–DRADeviceBindingConditionsfalseAlpha1.34–DRADeviceTaintsfalseAlpha1.33–DRAExtendedResourcefalseAlpha1.34–DRAPartitionableDevicesfalseAlpha1.33–DRAPrioritizedListfalseAlpha1.33–DRAPrioritizedListtrueBeta1.34–DRAResourceClaimDeviceStatusfalseAlpha1.321.32DRAResourceClaimDeviceStatustrueBeta1.33–EnvFilesfalseAlpha1.34–EventedPLEGfalseAlpha1.26–ExternalServiceAccountTokenSignerfalseAlpha1.321.33ExternalServiceAccountTokenSignertrueBeta1.34–GracefulNodeShutdownfalseAlpha1.201.20GracefulNodeShutdowntrueBeta1.21–GracefulNodeShutdownBasedOnPodPriorityfalseAlpha1.231.23GracefulNodeShutdownBasedOnPodPrioritytrueBeta1.24–HostnameOverridefalseAlpha1.34–HPAConfigurableTolerancefalseAlpha1.33–HPAScaleToZerofalseAlpha1.16–ImageMaximumGCAgefalseAlpha1.291.29ImageMaximumGCAgetrueBeta1.30–ImageVolumefalseAl", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/", "id": "k8s_00575"}
{"instruction": "Provide a tutorial on hello minikube", "response": "Hello MinikubeThis tutorial shows you how to run a sample app on Kubernetes using minikube. The tutorial provides a container image that uses NGINX to echo back all the requests.ObjectivesDeploy a sample application to minikube.Run the app.View application logs.Before you beginThis tutorial assumes that you have already set up minikube. See Step 1 in minikube start for installation instructions.Note:Only execute the instructions in Step 1, Installation. The rest is covered on this page.You also need to install kubectl. See Install tools for installation instructions.Create a minikube clusterminikube start Open the DashboardOpen the Kubernetes dashboard. You can do this two different ways:Open a new terminal, and run:# Start a new terminal, and leave this running. minikube dashboard Now, switch back to the terminal where you ran minikube start.Note:The dashboard command enables the dashboard add-on and opens the proxy in the default web browser. You can create Kubernetes resources on the dashboard such as Deployment and Service.To find out how to avoid directly invoking the browser from the terminal and get a URL for the web dashboard, see the \"URL copy and paste\" tab.By default, the dashboard is only accessible from within the internal Kubernetes virtual network. The dashboard command creates a temporary proxy to make the dashboard accessible from outside the Kubernetes virtual network.To stop the proxy, run Ctrl+C to exit the process. After the command exits, the dashboard remains running in the Kubernetes cluster. You can run the dashboard command again to create another proxy to access the dashboard.If you don't want minikube to open a web browser for you, run the dashboard subcommand with the --url flag. minikube outputs a URL that you can open in the browser you prefer.Open a new terminal, and run:# Start a new terminal, and leave this running. minikube dashboard --url Now, you can use this URL and switch back to the terminal where you ran minikube start.Create a DeploymentA Kubernetes Pod is a group of one or more Containers, tied together for the purposes of administration and networking. The Pod in this tutorial has only one Container. A Kubernetes Deployment checks on the health of your Pod and restarts the Pod's Container if it terminates. Deployments are the recommended way to manage the creation and scaling of Pods.Use the kubectl create command to create a Deployment that manages a Pod. The Pod runs a Container based on the provided Docker image.# Run a test container image that includes a webserver kubectl create deployment hello-node --image=registry.k8s.io/e2e-test-images/agnhost:2.53 -- /agnhost netexec --http-port=8080 View the Deployment:kubectl get deployments The output is similar to:NAME READY UP-TO-DATE AVAILABLE AGE hello-node 1/1 1 1 1m (It may take some time for the pod to become available. If you see \"0/1\", try again in a few seconds.)View the Pod:kubectl get pods The output is similar to:NAME READY STATUS RESTARTS AGE hello-node-5f76cf6ccf-br9b5 1/1 Running 0 1m View cluster events:kubectl get events View the kubectl configuration:kubectl config view View application logs for a container in a pod (replace pod name with the one you got from kubectl get pods).Note:Replace hello-node-5f76cf6ccf-br9b5 in the kubectl logs command with the name of the pod from the kubectl get pods command output.kubectl logs hello-node-5f76cf6ccf-br9b5 The output is similar to:I0911 09:19:26.677397 1 log.go:195] Started HTTP server on port 8080 I0911 09:19:26.677586 1 log.go:195] Started UDP server on port 8081 Note:For more information about kubectl commands, see the kubectl overview.Create a ServiceBy default, the Pod is only accessible by its internal IP address within the Kubernetes cluster. To make the hello-node Container accessible from outside the Kubernetes virtual network, you have to expose the Pod as a Kubernetes Service.Warning:The agnhost container has a /shell endpoint, which is useful for debugging, but da", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nHello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7286"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl logs hello-node-5f76cf6ccf-br9b5\n```\n\nHello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7287"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-node --type=LoadBalancer --port=8080\n```\n\nHello Minikube | The --type=LoadBalancer flag indicates that you want to expose your Service outside of the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7288"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl get pod,svc -n kube-system\n```\n\nHello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7289"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl delete service hello-node\nkubectl delete deployment hello-node\n```\n\nHello Minikube | Stop the Minikube cluster", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7290"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nHello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7291"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl logs hello-node-5f76cf6ccf-br9b5\n```\n\nHello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7292"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-node --type=LoadBalancer --port=8080\n```\n\nHello Minikube | The --type=LoadBalancer flag indicates that you want to expose your Service outside of the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7293"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl get pod,svc -n kube-system\n```\n\nHello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7294"}
{"instruction": "Write a bash example for hello minikube", "response": "Here's a bash example:\n\n```bash\nkubectl delete service hello-node\nkubectl delete deployment hello-node\n```\n\nHello Minikube | Stop the Minikube cluster", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/hello-minikube/", "id": "k8s_00576_code_7295"}
{"instruction": "What is the reference documentation for mutatingadmissionpolicy v1beta1?", "response": "MutatingAdmissionPolicy v1beta1MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain.apiVersion: admissionregistration.k8s.io/v1beta1import \"k8s.io/api/admissionregistration/v1beta1\"MutatingAdmissionPolicyMutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain.apiVersion: admissionregistration.k8s.io/v1beta1kind: MutatingAdmissionPolicymetadata (ObjectMeta)Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.spec (MutatingAdmissionPolicySpec)Specification of the desired behavior of the MutatingAdmissionPolicy.MutatingAdmissionPolicySpec is the specification of the desired behavior of the admission policy.spec.failurePolicy (string)failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.A policy is invalid if paramKind refers to a non-existent Kind. A binding is invalid if paramRef.name refers to a non-existent resource.failurePolicy does not define how validations that evaluate to false are handled.Allowed values are Ignore or Fail. Defaults to Fail.spec.matchConditions ([]MatchCondition)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergematchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the matchConstraints. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.If a parameter object is provided, it can be accessed via the params handle in the same manner as validation expressions.The exact matching logic is (in order):If ANY matchCondition evaluates to FALSE, the policy is skipped.If ALL matchConditions evaluate to TRUE, the policy is evaluated.If any matchCondition evaluates to an error (but none are FALSE):If failurePolicy=Fail, reject the requestIf failurePolicy=Ignore, the policy is skippedMatchCondition represents a condition which must be fulfilled for a request to be sent to a webhook.spec.matchConditions.expression (string), requiredExpression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the request resource. Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/Required.spec.matchConditions.name (string), requiredName is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')Required.spec.matchConstraints (MatchResources)matchConstraints specifies what resources this policy is designed to validate. The MutatingAdmissionPolicy cares about a request i", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/mutating-admission-policy-v1beta1/", "id": "k8s_00577"}
{"instruction": "Write a yaml example for mutatingadmissionpolicy v1beta1", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\n```\n\nMutatingAdmissionPolicy v1beta1 | import \"k8s.io/api/admissionregistration/v1beta1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/mutating-admission-policy-v1beta1/", "id": "k8s_00577_code_7297"}
{"instruction": "What is the reference documentation for kubectl create deployment?", "response": "kubectl create deploymentSynopsisCreate a deployment with the specified name.kubectl create deployment NAME --image=image -- [COMMAND] [args...] Examples # Create a deployment named my-dep that runs the busybox image kubectl create deployment my-dep --image=busybox # Create a deployment with a command kubectl create deployment my-dep --image=busybox -- date # Create a deployment named my-dep that runs the nginx image with 3 replicas kubectl create deployment my-dep --image=nginx --replicas=3 # Create a deployment named my-dep that runs the busybox image and expose port 5701 kubectl create deployment my-dep --image=busybox --port=5701 # Create a deployment named my-dep that runs multiple containers kubectl create deployment my-dep --image=busybox:latest --image=ubuntu:latest --image=nginx Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for deployment--image stringsImage names to run. A deployment can have multiple images set for multi-container pod.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--port int32 Default: -1The containerPort that this deployment exposes.-r, --replicas int32 Default: 1Number of replicas to create. Default is 1.--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This c", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_deployment/", "id": "k8s_00578"}
{"instruction": "Write a bash example for kubectl create deployment", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment NAME --image=image -- [COMMAND] [args...]\n```\n\nkubectl create deployment | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_deployment/", "id": "k8s_00578_code_7299"}
{"instruction": "Write a bash example for kubectl create deployment", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment NAME --image=image -- [COMMAND] [args...]\n```\n\nkubectl create deployment | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_deployment/", "id": "k8s_00578_code_7300"}
{"instruction": "What is the reference documentation for extend resources?", "response": "Extend ResourcesCustomResourceDefinitionCustomResourceDefinition represents a resource that should be exposed on the API server.DeviceClassDeviceClass is a vendor- or admin-provided resource that contains device configuration and selectors.MutatingWebhookConfigurationMutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.ValidatingWebhookConfigurationValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/", "id": "k8s_00579"}
{"instruction": "What is the reference documentation for prioritylevelconfiguration?", "response": "PriorityLevelConfigurationPriorityLevelConfiguration represents the configuration of a priority level.apiVersion: flowcontrol.apiserver.k8s.io/v1import \"k8s.io/api/flowcontrol/v1\"PriorityLevelConfigurationPriorityLevelConfiguration represents the configuration of a priority level.apiVersion: flowcontrol.apiserver.k8s.io/v1kind: PriorityLevelConfigurationmetadata (ObjectMeta)metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (PriorityLevelConfigurationSpec)spec is the specification of the desired behavior of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (PriorityLevelConfigurationStatus)status is the current status of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusPriorityLevelConfigurationSpecPriorityLevelConfigurationSpec specifies the configuration of a priority level.exempt (ExemptPriorityLevelConfiguration)exempt specifies how requests are handled for an exempt priority level. This field MUST be empty if type is \"Limited\". This field MAY be non-empty if type is \"Exempt\". If empty and type is \"Exempt\" then the default values for ExemptPriorityLevelConfiguration apply.ExemptPriorityLevelConfiguration describes the configurable aspects of the handling of exempt requests. In the mandatory exempt configuration object the values in the fields here can be modified by authorized users, unlike the rest of the spec.exempt.lendablePercent (int32)lendablePercent prescribes the fraction of the level's NominalCL that can be borrowed by other priority levels. This value of this field must be between 0 and 100, inclusive, and it defaults to 0. The number of seats that other levels can borrow from this level, known as this level's LendableConcurrencyLimit (LendableCL), is defined as follows.LendableCL(i) = round( NominalCL(i) * lendablePercent(i)/100.0 )exempt.nominalConcurrencyShares (int32)nominalConcurrencyShares (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats nominally reserved for this priority level. This DOES NOT limit the dispatching from this priority level but affects the other priority levels through the borrowing mechanism. The server's concurrency limit (ServerCL) is divided among all the priority levels in proportion to their NCS values:NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[priority level k] NCS(k)Bigger numbers mean a larger nominal concurrency limit, at the expense of every other priority level. This field has a default value of zero.limited (LimitedPriorityLevelConfiguration)limited specifies how requests are handled for a Limited priority level. This field must be non-empty if and only if type is \"Limited\".*LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:How are requests for this priority level limited?What should be done with requests that exceed the limit?*limited.borrowingLimitPercent (int32)borrowingLimitPercent, if present, configures a limit on how many seats this priority level can borrow from other priority levels. The limit is known as this level's BorrowingConcurrencyLimit (BorrowingCL) and is a limit on the total number of seats that this level may borrow at any one time. This field holds the ratio of that limit to the level's nominal concurrency limit. When this field is non-nil, it must hold a non-negative integer and the limit is calculated as follows.BorrowingCL(i) = round( NominalCL(i) * borrowingLimitPercent(i)/100.0 )The value of this field can be more than 100, implying that this priority level can borrow a number of seats that is greater than its own nominal concurrency limit (NominalCL). When this field is left nil, the limit is effectively infinit", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/priority-level-configuration-v1/", "id": "k8s_00580"}
{"instruction": "Write a yaml example for prioritylevelconfiguration", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\n```\n\nPriorityLevelConfiguration | import \"k8s.io/api/flowcontrol/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/priority-level-configuration-v1/", "id": "k8s_00580_code_7303"}
{"instruction": "Explain the Kubernetes concept: Pod Security Policies", "response": "Pod Security PoliciesRemoved featurePodSecurityPolicy was deprecated in Kubernetes v1.21, and removed from Kubernetes in v1.25.Instead of using PodSecurityPolicy, you can enforce similar restrictions on Pods using either or both:Pod Security Admissiona 3rd party admission plugin, that you deploy and configure yourselfFor a migration guide, see Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller. For more information on the removal of this API, see PodSecurityPolicy Deprecation: Past, Present, and Future.If you are not running Kubernetes v1.34, check the documentation for your version of Kubernetes.", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/security/pod-security-policy/", "id": "k8s_00581"}
{"instruction": "What is the reference documentation for kubernetes external metrics (v1beta1)?", "response": "Kubernetes External Metrics (v1beta1)Package v1beta1 is the v1beta1 version of the external metrics API.Resource TypesExternalMetricValueExternalMetricValueListExternalMetricValueAppears in:ExternalMetricValueListExternalMetricValue is a metric value for external metric A single metric value is identified by metric name and a set of string labels. For one metric there can be multiple values with different sets of labels.FieldDescriptionapiVersionstringexternal.metrics.k8s.io/v1beta1kindstringExternalMetricValuemetricName [Required]stringthe name of the metricmetricLabels [Required]map[string]stringa set of labels that identify a single time series for the metrictimestamp [Required]meta/v1.Timeindicates the time at which the metrics were producedwindow [Required]int64indicates the window ([Timestamp-Window, Timestamp]) from which these metrics were calculated, when returning rate metrics calculated from cumulative metrics (or zero for non-calculated instantaneous metrics).value [Required]k8s.io/apimachinery/pkg/api/resource.Quantitythe value of the metricExternalMetricValueListExternalMetricValueList is a list of values for a given metric for some set labelsFieldDescriptionapiVersionstringexternal.metrics.k8s.io/v1beta1kindstringExternalMetricValueListmetadata [Required]meta/v1.ListMetaNo description provided.items [Required][]ExternalMetricValuevalue of the metric matching a given set of labelsThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/external-api/external-metrics.v1beta1/", "id": "k8s_00582"}
{"instruction": "How do you issue a certificate for a kubernetes api client using a certificatesigningrequest in Kubernetes?", "response": "Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequestKubernetes lets you use a public key infrastructure (PKI) to authenticate to your cluster as a client.A few steps are required in order to get a normal user to be able to authenticate and invoke an API. First, this user must have an X.509 certificate issued by an authority that your Kubernetes cluster trusts. The client must then present that certificate to the Kubernetes API.You use a CertificateSigningRequest as part of this process, and either you or some other principal must approve the request.You will create a private key, and then get a certificate issued, and finally configure that private key for a client.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou need the kubectl, openssl and base64 utilities.This page assumes you are using Kubernetes role based access control (RBAC). If you have alternative or additional security mechanisms around authorization, you need to account for those as well.Create private keyIn this step, you create a private key. You need to keep this document secret; anyone who has it can impersonate the user.# Create a private key openssl genrsa -out myuser.key 3072 Create an X.509 certificate signing requestNote:This is not the same as the similarly-named CertificateSigningRequest API; the file you generate here goes into the CertificateSigningRequest.It is important to set CN and O attribute of the CSR. CN is the name of the user and O is the group that this user will belong to. You can refer to RBAC for standard groups.# Change the common name \"myuser\" to the actual username that you want to use openssl req -new -key myuser.key -out myuser.csr -subj \"/CN=myuser\" Create a Kubernetes CertificateSigningRequestEncode the CSR document using this command:cat myuser.csr | base64 | tr -d \"\\n\" Create a CertificateSigningRequest and submit it to a Kubernetes Cluster via kubectl. Below is a snippet of shell that you can use to generate the CertificateSigningRequest.cat <<EOF | kubectl apply -f - apiVersion: certificates.k8s.io/v1 kind: CertificateSigningRequest metadata: name: myuser # example spec: # This is an encoded CSR. Change this to the base64-encoded contents of myuser.csr request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZqQ0NBVDRDQVFBd0VURVBNQTBHQTFVRUF3d0dZVzVuWld4aE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRgpBQU9DQVE4QU1JSUJDZ0tDQVFFQTByczhJTHRHdTYxakx2dHhWTTJSVlRWMDNHWlJTWWw0dWluVWo4RElaWjBOCnR2MUZtRVFSd3VoaUZsOFEzcWl0Qm0wMUFSMkNJVXBGd2ZzSjZ4MXF3ckJzVkhZbGlBNVhwRVpZM3ExcGswSDQKM3Z3aGJlK1o2MVNrVHF5SVBYUUwrTWM5T1Nsbm0xb0R2N0NtSkZNMUlMRVI3QTVGZnZKOEdFRjJ6dHBoaUlFMwpub1dtdHNZb3JuT2wzc2lHQ2ZGZzR4Zmd4eW8ybmlneFNVekl1bXNnVm9PM2ttT0x1RVF6cXpkakJ3TFJXbWlECklmMXBMWnoyalVnald4UkhCM1gyWnVVV1d1T09PZnpXM01LaE8ybHEvZi9DdS8wYk83c0x0MCt3U2ZMSU91TFcKcW90blZtRmxMMytqTy82WDNDKzBERHk5aUtwbXJjVDBnWGZLemE1dHJRSURBUUFCb0FBd0RRWUpLb1pJaHZjTgpBUUVMQlFBRGdnRUJBR05WdmVIOGR4ZzNvK21VeVRkbmFjVmQ1N24zSkExdnZEU1JWREkyQTZ1eXN3ZFp1L1BVCkkwZXpZWFV0RVNnSk1IRmQycVVNMjNuNVJsSXJ3R0xuUXFISUh5VStWWHhsdnZsRnpNOVpEWllSTmU3QlJvYXgKQVlEdUI5STZXT3FYbkFvczFqRmxNUG5NbFpqdU5kSGxpT1BjTU1oNndLaTZzZFhpVStHYTJ2RUVLY01jSVUyRgpvU2djUWdMYTk0aEpacGk3ZnNMdm1OQUxoT045UHdNMGM1dVJVejV4T0dGMUtCbWRSeEgvbUNOS2JKYjFRQm1HCkkwYitEUEdaTktXTU0xMzhIQXdoV0tkNjVoVHdYOWl4V3ZHMkh4TG1WQzg0L1BHT0tWQW9FNkpsYWFHdTlQVmkKdjlOSjVaZlZrcXdCd0hKbzZXdk9xVlA3SVFjZmg3d0drWm89Ci0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo= signerName: kubernetes.io/kube-apiserver-client expirationSeconds: 86400 # one day usages: - client auth EOF Some points to note:usages has to be client authexpirationSeconds could be made lon", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583"}
{"instruction": "Write a yaml example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: myuser # example\nspec:\n  # This is an encoded CSR. Change this to the base64-encoded contents of myuser.csr\n  request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZqQ0NBVDRDQVFBd0VURVBNQTBHQTFVRUF3d0dZVzVuWld4aE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRgpBQU9DQVE4QU1JSUJDZ0tDQVFFQTByczhJTHRHdTYxakx2dHhWTTJSVlRWMDNHWlJTWWw0dWluVWo4RElaWjBOCnR2MUZtRVFSd3VoaUZsOFEzcWl0Qm0wMUFSMkNJVXBGd2ZzSjZ4MXF3ckJzVkhZbGlBNVhwRVpZM3ExcGswSDQKM3Z3aGJlK1o2MVNrVHF5SVBYUUwrTWM5T1Nsbm0xb0R2N0NtSkZNMUlMRVI3QTVGZnZKOEdFRjJ6dHBoaUlFMwpub1dtdHNZb3JuT2wzc2lHQ2ZGZzR4Zmd4eW8ybmlneFNVekl1bXNnVm9PM2ttT0x1RVF6cXpkakJ3TFJXbWlECklmMXBMWnoyalVnald4UkhCM1gyWnVVV1d1T09PZnpXM01LaE8ybHEvZi9DdS8wYk83c0x0MCt3U2ZMSU91TFcKcW90blZtRmxMMytqTy82WDNDKzBERHk5aUtwbXJjVDBnWGZLemE1dHJRSURBUUFCb0FBd0RRWUpLb1pJaHZjTgpBUUVMQlFBRGdnRUJBR05WdmVIOGR4ZzNvK21VeVRkbmFjVmQ1N24zSkExdnZEU1JWREkyQTZ1eXN3ZFp1L1BVCkkwZXpZWFV0RVNnSk1IRmQycVVNMjNuNVJsSXJ3R0xuUXFISUh5VStWWHhsdnZsRnpNOVpEWllSTmU3QlJvYXgKQVlEdUI5STZXT3FYbkFvczFqRmxNUG5NbFpqdU5kSGxpT1BjTU1oNndLaTZzZFhpVStHYTJ2RUVLY01jSVUyRgpvU2djUWdMYTk0aEpacGk3ZnNMdm1OQUxoT045UHdNMGM1dVJVejV4T0dGMUtCbWRSeEgvbUNOS2JKYjFRQm1HCkkwYitEUEdaTktXTU0xMzhIQXdoV0tkNjVoVHdYOWl4V3ZHMkh4TG1WQzg0L1BHT0tWQW9FNkpsYWFHdTlQVmkKdjlOSjVaZlZrcXdCd0hKbzZXdk9xVlA3SVFjZmg3d0drWm89Ci0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo=\n  signerName: kubernetes.io/kube-apiserver-client\n  expirationSeconds: 86400  # one day\n  usages:\n  - client auth\nEOF\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Some points to note:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7307"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve myuser\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Retrieve the certificate from the CSR, to check it looks OK.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7308"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl get csr/myuser -o yaml\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The certificate value is in Base64-encoded format under .status.certificate.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7309"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl get csr myuser -o jsonpath='{.status.certificate}'| base64 -d > myuser.crt\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The next step is to add this user into the kubeconfig file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7310"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials myuser --client-key=myuser.key --client-certificate=myuser.crt --embed-certs=true\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Then, you need to add the context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7311"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context myuser --cluster=kubernetes --user=myuser\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | To test it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7312"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl --context myuser auth whoami\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | You should see output confirming that you are “myuser“.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7313"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl create role developer --verb=create --verb=get --verb=list --verb=update --verb=delete --resource=pods\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | This is a sample command to create a RoleBinding for this new user:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7314"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding developer-binding-myuser --role=developer --user=myuser\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7315"}
{"instruction": "Write a yaml example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: myuser # example\nspec:\n  # This is an encoded CSR. Change this to the base64-encoded contents of myuser.csr\n  request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZqQ0NBVDRDQVFBd0VURVBNQTBHQTFVRUF3d0dZVzVuWld4aE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRgpBQU9DQVE4QU1JSUJDZ0tDQVFFQTByczhJTHRHdTYxakx2dHhWTTJSVlRWMDNHWlJTWWw0dWluVWo4RElaWjBOCnR2MUZtRVFSd3VoaUZsOFEzcWl0Qm0wMUFSMkNJVXBGd2ZzSjZ4MXF3ckJzVkhZbGlBNVhwRVpZM3ExcGswSDQKM3Z3aGJlK1o2MVNrVHF5SVBYUUwrTWM5T1Nsbm0xb0R2N0NtSkZNMUlMRVI3QTVGZnZKOEdFRjJ6dHBoaUlFMwpub1dtdHNZb3JuT2wzc2lHQ2ZGZzR4Zmd4eW8ybmlneFNVekl1bXNnVm9PM2ttT0x1RVF6cXpkakJ3TFJXbWlECklmMXBMWnoyalVnald4UkhCM1gyWnVVV1d1T09PZnpXM01LaE8ybHEvZi9DdS8wYk83c0x0MCt3U2ZMSU91TFcKcW90blZtRmxMMytqTy82WDNDKzBERHk5aUtwbXJjVDBnWGZLemE1dHJRSURBUUFCb0FBd0RRWUpLb1pJaHZjTgpBUUVMQlFBRGdnRUJBR05WdmVIOGR4ZzNvK21VeVRkbmFjVmQ1N24zSkExdnZEU1JWREkyQTZ1eXN3ZFp1L1BVCkkwZXpZWFV0RVNnSk1IRmQycVVNMjNuNVJsSXJ3R0xuUXFISUh5VStWWHhsdnZsRnpNOVpEWllSTmU3QlJvYXgKQVlEdUI5STZXT3FYbkFvczFqRmxNUG5NbFpqdU5kSGxpT1BjTU1oNndLaTZzZFhpVStHYTJ2RUVLY01jSVUyRgpvU2djUWdMYTk0aEpacGk3ZnNMdm1OQUxoT045UHdNMGM1dVJVejV4T0dGMUtCbWRSeEgvbUNOS2JKYjFRQm1HCkkwYitEUEdaTktXTU0xMzhIQXdoV0tkNjVoVHdYOWl4V3ZHMkh4TG1WQzg0L1BHT0tWQW9FNkpsYWFHdTlQVmkKdjlOSjVaZlZrcXdCd0hKbzZXdk9xVlA3SVFjZmg3d0drWm89Ci0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo=\n  signerName: kubernetes.io/kube-apiserver-client\n  expirationSeconds: 86400  # one day\n  usages:\n  - client auth\nEOF\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Some points to note:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7316"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve myuser\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Retrieve the certificate from the CSR, to check it looks OK.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7317"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl get csr/myuser -o yaml\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The certificate value is in Base64-encoded format under .status.certificate.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7318"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl get csr myuser -o jsonpath='{.status.certificate}'| base64 -d > myuser.crt\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The next step is to add this user into the kubeconfig file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7319"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials myuser --client-key=myuser.key --client-certificate=myuser.crt --embed-certs=true\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Then, you need to add the context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7320"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context myuser --cluster=kubernetes --user=myuser\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | To test it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7321"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl --context myuser auth whoami\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | You should see output confirming that you are “myuser“.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7322"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl create role developer --verb=create --verb=get --verb=list --verb=update --verb=delete --resource=pods\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | This is a sample command to create a RoleBinding for this new user:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7323"}
{"instruction": "Write a bash example for issue a certificate for a kubernetes api client using a certificatesigningrequest", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding developer-binding-myuser --role=developer --user=myuser\n```\n\nIssue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/tls/certificate-issue-client-csr/", "id": "k8s_00583_code_7324"}
{"instruction": "What is the reference documentation for node status?", "response": "Node StatusThe status of a node in Kubernetes is a critical aspect of managing a Kubernetes cluster. In this article, we'll cover the basics of monitoring and maintaining node status to ensure a healthy and stable cluster.Node status fieldsA Node's status contains the following information:AddressesConditionsCapacity and AllocatableInfoYou can use kubectl to view a Node's status and other details:kubectl describe node <insert-node-name-here> Each section of the output is described below.AddressesThe usage of these fields varies depending on your cloud provider or bare metal configuration.HostName: The hostname as reported by the node's kernel. Can be overridden via the kubelet --hostname-override parameter.ExternalIP: Typically the IP address of the node that is externally routable (available from outside the cluster).InternalIP: Typically the IP address of the node that is routable only within the cluster.ConditionsThe conditions field describes the status of all Running nodes. Examples of conditions include:Node conditions, and a description of when each condition applies.Node ConditionDescriptionReadyTrue if the node is healthy and ready to accept pods, False if the node is not healthy and is not accepting pods, and Unknown if the node controller has not heard from the node in the last node-monitor-grace-period (default is 50 seconds)DiskPressureTrue if pressure exists on the disk size—that is, if the disk capacity is low; otherwise FalseMemoryPressureTrue if pressure exists on the node memory—that is, if the node memory is low; otherwise FalsePIDPressureTrue if pressure exists on the processes—that is, if there are too many processes on the node; otherwise FalseNetworkUnavailableTrue if the network for the node is not correctly configured, otherwise FalseNote:If you use command-line tools to print details of a cordoned Node, the Condition includes SchedulingDisabled. SchedulingDisabled is not a Condition in the Kubernetes API; instead, cordoned nodes are marked Unschedulable in their spec.In the Kubernetes API, a node's condition is represented as part of the .status of the Node resource. For example, the following JSON structure describes a healthy node:\"conditions\": [ { \"type\": \"Ready\", \"status\": \"True\", \"reason\": \"KubeletReady\", \"message\": \"kubelet is posting ready status\", \"lastHeartbeatTime\": \"2019-06-05T18:38:35Z\", \"lastTransitionTime\": \"2019-06-05T11:41:27Z\" } ] When problems occur on nodes, the Kubernetes control plane automatically creates taints that match the conditions affecting the node. An example of this is when the status of the Ready condition remains Unknown or False for longer than the kube-controller-manager's NodeMonitorGracePeriod, which defaults to 50 seconds. This will cause either an node.kubernetes.io/unreachable taint, for an Unknown status, or a node.kubernetes.io/not-ready taint, for a False status, to be added to the Node.These taints affect pending pods as the scheduler takes the Node's taints into consideration when assigning a pod to a Node. Existing pods scheduled to the node may be evicted due to the application of NoExecute taints. Pods may also have tolerations that let them schedule to and continue running on a Node even though it has a specific taint.See Taint Based Evictions and Taint Nodes by Condition for more details.Capacity and AllocatableDescribes the resources available on the node: CPU, memory, and the maximum number of pods that can be scheduled onto the node.The fields in the capacity block indicate the total amount of resources that a Node has. The allocatable block indicates the amount of resources on a Node that is available to be consumed by normal Pods.You may read more about capacity and allocatable resources while learning how to reserve compute resources on a Node.InfoDescribes general information about the node, such as kernel version, Kubernetes version (kubelet and kube-proxy version), container runtime details, and which operating system the node uses. The kubel", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/node-status/", "id": "k8s_00584"}
{"instruction": "Write a bash example for node status", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\nNode Status | Each section of the output is described below.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/node-status/", "id": "k8s_00584_code_7326"}
{"instruction": "Write a bash example for node status", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\nNode Status | Each section of the output is described below.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/node-status/", "id": "k8s_00584_code_7327"}
{"instruction": "What is the reference documentation for devicetaintrule v1alpha3?", "response": "DeviceTaintRule v1alpha3DeviceTaintRule adds one taint to all devices which match the selector.apiVersion: resource.k8s.io/v1alpha3import \"k8s.io/api/resource/v1alpha3\"DeviceTaintRuleDeviceTaintRule adds one taint to all devices which match the selector. This has the same effect as if the taint was specified directly in the ResourceSlice by the DRA driver.apiVersion: resource.k8s.io/v1alpha3kind: DeviceTaintRulemetadata (ObjectMeta)Standard object metadataspec (DeviceTaintRuleSpec), requiredSpec specifies the selector and one taint.Changing the spec automatically increments the metadata.generation number.DeviceTaintRuleSpecDeviceTaintRuleSpec specifies the selector and one taint.taint (DeviceTaint), requiredThe taint that gets applied to matching devices.The device this taint is attached to has the \"effect\" on any claim which does not tolerate the taint and, through the claim, to pods using the claim.taint.effect (string), requiredThe effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them. Valid effects are NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here.taint.key (string), requiredThe taint key to be applied to a device. Must be a label name.taint.timeAdded (Time)TimeAdded represents the time at which the taint was added. Added automatically during create or update if not set.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.taint.value (string)The taint value corresponding to the taint key. Must be a label value.deviceSelector (DeviceTaintSelector)DeviceSelector defines which device(s) the taint is applied to. All selector criteria must be satisfied for a device to match. The empty selector matches all devices. Without a selector, no devices are matches.DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The empty selector matches all devices. Without a selector, no devices are matched.deviceSelector.device (string)If device is set, only devices with that name are selected. This field corresponds to slice.spec.devices[].name.Setting also driver and pool may be required to avoid ambiguity, but is not required.deviceSelector.deviceClassName (string)If DeviceClassName is set, the selectors defined there must be satisfied by a device to be selected. This field corresponds to class.metadata.name.deviceSelector.driver (string)If driver is set, only devices from that driver are selected. This fields corresponds to slice.spec.driver.deviceSelector.pool (string)If pool is set, only devices in that pool are selected.Also setting the driver name may be useful to avoid ambiguity when different drivers use the same pool name, but this is not required because selecting pools from different drivers may also be useful, for example when drivers with node-local devices use the node name as their pool name.deviceSelector.selectors ([]DeviceSelector)Atomic: will be replaced during a mergeSelectors contains the same selection criteria as a ResourceClaim. Currently, CEL expressions are supported. All of these selectors must be satisfied.DeviceSelector must have exactly one field set.deviceSelector.selectors.cel (CELDeviceSelector)CEL contains a CEL expression for selecting a device.CELDeviceSelector contains a CEL expression for selecting a device.deviceSelector.selectors.cel.expression (string), requiredExpression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.The expression's input is an object named \"device\", which carries the following properties:driver (string): the name of the driver which defines this device.attributes (map[string]object): the device's attributes, grouped by prefix (e.g. device.attributes[\"dra.example.com\"]", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/device-taint-rule-v1alpha3/", "id": "k8s_00585"}
{"instruction": "Write a yaml example for devicetaintrule v1alpha3", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\n```\n\nDeviceTaintRule v1alpha3 | import \"k8s.io/api/resource/v1alpha3\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/device-taint-rule-v1alpha3/", "id": "k8s_00585_code_7329"}
{"instruction": "What is the reference documentation for kube-proxy?", "response": "kube-proxySynopsisThe Kubernetes network proxy runs on each node. This reflects services as defined in the Kubernetes API on each node and can do simple TCP, UDP, and SCTP stream forwarding or round robin TCP, UDP, and SCTP forwarding across a set of backends. Service cluster IPs and ports are currently found through Docker-links-compatible environment variables specifying ports opened by the service proxy. There is an optional addon that provides cluster DNS for these cluster IPs. The user must create a service with the apiserver API to configure the proxy.kube-proxy [flags] Options--add_dir_headerIf true, adds the file directory to the header of the log messages--alsologtostderrlog to standard error as well as files (no effect when -logtostderr=true)--bind-address string Default: 0.0.0.0Overrides kube-proxy's idea of what its node's primary IP is. Note that the name is a historical artifact, and kube-proxy does not actually bind any sockets to this IP. This parameter is ignored if a config file is specified by --config.--bind-address-hard-failIf true kube-proxy will treat failure to bind to a port as fatal and exit--cleanupIf true cleanup iptables and ipvs rules and exit.--cluster-cidr stringThe CIDR range of the pods in the cluster. (For dual-stack clusters, this can be a comma-separated dual-stack pair of CIDR ranges.). When --detect-local-mode is set to ClusterCIDR, kube-proxy will consider traffic to be local if its source IP is in this range. (Otherwise it is not used.) This parameter is ignored if a config file is specified by --config.--config stringThe path to the configuration file.--config-sync-period duration Default: 15m0sHow often configuration from the apiserver is refreshed. Must be greater than 0.--conntrack-max-per-core int32 Default: 32768Maximum number of NAT connections to track per CPU core (0 to leave the limit as-is and ignore conntrack-min).--conntrack-min int32 Default: 131072Minimum number of conntrack entries to allocate, regardless of conntrack-max-per-core (set conntrack-max-per-core=0 to leave the limit as-is).--conntrack-tcp-be-liberalEnable liberal mode for tracking TCP packets by setting nf_conntrack_tcp_be_liberal to 1--conntrack-tcp-timeout-close-wait duration Default: 1h0m0sNAT timeout for TCP connections in the CLOSE_WAIT state--conntrack-tcp-timeout-established duration Default: 24h0m0sIdle timeout for established TCP connections (0 to leave as-is)--conntrack-udp-timeout durationIdle timeout for UNREPLIED UDP connections (0 to leave as-is)--conntrack-udp-timeout-stream durationIdle timeout for ASSURED UDP connections (0 to leave as-is)--detect-local-mode LocalModeMode to use to detect local traffic. This parameter is ignored if a config file is specified by --config.--feature-gates <comma-separated 'key=True|False' pairs>A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:APIResponseCompression=true|false (BETA - default=true)APIServerIdentity=true|false (BETA - default=true)APIServerTracing=true|false (BETA - default=true)APIServingWithRoutine=true|false (ALPHA - default=false)AllAlpha=true|false (ALPHA - default=false)AllBeta=true|false (BETA - default=false)AllowParsingUserUIDFromCertAuth=true|false (BETA - default=true)AllowUnsafeMalformedObjectDeletion=true|false (ALPHA - default=false)AnonymousAuthConfigurableEndpoints=true|false (BETA - default=true)AuthorizeNodeWithSelectors=true|false (BETA - default=true)AuthorizeWithSelectors=true|false (BETA - default=true)CBORServingAndStorage=true|false (ALPHA - default=false)CPUManagerPolicyAlphaOptions=true|false (ALPHA - default=false)CPUManagerPolicyBetaOptions=true|false (BETA - default=true)CSIVolumeHealth=true|false (ALPHA - default=false)ClientsAllowCBOR=true|false (ALPHA - default=false)ClientsPreferCBOR=true|false (ALPHA - default=false)CloudControllerManagerWebhook=true|false (ALPHA - default=false)ClusterTrustBundle=true|false (BETA - default=false)ClusterTrustBundleProjection=true|f", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/", "id": "k8s_00586"}
{"instruction": "What is the reference documentation for kubectl wait?", "response": "kubectl waitSynopsisExperimental: Wait for a specific condition on one or many resources.The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.Alternatively, the command can wait for the given set of resources to be created or deleted by providing the \"create\" or \"delete\" keyword as the value to the --for flag.A successful message will be printed to stdout indicating when the specified condition has been met. You can use -o option to change to output destination.kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]] Examples # Wait for the pod \"busybox1\" to contain the status condition of type \"Ready\" kubectl wait --for=condition=Ready pod/busybox1 # The default value of status condition is true; you can wait for other targets after an equal delimiter (compared after Unicode simple case folding, which is a more general form of case-insensitivity) kubectl wait --for=condition=Ready=false pod/busybox1 # Wait for the pod \"busybox1\" to contain the status phase to be \"Running\" kubectl wait --for=jsonpath='{.status.phase}'=Running pod/busybox1 # Wait for pod \"busybox1\" to be Ready kubectl wait --for='jsonpath={.status.conditions[?(@.type==\"Ready\")].status}=True' pod/busybox1 # Wait for the service \"loadbalancer\" to have ingress kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' service/loadbalancer # Wait for the secret \"busybox1\" to be created, with a timeout of 30s kubectl create secret generic busybox1 kubectl wait --for=create secret/busybox1 --timeout=30s # Wait for the pod \"busybox1\" to be deleted, with a timeout of 60s, after having issued the \"delete\" command kubectl delete pod/busybox1 kubectl wait --for=delete pod/busybox1 --timeout=60s Options--allSelect all resources in the namespace of the specified resource types-A, --all-namespacesIf present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsidentifying the resource.--for stringThe condition to wait on: [create|delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=[JSONPath value]]. The default condition-value is true. Condition values are compared after Unicode simple case folding, which is a more general form of case-insensitivity.-h, --helphelp for wait--localIf true, annotation will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursive Default: trueProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--timeout duration Default: 30sThe length of time to wait before giving up. Zero means check once and don't wait, negative means wait for a week.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_wait/", "id": "k8s_00587"}
{"instruction": "Write a bash example for kubectl wait", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]\n```\n\nkubectl wait | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_wait/", "id": "k8s_00587_code_7332"}
{"instruction": "Write a bash example for kubectl wait", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]\n```\n\nkubectl wait | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_wait/", "id": "k8s_00587_code_7333"}
{"instruction": "Explain the Kubernetes concept: Services, Load Balancing, and Networking", "response": "Services, Load Balancing, and NetworkingConcepts and resources behind networking in Kubernetes.The Kubernetes network modelThe Kubernetes network model is built out of several pieces:Each pod in a cluster gets its own unique cluster-wide IP address.A pod has its own private network namespace which is shared by all of the containers within the pod. Processes running in different containers in the same pod can communicate with each other over localhost.The pod network (also called a cluster network) handles communication between pods. It ensures that (barring intentional network segmentation):All pods can communicate with all other pods, whether they are on the same node or on different nodes. Pods can communicate with each other directly, without the use of proxies or address translation (NAT).On Windows, this rule does not apply to host-network pods.Agents on a node (such as system daemons, or kubelet) can communicate with all pods on that node.The Service API lets you provide a stable (long lived) IP address or hostname for a service implemented by one or more backend pods, where the individual pods making up the service can change over time.Kubernetes automatically manages EndpointSlice objects to provide information about the pods currently backing a Service.A service proxy implementation monitors the set of Service and EndpointSlice objects, and programs the data plane to route service traffic to its backends, by using operating system or cloud provider APIs to intercept or rewrite packets.The Gateway API (or its predecessor, Ingress) allows you to make Services accessible to clients that are outside the cluster.A simpler, but less-configurable, mechanism for cluster ingress is available via the Service API's type: LoadBalancer, when using a supported Cloud Provider.NetworkPolicy is a built-in Kubernetes API that allows you to control traffic between pods, or between pods and the outside world.In older container systems, there was no automatic connectivity between containers on different hosts, and so it was often necessary to explicitly create links between containers, or to map container ports to host ports to make them reachable by containers on other hosts. This is not needed in Kubernetes; Kubernetes's model is that pods can be treated much like VMs or physical hosts from the perspectives of port allocation, naming, service discovery, load balancing, application configuration, and migration.Only a few parts of this model are implemented by Kubernetes itself. For the other parts, Kubernetes defines the APIs, but the corresponding functionality is provided by external components, some of which are optional:Pod network namespace setup is handled by system-level software implementing the Container Runtime Interface.The pod network itself is managed by a pod network implementation. On Linux, most container runtimes use the Container Networking Interface (CNI) to interact with the pod network implementation, so these implementations are often called CNI plugins.Kubernetes provides a default implementation of service proxying, called kube-proxy, but some pod network implementations instead use their own service proxy that is more tightly integrated with the rest of the implementation.NetworkPolicy is generally also implemented by the pod network implementation. (Some simpler pod network implementations don't implement NetworkPolicy, or an administrator may choose to configure the pod network without NetworkPolicy support. In these cases, the API will still be present, but it will have no effect.)There are many implementations of the Gateway API, some of which are specific to particular cloud environments, some more focused on \"bare metal\" environments, and others more generic.What's nextThe Connecting Applications with Services tutorial lets you learn about Services and Kubernetes networking with a hands-on example.Cluster Networking explains how to set up networking for your cluster, and also provides an overview of the tec", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/services-networking/", "id": "k8s_00588"}
{"instruction": "What is the reference documentation for common definitions?", "response": "Common DefinitionsDeleteOptionsDeleteOptions may be provided when deleting an API object.LabelSelectorA label selector is a label query over a set of resources.ListMetaListMeta describes metadata that synthetic resources must have, including lists and various status objects.LocalObjectReferenceLocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.NodeSelectorRequirementA node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.ObjectFieldSelectorObjectFieldSelector selects an APIVersioned field of an object.ObjectMetaObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.ObjectReferenceObjectReference contains enough information to let you inspect or modify the referred object.PatchPatch is provided to give a concrete name and type to the Kubernetes PATCH request body.QuantityQuantity is a fixed-point representation of a number.ResourceFieldSelectorResourceFieldSelector represents container resources (cpu, memory) and their output format.StatusStatus is a return value for calls that don't return other objects.TypedLocalObjectReferenceTypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/", "id": "k8s_00589"}
{"instruction": "What is the reference documentation for kubectl set resources?", "response": "kubectl set resourcesSynopsisSpecify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits.For each compute resource, if a limit is specified and a request is omitted, the request will default to the limit.Possible resources include (case insensitive): Use \"kubectl api-resources\" for a complete list of supported resources..kubectl set resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS] Examples # Set a deployments nginx container cpu limits to \"200m\" and memory to \"512Mi\" kubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi # Set the resource request and limits for all containers in nginx kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi # Remove the resource requests for resources on containers in nginx kubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0 # Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml Options--allSelect all resources, in the namespace of the specified resource types--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.-c, --containers string Default: \"*\"The names of containers in the selected pod templates to change, all containers are selected by default - may use wildcards--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-set\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for resources-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--limits stringThe resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.--localIf true, set resources will NOT contact api-server but run locally.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--requests stringThe resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache dire", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_resources/", "id": "k8s_00590"}
{"instruction": "Write a bash example for kubectl set resources", "response": "Here's a bash example:\n\n```bash\nkubectl set resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS & --requests=REQUESTS]\n```\n\nkubectl set resources | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_resources/", "id": "k8s_00590_code_7337"}
{"instruction": "Write a bash example for kubectl set resources", "response": "Here's a bash example:\n\n```bash\nkubectl set resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS & --requests=REQUESTS]\n```\n\nkubectl set resources | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_set/kubectl_set_resources/", "id": "k8s_00590_code_7338"}
{"instruction": "How do you switching from polling to cri event-based updates to container status in Kubernetes?", "response": "Switching from Polling to CRI Event-based Updates to Container StatusFEATURE STATE: Kubernetes v1.26 [alpha] (enabled by default: false)This page shows how to migrate nodes to use event based updates for container status. The event-based implementation reduces node resource consumption by the kubelet, compared to the legacy approach that relies on polling. You may know this feature as evented Pod lifecycle event generator (PLEG). That's the name used internally within the Kubernetes project for a key implementation detail.The polling based approach is referred to as generic PLEG.Before you beginYou need to run a version of Kubernetes that provides this feature. Kubernetes v1.27 includes beta support for event-based container status updates. The feature is beta but is disabled by default because it requires support from the container runtime.Your Kubernetes server must be at or later than version 1.26.To check the version, enter kubectl version.If you are running a different version of Kubernetes, check the documentation for that release.The container runtime in use must support container lifecycle events. The kubelet automatically switches back to the legacy generic PLEG mechanism if the container runtime does not announce support for container lifecycle events, even if you have this feature gate enabled.Why switch to Evented PLEG?The Generic PLEG incurs non-negligible overhead due to frequent polling of container statuses.This overhead is exacerbated by Kubelet's parallelized polling of container states, thus limiting its scalability and causing poor performance and reliability problems.The goal of Evented PLEG is to reduce unnecessary work during inactivity by replacing periodic polling.Switching to Evented PLEGStart the Kubelet with the feature gate EventedPLEG enabled. You can manage the kubelet feature gates editing the kubelet config file and restarting the kubelet service. You need to do this on each node where you are using this feature.Make sure the node is drained before proceeding.Start the container runtime with the container event generation enabled.Version 1.7+Version 1.26+Check if the CRI-O is already configured to emit CRI events by verifying the configuration,crio config | grep enable_pod_events If it is enabled, the output should be similar to the following:enable_pod_events = true To enable it, start the CRI-O daemon with the flag --enable-pod-events=true or use a dropin config with the following lines:[crio.runtime] enable_pod_events: true Your Kubernetes server must be at or later than version 1.26.To check the version, enter kubectl version.Verify that the kubelet is using event-based container stage change monitoring. To check, look for the term EventedPLEG in the kubelet logs.The output should be similar to this:I0314 11:10:13.909915 1105457 feature_gate.go:249] feature gates: &{map[EventedPLEG:true]} If you have set --v to 4 and above, you might see more entries that indicate that the kubelet is using event-based container state monitoring.I0314 11:12:42.009542 1110177 evented.go:238] \"Evented PLEG: Generated pod status from the received event\" podUID=3b2c6172-b112-447a-ba96-94e7022912dc I0314 11:12:44.623326 1110177 evented.go:238] \"Evented PLEG: Generated pod status from the received event\" podUID=b3fba5ea-a8c5-4b76-8f43-481e17e8ec40 I0314 11:12:44.714564 1110177 evented.go:238] \"Evented PLEG: Generated pod status from the received event\" podUID=b3fba5ea-a8c5-4b76-8f43-481e17e8ec40 What's nextLearn more about the design in the Kubernetes Enhancement Proposal (KEP): Kubelet Evented PLEG for Better Performance.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/switch-to-evented-pleg/", "id": "k8s_00591"}
{"instruction": "Explain contributing new content in Kubernetes", "response": "Contributing new contentThis section contains information you should know before contributing new content.There are also dedicated pages about submitting case studies and blog articles.New content task flowflowchart LR subgraph second[Before you begin] direction TB S[ ] -.- A[Sign the CNCF CLA] --> B[Choose Git branch] B --> C[One language per PR] C --> F[Check outcontributor tools] end subgraph first[Contributing Basics] direction TB T[ ] -.- D[Write docs in markdownand build site with Hugo] --- E[source in GitHub] E --- G['/content/../docs' folder contains docsfor multiple languages] G --- H[Review Hugo page contenttypes and shortcodes] end first ----> second classDef grey fill:#dddddd,stroke:#ffffff,stroke-width:px,color:#000000, font-size:15px; classDef white fill:#ffffff,stroke:#000,stroke-width:px,color:#000,font-weight:bold classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000 class A,B,C,D,E,F,G,H grey class S,T spacewhite class first,second whiteJavaScript must be enabled to view this contentFigure - Contributing new content preparationThe figure above depicts the information you should know prior to submitting new content. The information details follow.Contributing basicsWrite Kubernetes documentation in Markdown and build the Kubernetes site using Hugo.Kubernetes documentation uses CommonMark as its flavor of Markdown.The source is in GitHub. You can find Kubernetes documentation at /content/en/docs/. Some of the reference documentation is automatically generated from scripts in the update-imported-docs/ directory.Page content types describe the presentation of documentation content in Hugo.You can use Docsy shortcodes or custom Hugo shortcodes to contribute to Kubernetes documentation.In addition to the standard Hugo shortcodes, we use a number of custom Hugo shortcodes in our documentation to control the presentation of content.Documentation source is available in multiple languages in /content/. Each language has its own folder with a two-letter code determined by the ISO 639-1 standard . For example, English documentation source is stored in /content/en/docs/.For more information about contributing to documentation in multiple languages or starting a new translation, see localization.Before you beginSign the CNCF CLAAll Kubernetes contributors must read the Contributor guide and sign the Contributor License Agreement (CLA) .Pull requests from contributors who haven't signed the CLA fail the automated tests. The name and email you provide must match those found in your git config, and your git name and email must match those used for the CNCF CLA.Choose which Git branch to useWhen opening a pull request, you need to know in advance which branch to base your work on.ScenarioBranchExisting or new English language content for the current releasemainContent for a feature change releaseThe branch which corresponds to the major and minor version the feature change is in, using the pattern dev-<version>. For example, if a feature changes in the v1.35 release, then add documentation changes to the dev-1.35 branch.Content in other languages (localizations)Use the localization's convention. See the Localization branching strategy for more information.If you're still not sure which branch to choose, ask in #sig-docs on Slack.Note:If you already submitted your pull request and you know that the base branch was wrong, you (and only you, the submitter) can change it.Languages per PRLimit pull requests to one language per PR. If you need to make an identical change to the same code sample in multiple languages, open a separate PR for each language.Tools for contributorsThe doc contributors tools directory in the kubernetes/website repository contains tools to help your contribution journey go more smoothly.What's nextRead about submitting blog articles.Opening a pull requestDocumenting a feature for a releaseSubmitting case studies", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/new-content/", "id": "k8s_00592"}
{"instruction": "Explain contribute to kubernetes documentation in Kubernetes", "response": "Contribute to Kubernetes DocumentationThis website is maintained by Kubernetes SIG Docs. The Kubernetes project welcomes help from all contributors, new or experienced!Kubernetes documentation contributors:Improve existing contentCreate new contentTranslate the documentationManage and publish the documentation parts of the Kubernetes release cycleThe blog team, part of SIG Docs, helps manage the official blogs. Read contributing to Kubernetes blogs to learn more.Note:To learn more about contributing to Kubernetes in general, see the general contributor documentation site.Getting startedAnyone can open an issue about documentation, or contribute a change with a pull request (PR) to the kubernetes/website GitHub repository. You need to be comfortable with git and GitHub to work effectively in the Kubernetes community.To get involved with documentation:Sign the CNCF Contributor License Agreement.Familiarize yourself with the documentation repository and the website's static site generator.Make sure you understand the basic processes for opening a pull request and reviewing changes.flowchart TB subgraph third[Open PR] direction TB U[ ] -.- Q[Improve content] --- N[Create content] N --- O[Translate docs] O --- P[Manage/publish docs partsof K8s release cycle] end subgraph second[Review] direction TB T[ ] -.- D[Look over thekubernetes/websiterepository] --- E[Check out theHugo static sitegenerator] E --- F[Understand basicGitHub commands] F --- G[Review open PRand change reviewprocesses] end subgraph first[Sign up] direction TB S[ ] -.- B[Sign the CNCFContributorLicense Agreement] --- C[Join sig-docsSlack channel] C --- V[Join kubernetes-sig-docsmailing list] V --- M[Attend weeklysig-docs callsor slack meetings] end A([fa:fa-user NewContributor]) --> first A --> second A --> third A --> H[Ask Questions!!!] classDef grey fill:#dddddd,stroke:#ffffff,stroke-width:px,color:#000000, font-size:15px; classDef white fill:#ffffff,stroke:#000,stroke-width:px,color:#000,font-weight:bold classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000 class A,B,C,D,E,F,G,H,M,Q,N,O,P,V grey class S,T,U spacewhite class first,second,third whiteJavaScript must be enabled to view this contentFigure 1. Getting started for a new contributor.Figure 1 outlines a roadmap for new contributors. You can follow some or all of the steps for Sign up and Review. Now you are ready to open PRs that achieve your contribution objectives with some listed under Open PR. Again, questions are always welcome!Some tasks require more trust and more access in the Kubernetes organization. See Participating in SIG Docs for more details about roles and permissions.Your first contributionYou can prepare for your first contribution by reviewing several steps beforehand. Figure 2 outlines the steps and the details follow.flowchart LR subgraph second[First Contribution] direction TB S[ ] -.- G[Review PRs from otherK8s members] --> A[Check kubernetes/websiteissues list forgood first PRs] --> B[Open a PR!!] end subgraph first[Suggested Prep] direction TB T[ ] -.- D[Read contribution overview] -->E[Read K8s contentand style guides] E --> F[Learn about Hugo pagecontent typesand shortcodes] end first ----> second classDef grey fill:#dddddd,stroke:#ffffff,stroke-width:px,color:#000000, font-size:15px; classDef white fill:#ffffff,stroke:#000,stroke-width:px,color:#000,font-weight:bold classDef spacewhite fill:#ffffff,stroke:#fff,stroke-width:0px,color:#000 class A,B,D,E,F,G grey class S,T spacewhite class first,second whiteJavaScript must be enabled to view this contentFigure 2. Preparation for your first contribution.Read the Contribution overview to learn about the different ways you can contribute.Check kubernetes/website issues list for issues that make good entry points.Open a pull request using GitHub to existing documentation and learn more about filing issues in GitHub.Review pull requests from other Kubernetes community members for accuracy and language.Read the Kuberne", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/docs/", "id": "k8s_00593"}
{"instruction": "Explain the Kubernetes concept: Communication between Nodes and the Control Plane", "response": "Communication between Nodes and the Control PlaneThis document catalogs the communication paths between the API server and the Kubernetes cluster. The intent is to allow users to customize their installation to harden the network configuration such that the cluster can be run on an untrusted network (or on fully public IPs on a cloud provider).Node to Control PlaneKubernetes has a \"hub-and-spoke\" API pattern. All API usage from nodes (or the pods they run) terminates at the API server. None of the other control plane components are designed to expose remote services. The API server is configured to listen for remote connections on a secure HTTPS port (typically 443) with one or more forms of client authentication enabled. One or more forms of authorization should be enabled, especially if anonymous requests or service account tokens are allowed.Nodes should be provisioned with the public root certificate for the cluster such that they can connect securely to the API server along with valid client credentials. A good approach is that the client credentials provided to the kubelet are in the form of a client certificate. See kubelet TLS bootstrapping for automated provisioning of kubelet client certificates.Pods that wish to connect to the API server can do so securely by leveraging a service account so that Kubernetes will automatically inject the public root certificate and a valid bearer token into the pod when it is instantiated. The kubernetes service (in default namespace) is configured with a virtual IP address that is redirected (via kube-proxy) to the HTTPS endpoint on the API server.The control plane components also communicate with the API server over the secure port.As a result, the default operating mode for connections from the nodes and pod running on the nodes to the control plane is secured by default and can run over untrusted and/or public networks.Control plane to nodeThere are two primary communication paths from the control plane (the API server) to the nodes. The first is from the API server to the kubelet process which runs on each node in the cluster. The second is from the API server to any node, pod, or service through the API server's proxy functionality.API server to kubeletThe connections from the API server to the kubelet are used for:Fetching logs for pods.Attaching (usually through kubectl) to running pods.Providing the kubelet's port-forwarding functionality.These connections terminate at the kubelet's HTTPS endpoint. By default, the API server does not verify the kubelet's serving certificate, which makes the connection subject to man-in-the-middle attacks and unsafe to run over untrusted and/or public networks.To verify this connection, use the --kubelet-certificate-authority flag to provide the API server with a root certificate bundle to use to verify the kubelet's serving certificate.If that is not possible, use SSH tunneling between the API server and kubelet if required to avoid connecting over an untrusted or public network.Finally, Kubelet authentication and/or authorization should be enabled to secure the kubelet API.API server to nodes, pods, and servicesThe connections from the API server to a node, pod, or service default to plain HTTP connections and are therefore neither authenticated nor encrypted. They can be run over a secure HTTPS connection by prefixing https: to the node, pod, or service name in the API URL, but they will not validate the certificate provided by the HTTPS endpoint nor provide client credentials. So while the connection will be encrypted, it will not provide any guarantees of integrity. These connections are not currently safe to run over untrusted or public networks.SSH tunnelsKubernetes supports SSH tunnels to protect the control plane to nodes communication paths. In this configuration, the API server initiates an SSH tunnel to each node in the cluster (connecting to the SSH server listening on port 22) and passes all traffic destined for a kubelet, node, ", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/architecture/control-plane-node-communication/", "id": "k8s_00594"}
{"instruction": "How do you managing secrets using kustomize in Kubernetes?", "response": "Managing Secrets using KustomizeCreating Secret objects using kustomization.yaml file.kubectl supports using the Kustomize object management tool to manage Secrets and ConfigMaps. You create a resource generator using Kustomize, which generates a Secret that you can apply to the API server using kubectl.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesCreate a SecretYou can generate a Secret by defining a secretGenerator in a kustomization.yaml file that references other existing files, .env files, or literal values. For example, the following instructions create a kustomization file for the username admin and the password 1f2d1e2e67df.Note:The stringData field for a Secret does not work well with server-side apply.Create the kustomization file secretGenerator: - name: database-creds literals: - username=admin - password=1f2d1e2e67df Store the credentials in files. The filenames are the keys of the secret:echo -n 'admin' > ./username.txt echo -n '1f2d1e2e67df' > ./password.txt The -n flag ensures that there's no newline character at the end of your files.Create the kustomization.yaml file:secretGenerator: - name: database-creds files: - username.txt - password.txt You can also define the secretGenerator in the kustomization.yaml file by providing .env files. For example, the following kustomization.yaml file pulls in data from an .env.secret file:secretGenerator: - name: db-user-pass envs: - .env.secret In all cases, you don't need to encode the values in base64. The name of the YAML file must be kustomization.yaml or kustomization.yml.Apply the kustomization fileTo create the Secret, apply the directory that contains the kustomization file:kubectl apply -k <directory-path> The output is similar to:secret/database-creds-5hdh7hhgfk created When a Secret is generated, the Secret name is created by hashing the Secret data and appending the hash value to the name. This ensures that a new Secret is generated each time the data is modified.To verify that the Secret was created and to decode the Secret data,kubectl get -k <directory-path> -o jsonpath='{.data}' The output is similar to:{ \"password\": \"MWYyZDFlMmU2N2Rm\", \"username\": \"YWRtaW4=\" } echo 'MWYyZDFlMmU2N2Rm' | base64 --decode The output is similar to:1f2d1e2e67df For more information, refer to Managing Secrets using kubectl and Declarative Management of Kubernetes Objects Using Kustomize.Edit a SecretIn your kustomization.yaml file, modify the data, such as the password.Apply the directory that contains the kustomization file:kubectl apply -k <directory-path> The output is similar to:secret/db-user-pass-6f24b56cc8 created The edited Secret is created as a new Secret object, instead of updating the existing Secret object. You might need to update references to the Secret in your Pods.Clean upTo delete a Secret, use kubectl:kubectl delete secret db-user-pass What's nextRead more about the Secret conceptLearn how to manage Secrets using kubectlLearn how to manage Secrets using config file", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\nManaging Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7344"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl get -k <directory-path> -o jsonpath='{.data}'\n```\n\nManaging Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7345"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\nManaging Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7346"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\nManaging Secrets using Kustomize |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7347"}
{"instruction": "Write a yaml example for managing secrets using kustomize", "response": "Here's a yaml example:\n\n```yaml\nsecretGenerator:\n- name: database-creds\n  literals:\n  - username=admin\n  - password=1f2d1e2e67df\n```\n\nManaging Secrets using Kustomize | Store the credentials in files. The filenames are the keys of the secret:echo -n 'admin' > ./username.txt echo -n '1f2d1e2e67df' > ./password.txt The -n flag ensures that there's no newline character", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7348"}
{"instruction": "Write a yaml example for managing secrets using kustomize", "response": "Here's a yaml example:\n\n```yaml\nsecretGenerator:\n- name: database-creds\n  files:\n  - username.txt\n  - password.txt\n```\n\nManaging Secrets using Kustomize | You can also define the secretGenerator in the kustomization.yaml file by providing .env files. For example, the following kustomization.yaml file pulls in data from an .env.secret file:secretGenerato", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7349"}
{"instruction": "Write a yaml example for managing secrets using kustomize", "response": "Here's a yaml example:\n\n```yaml\nsecretGenerator:\n- name: db-user-pass\n  envs:\n  - .env.secret\n```\n\nManaging Secrets using Kustomize | In all cases, you don't need to encode the values in base64. The name of the YAML file must be kustomization.yaml or kustomization.yml.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7350"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\nManaging Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7351"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl get -k <directory-path> -o jsonpath='{.data}'\n```\n\nManaging Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7352"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\nManaging Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7353"}
{"instruction": "Write a bash example for managing secrets using kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\nManaging Secrets using Kustomize |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kustomize/", "id": "k8s_00595_code_7354"}
{"instruction": "How do you use port forwarding to access applications in a cluster in Kubernetes?", "response": "Use Port Forwarding to Access Applications in a ClusterThis page shows how to use kubectl port-forward to connect to a MongoDB server running in a Kubernetes cluster. This type of connection can be useful for database debugging.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.10.To check the version, enter kubectl version.Install MongoDB Shell.Creating MongoDB deployment and serviceCreate a Deployment that runs MongoDB:kubectl apply -f https://k8s.io/examples/application/mongodb/mongo-deployment.yaml The output of a successful command verifies that the deployment was created:deployment.apps/mongo created View the pod status to check that it is ready:kubectl get pods The output displays the pod created:NAME READY STATUS RESTARTS AGE mongo-75f59d57f4-4nd6q 1/1 Running 0 2m4s View the Deployment's status:kubectl get deployment The output displays that the Deployment was created:NAME READY UP-TO-DATE AVAILABLE AGE mongo 1/1 1 1 2m21s The Deployment automatically manages a ReplicaSet. View the ReplicaSet status using:kubectl get replicaset The output displays that the ReplicaSet was created:NAME DESIRED CURRENT READY AGE mongo-75f59d57f4 1 1 1 3m12s Create a Service to expose MongoDB on the network:kubectl apply -f https://k8s.io/examples/application/mongodb/mongo-service.yaml The output of a successful command verifies that the Service was created:service/mongo created Check the Service created:kubectl get service mongo The output displays the service created:NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE mongo ClusterIP 10.96.41.183 <none> 27017/TCP 11s Verify that the MongoDB server is running in the Pod, and listening on port 27017:# Change mongo-75f59d57f4-4nd6q to the name of the Pod kubectl get pod mongo-75f59d57f4-4nd6q --template='{{(index (index .spec.containers 0).ports 0).containerPort}}{{\"\\n\"}}' The output displays the port for MongoDB in that Pod:27017 27017 is the official TCP port for MongoDB.Forward a local port to a port on the Podkubectl port-forward allows using resource name, such as a pod name, to select a matching pod to port forward to.# Change mongo-75f59d57f4-4nd6q to the name of the Pod kubectl port-forward mongo-75f59d57f4-4nd6q 28015:27017 which is the same askubectl port-forward pods/mongo-75f59d57f4-4nd6q 28015:27017 orkubectl port-forward deployment/mongo 28015:27017 orkubectl port-forward replicaset/mongo-75f59d57f4 28015:27017 orkubectl port-forward service/mongo 28015:27017 Any of the above commands works. The output is similar to this:Forwarding from 127.0.0.1:28015 -> 27017 Forwarding from [::1]:28015 -> 27017 Note:kubectl port-forward does not return. To continue with the exercises, you will need to open another terminal.Start the MongoDB command line interface:mongosh --port 28015 At the MongoDB command line prompt, enter the ping command:db.runCommand( { ping: 1 } ) A successful ping request returns:{ ok: 1 } Optionally let kubectl choose the local portIf you don't need a specific local port, you can let kubectl choose and allocate the local port and thus relieve you from having to manage local port conflicts, with the slightly simpler syntax:kubectl port-forward deployment/mongo :27017 The kubectl tool finds a local port number that is not in use (avoiding low ports numbers, because these might be used by other applications). The output is similar to:Forwarding from 127.0.0.1:63753 -> 27017 Forwarding from [::1]:63753 -> 27017 DiscussionConnections made to local port 28015 are forwarded to port 27017 of the Pod that is running the MongoDB server. With t", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-deployment.yaml\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7356"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output displays that the Deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7357"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicaset\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output displays that the ReplicaSet was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7358"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-service.yaml\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the Service was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7359"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service mongo\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output displays the service created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7360"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pods/mongo-75f59d57f4-4nd6q 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7361"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7362"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward replicaset/mongo-75f59d57f4 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7363"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/mongo 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | Any of the above commands works. The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7364"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo :27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The kubectl tool finds a local port number that is not in use (avoiding low ports numbers, because these might be used by other applications). The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7365"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-deployment.yaml\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7366"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output displays that the Deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7367"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicaset\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output displays that the ReplicaSet was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7368"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-service.yaml\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the Service was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7369"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service mongo\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The output displays the service created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7370"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pods/mongo-75f59d57f4-4nd6q 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7371"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7372"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward replicaset/mongo-75f59d57f4 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7373"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/mongo 28015:27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | Any of the above commands works. The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7374"}
{"instruction": "Write a bash example for use port forwarding to access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo :27017\n```\n\nUse Port Forwarding to Access Applications in a Cluster | The kubectl tool finds a local port number that is not in use (avoiding low ports numbers, because these might be used by other applications). The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/", "id": "k8s_00596_code_7375"}
{"instruction": "What is the reference documentation for endpoints?", "response": "EndpointsEndpoints is a collection of endpoints that implement the actual service.apiVersion: v1import \"k8s.io/api/core/v1\"EndpointsEndpoints is a collection of endpoints that implement the actual service. Example:Name: \"mysvc\", Subsets: [ { Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}], Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}] }, { Addresses: [{\"ip\": \"10.10.3.3\"}], Ports: [{\"name\": \"a\", \"port\": 93}, {\"name\": \"b\", \"port\": 76}] }, ]Endpoints is a legacy API and does not contain information about all Service features. Use discoveryv1.EndpointSlice for complete information about Service endpoints.Deprecated: This API is deprecated in v1.33+. Use discoveryv1.EndpointSlice.apiVersion: v1kind: Endpointsmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatasubsets ([]EndpointSubset)Atomic: will be replaced during a mergeThe set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service.*EndpointSubset is a group of addresses with a common set of ports. The expanded set of endpoints is the Cartesian product of Addresses x Ports. For example, given:{ Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}], Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}] }The resulting set of endpoints can be viewed as:a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], b: [ 10.10.1.1:309, 10.10.2.2:309 ]Deprecated: This API is deprecated in v1.33+.*subsets.addresses ([]EndpointAddress)Atomic: will be replaced during a mergeIP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize.EndpointAddress is a tuple that describes single IP address. Deprecated: This API is deprecated in v1.33+.subsets.addresses.ip (string), requiredThe IP of this endpoint. May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), or link-local multicast (224.0.0.0/24 or ff02::/16).subsets.addresses.hostname (string)The Hostname of this endpointsubsets.addresses.nodeName (string)Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.subsets.addresses.targetRef (ObjectReference)Reference to object providing the endpoint.subsets.notReadyAddresses ([]EndpointAddress)Atomic: will be replaced during a mergeIP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check.EndpointAddress is a tuple that describes single IP address. Deprecated: This API is deprecated in v1.33+.subsets.notReadyAddresses.ip (string), requiredThe IP of this endpoint. May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), or link-local multicast (224.0.0.0/24 or ff02::/16).subsets.notReadyAddresses.hostname (string)The Hostname of this endpointsubsets.notReadyAddresses.nodeName (string)Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.subsets.notReadyAddresses.targetRef (ObjectReference)Reference to object providing the endpoint.subsets.ports ([]EndpointPort)Atomic: will be replaced during a mergePort numbers available on the related IP addresses.EndpointPort is a tuple that describes a single port. Deprecated: This API is deprecated in v1.33+.subsets.ports.port (int32), requiredThe port number of the endpoint.subsets.ports.protocol (string)The IP protocol for this port. Must be UDP, TCP, or SCTP. Default i", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoints-v1/", "id": "k8s_00597"}
{"instruction": "What is the reference documentation for kubectl create service clusterip?", "response": "kubectl create service clusteripSynopsisCreate a ClusterIP service with the specified name.kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none] Examples # Create a new ClusterIP service named my-cs kubectl create service clusterip my-cs --tcp=5678:8080 # Create a new ClusterIP service named my-cs (in headless mode) kubectl create service clusterip my-cs --clusterip=\"None\" Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--clusterip stringAssign your own ClusterIP or set to 'None' for a 'headless' service (no loadbalancing).--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for clusterip-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--tcp stringsPort pairs can be specified as '<port>:<targetPort>'.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Defau", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_clusterip/", "id": "k8s_00598"}
{"instruction": "Write a bash example for kubectl create service clusterip", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]\n```\n\nkubectl create service clusterip | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_clusterip/", "id": "k8s_00598_code_7378"}
{"instruction": "Write a bash example for kubectl create service clusterip", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]\n```\n\nkubectl create service clusterip | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_clusterip/", "id": "k8s_00598_code_7379"}
{"instruction": "Provide a tutorial on using kubectl to create a deployment", "response": "Using kubectl to Create a DeploymentObjectivesLearn about application Deployments.Deploy your first app on Kubernetes with kubectl.Kubernetes DeploymentsA Deployment is responsible for creating and updating instances of your application.Note:This tutorial uses a container that requires the AMD64 architecture. If you are using minikube on a computer with a different CPU architecture, you could try using minikube with a driver that can emulate AMD64. For example, the Docker Desktop driver can do this.Once you have a running Kubernetes cluster, you can deploy your containerized applications on top of it. To do so, you create a Kubernetes Deployment. The Deployment instructs Kubernetes how to create and update instances of your application. Once you've created a Deployment, the Kubernetes control plane schedules the application instances included in that Deployment to run on individual Nodes in the cluster.Once the application instances are created, a Kubernetes Deployment controller continuously monitors those instances. If the Node hosting an instance goes down or is deleted, the Deployment controller replaces the instance with an instance on another Node in the cluster. This provides a self-healing mechanism to address machine failure or maintenance.In a pre-orchestration world, installation scripts would often be used to start applications, but they did not allow recovery from machine failure. By both creating your application instances and keeping them running across Nodes, Kubernetes Deployments provide a fundamentally different approach to application management.Deploying your first app on KubernetesApplications need to be packaged into one of the supported container formats in order to be deployed on Kubernetes.You can create and manage a Deployment by using the Kubernetes command line interface, kubectl. kubectl uses the Kubernetes API to interact with the cluster. In this module, you'll learn the most common kubectl commands needed to create Deployments that run your applications on a Kubernetes cluster.When you create a Deployment, you'll need to specify the container image for your application and the number of replicas that you want to run. You can change that information later by updating your Deployment; Module 5 and Module 6 of the bootcamp discuss how you can scale and update your Deployments.For your first Deployment, you'll use a hello-node application packaged in a Docker container that uses NGINX to echo back all the requests. (If you didn't already try creating a hello-node application and deploying it using a container, you can do that first by following the instructions from the Hello Minikube tutorial.)You will need to have installed kubectl as well. If you need to install it, visit install tools.Now that you know what Deployments are, let's deploy our first app!kubectl basicsThe common format of a kubectl command is: kubectl action resource.This performs the specified action (like create, describe or delete) on the specified resource (like node or deployment. You can use --help after the subcommand to get additional info about possible parameters (for example: kubectl get nodes --help).Check that kubectl is configured to talk to your cluster, by running the kubectl version command.Check that kubectl is installed and that you can see both the client and the server versions.To view the nodes in the cluster, run the kubectl get nodes command.You see the available nodes. Later, Kubernetes will choose where to deploy our application based on Node available resources.Deploy an appLet’s deploy our first app on Kubernetes with the kubectl create deployment command. We need to provide the deployment name and app image location (include the full repository url for images hosted outside Docker Hub).kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 Great! You just deployed your first application by creating a deployment. This performed a few things for you:searched for", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1\n```\n\nUsing kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7381"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nUsing kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7382"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl action resource\n```\n\nUsing kubectl to Create a Deployment | This performs the specified action (like create, describe or delete) on the specified resource (like node or deployment. You can use --help after the subcommand to get additional info about possible p", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7383"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --help\n```\n\nUsing kubectl to Create a Deployment | Check that kubectl is configured to talk to your cluster, by running the kubectl version command.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7384"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\nUsing kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7385"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nUsing kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7386"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1\n```\n\nUsing kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7387"}
{"instruction": "Write a bash example for using kubectl to create a deployment", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\nUsing kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/", "id": "k8s_00599_code_7388"}
{"instruction": "What is the reference documentation for kubectl uncordon?", "response": "kubectl uncordonSynopsisMark node as schedulable.kubectl uncordon NODE Examples # Mark node \"foo\" as schedulable kubectl uncordon foo Options--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.-h, --helphelp for uncordon-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl - kubectl controls the Kubernetes cluster managerThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_uncordon/", "id": "k8s_00600"}
{"instruction": "Write a bash example for kubectl uncordon", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE\n```\n\nkubectl uncordon | Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_uncordon/", "id": "k8s_00600_code_7390"}
{"instruction": "Write a bash example for kubectl uncordon", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE\n```\n\nkubectl uncordon | Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_uncordon/", "id": "k8s_00600_code_7391"}
{"instruction": "What is the reference documentation for kubernetes metrics reference?", "response": "Kubernetes Metrics ReferenceDetails of the metric data that Kubernetes components export.Metrics (v1.34)This page details the metrics that different Kubernetes components export. You can query the metrics endpoint for these components using an HTTP scrape, and fetch the current metrics data in Prometheus format.List of Stable Kubernetes MetricsStable metrics observe strict API contracts and no labels can be added or removed from stable metrics during their lifetime.apiserver_admission_controller_admission_duration_secondsAdmission controller latency histogram in seconds, identified by name and broken out for each operation and API resource and type (validate or admit).Stability Level:STABLEType: HistogramLabels:nameoperationrejectedtypeapiserver_admission_step_admission_duration_secondsAdmission sub-step latency histogram in seconds, broken out for each operation and API resource and step type (validate or admit).Stability Level:STABLEType: HistogramLabels:operationrejectedtypeapiserver_admission_webhook_admission_duration_secondsAdmission webhook latency histogram in seconds, identified by name and broken out for each operation and API resource and type (validate or admit).Stability Level:STABLEType: HistogramLabels:nameoperationrejectedtypeapiserver_current_inflight_requestsMaximal number of currently used inflight request limit of this apiserver per request kind in last second.Stability Level:STABLEType: GaugeLabels:request_kindapiserver_longrunning_requestsGauge of all active long-running apiserver requests broken out by verb, group, version, resource, scope and component. Not all requests are tracked this way.Stability Level:STABLEType: GaugeLabels:componentgroupresourcescopesubresourceverbversionapiserver_request_duration_secondsResponse latency distribution in seconds for each verb, dry run value, group, version, resource, subresource, scope and component.Stability Level:STABLEType: HistogramLabels:componentdry_rungroupresourcescopesubresourceverbversionapiserver_request_totalCounter of apiserver requests broken out for each verb, dry run value, group, version, resource, scope, component, and HTTP response code.Stability Level:STABLEType: CounterLabels:codecomponentdry_rungroupresourcescopesubresourceverbversionapiserver_requested_deprecated_apisGauge of deprecated APIs that have been requested, broken out by API group, version, resource, subresource, and removed_release.Stability Level:STABLEType: GaugeLabels:groupremoved_releaseresourcesubresourceversionapiserver_response_sizesResponse size distribution in bytes for each group, version, verb, resource, subresource, scope and component.Stability Level:STABLEType: HistogramLabels:componentgroupresourcescopesubresourceverbversionapiserver_storage_objects[DEPRECATED, consider using apiserver_resource_objects instead] Number of stored objects at the time of last check split by kind. In case of a fetching error, the value will be -1.Stability Level:STABLEType: GaugeLabels:resourceDeprecated Versions:1.34.0apiserver_storage_size_bytesSize of the storage database file physically allocated in bytes.Stability Level:STABLEType: CustomLabels:storage_cluster_idcontainer_cpu_usage_seconds_totalCumulative cpu time consumed by the container in core-secondsStability Level:STABLEType: CustomLabels:containerpodnamespacecontainer_memory_working_set_bytesCurrent working set of the container in bytesStability Level:STABLEType: CustomLabels:containerpodnamespacecontainer_start_time_secondsStart time of the container since unix epoch in secondsStability Level:STABLEType: CustomLabels:containerpodnamespacecronjob_controller_job_creation_skew_duration_secondsTime between when a cronjob is scheduled to be run, and when the corresponding job is createdStability Level:STABLEType: Histogramjob_controller_job_pods_finished_totalThe number of finished Pods that are fully trackedStability Level:STABLEType: CounterLabels:completion_moderesultjob_controller_job_sync_duration_secondsThe time it took to ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/metrics/", "id": "k8s_00601"}
{"instruction": "How do you update api objects in place using kubectl patch in Kubernetes?", "response": "Update API Objects in Place Using kubectl patchUse kubectl patch to update Kubernetes API objects in place. Do a strategic merge patch or a JSON merge patch.This task shows how to use kubectl patch to update an API object in place. The exercises in this task demonstrate a strategic merge patch and a JSON merge patch.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Use a strategic merge patch to update a DeploymentHere's the configuration file for a Deployment that has two replicas. Each replica is a Pod that has one container:application/deployment-patch.yaml apiVersion: apps/v1 kind: Deployment metadata: name: patch-demo spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: patch-demo-ctr image: nginx tolerations: - effect: NoSchedule key: dedicated value: test-team Create the Deployment:kubectl apply -f https://k8s.io/examples/application/deployment-patch.yaml View the Pods associated with your Deployment:kubectl get pods The output shows that the Deployment has two Pods. The 1/1 indicates that each Pod has one container:NAME READY STATUS RESTARTS AGE patch-demo-28633765-670qr 1/1 Running 0 23s patch-demo-28633765-j5qs3 1/1 Running 0 23s Make a note of the names of the running Pods. Later, you will see that these Pods get terminated and replaced by new ones.At this point, each Pod has one Container that runs the nginx image. Now suppose you want each Pod to have two containers: one that runs nginx and one that runs redis.Create a file named patch-file.yaml that has this content:spec: template: spec: containers: - name: patch-demo-ctr-2 image: redis Patch your Deployment:kubectl patch deployment patch-demo --patch-file patch-file.yaml View the patched Deployment:kubectl get deployment patch-demo --output yaml The output shows that the PodSpec in the Deployment has two Containers:containers: - image: redis imagePullPolicy: Always name: patch-demo-ctr-2 ... - image: nginx imagePullPolicy: Always name: patch-demo-ctr ... View the Pods associated with your patched Deployment:kubectl get pods The output shows that the running Pods have different names from the Pods that were running previously. The Deployment terminated the old Pods and created two new Pods that comply with the updated Deployment spec. The 2/2 indicates that each Pod has two Containers:NAME READY STATUS RESTARTS AGE patch-demo-1081991389-2wrn5 2/2 Running 0 1m patch-demo-1081991389-jmg7b 2/2 Running 0 1m Take a closer look at one of the patch-demo Pods:kubectl get pod <your-pod-name> --output yaml The output shows that the Pod has two Containers: one running nginx and one running redis:containers: - image: redis ... - image: nginx ... Notes on the strategic merge patchThe patch you did in the preceding exercise is called a strategic merge patch. Notice that the patch did not replace the containers list. Instead it added a new Container to the list. In other words, the list in the patch was merged with the existing list. This is not always what happens when you use a strategic merge patch on a list. In some cases, the list is replaced, not merged.With a strategic merge patch, a list is either replaced or merged depending on its patch strategy. The patch strategy is specified by the value of the patchStrategy key in a field tag in the Kubernetes source code. For example, the Containers field of PodSpec struct has a patchStrategy of merge:type PodSpec struct { ... Containers []Container `json:\"containers\" patchStrategy:\"merge\" patchMergeKey:\"name\" ...` ... } You can also see the ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7394"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-patch.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7395"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7396"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has two Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7397"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <your-pod-name> --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the Pod has two Containers: one running nginx and one running redis:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7398"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7399"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has only one Toleration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7400"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --type merge --patch-file patch-file-2.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7401"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The containers list that you specified in the patch has only one Container. The output shows that your list of one Container replaced the existing containers list.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7402"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7403"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-retainkeys.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | At this point, the deployment is created and is using the RollingUpdate strategy.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7404"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-no-retainkeys.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | In the output, you can see that it is not possible to set type as Recreate when a value is defined for spec.strategy.rollingUpdate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7405"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-retainkeys.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | Examine the content of the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7406"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment retainkeys-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the strategy object in the Deployment does not contain the rollingUpdate key anymore:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7407"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\nkubectl patch deployment patch-demo --patch 'spec:\\n template:\\n  spec:\\n   containers:\\n   - name: patch-demo-ctr-2\\n     image: redis'\n\nkubectl patch deployment patch-demo --patch-file patch-file.json\nkubectl patch deployment patch-demo --patch '{\"spec\": {\"template\": {\"spec\": {\"containers\": [{\"name\": \"patch-demo-ctr-2\",\"image\": \"redis\"}]}}}}'\n```\n\nUpdate API Objects in Place Using kubectl patch | The flag --subresource=[subresource-name] is used with kubectl commands like get, patch, edit, apply and replace to fetch and update status, scale and resize subresource of the resources you specify.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7408"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7409"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7410"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | In the output, you can see that Deployment has two Pods. For example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7411"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":3}}'\n```\n\nUpdate API Objects in Place Using kubectl patch | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7412"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | In the output, you can see one new pod is created, so now you have 3 running pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7413"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7414"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7415"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      containers:\n      - name: patch-demo-ctr-2\n        image: redis\n```\n\nUpdate API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7416"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\ncontainers:\n- image: redis\n  imagePullPolicy: Always\n  name: patch-demo-ctr-2\n  ...\n- image: nginx\n  imagePullPolicy: Always\n  name: patch-demo-ctr\n  ...\n```\n\nUpdate API Objects in Place Using kubectl patch | View the Pods associated with your patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7417"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\n\"io.k8s.api.core.v1.PodSpec\": {\n    ...,\n    \"containers\": {\n        \"description\": \"List of containers belonging to the pod.  ....\"\n    },\n    \"x-kubernetes-patch-merge-key\": \"name\",\n    \"x-kubernetes-patch-strategy\": \"merge\"\n}\n```\n\nUpdate API Objects in Place Using kubectl patch | And you can see the patch strategy in the Kubernetes API documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7418"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      tolerations:\n      - effect: NoSchedule\n        key: disktype\n        value: ssd\n```\n\nUpdate API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7419"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- effect: NoSchedule\n  key: disktype\n  value: ssd\n```\n\nUpdate API Objects in Place Using kubectl patch | Notice that the tolerations list in the PodSpec was replaced, not merged. This is because the Tolerations field of PodSpec does not have a patchStrategy key in its field tag. So the strategic merge pa", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7420"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      containers:\n      - name: patch-demo-ctr-3\n        image: gcr.io/google-samples/hello-app:2.0\n```\n\nUpdate API Objects in Place Using kubectl patch | In your patch command, set type to merge:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7421"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - image: gcr.io/google-samples/hello-app:2.0\n    ...\n    name: patch-demo-ctr-3\n```\n\nUpdate API Objects in Place Using kubectl patch | List the running Pods:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7422"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7423"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    type: Recreate\n```\n\nUpdate API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7424"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    $retainKeys:\n    - type\n    type: Recreate\n```\n\nUpdate API Objects in Place Using kubectl patch | With this patch, we indicate that we want to retain only the type key of the strategy object. Thus, the rollingUpdate will be removed during the patch operation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7425"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    type: Recreate\n  template:\n```\n\nUpdate API Objects in Place Using kubectl patch | The patch you did in the preceding exercise is called a strategic merge patch with retainKeys strategy. This method introduces a new directive $retainKeys that has the following strategies:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7426"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\n\"io.k8s.api.apps.v1.DeploymentSpec\": {\n    ...,\n    \"strategy\": {\n        \"$ref\": \"#/definitions/io.k8s.api.apps.v1.DeploymentStrategy\",\n        \"description\": \"The deployment strategy to use to replace existing pods with new ones.\",\n        \"x-kubernetes-patch-strategy\": \"retainKeys\"\n    },\n    ....\n}\n```\n\nUpdate API Objects in Place Using kubectl patch | And you can see the retainKeys strategy in the Kubernetes API documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7427"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7428"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\n...\nspec:\n  replicas: 3\n  ...\nstatus:\n  ...\n  availableReplicas: 3\n  readyReplicas: 3\n  replicas: 3\n```\n\nUpdate API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7429"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-patch.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7430"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7431"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-patch.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7432"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7433"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has two Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7434"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <your-pod-name> --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the Pod has two Containers: one running nginx and one running redis:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7435"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7436"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has only one Toleration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7437"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --type merge --patch-file patch-file-2.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7438"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The containers list that you specified in the patch has only one Container. The output shows that your list of one Container replaced the existing containers list.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7439"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-retainkeys.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7440"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7441"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-retainkeys.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | At this point, the deployment is created and is using the RollingUpdate strategy.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7442"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-no-retainkeys.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | In the output, you can see that it is not possible to set type as Recreate when a value is defined for spec.strategy.rollingUpdate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7443"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-retainkeys.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | Examine the content of the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7444"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment retainkeys-demo --output yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | The output shows that the strategy object in the Deployment does not contain the rollingUpdate key anymore:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7445"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\nkubectl patch deployment patch-demo --patch 'spec:\\n template:\\n  spec:\\n   containers:\\n   - name: patch-demo-ctr-2\\n     image: redis'\n\nkubectl patch deployment patch-demo --patch-file patch-file.json\nkubectl patch deployment patch-demo --patch '{\"spec\": {\"template\": {\"spec\": {\"containers\": [{\"name\": \"patch-demo-ctr-2\",\"image\": \"redis\"}]}}}}'\n```\n\nUpdate API Objects in Place Using kubectl patch | The flag --subresource=[subresource-name] is used with kubectl commands like get, patch, edit, apply and replace to fetch and update status, scale and resize subresource of the resources you specify.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7446"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7447"}
{"instruction": "Write a yaml example for update api objects in place using kubectl patch", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nUpdate API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7448"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7449"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | In the output, you can see that Deployment has two Pods. For example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7450"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":3}}'\n```\n\nUpdate API Objects in Place Using kubectl patch | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7451"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\nUpdate API Objects in Place Using kubectl patch | In the output, you can see one new pod is created, so now you have 3 running pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7452"}
{"instruction": "Write a bash example for update api objects in place using kubectl patch", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\nUpdate API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/", "id": "k8s_00602_code_7453"}
{"instruction": "What is the reference documentation for kube-controller-manager?", "response": "kube-controller-managerSynopsisThe Kubernetes controller manager is a daemon that embeds the core control loops shipped with Kubernetes. In applications of robotics and automation, a control loop is a non-terminating loop that regulates the state of the system. In Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current state towards the desired state. Examples of controllers that ship with Kubernetes today are the replication controller, endpoints controller, namespace controller, and serviceaccounts controller.kube-controller-manager [flags] Options--allocate-node-cidrsShould CIDRs for Pods be allocated and set on the cloud provider. Requires --cluster-cidr.--allow-metric-labels stringToString Default: []The map from metric-label to value allow-list of this label. The key's format is <MetricName>,<LabelName>. The value's format is <allowed_value>,<allowed_value>...e.g. metric1,label1='v1,v2,v3', metric1,label2='v1,v2,v3' metric2,label1='v1,v2,v3'.--allow-metric-labels-manifest stringThe path to the manifest file that contains the allow-list mapping. The format of the file is the same as the flag --allow-metric-labels. Note that the flag --allow-metric-labels will override the manifest file.--attach-detach-reconcile-sync-period duration Default: 1m0sThe reconciler sync wait time between volume attach detach. This duration must be larger than one second, and increasing this value from the default may allow for volumes to be mismatched with pods.--authentication-kubeconfig stringkubeconfig file pointing at the 'core' kubernetes server with enough rights to create tokenreviews.authentication.k8s.io. This is optional. If empty, all token requests are considered to be anonymous and no client CA is looked up in the cluster.--authentication-skip-lookupIf false, the authentication-kubeconfig will be used to lookup missing authentication configuration from the cluster.--authentication-token-webhook-cache-ttl duration Default: 10sThe duration to cache responses from the webhook token authenticator.--authentication-tolerate-lookup-failureIf true, failures to look up missing authentication configuration from the cluster are not considered fatal. Note that this can result in authentication that treats all requests as anonymous.--authorization-always-allow-paths strings Default: \"/healthz,/readyz,/livez\"A list of HTTP paths to skip during authorization, i.e. these are authorized without contacting the 'core' kubernetes server.--authorization-kubeconfig stringkubeconfig file pointing at the 'core' kubernetes server with enough rights to create subjectaccessreviews.authorization.k8s.io. This is optional. If empty, all requests not skipped by authorization are forbidden.--authorization-webhook-cache-authorized-ttl duration Default: 10sThe duration to cache 'authorized' responses from the webhook authorizer.--authorization-webhook-cache-unauthorized-ttl duration Default: 10sThe duration to cache 'unauthorized' responses from the webhook authorizer.--bind-address string Default: 0.0.0.0The IP address on which to listen for the --secure-port port. The associated interface(s) must be reachable by the rest of the cluster, and by CLI/web clients. If blank or an unspecified address (0.0.0.0 or ::), all interfaces and IP address families will be used.--cert-dir stringThe directory where the TLS certs are located. If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.--cidr-allocator-type string Default: \"RangeAllocator\"Type of CIDR allocator to use--client-ca-file stringIf set, any request presenting a client certificate signed by one of the authorities in the client-ca-file is authenticated with an identity corresponding to the CommonName of the client certificate.--cloud-config stringThe path to the cloud provider configuration file. Empty string for no configuration file.--cloud-provider stringThe provider for cloud", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/", "id": "k8s_00603"}
{"instruction": "How do you assign pods to nodes in Kubernetes?", "response": "Assign Pods to NodesThis page shows how to assign a Kubernetes Pod to a particular node in a Kubernetes cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Add a label to a nodeList the nodes in your cluster, along with their labels:kubectl get nodes --show-labels The output is similar to this:NAME STATUS ROLES AGE VERSION LABELS worker0 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker0 worker1 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker1 worker2 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker2 Choose one of your nodes, and add a label to it:kubectl label nodes <your-node-name> disktype=ssd where <your-node-name> is the name of your chosen node.Verify that your chosen node has a disktype=ssd label:kubectl get nodes --show-labels The output is similar to this:NAME STATUS ROLES AGE VERSION LABELS worker0 Ready <none> 1d v1.13.0 ...,disktype=ssd,kubernetes.io/hostname=worker0 worker1 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker1 worker2 Ready <none> 1d v1.13.0 ...,kubernetes.io/hostname=worker2 In the preceding output, you can see that the worker0 node has a disktype=ssd label.Create a pod that gets scheduled to your chosen nodeThis pod configuration file describes a pod that has a node selector, disktype: ssd. This means that the pod will get scheduled on a node that has a disktype=ssd label.pods/pod-nginx.yaml apiVersion: v1 kind: Pod metadata: name: nginx labels: env: test spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent nodeSelector: disktype: ssd Use the configuration file to create a pod that will get scheduled on your chosen node:kubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml Verify that the pod is running on your chosen node:kubectl get pods --output=wide The output is similar to this:NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 Create a pod that gets scheduled to specific nodeYou can also schedule a pod to one specific node via setting nodeName.pods/pod-nginx-specific-node.yaml apiVersion: v1 kind: Pod metadata: name: nginx spec: nodeName: foo-node # schedule pod to specific node containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent Use the configuration file to create a pod that will get scheduled on foo-node only.What's nextLearn more about labels and selectors.Learn more about nodes.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7456"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\nAssign Pods to Nodes | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7457"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7458"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7459"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml\n```\n\nAssign Pods to Nodes | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7460"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAssign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7461"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7462"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7463"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7464"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7465"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\nAssign Pods to Nodes | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7466"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\nAssign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7467"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7468"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7469"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml\n```\n\nAssign Pods to Nodes | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7470"}
{"instruction": "Write a bash example for assign pods to nodes", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nAssign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7471"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-specific-node.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7472"}
{"instruction": "Write a yaml example for assign pods to nodes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\nAssign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/", "id": "k8s_00604_code_7473"}
{"instruction": "Explain the Kubernetes concept: Taints and Tolerations", "response": "Taints and TolerationsNode affinity is a property of Pods that attracts them to a set of nodes (either as a preference or a hard requirement). Taints are the opposite -- they allow a node to repel a set of pods.Tolerations are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints. Tolerations allow scheduling but don't guarantee scheduling: the scheduler also evaluates other parameters as part of its function.Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes. One or more taints are applied to a node; this marks that the node should not accept any pods that do not tolerate the taints.ConceptsYou add a taint to a node using kubectl taint. For example,kubectl taint nodes node1 key1=value1:NoSchedule places a taint on node node1. The taint has key key1, value value1, and taint effect NoSchedule. This means that no pod will be able to schedule onto node1 unless it has a matching toleration.To remove the taint added by the command above, you can run:kubectl taint nodes node1 key1=value1:NoSchedule- You specify a toleration for a pod in the PodSpec. Both of the following tolerations \"match\" the taint created by the kubectl taint line above, and thus a pod with either toleration would be able to schedule onto node1:tolerations: - key: \"key1\" operator: \"Equal\" value: \"value1\" effect: \"NoSchedule\" tolerations: - key: \"key1\" operator: \"Exists\" effect: \"NoSchedule\" The default Kubernetes scheduler takes taints and tolerations into account when selecting a node to run a particular Pod. However, if you manually specify the .spec.nodeName for a Pod, that action bypasses the scheduler; the Pod is then bound onto the node where you assigned it, even if there are NoSchedule taints on that node that you selected. If this happens and the node also has a NoExecute taint set, the kubelet will eject the Pod unless there is an appropriate tolerance set.Here's an example of a pod that has some tolerations defined:pods/pod-with-toleration.yaml apiVersion: v1 kind: Pod metadata: name: nginx labels: env: test spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent tolerations: - key: \"example-key\" operator: \"Exists\" effect: \"NoSchedule\" The default value for operator is Equal.A toleration \"matches\" a taint if the keys are the same and the effects are the same, and:the operator is Exists (in which case no value should be specified), orthe operator is Equal and the values should be equal.Note:There are two special cases:If the key is empty, then the operator must be Exists, which matches all keys and values. Note that the effect still needs to be matched at the same time.An empty effect matches all effects with key key1.The above example used the effect of NoSchedule. Alternatively, you can use the effect of PreferNoSchedule.The allowed values for the effect field are:NoExecuteThis affects pods that are already running on the node as follows:Pods that do not tolerate the taint are evicted immediatelyPods that tolerate the taint without specifying tolerationSeconds in their toleration specification remain bound foreverPods that tolerate the taint with a specified tolerationSeconds remain bound for the specified amount of time. After that time elapses, the node lifecycle controller evicts the Pods from the node.NoScheduleNo new Pods will be scheduled on the tainted node unless they have a matching toleration. Pods currently running on the node are not evicted.PreferNoSchedulePreferNoSchedule is a \"preference\" or \"soft\" version of NoSchedule. The control plane will try to avoid placing a Pod that does not tolerate the taint on the node, but it is not guaranteed.You can put multiple taints on the same node and multiple tolerations on the same pod. The way Kubernetes processes multiple taints and tolerations is like a filter: start with all of a node's taints, then ignore the ones for which the pod has a matching toleration; the remaining un-ignored taints have", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\n```\n\nTaints and Tolerations | places a taint on node node1. The taint has key key1, value value1, and taint effect NoSchedule. This means that no pod will be able to schedule onto node1 unless it has a matching toleration.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7475"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule-\n```\n\nTaints and Tolerations | You specify a toleration for a pod in the PodSpec. Both of the following tolerations \"match\" the taint created by the kubectl taint line above, and thus a pod with either toleration would be able to s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7476"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\nTaints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7477"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\nkubectl taint nodes node1 key1=value1:NoExecute\nkubectl taint nodes node1 key2=value2:NoSchedule\n```\n\nTaints and Tolerations | And a pod has two tolerations:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7478"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoSchedule\"\n```\n\nTaints and Tolerations | The default Kubernetes scheduler takes taints and tolerations into account when selecting a node to run a particular Pod. However, if you manually specify the .spec.nodeName for a Pod, that action byp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7479"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Exists\"\n  effect: \"NoSchedule\"\n```\n\nTaints and Tolerations | The default Kubernetes scheduler takes taints and tolerations into account when selecting a node to run a particular Pod. However, if you manually specify the .spec.nodeName for a Pod, that action byp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7480"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\nTaints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7481"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoSchedule\"\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoExecute\"\n```\n\nTaints and Tolerations | In this case, the pod will not be able to schedule onto the node, because there is no toleration matching the third taint. But it will be able to continue running if it is already running on the node", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7482"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoExecute\"\n  tolerationSeconds: 3600\n```\n\nTaints and Tolerations | means that if this pod is running and a matching taint is added to the node, then the pod will stay bound to the node for 3600 seconds, and then be evicted. If the taint is removed before that time, t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7483"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes nodename dedicated=groupName:NoSchedule\n```\n\nTaints and Tolerations | Nodes with Special Hardware: In a cluster where a small subset of nodes have specialized hardware (for example GPUs), it is desirable to keep pods that don't need the specialized hardware off of those", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7484"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes nodename special=true:NoSchedule\n```\n\nTaints and Tolerations | Taint based Evictions: A per-pod-configurable eviction behavior when there are node problems, which is described in the next section.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7485"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes nodename special=true:PreferNoSchedule\n```\n\nTaints and Tolerations | Taint based Evictions: A per-pod-configurable eviction behavior when there are node problems, which is described in the next section.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7486"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"node.kubernetes.io/unreachable\"\n  operator: \"Exists\"\n  effect: \"NoExecute\"\n  tolerationSeconds: 6000\n```\n\nTaints and Tolerations | Kubernetes automatically adds a toleration for node.kubernetes.io/not-ready and node.kubernetes.io/unreachable with tolerationSeconds=300, unless you, or a controller, set those tolerations explicitly", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7487"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\n```\n\nTaints and Tolerations | places a taint on node node1. The taint has key key1, value value1, and taint effect NoSchedule. This means that no pod will be able to schedule onto node1 unless it has a matching toleration.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7488"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule-\n```\n\nTaints and Tolerations | You specify a toleration for a pod in the PodSpec. Both of the following tolerations \"match\" the taint created by the kubectl taint line above, and thus a pod with either toleration would be able to s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7489"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-toleration.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\nTaints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7490"}
{"instruction": "Write a yaml example for taints and tolerations", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\nTaints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7491"}
{"instruction": "Write a bash example for taints and tolerations", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\nkubectl taint nodes node1 key1=value1:NoExecute\nkubectl taint nodes node1 key2=value2:NoSchedule\n```\n\nTaints and Tolerations | And a pod has two tolerations:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/", "id": "k8s_00605_code_7492"}
{"instruction": "What is the reference documentation for kubectl port-forward?", "response": "kubectl port-forwardSynopsisForward one or more local ports to a pod.Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.If there are multiple pods matching the criteria, a pod will be selected automatically. The forwarding session ends when the selected pod terminates, and a rerun of the command is needed to resume forwarding.kubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] Examples # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod kubectl port-forward pod/mypod 5000 6000 # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment kubectl port-forward deployment/mydeployment 5000 6000 # Listen on port 8443 locally, forwarding to the targetPort of the service's port named \"https\" in a pod selected by the service kubectl port-forward service/myservice 8443:https # Listen on port 8888 locally, forwarding to 5000 in the pod kubectl port-forward pod/mypod 8888:5000 # Listen on port 8888 on all addresses, forwarding to 5000 in the pod kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000 # Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000 # Listen on a random port locally, forwarding to 5000 in the pod kubectl port-forward pod/mypod :5000 Options--address strings Default: \"localhost\"Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of these addresses are available to bind.-h, --helphelp for port-forward--pod-running-timeout duration Default: 1m0sThe length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is runningParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--st", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_port-forward/", "id": "k8s_00606"}
{"instruction": "Write a bash example for kubectl port-forward", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]\n```\n\nkubectl port-forward | Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_port-forward/", "id": "k8s_00606_code_7494"}
{"instruction": "Write a bash example for kubectl port-forward", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]\n```\n\nkubectl port-forward | Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_port-forward/", "id": "k8s_00606_code_7495"}
{"instruction": "What is the reference documentation for mutatingadmissionpolicybinding v1alpha1?", "response": "MutatingAdmissionPolicyBinding v1alpha1MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources.apiVersion: admissionregistration.k8s.io/v1alpha1import \"k8s.io/api/admissionregistration/v1alpha1\"MutatingAdmissionPolicyBindingMutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators configure policies for clusters.For a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. Each evaluation is constrained by a runtime cost budget.Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.apiVersion: admissionregistration.k8s.io/v1alpha1kind: MutatingAdmissionPolicyBindingmetadata (ObjectMeta)Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.spec (MutatingAdmissionPolicyBindingSpec)Specification of the desired behavior of the MutatingAdmissionPolicyBinding.MutatingAdmissionPolicyBindingSpec is the specification of the MutatingAdmissionPolicyBinding.spec.matchResources (MatchResources)matchResources limits what resources match this binding and may be mutated by it. Note that if matchResources matches a resource, the resource must also match a policy's matchConstraints and matchConditions before the resource may be mutated. When matchResources is unset, it does not constrain resource matching, and only the policy's matchConstraints and matchConditions must match for the resource to be mutated. Additionally, matchResources.resourceRules are optional and do not constraint matching when unset. Note that this is differs from MutatingAdmissionPolicy matchConstraints, where resourceRules are required. The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. '*' matches CREATE, UPDATE and CONNECT.MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)spec.matchResources.excludeResourceRules ([]NamedRuleWithOperations)Atomic: will be replaced during a mergeExcludeResourceRules describes what operations on what resources/subresources the policy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.spec.matchResources.excludeResourceRules.apiGroups ([]string)Atomic: will be replaced during a mergeAPIGroups is the API groups the resources belong to. '' is all groups. If '' is present, the length of the slice must be one. Required.spec.matchResources.excludeResourceRules.apiVersions ([]string)Atomic: will be replaced during a mergeAPIVersions is the API versions the resources belong to. '' is all versions. If '' is present, the length of the slice must be one. Required.spec.matchResources.excludeResourceRules.operations ([]string)Atomic: will be replaced during a mergeOperations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.spec.matchResources.excludeResourceRules.resourceNames ([]string)Atomic: will be replaced during a mergeResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.spec.matchResources.excludeResourceRules.resources ([]string)Atomic: will be replaced during a mergeResources is a list of resources this rule applies to.For example: 'pods' means p", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/mutating-admission-policy-binding-v1alpha1/", "id": "k8s_00607"}
{"instruction": "Write a yaml example for mutatingadmissionpolicybinding v1alpha1", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\n```\n\nMutatingAdmissionPolicyBinding v1alpha1 | import \"k8s.io/api/admissionregistration/v1alpha1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/mutating-admission-policy-binding-v1alpha1/", "id": "k8s_00607_code_7497"}
{"instruction": "What is the reference documentation for quantity?", "response": "QuantityQuantity is a fixed-point representation of a number.import \"k8s.io/apimachinery/pkg/api/resource\"Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.The serialization format is: \\<quantity> ::= \\<signedNumber>\\<suffix> (Note that \\<suffix> may be empty, from the \"\" case in \\<decimalSI>.) \\<digit> ::= 0 | 1 | ... | 9 \\<digits> ::= \\<digit> | \\<digit>\\<digits> \\<number> ::= \\<digits> | \\<digits>.\\<digits> | \\<digits>. | .\\<digits> \\<sign> ::= \"+\" | \"-\" \\<signedNumber> ::= \\<number> | \\<sign>\\<number> \\<suffix> ::= \\<binarySI> | \\<decimalExponent> | \\<decimalSI> \\<binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) \\<decimalSI> ::= m | \"\" | k | M | G | T | P | E (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) \\<decimalExponent> ::= \"e\" \\<signedNumber> | \"E\" \\<signedNumber> No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.Before serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.The sign will be omitted unless the number is negative.Examples:1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/", "id": "k8s_00608"}
{"instruction": "Explain the Kubernetes concept: API Priority and Fairness", "response": "API Priority and FairnessFEATURE STATE: Kubernetes v1.29 [stable]Controlling the behavior of the Kubernetes API server in an overload situation is a key task for cluster administrators. The kube-apiserver has some controls available (i.e. the --max-requests-inflight and --max-mutating-requests-inflight command-line flags) to limit the amount of outstanding work that will be accepted, preventing a flood of inbound requests from overloading and potentially crashing the API server, but these flags are not enough to ensure that the most important requests get through in a period of high traffic.The API Priority and Fairness feature (APF) is an alternative that improves upon aforementioned max-inflight limitations. APF classifies and isolates requests in a more fine-grained way. It also introduces a limited amount of queuing, so that no requests are rejected in cases of very brief bursts. Requests are dispatched from queues using a fair queuing technique so that, for example, a poorly-behaved controller need not starve others (even at the same priority level).This feature is designed to work well with standard controllers, which use informers and react to failures of API requests with exponential back-off, and other clients that also work this way.Caution:Some requests classified as \"long-running\"—such as remote command execution or log tailing—are not subject to the API Priority and Fairness filter. This is also true for the --max-requests-inflight flag without the API Priority and Fairness feature enabled. API Priority and Fairness does apply to watch requests. When API Priority and Fairness is disabled, watch requests are not subject to the --max-requests-inflight limit.Enabling/Disabling API Priority and FairnessThe API Priority and Fairness feature is controlled by a command-line flag and is enabled by default. See Options for a general explanation of the available kube-apiserver command-line options and how to enable and disable them. The name of the command-line option for APF is \"--enable-priority-and-fairness\". This feature also involves an API Group with: (a) a stable v1 version, introduced in 1.29, and enabled by default (b) a v1beta3 version, enabled by default, and deprecated in v1.29. You can disable the API group beta version v1beta3 by adding the following command-line flags to your kube-apiserver invocation:kube-apiserver \\ --runtime-config=flowcontrol.apiserver.k8s.io/v1beta3=false \\ # …and other flags as usual The command-line flag --enable-priority-and-fairness=false will disable the API Priority and Fairness feature.Recursive server scenariosAPI Priority and Fairness must be used carefully in recursive server scenarios. These are scenarios in which some server A, while serving a request, issues a subsidiary request to some server B. Perhaps server B might even make a further subsidiary call back to server A. In situations where Priority and Fairness control is applied to both the original request and some subsidiary ones(s), no matter how deep in the recursion, there is a danger of priority inversions and/or deadlocks.One example of recursion is when the kube-apiserver issues an admission webhook call to server B, and while serving that call, server B makes a further subsidiary request back to the kube-apiserver. Another example of recursion is when an APIService object directs the kube-apiserver to delegate requests about a certain API group to a custom external server B (this is one of the things called \"aggregation\").When the original request is known to belong to a certain priority level, and the subsidiary controlled requests are classified to higher priority levels, this is one possible solution. When the original requests can belong to any priority level, the subsidiary controlled requests have to be exempt from Priority and Fairness limitation. One way to do that is with the objects that configure classification and handling, discussed below. Another way is to disable Priority and Fairness on server B e", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\nAPI Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7500"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\nAPI Priority and Fairness |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7501"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\nAPI Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7502"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\nAPI Priority and Fairness |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7503"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\npriority-and-fairness/health-for-strangers.yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\nAPI Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7504"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\nAPI Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7505"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\npriority-and-fairness/list-events-default-service-account.yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\nAPI Priority and Fairness |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7506"}
{"instruction": "Write a yaml example for api priority and fairness", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\nAPI Priority and Fairness |", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/flow-control/", "id": "k8s_00609_code_7507"}
{"instruction": "How do you change the access mode of a persistentvolume to readwriteoncepod in Kubernetes?", "response": "Change the Access Mode of a PersistentVolume to ReadWriteOncePodThis page shows how to change the access mode on an existing PersistentVolume to use ReadWriteOncePod.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.22.To check the version, enter kubectl version.Note:The ReadWriteOncePod access mode graduated to stable in the Kubernetes v1.29 release. If you are running a version of Kubernetes older than v1.29, you might need to enable a feature gate. Check the documentation for your version of Kubernetes.Note:The ReadWriteOncePod access mode is only supported for CSI volumes. To use this volume access mode you will need to update the following CSI sidecars to these versions or greater:csi-provisioner:v3.0.0+csi-attacher:v3.3.0+csi-resizer:v1.3.0+Why should I use ReadWriteOncePod?Prior to Kubernetes v1.22, the ReadWriteOnce access mode was commonly used to restrict PersistentVolume access for workloads that required single-writer access to storage. However, this access mode had a limitation: it restricted volume access to a single node, allowing multiple pods on the same node to read from and write to the same volume simultaneously. This could pose a risk for applications that demand strict single-writer access for data safety.If ensuring single-writer access is critical for your workloads, consider migrating your volumes to ReadWriteOncePod.Migrating existing PersistentVolumesIf you have existing PersistentVolumes, they can be migrated to use ReadWriteOncePod. Only migrations from ReadWriteOnce to ReadWriteOncePod are supported.In this example, there is already a ReadWriteOnce \"cat-pictures-pvc\" PersistentVolumeClaim that is bound to a \"cat-pictures-pv\" PersistentVolume, and a \"cat-pictures-writer\" Deployment that uses this PersistentVolumeClaim.Note:If your storage plugin supports Dynamic provisioning, the \"cat-picutres-pv\" will be created for you, but its name may differ. To get your PersistentVolume's name run:kubectl get pvc cat-pictures-pvc -o jsonpath='{.spec.volumeName}' And you can view the PVC before you make changes. Either view the manifest locally, or run kubectl get pvc <name-of-pvc> -o yaml. The output is similar to:# cat-pictures-pvc.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: cat-pictures-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi Here's an example Deployment that relies on that PersistentVolumeClaim:# cat-pictures-writer-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: cat-pictures-writer spec: replicas: 3 selector: matchLabels: app: cat-pictures-writer template: metadata: labels: app: cat-pictures-writer spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 volumeMounts: - name: cat-pictures mountPath: /mnt volumes: - name: cat-pictures persistentVolumeClaim: claimName: cat-pictures-pvc readOnly: false As a first step, you need to edit your PersistentVolume's spec.persistentVolumeReclaimPolicy and set it to Retain. This ensures your PersistentVolume will not be deleted when you delete the corresponding PersistentVolumeClaim:kubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc cat-pictures-pvc -o jsonpath='{.spec.volumeName}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | And you can view the PVC before you make changes. Either view the manifest locally, or run kubectl get pvc <name-of-pvc> -o yaml. The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7509"}
{"instruction": "Write a yaml example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-pvc.yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: cat-pictures-pvc\nspec:\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7510"}
{"instruction": "Write a yaml example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-writer-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: cat-pictures-writer\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cat-pictures-writer\n  template:\n    metadata:\n      labels:\n        app: cat-pictures-writer\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n        volumeMounts:\n        - name: cat-pictures\n          mountPath: /mnt\n      volumes:\n      - name: cat-pictures\n        persistentVolumeClaim:\n          claimName: cat-pictures-pvc\n          readOnly: false\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | As a first step, you need to edit your PersistentVolume's spec.persistentVolumeReclaimPolicy and set it to Retain. This ensures your PersistentVolume will not be deleted when you delete the correspond", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7511"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to stop any workloads that are using the PersistentVolumeClaim bound to the PersistentVolume you want to migrate, and then delete the PersistentVolumeClaim. Avoid making any other change", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7512"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=0 deployment cat-pictures-writer\nkubectl delete pvc cat-pictures-pvc\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"claimRef\":{\"uid\":\"\"}}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | After that, replace the PersistentVolume's list of valid access modes to be (only) ReadWriteOncePod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7513"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"accessModes\":[\"ReadWriteOncePod\"]}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to modify your PersistentVolumeClaim to set ReadWriteOncePod as the only access mode. You should also set the PersistentVolumeClaim's spec.volumeName to the name of your PersistentVolume", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7514"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Delete\"}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7515"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc <name-of-pvc> -o yaml\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7516"}
{"instruction": "Write a yaml example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-pvc.yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: cat-pictures-pvc\nspec:\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7517"}
{"instruction": "Write a yaml example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-writer-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: cat-pictures-writer\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cat-pictures-writer\n  template:\n    metadata:\n      labels:\n        app: cat-pictures-writer\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n        volumeMounts:\n        - name: cat-pictures\n          mountPath: /mnt\n      volumes:\n      - name: cat-pictures\n        persistentVolumeClaim:\n          claimName: cat-pictures-pvc\n          readOnly: false\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | As a first step, you need to edit your PersistentVolume's spec.persistentVolumeReclaimPolicy and set it to Retain. This ensures your PersistentVolume will not be deleted when you delete the correspond", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7518"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc cat-pictures-pvc -o jsonpath='{.spec.volumeName}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | And you can view the PVC before you make changes. Either view the manifest locally, or run kubectl get pvc <name-of-pvc> -o yaml. The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7519"}
{"instruction": "Write a yaml example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-pvc.yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: cat-pictures-pvc\nspec:\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7520"}
{"instruction": "Write a yaml example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-writer-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: cat-pictures-writer\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cat-pictures-writer\n  template:\n    metadata:\n      labels:\n        app: cat-pictures-writer\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n        volumeMounts:\n        - name: cat-pictures\n          mountPath: /mnt\n      volumes:\n      - name: cat-pictures\n        persistentVolumeClaim:\n          claimName: cat-pictures-pvc\n          readOnly: false\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | As a first step, you need to edit your PersistentVolume's spec.persistentVolumeReclaimPolicy and set it to Retain. This ensures your PersistentVolume will not be deleted when you delete the correspond", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7521"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to stop any workloads that are using the PersistentVolumeClaim bound to the PersistentVolume you want to migrate, and then delete the PersistentVolumeClaim. Avoid making any other change", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7522"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=0 deployment cat-pictures-writer\nkubectl delete pvc cat-pictures-pvc\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"claimRef\":{\"uid\":\"\"}}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | After that, replace the PersistentVolume's list of valid access modes to be (only) ReadWriteOncePod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7523"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"accessModes\":[\"ReadWriteOncePod\"]}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to modify your PersistentVolumeClaim to set ReadWriteOncePod as the only access mode. You should also set the PersistentVolumeClaim's spec.volumeName to the name of your PersistentVolume", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7524"}
{"instruction": "Write a bash example for change the access mode of a persistentvolume to readwriteoncepod", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Delete\"}}'\n```\n\nChange the Access Mode of a PersistentVolume to ReadWriteOncePod |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/change-pv-access-mode-readwriteoncepod/", "id": "k8s_00610_code_7525"}
{"instruction": "How do you resize cpu and memory resources assigned to containers in Kubernetes?", "response": "Resize CPU and Memory Resources assigned to ContainersFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: true)This page explains how to change the CPU and memory resource requests and limits assigned to a container without recreating the Pod.Traditionally, changing a Pod's resource requirements necessitated deleting the existing Pod and creating a replacement, often managed by a workload controller. In-place Pod Resize allows changing the CPU/memory allocation of container(s) within a running Pod while potentially avoiding application disruption.Key Concepts:Desired Resources: A container's spec.containers[*].resources represent the desired resources for the container, and are mutable for CPU and memory.Actual Resources: The status.containerStatuses[*].resources field reflects the resources currently configured for a running container. For containers that haven't started or were restarted, it reflects the resources allocated upon their", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611"}
{"instruction": "Write a yaml example for resize cpu and memory resources assigned to containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nResize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7527"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod-resize.yaml\n```\n\nResize CPU and Memory Resources assigned to Containers | This pod starts in the Guaranteed QoS class. Verify its initial state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7528"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"cpu\":\"800m\"}, \"limits\":{\"cpu\":\"800m\"}}}]}}'\n\n# Alternative methods:\n# kubectl -n qos-example edit pod resize-demo --subresource resize\n# kubectl -n qos-example apply -f <updated-manifest> --subresource resize --server-side\n```\n\nResize CPU and Memory Resources assigned to Containers | Check the pod status again after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7529"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml --namespace=qos-example\n```\n\nResize CPU and Memory Resources assigned to Containers | You should see:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7530"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"memory\":\"300Mi\"}, \"limits\":{\"memory\":\"300Mi\"}}}]}}'\n```\n\nResize CPU and Memory Resources assigned to Containers | Check the pod status shortly after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7531"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\nResize CPU and Memory Resources assigned to Containers | You should now observe:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7532"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\nResize CPU and Memory Resources assigned to Containers | You'll see changes indicating the problem:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7533"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod resize-demo\n```\n\nResize CPU and Memory Resources assigned to Containers | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7534"}
{"instruction": "Write a yaml example for resize cpu and memory resources assigned to containers", "response": "Here's a yaml example:\n\n```yaml\nresizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired\n    - resourceName: memory\n      restartPolicy: RestartContainer\n```\n\nResize CPU and Memory Resources assigned to Containers | If resizePolicy[*].restartPolicy is not specified for a resource, it defaults to NotRequired.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7535"}
{"instruction": "Write a yaml example for resize cpu and memory resources assigned to containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nResize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7536"}
{"instruction": "Write a yaml example for resize cpu and memory resources assigned to containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-resize.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nResize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7537"}
{"instruction": "Write a yaml example for resize cpu and memory resources assigned to containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nResize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7538"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod-resize.yaml\n```\n\nResize CPU and Memory Resources assigned to Containers | This pod starts in the Guaranteed QoS class. Verify its initial state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7539"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"cpu\":\"800m\"}, \"limits\":{\"cpu\":\"800m\"}}}]}}'\n\n# Alternative methods:\n# kubectl -n qos-example edit pod resize-demo --subresource resize\n# kubectl -n qos-example apply -f <updated-manifest> --subresource resize --server-side\n```\n\nResize CPU and Memory Resources assigned to Containers | Check the pod status again after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7540"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml --namespace=qos-example\n```\n\nResize CPU and Memory Resources assigned to Containers | You should see:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7541"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"memory\":\"300Mi\"}, \"limits\":{\"memory\":\"300Mi\"}}}]}}'\n```\n\nResize CPU and Memory Resources assigned to Containers | Check the pod status shortly after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7542"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\nResize CPU and Memory Resources assigned to Containers | You should now observe:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7543"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\nResize CPU and Memory Resources assigned to Containers | You'll see changes indicating the problem:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7544"}
{"instruction": "Write a bash example for resize cpu and memory resources assigned to containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod resize-demo\n```\n\nResize CPU and Memory Resources assigned to Containers | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/", "id": "k8s_00611_code_7545"}
{"instruction": "What is the reference documentation for limitrange?", "response": "LimitRangeLimitRange sets resource usage limits for each kind of resource in a Namespace.apiVersion: v1import \"k8s.io/api/core/v1\"LimitRangeLimitRange sets resource usage limits for each kind of resource in a Namespace.apiVersion: v1kind: LimitRangemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (LimitRangeSpec)Spec defines the limits enforced. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusLimitRangeSpecLimitRangeSpec defines a min/max usage limit for resources that match on kind.limits ([]LimitRangeItem), requiredAtomic: will be replaced during a mergeLimits is the list of LimitRangeItem objects that are enforced.LimitRangeItem defines a min/max usage limit for any resource that matches on kind.limits.type (string), requiredType of resource that this limit applies to.limits.default (map[string]Quantity)Default resource requirement limit value by resource name if resource limit is omitted.limits.defaultRequest (map[string]Quantity)DefaultRequest is the default resource requirement request value by resource name if resource request is omitted.limits.max (map[string]Quantity)Max usage constraints on this kind by resource name.limits.maxLimitRequestRatio (map[string]Quantity)MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource.limits.min (map[string]Quantity)Min usage constraints on this kind by resource name.LimitRangeListLimitRangeList is a list of LimitRange items.apiVersion: v1kind: LimitRangeListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems ([]LimitRange), requiredItems is a list of LimitRange objects. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/Operationsget read the specified LimitRangeHTTP RequestGET /api/v1/namespaces/{namespace}/limitranges/{name}Parametersname (in path): string, requiredname of the LimitRangenamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (LimitRange): OK401: Unauthorizedlist list or watch objects of kind LimitRangeHTTP RequestGET /api/v1/namespaces/{namespace}/limitrangesParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (LimitRangeList): OK401: Unauthorizedlist list or watch objects of kind LimitRangeHTTP RequestGET /api/v1/limitrangesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (LimitRangeList): OK401: Unauthorizedcreate create a LimitRangeHTTP RequestPOST /api/v1/namespaces/{namespace}/limitrangesParametersnamespace (in path): string, requirednamespacebody: LimitRange, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in quer", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/limit-range-v1/", "id": "k8s_00612"}
{"instruction": "What is the reference documentation for tokenreview?", "response": "TokenReviewTokenReview attempts to authenticate a token to a known user.apiVersion: authentication.k8s.io/v1import \"k8s.io/api/authentication/v1\"TokenReviewTokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.apiVersion: authentication.k8s.io/v1kind: TokenReviewmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (TokenReviewSpec), requiredSpec holds information about the request being evaluatedstatus (TokenReviewStatus)Status is filled in by the server and indicates whether the request can be authenticated.TokenReviewSpecTokenReviewSpec is a description of the token authentication request.audiences ([]string)Atomic: will be replaced during a mergeAudiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.token (string)Token is the opaque bearer token.TokenReviewStatusTokenReviewStatus is the result of the token authentication request.audiences ([]string)Atomic: will be replaced during a mergeAudiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.authenticated (boolean)Authenticated indicates that the token was associated with a known user.error (string)Error indicates that the token couldn't be checkeduser (UserInfo)User is the UserInfo associated with the provided token.UserInfo holds the information about the user needed to implement the user.Info interface.user.extra (map[string][]string)Any additional information provided by the authenticator.user.groups ([]string)Atomic: will be replaced during a mergeThe names of groups this user is a part of.user.uid (string)A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.user.username (string)The name that uniquely identifies this user among all active users.Operationscreate create a TokenReviewHTTP RequestPOST /apis/authentication.k8s.io/v1/tokenreviewsParametersbody: TokenReview, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (TokenReview): OK201 (TokenReview): Created202 (TokenReview): Accepted401: UnauthorizedThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/", "id": "k8s_00613"}
{"instruction": "Write a yaml example for tokenreview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\nTokenReview | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/", "id": "k8s_00613_code_7548"}
{"instruction": "What is the reference documentation for kube-scheduler configuration (v1)?", "response": "kube-scheduler Configuration (v1)Resource TypesDefaultPreemptionArgsInterPodAffinityArgsKubeSchedulerConfigurationNodeAffinityArgsNodeResourcesBalancedAllocationArgsNodeResourcesFitArgsPodTopologySpreadArgsVolumeBindingArgsClientConnectionConfigurationAppears in:KubeSchedulerConfigurationClientConnectionConfiguration contains details for constructing a client.FieldDescriptionkubeconfig [Required]stringkubeconfig is the path to a KubeConfig file.acceptContentTypes [Required]stringacceptContentTypes defines the Accept header sent by clients when connecting to a server, overriding the default value of 'application/json'. This field will control all connections to the server used by a particular client.contentType [Required]stringcontentType is the content type used when sending data to the server from this client.qps [Required]float32qps controls the number of queries per second allowed for this connection.burst [Required]int32burst allows extra queries to accumulate when a client is exceeding its rate.DebuggingConfigurationAppears in:KubeSchedulerConfigurationDebuggingConfiguration holds configuration for Debugging related features.FieldDescriptionenableProfiling [Required]boolenableProfiling enables profiling via web interface host:port/debug/pprof/enableContentionProfiling [Required]boolenableContentionProfiling enables block profiling, if enableProfiling is true.LeaderElectionConfigurationAppears in:KubeSchedulerConfigurationLeaderElectionConfiguration defines the configuration of leader election clients for components that can run with leader election enabled.FieldDescriptionleaderElect [Required]boolleaderElect enables a leader election client to gain leadership before executing the main loop. Enable this when running replicated components for high availability.leaseDuration [Required]meta/v1.DurationleaseDuration is the duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled.renewDeadline [Required]meta/v1.DurationrenewDeadline is the interval between attempts by the acting master to renew a leadership slot before it stops leading. This must be less than or equal to the lease duration. This is only applicable if leader election is enabled.retryPeriod [Required]meta/v1.DurationretryPeriod is the duration the clients should wait between attempting acquisition and renewal of a leadership. This is only applicable if leader election is enabled.resourceLock [Required]stringresourceLock indicates the resource object type that will be used to lock during leader election cycles.resourceName [Required]stringresourceName indicates the name of resource object that will be used to lock during leader election cycles.resourceNamespace [Required]stringresourceName indicates the namespace of resource object that will be used to lock during leader election cycles.DefaultPreemptionArgsDefaultPreemptionArgs holds arguments used to configure the DefaultPreemption plugin.FieldDescriptionapiVersionstringkubescheduler.config.k8s.io/v1kindstringDefaultPreemptionArgsminCandidateNodesPercentage [Required]int32MinCandidateNodesPercentage is the minimum number of candidates to shortlist when dry running preemption as a percentage of number of nodes. Must be in the range [0, 100]. Defaults to 10% of the cluster size if unspecified.minCandidateNodesAbsolute [Required]int32MinCandidateNodesAbsolute is the absolute minimum number of candidates to shortlist. The likely number of candidates enumerated for dry running preemption is given by the formula: numCandidates = max(numNodes * minCandidateNodesPercentage, minCandidateNodesAbsolute) We say \"likely\" because there are other factors such as PDB violations that play a role in the number of candidates shortlisted. Must be at least 0 nodes. De", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kube-scheduler-config.v1/", "id": "k8s_00614"}
{"instruction": "Explain configuring each kubelet in your cluster using kubeadm in Kubernetes", "response": "Configuring each kubelet in your cluster using kubeadmNote: Dockershim has been removed from the Kubernetes project as of release 1.24. Read the Dockershim Removal FAQ for further details.FEATURE STATE: Kubernetes v1.11 [stable]The lifecycle of the kubeadm CLI tool is decoupled from the kubelet, which is a daemon that runs on each node within the Kubernetes cluster. The kubeadm CLI tool is executed by the user when Kubernetes is initialized or upgraded, whereas the kubelet is always running in the background.Since the kubelet is a daemon, it needs to be maintained by some kind of an init system or service manager. When the kubelet is installed using DEBs or RPMs, systemd is configured to manage the kubelet. You can use a different service manager instead, but you need to configure it manually.Some kubelet configuration details need to be the same across all kubelets involved in the cluster, while other configuration aspects need to be set on a per-kubelet basis to accommodate the different characteristics of a given machine (such as OS, storage, and networking). You can manage the configuration of your kubelets manually, but kubeadm now provides a KubeletConfiguration API type for managing your kubelet configurations centrally.Kubelet configuration patternsThe following sections describe patterns to kubelet configuration that are simplified by using kubeadm, rather than managing the kubelet configuration for each Node manually.Propagating cluster-level configuration to each kubeletYou can provide the kubelet with default values to be used by kubeadm init and kubeadm join commands. Interesting examples include using a different container runtime or setting the default subnet used by services.If you want your services to use the subnet 10.96.0.0/12 as the default for services, you can pass the --service-cidr parameter to kubeadm:kubeadm init --service-cidr 10.96.0.0/12 Virtual IPs for services are now allocated from this subnet. You also need to set the DNS address used by the kubelet, using the --cluster-dns flag. This setting needs to be the same for every kubelet on every manager and Node in the cluster. The kubelet provides a versioned, structured API object that can configure most parameters in the kubelet and push out this configuration to each running kubelet in the cluster. This object is called KubeletConfiguration. The KubeletConfiguration allows the user to specify flags such as the cluster DNS IP addresses expressed as a list of values to a camelCased key, illustrated by the following example:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration clusterDNS: - 10.96.0.10 For more details on the KubeletConfiguration have a look at this section.Providing instance-specific configuration detailsSome hosts require specific kubelet configurations due to differences in hardware, operating system, networking, or other host-specific parameters. The following list provides a few examples.The path to the DNS resolution file, as specified by the --resolv-conf kubelet configuration flag, may differ among operating systems, or depending on whether you are using systemd-resolved. If this path is wrong, DNS resolution will fail on the Node whose kubelet is configured incorrectly.The Node API object .metadata.name is set to the machine's hostname by default, unless you are using a cloud provider. You can use the --hostname-override flag to override the default behavior if you need to specify a Node name different from the machine's hostname.Currently, the kubelet cannot automatically detect the cgroup driver used by the container runtime, but the value of --cgroup-driver must match the cgroup driver used by the container runtime to ensure the health of the kubelet.To specify the container runtime you must set its endpoint with the --container-runtime-endpoint=<path> flag.The recommended way of applying such instance-specific configuration is by using KubeletConfiguration patches.Configure kubelets using kubeadmIt is pos", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615"}
{"instruction": "Write a yaml example for configuring each kubelet in your cluster using kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n- 10.96.0.10\n```\n\nConfiguring each kubelet in your cluster using kubeadm | For more details on the KubeletConfiguration have a look at this section.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615_code_7551"}
{"instruction": "Write a bash example for configuring each kubelet in your cluster using kubeadm", "response": "Here's a bash example:\n\n```bash\nkubeadm init --service-cidr 10.96.0.0/12\n```\n\nConfiguring each kubelet in your cluster using kubeadm | Virtual IPs for services are now allocated from this subnet. You also need to set the DNS address used by the kubelet, using the --cluster-dns flag. This setting needs to be the same for every kubelet", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615_code_7552"}
{"instruction": "Write a yaml example for configuring each kubelet in your cluster using kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n- 10.96.0.10\n```\n\nConfiguring each kubelet in your cluster using kubeadm | For more details on the KubeletConfiguration have a look at this section.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615_code_7553"}
{"instruction": "Write a bash example for configuring each kubelet in your cluster using kubeadm", "response": "Here's a bash example:\n\n```bash\nKUBELET_KUBEADM_ARGS=\"--flag1=value1 --flag2=value2 ...\"\n```\n\nConfiguring each kubelet in your cluster using kubeadm | In addition to the flags used when starting the kubelet, the file also contains dynamic parameters such as the cgroup driver.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615_code_7554"}
{"instruction": "Write a bash example for configuring each kubelet in your cluster using kubeadm", "response": "Here's a bash example:\n\n```bash\nsystemctl daemon-reload && systemctl restart kubelet\n```\n\nConfiguring each kubelet in your cluster using kubeadm | If the reload and restart are successful, the normal kubeadm init workflow continues.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615_code_7555"}
{"instruction": "Write a bash example for configuring each kubelet in your cluster using kubeadm", "response": "Here's a bash example:\n\n```bash\nsystemctl daemon-reload && systemctl restart kubelet\n```\n\nConfiguring each kubelet in your cluster using kubeadm | After the kubelet loads the new configuration, kubeadm writes the /etc/kubernetes/bootstrap-kubelet.conf KubeConfig file, which contains a CA certificate and Bootstrap Token. These are used by the kub", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615_code_7556"}
{"instruction": "Write a yaml example for configuring each kubelet in your cluster using kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n- 10.96.0.10\n```\n\nConfiguring each kubelet in your cluster using kubeadm | For more details on the KubeletConfiguration have a look at this section.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/", "id": "k8s_00615_code_7557"}
{"instruction": "Explain content organization in Kubernetes", "response": "Content organizationThis site uses Hugo. In Hugo, content organization is a core concept.Note:Hugo Tip: Start Hugo with hugo server --navigateToChanged for content edit-sessions.Page ListsPage OrderThe documentation side menu, the documentation page browser etc. are listed using Hugo's default sort order, which sorts by weight (from 1), date (newest first), and finally by the link title.Given that, if you want to move a page or a section up, set a weight in the page's front matter:title: My Page weight: 10 Note:For page weights, it can be smart not to use 1, 2, 3 ..., but some other interval, say 10, 20, 30... This allows you to insert pages where you want later. Additionally, each weight within the same directory (section) should not be overlapped with the other weights. This makes sure that content is always organized correctly, especially in localized content.Documentation Main MenuThe Documentation main menu is built from the sections below docs/ with the main_menu flag set in front matter of the _index.md section content file:main_menu: true Note that the link title is fetched from the page's linkTitle, so if you want it to be something different than the title, change it in the content file:main_menu: true title: Page Title linkTitle: Title used in links Note:The above needs to be done per language. If you don't see your section in the menu, it is probably because it is not identified as a section by Hugo. Create a _index.md content file in the section folder.Documentation Side MenuThe documentation side-bar menu is built from the current section tree starting below docs/.It will show all sections and their pages.If you don't want to list a section or page, set the toc_hide flag to true in front matter:toc_hide: true When you navigate to a section that has content, the specific section or page (e.g. _index.md) is shown. Else, the first page inside that section is shown.Documentation BrowserThe page browser on the documentation home page is built using all the sections and pages that are directly below the docs section.If you don't want to list a section or page, set the toc_hide flag to true in front matter:toc_hide: true The Main MenuThe site links in the top-right menu -- and also in the footer -- are built by page-lookups. This is to make sure that the page actually exists. So, if the case-studies section does not exist in a site (language), it will not be linked to.Page BundlesIn addition to standalone content pages (Markdown files), Hugo supports Page Bundles.One example is Custom Hugo Shortcodes. It is considered a leaf bundle. Everything below the directory, including the index.md, will be part of the bundle. This also includes page-relative links, images that can be processed etc.:en/docs/home/contribute/includes ├── example1.md ├── example2.md ├── index.md └── podtemplate.json Another widely used example is the includes bundle. It sets headless: true in front matter, which means that it does not get its own URL. It is only used in other pages.en/includes ├── default-storage-class-prereqs.md ├── index.md ├── partner-script.js ├── partner-style.css ├── task-tutorial-prereqs.md ├── user-guide-content-moved.md └── user-guide-migration-notice.md Some important notes to the files in the bundles:For translated bundles, any missing non-content files will be inherited from languages above. This avoids duplication.All the files in a bundle are what Hugo calls Resources and you can provide metadata per language, such as parameters and title, even if it does not supports front matter (YAML files etc.). See Page Resources Metadata.The value you get from .RelPermalink of a Resource is page-relative. See Permalinks.StylesThe SASS source of the stylesheets for this site is stored in assets/sass and is automatically built by Hugo.What's nextLearn about custom Hugo shortcodesLearn about the Style guideLearn about the Content guide", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/content-organization/", "id": "k8s_00616"}
{"instruction": "Write a yaml example for content organization", "response": "Here's a yaml example:\n\n```yaml\ntitle: My Page\nweight: 10\n```\n\nContent organization | The Documentation main menu is built from the sections below docs/ with the main_menu flag set in front matter of the _index.md section content file:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/content-organization/", "id": "k8s_00616_code_7559"}
{"instruction": "Write a yaml example for content organization", "response": "Here's a yaml example:\n\n```yaml\nmain_menu: true\ntitle: Page Title\nlinkTitle: Title used in links\n```\n\nContent organization | The documentation side-bar menu is built from the current section tree starting below docs/.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/content-organization/", "id": "k8s_00616_code_7560"}
{"instruction": "Write a bash example for content organization", "response": "Here's a bash example:\n\n```bash\nen/docs/home/contribute/includes\n├── example1.md\n├── example2.md\n├── index.md\n└── podtemplate.json\n```\n\nContent organization | Another widely used example is the includes bundle. It sets headless: true in front matter, which means that it does not get its own URL. It is only used in other pages.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/content-organization/", "id": "k8s_00616_code_7561"}
{"instruction": "Write a bash example for content organization", "response": "Here's a bash example:\n\n```bash\nen/includes\n├── default-storage-class-prereqs.md\n├── index.md\n├── partner-script.js\n├── partner-style.css\n├── task-tutorial-prereqs.md\n├── user-guide-content-moved.md\n└── user-guide-migration-notice.md\n```\n\nContent organization | Some important notes to the files in the bundles:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/content-organization/", "id": "k8s_00616_code_7562"}
{"instruction": "Explain the Kubernetes concept: Concepts", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Concepts1: Overview1.1: Kubernetes Components1.2: Objects In Kubernetes1.2.1: Kubernetes Object Management1.2.2: Object Names and IDs1.2.3: Labels and Selectors1.2.4: Namespaces1.2.5: Annotations1.2.6: Field Selectors1.2.7: Finalizers1.2.8: Owners and Dependents1.2.9: Recommended Labels1.3: The Kubernetes API2: Cluster Architecture2.1: Nodes2.2: Communication between Nodes and the Control Plane2.3: Controllers2.4: Leases2.5: Cloud Controller Manager2.6: About cgroup v22.7: Kubernetes Self-Healing2.8: Container Runtime Interface (CRI)2.9: Garbage Collection2.10: Mixed Version Proxy3: Containers3.1: Images3.2: Container Environment3.3: Runtime Class3.4: Container Lifecycle Hooks4: Workloads4.1: Pods4.1.1: Pod Lifecycle4.1.2: Init Containers4.1.3: Sidecar Containers4.1.4: Ephemeral Containers4.1.5: Disruptions4.1.6: Pod Hostname4.1.7: Pod Quality of Service Classes4.1.8: User Namespaces4.1.9: Downward API4.2: Workload Management4.2.1: Deployments4.2.2: ReplicaSet4.2.3: StatefulSets4.2.4: DaemonSet4.2.5: Jobs4.2.6: Automatic Cleanup for Finished Jobs4.2.7: CronJob4.2.8: ReplicationController4.3: Autoscaling Workloads4.4: Managing Workloads5: Services, Load Balancing, and Networking5.1: Service5.2: Ingress5.3: Ingress Controllers5.4: Gateway API5.5: EndpointSlices5.6: Network Policies5.7: DNS for Services and Pods5.8: IPv4/IPv6 dual-stack5.9: Topology Aware Routing5.10: Networking on Windows5.11: Service ClusterIP allocation5.12: Service Internal Traffic Policy6: Storage6.1: Volumes6.2: Persistent Volumes6.3: Projected Volumes6.4: Ephemeral Volumes6.5: Storage Classes6.6: Volume Attributes Classes6.7: Dynamic Volume Provisioning6.8: Volume Snapshots6.9: Volume Snapshot Classes6.10: CSI Volume Cloning6.11: Storage Capacity6.12: Node-specific Volume Limits6.13: Volume Health Monitoring6.14: Windows Storage7: Configuration7.1: Configuration Best Practices7.2: ConfigMaps7.3: Secrets7.4: Liveness, Readiness, and Startup Probes7.5: Resource Management for Pods and Containers7.6: Organizing Cluster Access Using kubeconfig Files7.7: Resource Management for Windows nodes8: Security8.1: Cloud Native Security and Kubernetes8.2: Pod Security Standards8.3: Pod Security Admission8.4: Service Accounts8.5: Pod Security Policies8.6: Security For Linux Nodes8.7: Security For Windows Nodes8.8: Controlling Access to the Kubernetes API8.9: Role Based Access Control Good Practices8.10: Good practices for Kubernetes Secrets8.11: Multi-tenancy8.12: Hardening Guide - Authentication Mechanisms8.13: Hardening Guide - Scheduler Configuration8.14: Kubernetes API Server Bypass Risks8.15: Linux kernel security constraints for Pods and containers8.16: Security Checklist8.17: Application Security Checklist9: Policies9.1: Limit Ranges9.2: Resource Quotas9.3: Process ID Limits And Reservations9.4: Node Resource Managers10: Scheduling, Preemption and Eviction10.1: Kubernetes Scheduler10.2: Assigning Pods to Nodes10.3: Pod Overhead10.4: Pod Scheduling Readiness10.5: Pod Topology Spread Constraints10.6: Taints and Tolerations10.7: Scheduling Framework10.8: Dynamic Resource Allocation10.9: Scheduler Performance Tuning10.10: Resource Bin Packing10.11: Pod Priority and Preemption10.12: Node-pressure Eviction10.13: API-initiated Eviction11: Cluster Administration11.1: Node Shutdowns11.2: Swap memory management11.3: Node Autoscaling11.4: Certificates11.5: Cluster Networking11.6: Admission Webhook Good Practices11.7: Good practices for Dynamic Resource Allocation as a Cluster Admin11.8: Logging Architecture11.9: Compatibility Version For Kubernetes Control Plane Components11.10: Metrics For Kubernetes System Components11.11: Metrics for Kubernetes Object States11.12: System Logs11.13: Traces For Kubernetes System Components11.14: Proxies in Kubernetes11.15: API Priority and Fairness11.16: Installing Addons11.17: Coordinated Leader Election12: Windows in Kubernet", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1.2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7564"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n1.2 - Objects In Kubernetes | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7565"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image nginx\n```\n\n1.2.1 - Kubernetes Object Management | Advantages compared to object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7566"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nginx.yaml\n```\n\n1.2.1 - Kubernetes Object Management | Delete the objects defined in two configuration files:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7567"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f nginx.yaml -f redis.yaml\n```\n\n1.2.1 - Kubernetes Object Management | Update the objects defined in a configuration file by overwriting the live configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7568"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f nginx.yaml\n```\n\n1.2.1 - Kubernetes Object Management | Advantages compared to imperative commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7569"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f configs/\nkubectl apply -f configs/\n```\n\n1.2.1 - Kubernetes Object Management | Recursively process directories:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7570"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl diff -R -f configs/\nkubectl apply -R -f configs/\n```\n\n1.2.1 - Kubernetes Object Management | Advantages compared to imperative object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7571"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.2 - Object Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7572"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.3 - Labels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7573"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\n1.2.3 - Labels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7574"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\n1.2.3 - Labels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7575"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\n1.2.3 - Labels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7576"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\n1.2.3 - Labels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7577"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\n1.2.3 - Labels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7578"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\n1.2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7579"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\n1.2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7580"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\n1.2.3 - Labels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7581"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\n1.2.3 - Labels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7582"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\n1.2.4 - Namespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7583"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\n1.2.4 - Namespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7584"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\n1.2.4 - Namespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7585"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.5 - Annotations | Field selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7586"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector status.phase=Running\n```\n\n1.2.6 - Field Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7587"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress --field-selector foo.bar=baz\n```\n\n1.2.6 - Field Selectors | All custom resource types support the metadata.name and metadata.namespace fields.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7588"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get services  --all-namespaces --field-selector metadata.namespace!=default\n```\n\n1.2.6 - Field Selectors | As with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7589"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always\n```\n\n1.2.6 - Field Selectors | You can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7590"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default\n```\n\n1.2.6 - Field Selectors | Finalizers are namespaced keys that tell Kubernetes to wait until specific conditions are met before it fully deletes resources that are marked for deletion. Finalizers alert controllers to clean up r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7591"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\n1.2.9 - Recommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7592"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7593"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n1.2.9 - Recommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7594"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7595"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7596"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7597"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7598"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl cordon $NODENAME\n```\n\n2.1 - Nodes | See Safely Drain a Node for more details.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7599"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\n2.1 - Nodes | See Node Status for more details.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7600"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease -l apiserver.kubernetes.io/identity=kube-apiserver\n```\n\n2.4 - Leases | The SHA256 hash used in the lease name is based on the OS hostname as seen by that API server. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instanc", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7601"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease apiserver-07a5ea9b9b072c4a5f3d1c3702 -o yaml\n```\n\n2.4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7602"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\n2.4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7603"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\n2.5 - Cloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7604"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry <name> \\\n  --docker-server=<docker-registry-server> \\\n  --docker-username=<docker-user> \\\n  --docker-password=<docker-password> \\\n  --docker-email=<docker-email>\n```\n\n3.1 - Images | If you already have a Docker credentials file then, rather than using the above command, you can import the credentials file as a Kubernetes Secret. Create a Secret based on existing Docker credential", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7605"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: foo\n  namespace: awesomeapps\nspec:\n  containers:\n    - name: foo\n      image: janedoe/awesomeapp:v1\n  imagePullSecrets:\n    - name: myregistrykey\nEOF\n\ncat <<EOF >> ./kustomization.yaml\nresources:\n- pod.yaml\nEOF\n```\n\n3.1 - Images | This needs to be done for each Pod that is using a private registry.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7606"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# RuntimeClass is defined in the node.k8s.io API group\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  # The name the RuntimeClass will be referenced by.\n  # RuntimeClass is a non-namespaced resource.\n  name: myclass \n# The name of the corresponding CRI configuration\nhandler: myconfiguration\n```\n\n3.3 - Runtime Class | The name of a RuntimeClass object must be a valid DNS subdomain name.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7607"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  runtimeClassName: myclass\n  # ...\n```\n\n3.3 - Runtime Class | This will instruct the kubelet to use the named RuntimeClass to run this pod. If the named RuntimeClass does not exist, or the CRI cannot run the corresponding handler, the pod will enter the Failed t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7608"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n4.1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7609"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml\n```\n\n4.1 - Pods | Pods are generally not created directly and are created using workload resources. See Working with Pods for more information on how Pods are used with workload resources.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7610"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\n4.1 - Pods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7611"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\n4.1.1 - Pod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7612"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\n4.1.1 - Pod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7613"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\n4.1.1 - Pod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7614"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\n4.1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7615"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\n4.1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7616"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\n4.1.1 - Pod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7617"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\n4.1.2 - Init Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7618"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7619"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7620"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7621"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs myapp-pod -c init-myservice # Inspect the first init container\nkubectl logs myapp-pod -c init-mydb      # Inspect the second init container\n```\n\n4.1.2 - Init Containers | At this point, those init containers will be waiting to discover Services named mydb and myservice.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7622"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\n4.1.2 - Init Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7623"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f services.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7624"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7625"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7626"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7627"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n4.1.6 - Pod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7628"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n4.1.6 - Pod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7629"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\n4.1.8 - User Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7630"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7631"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml\n```\n\n4.2.1 - Deployments | Run kubectl get deployments to check if the Deployment was created.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7632"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1\n```\n\n4.2.1 - Deployments | or use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7633"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n4.2.1 - Deployments | where deployment/nginx-deployment indicates the Deployment, nginx indicates the Container the update will take place and nginx:1.16.1 indicates the new image and its tag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7634"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7635"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7636"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7637"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.161\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7638"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7639"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7640"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7641"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment --revision=2\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7642"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7643"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment --to-revision=2\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7644"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7645"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7646"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=10\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7647"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment/nginx-deployment --min=10 --max=15 --cpu-percent=80\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7648"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:sometag\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7649"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7650"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7651"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7652"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7653"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7654"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --watch\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7655"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7656"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment/nginx-deployment -p '{\"spec\":{\"progressDeadlineSeconds\":600}}'\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7657"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7658"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7659"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\n4.2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7660"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\n4.2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7661"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\n4.2.1 - Deployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7662"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7663"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n4.2.2 - ReplicaSet | You can then get the current ReplicaSets deployed:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7664"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe rs/frontend\n```\n\n4.2.2 - ReplicaSet | And you will see output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7665"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods frontend-gbgfx -o yaml\n```\n\n4.2.2 - ReplicaSet | The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7666"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\n4.2.2 - ReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7667"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n4.2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7668"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n4.2.2 - ReplicaSet | The new Pods will be acquired by the ReplicaSet, and then immediately terminated as the ReplicaSet would be over its desired count.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7669"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n4.2.2 - ReplicaSet | And then create the ReplicaSet however:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7670"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n4.2.2 - ReplicaSet | You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the number of its new Pods and the original matches its desired count. As fetching the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7671"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Foreground\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n4.2.2 - ReplicaSet | You can delete a ReplicaSet without affecting any of its Pods using kubectl delete with the --cascade=orphan option. When using the REST API or the client-go library, you must set propagationPolicy to", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7672"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Orphan\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n4.2.2 - ReplicaSet | Once the original is deleted, you can create a new ReplicaSet to replace it. As long as the old and new .spec.selector are the same, then the new one will adopt the old Pods. However, it will not make", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7673"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7674"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/hpa-rs.yaml\n```\n\n4.2.2 - ReplicaSet | Alternatively, you can use the kubectl autoscale command to accomplish the same (and it's easier!)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7675"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50\n```\n\n4.2.2 - ReplicaSet | Deployment is an object which can own ReplicaSets and update them and their Pods via declarative, server-side rolling updates. While ReplicaSets can be used independently, today they're mainly used by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7676"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n4.2.3 - StatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7677"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\n4.2.3 - StatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7678"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\n4.2.3 - StatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7679"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\n4.2.3 - StatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7680"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n4.2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7681"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\n4.2.4 - DaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7682"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n4.2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7683"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/job.yaml\n```\n\n4.2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7684"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\n4.2.5 - Jobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7685"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n4.2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7686"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get -o yaml job job-backoff-limit-per-index-example\n```\n\n4.2.5 - Jobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7687"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n4.2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7688"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7689"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7690"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7691"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get job myjob -o yaml\n```\n\n4.2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7692"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\n4.2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7693"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":true}}'\n```\n\n4.2.5 - Jobs | Resume a suspended Job:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7694"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":false}}'\n```\n\n4.2.5 - Jobs | The Job's status can be used to determine if a Job is suspended or has been suspended in the past:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7695"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n4.2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7696"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\n4.2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7697"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/myjob\n```\n\n4.2.5 - Jobs | The last four events, particularly the \"Suspended\" and \"Resumed\" events, are directly a result of toggling the .spec.suspend field. In the time between these two events, we see that no Pods were creat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7698"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get job old -o yaml\n```\n\n4.2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7699"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n4.2.5 - Jobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7700"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n4.2.5 - Jobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7701"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\n4.2.5 - Jobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7702"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n4.2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7703"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\n4.2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7704"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n4.2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7705"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n4.2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7706"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/replication.yaml\n```\n\n4.2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7707"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe replicationcontrollers/nginx\n```\n\n4.2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7708"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7709"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4.4 - Managing Workloads | The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7710"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \\\n  -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4.4 - Managing Workloads | It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same direct", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7711"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4.4 - Managing Workloads | If you need to define more manifests, such as adding a ConfigMap, you can do that too.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7712"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4.4 - Managing Workloads | In the case of two resources, you can specify both resources on the command line using the resource/name syntax:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7713"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/my-nginx services/my-nginx-svc\n```\n\n4.4 - Managing Workloads | For larger numbers of resources, you'll find it easier to specify the selector (label query) specified using -l or --selector, to filter resources by their labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7714"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,services -l app=nginx\n```\n\n4.4 - Managing Workloads | Because kubectl outputs resource names in the same syntax it accepts, you can chain operations using $() or xargs:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7715"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ )\nkubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ | xargs -i kubectl get '{}'\n```\n\n4.4 - Managing Workloads | The output might be similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7716"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development\n```\n\n4.4 - Managing Workloads | Instead, specify the --recursive or -R command line argument along with the --filename/-f argument:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7717"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development --recursive\n```\n\n4.4 - Managing Workloads | The --recursive argument works with any operation that accepts the --filename/-f argument such as: kubectl create, kubectl get, kubectl delete, kubectl describe, or even kubectl rollout.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7718"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/namespaces -f project/k8s/development --recursive\n```\n\n4.4 - Managing Workloads | If you're interested in learning more about kubectl, go ahead and read Command line tool (kubectl).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7719"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-nginx --image=nginx:1.14.2\n```\n\n4.4 - Managing Workloads | Ensure that there is 1 replica:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7720"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas 1 deployments/my-nginx --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\": 1}}'\n```\n\n4.4 - Managing Workloads | and allow Kubernetes to add more temporary replicas during a rollout, by setting a surge maximum of 100%:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7721"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch --type='merge' -p '{\"spec\":{\"strategy\":{\"rollingUpdate\":{\"maxSurge\": \"100%\" }}}}'\n```\n\n4.4 - Managing Workloads | To update to version 1.16.1, change .spec.template.spec.containers[0].image from nginx:1.14.2 to nginx:1.16.1 using kubectl edit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7722"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n# Change the manifest to use the newer container image, then save your changes\n```\n\n4.4 - Managing Workloads | That's it! The Deployment will declaratively update the deployed nginx application progressively behind the scene. It ensures that only a certain number of old replicas may be down while they are bein", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7723"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-deployment.yaml\n\n# wait for rollout to finish\nkubectl rollout status deployment/my-deployment --timeout 10m # 10 minute timeout\n```\n\n4.4 - Managing Workloads | or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7724"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f backing-stateful-component.yaml\n\n# don't wait for rollout to finish, just check the status\nkubectl rollout status statefulsets/backing-stateful-component --watch=false\n```\n\n4.4 - Managing Workloads | You can also pause, resume or cancel a rollout. Visit kubectl rollout to learn more.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7725"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods my-nginx-v4-9gw19 description='my frontend running nginx'\nkubectl get pods my-nginx-v4-9gw19 -o yaml\n```\n\n4.4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7726"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: pod\nmetadata:\n  annotations:\n    description: my frontend running nginx\n...\n```\n\n4.4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7727"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/my-nginx --replicas=1\n```\n\n4.4 - Managing Workloads | Now you only have one pod managed by the deployment.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7728"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n4.4 - Managing Workloads | To have the system automatically choose the number of nginx replicas as needed, ranging from 1 to 3, do:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7729"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4.4 - Managing Workloads | To learn more about the underlying mechanism, read server-side apply.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7730"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n```\n\n4.4 - Managing Workloads | This is equivalent to first get the resource, edit it in text editor, and then apply the resource with the updated version:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7731"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment my-nginx -o yaml > /tmp/nginx.yaml\nvi /tmp/nginx.yaml\n# do some edit, and then save the file\n\nkubectl apply -f /tmp/nginx.yaml\ndeployment.apps/my-nginx configured\n\nrm /tmp/nginx.yaml\n```\n\n4.4 - Managing Workloads | This allows you to do more significant changes more easily. Note that you can specify the editor with your EDITOR or KUBE_EDITOR environment variables.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7732"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force\n```\n\n4.4 - Managing Workloads | The Kubernetes network model is built out of several pieces:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7733"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n5.1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7734"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\n5.1 - Service | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7735"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n5.1 - Service | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7736"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\n5.1 - Service | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7737"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\n5.1 - Service | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7738"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\n5.1 - Service | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7739"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\n5.1 - Service | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7740"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\n5.1 - Service | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7741"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\n5.1 - Service | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7742"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7743"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n5.2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7744"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\n5.2 - Ingress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7745"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7746"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n5.2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7747"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\n5.2 - Ingress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7748"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\n5.2 - Ingress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7749"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n5.2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7750"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n5.2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7751"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\n5.2 - Ingress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7752"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n5.2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7753"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress simple-fanout-example\n```\n\n5.2 - Ingress | The Ingress controller provisions an implementation-specific load balancer that satisfies the Ingress, as long as the Services (service1, service2) exist. When it has done so, you can see the address", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7754"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7755"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n5.2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7756"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\n5.2 - Ingress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7757"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7758"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n5.2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7759"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit ingress test\n```\n\n5.2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7760"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n5.2 - Ingress | You can achieve the same outcome by invoking kubectl replace -f on a modified Ingress YAML file.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7761"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\n5.4 - Gateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7762"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\n5.4 - Gateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7763"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\n5.4 - Gateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7764"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\n5.4 - Gateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7765"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\n5.4 - Gateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7766"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\n5.5 - EndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7767"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n5.6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7768"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7769"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7770"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7771"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7772"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7773"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n5.6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7774"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl label namespace frontend namespace=frontend\nkubectl label namespace backend namespace=backend\n```\n\n5.6 - Network Policies | Add the labels under namespaceSelector in your NetworkPolicy document. For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7775"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\n5.6 - Network Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7776"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n5.7 - DNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7777"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\n5.7 - DNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7778"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n5.7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7779"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dns-example -- cat /etc/resolv.conf\n```\n\n5.7 - DNS for Services and Pods | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7780"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7781"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7782"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7783"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7784"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n5.8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7785"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n5.8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7786"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7787"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n5.8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7788"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\n5.8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7789"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\n5.9 - Topology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7790"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\n5.11 - Service ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7791"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\n5.12 - Service Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7792"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\n6.1 - Volumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7793"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\n6.1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7794"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\n6.1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7795"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\n6.1 - Volumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7796"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\n6.1 - Volumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7797"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\n6.1 - Volumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7798"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\n6.1 - Volumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7799"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n6.1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7800"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\n6.1 - Volumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7801"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\n6.1 - Volumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7802"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\n6.1 - Volumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7803"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\n6.1 - Volumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7804"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\n6.1 - Volumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7805"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n6.1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7806"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc hostpath\nName:          hostpath\nNamespace:     default\nStorageClass:  example-hostpath\nStatus:        Terminating\nVolume:\nLabels:        <none>\nAnnotations:   volume.beta.kubernetes.io/storage-class=example-hostpath\n               volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath\nFinalizers:    [kubernetes.io/pvc-protection]\n...\n```\n\n6.2 - Persistent Volumes | You can see that a PV is protected when the PV's status is Terminating and the Finalizers list includes kubernetes.io/pv-protection too:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7807"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv task-pv-volume\nName:            task-pv-volume\nLabels:          type=local\nAnnotations:     <none>\nFinalizers:      [kubernetes.io/pv-protection]\nStorageClass:    standard\nStatus:          Terminating\nClaim:\nReclaim Policy:  Delete\nAccess Modes:    RWO\nCapacity:        1Gi\nMessage:\nSource:\n    Type:          HostPath (bare host directory volume)\n    Path:          /tmp/data\n    HostPathType:\nEvents:            <none>\n```\n\n6.2 - Persistent Volumes | When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource. The reclaim policy for a PersistentVolume tells the cluster what to do with", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7808"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\n6.2 - Persistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7809"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nName:            pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nLabels:          <none>\nAnnotations:     kubernetes.io/createdby: vsphere-volume-dynamic-provisioner\n                 pv.kubernetes.io/bound-by-controller: yes\n                 pv.kubernetes.io/provisioned-by: kubernetes.io/vsphere-volume\nFinalizers:      [kubernetes.io/pv-protection kubernetes.io/pv-controller]\nStorageClass:    vcp-sc\nStatus:          Bound\nClaim:           default/vcp-pvc-1\nReclaim Policy:  Delete\nAccess Modes:    RWO\nVolumeMode:      Filesystem\nCapacity:        1Gi\nNode Affinity:   <none>\nMessage:\nSource:\n    Type:               vSphereVolume (a Persistent Disk resource in vSphere)\n    VolumePath:         [vsanDatastore] d49c4a62-166f-ce12-c464-020077ba5d46/kubernetes-dynamic-pvc-74a498d6-3929-47e8-8c02-078c1ece4d78.vmdk\n    FSType:             ext4\n    StoragePolicyName:  vSAN Default Storage Policy\nEvents:                 <none>\n```\n\n6.2 - Persistent Volumes | The finalizer external-provisioner.volume.kubernetes.io/finalizer is added for CSI volumes. The following is an example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7810"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\n6.2 - Persistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7811"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\n6.2 - Persistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7812"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n6.2 - Persistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7813"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\n6.2 - Persistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7814"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\n6.2 - Persistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7815"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\n6.2 - Persistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7816"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7817"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7818"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7819"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7820"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7821"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7822"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\n6.2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7823"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\n6.2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7824"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7825"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7826"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n6.3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7827"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n6.3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7828"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n6.3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7829"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\n6.4 - Ephemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7830"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\n6.4 - Ephemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7831"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n6.5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7832"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n6.5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7833"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n6.5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7834"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n6.5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7835"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n6.5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7836"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n6.5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7837"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\n6.5 - Storage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7838"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\n6.5 - Storage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7839"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n6.5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7840"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\n6.5 - Storage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7841"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n6.5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7842"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7843"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7844"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\n6.6 - Volume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7845"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\n6.6 - Volume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7846"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\n6.6 - Volume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7847"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\n6.6 - Volume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7848"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\n6.7 - Dynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7849"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\n6.7 - Dynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7850"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\n6.7 - Dynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7851"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\n6.8 - Volume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7852"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\n6.8 - Volume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7853"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\n6.8 - Volume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7854"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n6.8 - Volume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7855"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n6.8 - Volume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7856"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n6.9 - Volume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7857"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n6.9 - Volume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7858"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\n6.10 - CSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7859"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\n6.12 - Node-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7860"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\n7.2 - ConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7861"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n7.2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7862"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\n7.2 - ConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7863"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\n7.2 - ConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7864"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myconfigmap.yaml\n```\n\n7.2 - ConfigMaps | The following Pod consumes the content of the ConfigMap as environment variables:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7865"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n7.2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7866"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f env-configmap.yaml\n```\n\n7.2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7867"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/ env-configmap\n```\n\n7.2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7868"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\n7.2 - ConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7869"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\n7.2 - ConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7870"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n7.3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7871"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic empty-secret\nkubectl get secret empty-secret\n```\n\n7.3 - Secrets | The output looks like:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7872"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n7.3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7873"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n7.3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7874"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry secret-tiger-docker \\\n  --docker-email=tiger@acme.example \\\n  --docker-username=tiger \\\n  --docker-password=pass1234 \\\n  --docker-server=my-registry.example:5000\n```\n\n7.3 - Secrets | This command creates a Secret of type kubernetes.io/dockerconfigjson.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7875"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret-tiger-docker -o jsonpath='{.data.*}' | base64 -d\n```\n\n7.3 - Secrets | The output is equivalent to the following JSON document (which is also a valid Docker configuration file):", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7876"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n7.3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7877"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n7.3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7878"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n7.3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7879"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls my-tls-secret \\\n  --cert=path/to/cert/file \\\n  --key=path/to/key/file\n```\n\n7.3 - Secrets | The public/private key pair must exist before hand. The public key certificate for --cert must be .PEM encoded and must match the given private key for --key.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7880"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n7.3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7881"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n7.3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7882"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n7.3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7883"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\n7.3 - Secrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7884"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\n7.5 - Resource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7885"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n7.5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7886"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\n7.5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7887"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\n7.5 - Resource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7888"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod frontend | grep -A 9999999999 Events\n```\n\n7.5 - Resource Management for Pods and Containers | In the preceding example, the Pod named \"frontend\" fails to be scheduled due to insufficient CPU resource on any node. Similar error messages can also suggest failure due to insufficient memory (PodEx", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7889"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes e2e-test-node-pool-4lw4\n```\n\n7.5 - Resource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7890"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod simmemleak-hra99\n```\n\n7.5 - Resource Management for Pods and Containers | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7891"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\n7.6 - Organizing Cluster Access Using kubeconfig Files | The KUBECONFIG environment variable holds a list of kubeconfig files. For Linux and Mac, the list is colon-delimited. For Windows, the list is semicolon-delimited. The KUBECONFIG environment variable", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7892"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\n7.6 - Organizing Cluster Access Using kubeconfig Files | This page outlines the differences in how resources are managed between Linux and Windows.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7893"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\n8.4 - Service Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7894"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\n8.13 - Hardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7895"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n9.1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7896"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7897"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7898"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7899"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota.yaml\n```\n\n9.2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7900"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7901"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7902"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./high-priority-pod.yaml\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"high\" priority quota, pods-high, has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7903"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Operators can use CrossNamespacePodAffinity quota scope to limit which namespaces are allowed to have pods with affinity terms that cross namespaces. Specifically, it controls which pods are allowed t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7904"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\n9.2 - Resource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7905"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\n9.2 - Resource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7906"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7907"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota-vac.yaml\n```\n\n9.2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7908"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7909"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7910"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./gold-vac-pvc.yaml\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"gold\" volume attributes class quota, pvcs-gold has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7911"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Once the PVC is bound, it is allowed to modify the desired volume attributes class. Let's change it to \"silver\" with kubectl patch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7912"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"silver\"}}'\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"silver\" volume attributes class quota, pvcs-silver has changed, pvcs-copper is unchanged, and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7913"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Let's change it to \"copper\" with kubectl patch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7914"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"copper\"}}'\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"copper\" volume attributes class quota, pvcs-copper has changed, pvcs-silver and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7915"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Print the manifest of the PVC using the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7916"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc gold-vac-pvc -o yaml\n```\n\n9.2 - Resource Quotas | It might show the following output:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7917"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\n9.2 - Resource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7918"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | When allocating compute resources, each container may specify a request and a limit value for either CPU or memory. The quota can be configured to quota either value.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7919"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7920"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > compute-resources.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: compute-resources\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: \"1Gi\"\n    limits.cpu: \"2\"\n    limits.memory: \"2Gi\"\n    requests.nvidia.com/gpu: 4\nEOF\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7921"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./compute-resources.yaml --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7922"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > object-counts.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-counts\nspec:\n  hard:\n    configmaps: \"10\"\n    persistentvolumeclaims: \"4\"\n    pods: \"4\"\n    replicationcontrollers: \"20\"\n    secrets: \"10\"\n    services: \"10\"\n    services.loadbalancers: \"2\"\nEOF\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7923"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./object-counts.yaml --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7924"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get quota --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7925"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota compute-resources --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7926"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota object-counts --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7927"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7928"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create quota test --hard=count/deployments.apps=2,count/replicasets.apps=4,count/pods=3,count/secrets=4 --namespace=myspace\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7929"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx --namespace=myspace --replicas=2\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7930"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota --namespace=myspace\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7931"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\n9.2 - Resource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7932"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n9.2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7933"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/policy/priority-class-resourcequota.yaml -n kube-system\n```\n\n9.2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7934"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7935"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7936"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: foo-scheduler\n    pluginConfig:\n      - name: NodeAffinity\n        args:\n          addedAffinity:\n            requiredDuringSchedulingIgnoredDuringExecution:\n              nodeSelectorTerms:\n              - matchExpressions:\n                - key: scheduler-profile\n                  operator: In\n                  values:\n                  - foo\n```\n\n10.2 - Assigning Pods to Nodes | The addedAffinity is applied to all Pods that set .spec.schedulerName to foo-scheduler, in addition to the NodeAffinity specified in the PodSpec. That is, in order to match the Pod, nodes need to sati", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7937"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7938"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: application-server\n...\nspec:\n  template:\n    spec:\n      affinity:\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - database\n            topologyKey: topology.kubernetes.io/zone\n            # Only Pods from a given rollout are taken into consideration when calculating pod affinity.\n            # If you update the Deployment, the replacement Pods follow their own affinity rules\n            # (if there are any defined in the new Pod template)\n            matchLabelKeys:\n            - pod-template-hash\n```\n\n10.2 - Assigning Pods to Nodes | The mismatchLabelKeys field is a beta-level field and is enabled by default in Kubernetes 1.34. When you want to disable it, you have to disable it explicitly via the MatchLabelKeysInPodAffinity featu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7939"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    # Assume that all relevant Pods have a \"tenant\" label set\n    tenant: tenant-a\n...\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant land on the correct node pool\n      - matchLabelKeys:\n          - tenant\n        topologyKey: node-pool\n    podAntiAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant can't schedule to nodes used for another tenant\n      - mismatchLabelKeys:\n        - tenant # whatever the value of the \"tenant\" label for this Pod, prevent\n                 # scheduling to nodes in any pool where any Pod from a different\n                 # tenant is running.\n        labelSelector:\n          # We have to have the labelSelector which selects only Pods with the tenant label,\n          # otherwise this Pod would have anti-affinity against Pods from daemonsets as well, for example,\n          # which aren't supposed to have the tenant label.\n          matchExpressions:\n          - key: tenant\n            operator: Exists\n        topologyKey: node-pool\n```\n\n10.2 - Assigning Pods to Nodes | Inter-pod affinity and anti-affinity can be even more useful when they are used with higher level collections such as ReplicaSets, StatefulSets, Deployments, etc. These rules allow you to configure th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7940"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-cache\nspec:\n  selector:\n    matchLabels:\n      app: store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: redis-server\n        image: redis:3.2-alpine\n```\n\n10.2 - Assigning Pods to Nodes | The following example Deployment for the web servers creates replicas with the label app=web-store. The Pod affinity rule tells the scheduler to place each replica on a node that has a Pod with the la", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7941"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: web-server\nspec:\n  selector:\n    matchLabels:\n      app: web-store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: web-store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - web-store\n            topologyKey: \"kubernetes.io/hostname\"\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: web-app\n        image: nginx:1.16-alpine\n```\n\n10.2 - Assigning Pods to Nodes | Creating the two preceding Deployments results in the following cluster layout, where each web server is co-located with a cache, on three separate nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7942"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n  nodeName: kube-01\n```\n\n10.2 - Assigning Pods to Nodes | The above Pod will only run on the node kube-01.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7943"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n...\nstatus:\n  nominatedNodeName: kube-01\n```\n\n10.2 - Assigning Pods to Nodes | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, or among any other topology domains that you define. You", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7944"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# You need to change this example to match the actual runtime name, and per-Pod\n# resource overhead, that the container runtime is adding in your cluster.\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: kata-fc\nhandler: kata-fc\noverhead:\n  podFixed:\n    memory: \"120Mi\"\n    cpu: \"250m\"\n```\n\n10.3 - Pod Overhead | Workloads which are created which specify the kata-fc RuntimeClass handler will take the memory and cpu overheads into account for resource quota calculations, node scheduling, as well as Pod cgroup s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7945"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  runtimeClassName: kata-fc\n  containers:\n  - name: busybox-ctr\n    image: busybox:1.28\n    stdin: true\n    tty: true\n    resources:\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  - name: nginx-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: 1500m\n        memory: 100Mi\n```\n\n10.3 - Pod Overhead | At admission time the RuntimeClass admission controller updates the workload's PodSpec to include the overhead as described in the RuntimeClass. If the PodSpec already has this field defined, the Pod", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7946"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.overhead}'\n```\n\n10.3 - Pod Overhead | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7947"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.containers[*].resources.limits}'\n```\n\n10.3 - Pod Overhead | The total container requests are 2000m CPU and 200MiB of memory:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7948"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe node | grep test-pod -B2\n```\n\n10.3 - Pod Overhead | The output shows requests for 2250m CPU, and for 320MiB of memory. The requests include Pod overhead:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7949"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7950"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod\n```\n\n10.4 - Pod Scheduling Readiness | The output reveals it's in SchedulingGated state:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7951"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\n10.4 - Pod Scheduling Readiness | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7952"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7953"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\n10.4 - Pod Scheduling Readiness | The output is expected to be empty. And you can check its latest status by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7954"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o wide\n```\n\n10.4 - Pod Scheduling Readiness | Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get transited from previous SchedulingGated to Running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7955"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-pod\nspec:\n  # Configure a topology spread constraint\n  topologySpreadConstraints:\n    - maxSkew: <integer>\n      minDomains: <integer> # optional\n      topologyKey: <string>\n      whenUnsatisfiable: <string>\n      labelSelector: <object>\n      matchLabelKeys: <list> # optional; beta since v1.27\n      nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26\n      nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26\n  ### other Pod fields go here\n```\n\n10.5 - Pod Topology Spread Constraints | You can read more about this field by running kubectl explain Pod.spec.topologySpreadConstraints or refer to the scheduling section of the API reference for Pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7956"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7957"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7958"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7959"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints:\n            - maxSkew: 1\n              topologyKey: topology.kubernetes.io/zone\n              whenUnsatisfiable: ScheduleAnyway\n          defaultingType: List\n```\n\n10.5 - Pod Topology Spread Constraints | If you don't configure any cluster-level default constraints for pod topology spreading, then kube-scheduler acts as if you specified the following default topology constraints:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7960"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints: []\n          defaultingType: List\n```\n\n10.5 - Pod Topology Spread Constraints | In Kubernetes, inter-Pod affinity and anti-affinity control how Pods are scheduled in relation to one another - either more packed or more scattered.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7961"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\n```\n\n10.6 - Taints and Tolerations | places a taint on node node1. The taint has key key1, value value1, and taint effect NoSchedule. This means that no pod will be able to schedule onto node1 unless it has a matching toleration.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7962"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule-\n```\n\n10.6 - Taints and Tolerations | You specify a toleration for a pod in the PodSpec. Both of the following tolerations \"match\" the taint created by the kubectl taint line above, and thus a pod with either toleration would be able to s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7963"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\n10.6 - Taints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7964"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\nkubectl taint nodes node1 key1=value1:NoExecute\nkubectl taint nodes node1 key2=value2:NoSchedule\n```\n\n10.6 - Taints and Tolerations | And a pod has two tolerations:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7965"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: prioritized-list-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        firstAvailable:\n        - name: large-black\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"black\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"large\"                \n        - name: small-white\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"white\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"small\"                \n          count: 2\n```\n\n10.8 - Dynamic Resource Allocation | The decision is made on a per-Pod basis, so if the Pod is a member of a ReplicaSet or similar grouping, you cannot rely on all the members of the group having the same subrequest chosen. Your workload", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7966"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: cat-slice\nspec:\n  driver: \"resource-driver.example.com\"\n  pool:\n    generation: 1\n    name: \"black-cat-pool\"\n    resourceSliceCount: 1\n  # The allNodes field defines whether any node in the cluster can access the device.\n  allNodes: true\n  devices:\n  - name: \"large-black-cat\"\n    attributes:\n      color:\n        string: \"black\"\n      size:\n        string: \"large\"\n      cat:\n        boolean: true\n```\n\n10.8 - Dynamic Resource Allocation | This ResourceSlice is managed by the resource-driver.example.com driver in the black-cat-pool pool. The allNodes: true field indicates that any node in the cluster can access the devices. There's one", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7967"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-cats\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: name-of-the-intended-node\n  ...\n```\n\n10.8 - Dynamic Resource Allocation | You may also be able to mutate the incoming Pod, at admission time, to unset the .spec.nodeName field and to use a node selector instead.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7968"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: large-black-cat-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n          deviceClassName: resource.example.com\n          allocationMode: All\n          adminAccess: true\n```\n\n10.8 - Dynamic Resource Allocation | If this feature is disabled, the adminAccess field will be removed automatically when creating such a ResourceClaim.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7969"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel:\n      expression: device.driver == 'gpu.example.com' && device.attributes['gpu.example.com'].type\n        == 'gpu'\n  extendedResourceName: example.com/gpu\n```\n\n10.8 - Dynamic Resource Allocation | In addition, users can use a special extended resource to allocate devices without having to explicitly create a ResourceClaim. Using the extended resource name prefix deviceclass.resource.kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7970"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  sharedCounters:\n  - name: gpu-1-counters\n    counters:\n      memory:\n        value: 8Gi\n  devices:\n  - name: device-1\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n  - name: device-2\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n```\n\n10.8 - Dynamic Resource Allocation | Partitionable devices is an alpha feature and only enabled when the DRAPartitionableDevices feature gate is enabled in the kube-apiserver and kube-scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7971"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  devices:\n  - name: eth1\n    allowMultipleAllocations: true\n    attributes:\n      name:\n        string: \"eth1\"\n    capacity:\n      bandwidth:\n        requestPolicy:\n          default: \"1M\"\n          validRange:\n            min: \"1M\"\n            step: \"8\"\n        value: \"10G\"\n```\n\n10.8 - Dynamic Resource Allocation | The consumable capacity can be requested as shown in the below example.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7972"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: bandwidth-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n        - deviceClassName: resource.example.com\n          capacity:\n            requests:\n              bandwidth: 1G\n```\n\n10.8 - Dynamic Resource Allocation | The allocation result will include the consumed capacity and the identifier of the share.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7973"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\n...\nstatus:\n  allocation:\n    devices:\n      results:\n      - consumedCapacity:\n          bandwidth: 1G\n        device: eth1\n        shareID: \"a671734a-e8e5-11e4-8fde-42010af09327\"\n```\n\n10.8 - Dynamic Resource Allocation | In this example, a multiply-allocatable device was chosen. However, any resource.example.com device with at least the requested 1G bandwidth could have met the requirement. If a non-multiply-allocatab", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7974"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\nkind: DeviceTaintRule\nmetadata:\n  name: example\nspec:\n  # The entire hardware installation for this\n  # particular driver is broken.\n  # Evict all pods and don't schedule new ones.\n  deviceSelector:\n    driver: dra.example.com\n  taint:\n    key: dra.example.com/unhealthy\n    value: Broken\n    effect: NoExecute\n```\n\n10.8 - Dynamic Resource Allocation | Device Binding Conditions allow the Kubernetes scheduler to delay Pod binding until external resources, such as fabric-attached GPUs or reprogrammable FPGAs, are confirmed to be ready.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7975"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: gpu-slice\nspec:\n  driver: dra.example.com\n  nodeSelector:\n    accelerator-type: high-performance\n  pool:\n    name: gpu-pool\n    generation: 1\n    resourceSliceCount: 1\n  devices:\n    - name: gpu-1\n      attributes:\n        vendor:\n          string: \"example\"\n        model:\n          string: \"example-gpu\"\n      bindsToNode: true\n      bindingConditions:\n        - dra.example.com/is-prepared\n      bindingFailureConditions:\n        - dra.example.com/preparing-failed\n```\n\n10.8 - Dynamic Resource Allocation | This example ResourceSlice has the following properties:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7976"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system | grep kube-scheduler\n```\n\n10.9 - Scheduler Performance Tuning | to verify that the kube-scheduler component is healthy.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7977"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1alpha1\nkind: KubeSchedulerConfiguration\nalgorithmSource:\n  provider: DefaultProvider\n\n...\n\npercentageOfNodesToScore: 50\n```\n\n10.9 - Scheduler Performance Tuning | percentageOfNodesToScore must be a value between 1 and 100 with the default value being calculated based on the cluster size. There is also a hardcoded minimum value of 100 nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7978"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        - name: memory\n          weight: 1\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\n10.10 - Resource Bin Packing | To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7979"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        requestedToCapacityRatio:\n          shape:\n          - utilization: 0\n            score: 0\n          - utilization: 100\n            score: 10\n        type: RequestedToCapacityRatio\n    name: NodeResourcesFit\n```\n\n10.10 - Resource Bin Packing | Referencing the KubeSchedulerConfiguration file with the kube-scheduler flag --config=/path/to/config/file will pass the configuration to the scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7980"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for XYZ service pods only.\"\n```\n\n10.11 - Pod Priority and Preemption | Pods with preemptionPolicy: Never will be placed in the scheduling queue ahead of lower-priority pods, but they cannot preempt other pods. A non-preempting pod waiting to be scheduled will stay in the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7981"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority-nonpreempting\nvalue: 1000000\npreemptionPolicy: Never\nglobalDefault: false\ndescription: \"This priority class will not cause other pods to be preempted.\"\n```\n\n10.11 - Pod Priority and Preemption | After you have one or more PriorityClasses, you can create Pods that specify one of those PriorityClass names in their specifications. The priority admission controller uses the priorityClassName fiel", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7982"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  priorityClassName: high-priority\n```\n\n10.11 - Pod Priority and Preemption | When Pod priority is enabled, the scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. As a result, the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7983"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nevictionHard:\n  memory.available: \"500Mi\"\n  nodefs.available: \"1Gi\"\n  imagefs.available: \"100Gi\"\nevictionMinimumReclaim:\n  memory.available: \"0Mi\"\n  nodefs.available: \"500Mi\"\n  imagefs.available: \"2Gi\"\n```\n\n10.12 - Node-pressure Eviction | In this example, if the nodefs.available signal meets the eviction threshold, the kubelet reclaims the resource until the signal reaches the threshold of 1GiB, and then continues to reclaim the minimu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7984"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7985"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -n kube-system --show-swap\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7986"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o go-template='{{range .items}}{{.metadata.name}}: {{if .status.nodeInfo.swap.capacity}}{{.status.nodeInfo.swap.capacity}}{{else}}<unknown>{{end}}{{\"\\n\"}}{{end}}'\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7987"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o jsonpath='{range .items[?(@.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap)]}{.metadata.name}{\"\\t\"}{.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap}{\"\\n\"}{end}'\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7988"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get mutatingwebhookconfigurations\n```\n\n11.6 - Admission Webhook Good Practices | The output lists any mutating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7989"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get validatingwebhookconfigurations\n```\n\n11.6 - Admission Webhook Good Practices | The output lists any validating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7990"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7991"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod.yaml\n```\n\n11.8 - Logging Architecture | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7992"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter -c count\n```\n\n11.8 - Logging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7993"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7994"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod-err.yaml\n```\n\n11.8 - Logging Architecture | To fetch only the stderr log stream, you can run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7995"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/namespaces/default/pods/counter-err/log?stream=Stderr\"\n```\n\n11.8 - Logging Architecture | See the kubectl logs documentation for more details.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7996"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7997"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7998"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-1\n```\n\n11.8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_7999"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-2\n```\n\n11.8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8000"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n11.8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8001"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n11.8 - Logging Architecture |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8002"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\n11.10 - Metrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8003"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/<insert-node-name-here>/proxy/logs/?query=/<insert-log-file-name-here>\"\n```\n\n11.12 - System Logs | The kubelet uses heuristics to retrieve logs. This helps if you are not aware whether a given system service is writing logs to the operating system's native logger like journald or to a log file in /", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8004"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\n11.13 - Traces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8005"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\n11.13 - Traces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8006"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n11.15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8007"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n11.15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8008"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: win-webserver\n  labels:\n    app: win-webserver\nspec:\n  ports:\n    # the port that this service should serve on\n    - port: 80\n      targetPort: 80\n  selector:\n    app: win-webserver\n  type: NodePort\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: win-webserver\n  name: win-webserver\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: win-webserver\n  template:\n    metadata:\n      labels:\n        app: win-webserver\n      name: win-webserver\n    spec:\n     containers:\n      - name: windowswebserver\n        image: mcr.microsoft.com/windows/servercore:ltsc2019\n        command:\n        - powershell.exe\n        - -command\n        - \"<#code used from https://gist.github.com/19WAS85/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ;  ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus)  } ; \"\n     nodeSelector:\n      kubernetes.io/os: windows\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Check that all nodes are healthy:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8009"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f win-webserver.yaml\nkubectl get pods -o wide -w\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | When the service is deployed correctly both Pods are marked as Ready. To exit the watch command, press Ctrl+C.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8010"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: windows-2019\nhandler: example-container-runtime-handler\nscheduling:\n  nodeSelector:\n    kubernetes.io/os: 'windows'\n    kubernetes.io/arch: 'amd64'\n    node.kubernetes.io/windows-build: '10.0.17763'\n  tolerations:\n  - effect: NoSchedule\n    key: os\n    operator: Equal\n    value: \"windows\"\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Run kubectl create -f runtimeClasses.yml using as a cluster administrator", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8011"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: iis-2019\n  labels:\n    app: iis-2019\nspec:\n  replicas: 1\n  template:\n    metadata:\n      name: iis-2019\n      labels:\n        app: iis-2019\n    spec:\n      runtimeClassName: windows-2019\n      containers:\n      - name: iis\n        image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        resources:\n          limits:\n            cpu: 1\n            memory: 800Mi\n          requests:\n            cpu: .1\n            memory: 300Mi\n        ports:\n          - containerPort: 80\n selector:\n    matchLabels:\n      app: iis-2019\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: iis\nspec:\n  type: LoadBalancer\n  ports:\n  - protocol: TCP\n    port: 80\n  selector:\n    app: iis-2019\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Kubernetes is highly configurable and extensible. As a result, there is rarely a need to fork or submit patches to the Kubernetes project code.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8012"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubernetes.io/ingress-bandwidth: 1M\n    kubernetes.io/egress-bandwidth: 1M\n...\n```\n\n13.1.1 - Network Plugins | Kubernetes provides a device plugin framework that you can use to advertise system hardware resources to the Kubelet.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8013"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: demo-pod\nspec:\n  containers:\n    - name: demo-container-1\n      image: registry.k8s.io/pause:3.8\n      resources:\n        limits:\n          hardware-vendor.example/foo: 2\n#\n# This Pod needs 2 of the hardware-vendor.example/foo devices\n# and can only schedule onto a Node that's able to satisfy\n# that need.\n#\n# If the Node has more than 2 of those devices available, the\n# remainder would be available for other Pods to use.\n```\n\n13.1.2 - Device Plugins | The general workflow of a device plugin includes the following steps:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8014"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n13.2.1 - Custom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8015"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\n13.2.1 - Custom Resources | The output should be:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8016"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get SampleDB                   # find configured databases\n\nkubectl edit SampleDB/example-database # manually change some settings\n```\n\n13.3 - Operator pattern | …and that's it! The operator will take care of applying the changes as well as keeping the existing service in good shape.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8017"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1.2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8018"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.2 - Object Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8019"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.3 - Labels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8020"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\n1.2.3 - Labels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8021"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  component: redis\n```\n\n1.2.3 - Labels and Selectors | This selector (respectively in json or yaml format) is equivalent to component=redis or component in (redis).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8022"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n    component: redis\n  matchExpressions:\n    - { key: tier, operator: In, values: [cache] }\n    - { key: environment, operator: NotIn, values: [dev] }\n```\n\n1.2.3 - Labels and Selectors | matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8023"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: frontend\n```\n\n1.2.3 - Labels and Selectors | while the Redis master and replica would have different tier labels, and perhaps even an additional role label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8024"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: master\n```\n\n1.2.3 - Labels and Selectors | and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8025"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: replica\n```\n\n1.2.3 - Labels and Selectors | The labels allow for slicing and dicing the resources along any dimension specified by a label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8026"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.5 - Annotations | Field selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8027"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector \"\"\n```\n\n1.2.6 - Field Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8028"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace\n```\n\n1.2.8 - Owners and Dependents | When you tell Kubernetes to delete a resource, the API server allows the managing controller to process any finalizer rules for the resource. Finalizers prevent accidental deletion of resources your c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8029"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\n1.2.9 - Recommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8030"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8031"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n1.2.9 - Recommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8032"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8033"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8034"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8035"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8036"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply --dry-run=server\n```\n\n1.3 - The Kubernetes API | Kubernetes supports publishing a description of its APIs as OpenAPI v3.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8037"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n{\n    \"paths\": {\n        ...,\n        \"api/v1\": {\n            \"serverRelativeURL\": \"/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF\"\n        },\n        \"apis/admissionregistration.k8s.io/v1\": {\n            \"serverRelativeURL\": \"/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597\"\n        },\n        ....\n    }\n}\n```\n\n1.3 - The Kubernetes API | The relative URLs are pointing to immutable OpenAPI descriptions, in order to improve client-side caching. The proper HTTP caching headers are also set by the API server for that purpose (Expires to 1", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8038"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\n2.4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8039"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\n2.5 - Cloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8040"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace\n```\n\n2.9 - Garbage Collection | Kubernetes checks for and deletes objects that no longer have owner references, like the pods left behind when you delete a ReplicaSet. When you delete an object, you can control whether Kubernetes de", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8041"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\ndocker.io/library/busybox:latest\n```\n\n3.1 - Images | When you first create a Deployment, StatefulSet, Pod, or other object that includes a PodTemplate, and a pull policy was not explicitly specified, then by default the pull policy of all containers in", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8042"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\ndocker.io/library/busybox:1.32.0\n```\n\n3.1 - Images | When you first create a Deployment, StatefulSet, Pod, or other object that includes a PodTemplate, and a pull policy was not explicitly specified, then by default the pull policy of all containers in", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8043"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry\n```\n\n3.1 - Images | Now, you can create pods which reference that secret by adding the imagePullSecrets section to a Pod definition. Each item in the imagePullSecrets array can only reference one Secret in the same names", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8044"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# RuntimeClass is defined in the node.k8s.io API group\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  # The name the RuntimeClass will be referenced by.\n  # RuntimeClass is a non-namespaced resource.\n  name: myclass \n# The name of the corresponding CRI configuration\nhandler: myconfiguration\n```\n\n3.3 - Runtime Class | The name of a RuntimeClass object must be a valid DNS subdomain name.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8045"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  runtimeClassName: myclass\n  # ...\n```\n\n3.3 - Runtime Class | This will instruct the kubelet to use the named RuntimeClass to run this pod. If the named RuntimeClass does not exist, or the CRI cannot run the corresponding handler, the pod will enter the Failed t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8046"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod lifecycle-demo\n```\n\n3.4 - Container Lifecycle Hooks | A workload is an application running on Kubernetes. Whether your workload is a single component or several that work together, on Kubernetes you run it inside a set of pods. In Kubernetes, a Pod repre", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8047"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n4.1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8048"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\n4.1 - Pods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8049"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <name-of-pod>\n```\n\n4.1.1 - Pod Lifecycle | Each state has a specific meaning:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8050"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs <name-of-pod>\n```\n\n4.1.1 - Pod Lifecycle | When a container in your Pod stops, or experiences failure, Kubernetes can restart it. A restart isn't always appropriate; for example, init containers run only once, during Pod startup.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8051"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <name-of-pod>\n```\n\n4.1.1 - Pod Lifecycle | When a container in your Pod stops, or experiences failure, Kubernetes can restart it. A restart isn't always appropriate; for example, init containers run only once, during Pod startup.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8052"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\n4.1.1 - Pod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8053"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\n4.1.1 - Pod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8054"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\n4.1.1 - Pod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8055"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\n4.1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8056"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\n4.1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8057"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\n4.1.1 - Pod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8058"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  os:\n    name: linux\n  containers:\n    - name: my-container\n      image: container-image:latest\n      lifecycle:\n        stopSignal: SIGUSR1\n```\n\n4.1.1 - Pod Lifecycle | If a stop signal is defined in the lifecycle, this will override the signal defined in the container image. If no stop signal is defined in the container spec, the container would fall back to the def", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8059"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\n4.1.2 - Init Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8060"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\n4.1.2 - Init Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8061"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8062"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8063"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n4.1.6 - Pod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8064"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n4.1.6 - Pod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8065"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\n4.1.8 - User Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8066"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8067"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n4.2.1 - Deployments | If the Deployment is still being created, the output is similar to the following:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8068"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8069"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n4.2.1 - Deployments | Notice that the Deployment has created all three replicas, and all replicas are up-to-date (they contain the latest Pod template) and available.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8070"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --show-labels\n```\n\n4.2.1 - Deployments | The created ReplicaSet ensures that there are three nginx Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8071"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n4.2.1 - Deployments | Run kubectl get rs to see that the Deployment updated the Pods by creating a new ReplicaSet and scaling it up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8072"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl annotate deployment/nginx-deployment kubernetes.io/change-cause=\"image updated to 1.16.1\"\n```\n\n4.2.1 - Deployments | To see the details of each revision, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8073"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n4.2.1 - Deployments | Kubernetes marks a Deployment as complete when it has the following characteristics:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8074"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8075"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8076"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n4.2.1 - Deployments | Eventually, once the Deployment progress deadline is exceeded, Kubernetes updates the status and the reason for the Progressing condition:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8077"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8078"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8079"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment deployment --replicas=X\n```\n\n4.2.1 - Deployments | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Deployment, don't set .spec.replicas.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8080"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f deployment.yaml\n```\n\n4.2.1 - Deployments | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Deployment, don't set .spec.replicas.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8081"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\n4.2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8082"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\n4.2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8083"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\n4.2.1 - Deployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8084"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8085"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\n4.2.2 - ReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8086"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n4.2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8087"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmatchLabels:\n  tier: frontend\n```\n\n4.2.2 - ReplicaSet | In the ReplicaSet, .spec.template.metadata.labels must match spec.selector, or it will be rejected by the API.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8088"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8089"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n4.2.3 - StatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8090"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\n4.2.3 - StatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8091"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\n# View revision history\nkubectl rollout history statefulset/webapp\n\n# Rollback to a specific revision\nkubectl rollout undo statefulset/webapp --to-revision=3\n```\n\n4.2.3 - StatefulSets | This will:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8092"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\n# List all revisions for the StatefulSet\nkubectl get controllerrevisions -l app.kubernetes.io/name=webapp\n\n# View detailed configuration of a specific revision\nkubectl get controllerrevision/webapp-3 -o yaml\n```\n\n4.2.3 - StatefulSets | Regularly check revisions with:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8093"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\n4.2.3 - StatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8094"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\n4.2.3 - StatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8095"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset statefulset --replicas=X\n```\n\n4.2.3 - StatefulSets | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Statefulset, don't set .spec.replicas. Instead, allow the Kubernetes control plane to manage the .spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8096"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f statefulset.yaml\n```\n\n4.2.3 - StatefulSets | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Statefulset, don't set .spec.replicas. Instead, allow the Kubernetes control plane to manage the .spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8097"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n4.2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8098"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\n4.2.4 - DaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8099"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nnodeAffinity:\n  requiredDuringSchedulingIgnoredDuringExecution:\n    nodeSelectorTerms:\n    - matchFields:\n      - key: metadata.name\n        operator: In\n        values:\n        - target-host-name\n```\n\n4.2.4 - DaemonSet | The DaemonSet controller automatically adds a set of tolerations to DaemonSet Pods:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8100"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n4.2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8101"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nName:           pi\nNamespace:      default\nSelector:       batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\nLabels:         batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\n                batch.kubernetes.io/job-name=pi\n                ...\nAnnotations:    batch.kubernetes.io/job-tracking: \"\"\nParallelism:    1\nCompletions:    1\nStart Time:     Mon, 02 Dec 2019 15:20:11 +0200\nCompleted At:   Mon, 02 Dec 2019 15:21:16 +0200\nDuration:       65s\nPods Statuses:  0 Running / 1 Succeeded / 0 Failed\nPod Template:\n  Labels:  batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\n           batch.kubernetes.io/job-name=pi\n  Containers:\n   pi:\n    Image:      perl:5.34.0\n    Port:       <none>\n    Host Port:  <none>\n    Command:\n      perl\n      -Mbignum=bpi\n      -wle\n      print bpi(2000)\n    Environment:  <none>\n    Mounts:       <none>\n  Volumes:        <none>\nEvents:\n  Type    Reason            Age   From            Message\n  ----    ------            ----  ----            -------\n  Normal  SuccessfulCreate  21s   job-controller  Created pod: pi-xf9p4\n  Normal  Completed         18s   job-controller  Job completed\n```\n\n4.2.5 - Jobs | apiVersion: batch/v1 kind: Job metadata: annotations: batch.kubernetes.io/job-tracking: \"\" ... creationTimestamp: \"2022-11-10T17:53:53Z\" generation: 1 labels: batch.kubernet", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8102"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\n4.2.5 - Jobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8103"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n4.2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8104"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n    completedIndexes: 1,3,5,7,9\n    failedIndexes: 0,2,4,6,8\n    succeeded: 5          # 1 succeeded pod for each of 5 succeeded indexes\n    failed: 10            # 2 failed pods (1 retry) for each of 5 failed indexes\n    conditions:\n    - message: Job has failed indexes\n      reason: FailedIndexes\n      status: \"True\"\n      type: FailureTarget\n    - message: Job has failed indexes\n      reason: FailedIndexes\n      status: \"True\"\n      type: Failed\n```\n\n4.2.5 - Jobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8105"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n4.2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8106"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8107"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/pi\n```\n\n4.2.5 - Jobs | By default, a Job will run uninterrupted unless a Pod fails (restartPolicy=Never) or a Container exits in error (restartPolicy=OnFailure), at which point the Job defers to the .spec.backoffLimit descr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8108"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./job.yaml\n```\n\n4.2.5 - Jobs | By default, a Job will run uninterrupted unless a Pod fails (restartPolicy=Never) or a Container exits in error (restartPolicy=OnFailure), at which point the Job defers to the .spec.backoffLimit descr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8109"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8110"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8111"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\n4.2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8112"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\n4.2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8113"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/old --cascade=orphan\n```\n\n4.2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8114"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n4.2.5 - Jobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8115"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n4.2.5 - Jobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8116"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\n4.2.5 - Jobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8117"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\n4.2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8118"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n4.2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8119"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n4.2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8120"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8121"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nselector:\n   app: guestbook\n   tier: frontend\n```\n\n4.4 - Managing Workloads | You can tweak the number of replicas of the stable and canary releases to determine the ratio of each release that will receive live production traffic (in this case, 3:1). Once you're confident, you", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8122"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n5.1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8123"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\n5.1 - Service | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8124"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n5.1 - Service | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8125"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\n5.1 - Service | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8126"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/<service-name> forwardedPort:servicePort\n```\n\n5.1 - Service | An ExternalName Service is a special case of Service that does not have selectors and uses DNS names instead. For more information, see the ExternalName section.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8127"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\n5.1 - Service | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8128"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\n5.1 - Service | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8129"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\n5.1 - Service | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8130"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    networking.gke.io/load-balancer-type: \"Internal\"\n```\n\n5.1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/aws-load-balancer-internal: \"true\"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8131"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/aws-load-balancer-internal: \"true\"\n```\n\n5.1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8132"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"\n```\n\n5.1 - Service | metadata: name: my-service annotations: service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: \"private\"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8133"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: \"private\"\n```\n\n5.1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/openstack-internal-load-balancer: \"true\"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8134"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/openstack-internal-load-balancer: \"true\"\n```\n\n5.1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/cce-load-balancer-internal-vpc: \"true\"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8135"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/cce-load-balancer-internal-vpc: \"true\"\n```\n\n5.1 - Service | metadata: annotations: service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxx", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8136"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  annotations:\n    service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxx\n```\n\n5.1 - Service | metadata: annotations: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: \"intranet\"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8137"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  annotations:\n    service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: \"intranet\"\n```\n\n5.1 - Service | metadata: name: my-service annotations: service.beta.kubernetes.io/oci-load-balancer-internal: true", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8138"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  name: my-service\n  annotations:\n    service.beta.kubernetes.io/oci-load-balancer-internal: true\n```\n\n5.1 - Service | Services of type ExternalName map a Service to a DNS name, not to a typical selector such as my-service or cassandra. You specify these Services with the spec.externalName parameter.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8139"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\n5.1 - Service | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8140"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\n5.1 - Service | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8141"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8142"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n5.2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8143"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\n5.2 - Ingress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8144"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8145"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n5.2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8146"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\n5.2 - Ingress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8147"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\n5.2 - Ingress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8148"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n5.2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8149"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n5.2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8150"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\n5.2 - Ingress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8151"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n5.2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8152"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8153"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n5.2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8154"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\n5.2 - Ingress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8155"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8156"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - backend:\n          service:\n            name: service1\n            port:\n              number: 80\n        path: /foo\n        pathType: Prefix\n  - host: bar.baz.com\n    http:\n      paths:\n      - backend:\n          service:\n            name: service2\n            port:\n              number: 80\n        path: /foo\n        pathType: Prefix\n..\n```\n\n5.2 - Ingress | After you save your changes, kubectl updates the resource in the API server, which tells the Ingress controller to reconfigure the load balancer.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8157"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\n5.4 - Gateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8158"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\n5.4 - Gateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8159"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\n5.4 - Gateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8160"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\n5.4 - Gateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8161"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\n5.4 - Gateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8162"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\n5.5 - EndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8163"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n5.6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8164"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n  - from:\n    - namespaceSelector:\n        matchLabels:\n          user: alice\n      podSelector:\n        matchLabels:\n          role: client\n  ...\n```\n\n5.6 - Network Policies | This policy contains a single from element allowing connections from Pods with the label role=client in namespaces with the label user=alice. But the following policy is different:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8165"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n  - from:\n    - namespaceSelector:\n        matchLabels:\n          user: alice\n    - podSelector:\n        matchLabels:\n          role: client\n  ...\n```\n\n5.6 - Network Policies | It contains two elements in the from array, and allows connections from Pods in the local Namespace with the label role=client, or from any Pod in any namespace with the label user=alice.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8166"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8167"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8168"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8169"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8170"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8171"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n5.6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8172"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\n5.6 - Network Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8173"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n...\n  spec:\n    podSelector:\n      matchLabels:\n        role: client\n  ...\n```\n\n5.6 - Network Policies | a hostNetwork pod is selected by a podSelector or namespaceSelector in an ingress or egress rule.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8174"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n...\n  ingress:\n    - from:\n      - podSelector:\n          matchLabels:\n            role: client\n  ...\n```\n\n5.6 - Network Policies | At the same time, since hostNetwork pods have the same IP addresses as the nodes they reside on, their connections will be treated as node connections. For example, you can allow traffic from a hostNe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8175"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n5.7 - DNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8176"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\n5.7 - DNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8177"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n5.7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8178"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8179"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8180"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8181"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8182"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n5.8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8183"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8184"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\n5.8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8185"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ipFamilyPolicy: SingleStack\n```\n\n5.8 - IPv4/IPv6 dual-stack | After:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8186"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ipFamilyPolicy: PreferDualStack\n```\n\n5.8 - IPv4/IPv6 dual-stack | To change a Service from dual-stack to single-stack, change .spec.ipFamilyPolicy from PreferDualStack or RequireDualStack to SingleStack. When you change this Service from dual-stack to single-stack,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8187"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\n5.9 - Topology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8188"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\n5.11 - Service ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8189"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\n5.12 - Service Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8190"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\n6.1 - Volumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8191"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\n6.1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8192"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\n6.1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8193"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\n6.1 - Volumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8194"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\n6.1 - Volumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8195"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\n6.1 - Volumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8196"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\n6.1 - Volumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8197"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n6.1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8198"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\n6.1 - Volumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8199"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\n6.1 - Volumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8200"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\n6.1 - Volumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8201"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\n6.1 - Volumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8202"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\n6.1 - Volumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8203"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n6.1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8204"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\n6.2 - Persistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8205"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\n6.2 - Persistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8206"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\n6.2 - Persistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8207"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n6.2 - Persistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8208"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\n6.2 - Persistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8209"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe persistentvolume <name>\n```\n\n6.2 - Persistent Volumes | The .status field for a PersistentVolume can include an alpha lastPhaseTransitionTime field. This field records the timestamp of when the volume last transitioned its phase. For newly created volumes", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8210"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\n6.2 - Persistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8211"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\n6.2 - Persistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8212"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8213"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8214"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8215"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8216"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8217"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8218"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\n6.2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8219"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\n6.2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8220"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8221"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8222"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n6.3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8223"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n6.3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8224"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n6.3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8225"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\n6.4 - Ephemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8226"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\n6.4 - Ephemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8227"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n6.5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8228"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n6.5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8229"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n6.5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8230"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n6.5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8231"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n6.5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8232"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n6.5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8233"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\n6.5 - Storage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8234"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\n6.5 - Storage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8235"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n6.5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8236"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n6.5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8237"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8238"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8239"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\n6.6 - Volume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8240"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\n6.6 - Volume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8241"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\n6.6 - Volume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8242"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\n6.6 - Volume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8243"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\n6.7 - Dynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8244"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\n6.7 - Dynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8245"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\n6.7 - Dynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8246"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\n6.8 - Volume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8247"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\n6.8 - Volume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8248"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\n6.8 - Volume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8249"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n6.8 - Volume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8250"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl get crd volumesnapshotcontent -o yaml\n```\n\n6.8 - Volume Snapshots | If you want to allow users to create a PersistentVolumeClaim from an existing VolumeSnapshot, but with a different volume mode than the source, the annotation snapshot.storage.kubernetes.io/allow-volu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8251"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n6.8 - Volume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8252"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n6.9 - Volume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8253"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n6.9 - Volume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8254"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\n6.10 - CSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8255"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\n6.12 - Node-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8256"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\n7.1 - Configuration Best Practices | Use label selectors for get and delete operations instead of specific object names. See the sections on label selectors and using labels effectively.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8257"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\n7.1 - Configuration Best Practices | A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8258"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\n7.2 - ConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8259"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n7.2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8260"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\n7.2 - ConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8261"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\n7.2 - ConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8262"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n7.2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8263"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\n7.2 - ConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8264"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\n7.2 - ConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8265"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n7.3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8266"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n7.3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8267"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n7.3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8268"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n7.3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8269"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n7.3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8270"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n7.3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8271"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n7.3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8272"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n7.3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8273"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n7.3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8274"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\n7.3 - Secrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8275"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\n7.5 - Resource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8276"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n7.5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8277"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\n7.5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8278"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\n# For ext4, with /dev/block-device not mounted\nsudo tune2fs -O project -Q prjquota /dev/block-device\n```\n\n7.5 - Resource Management for Pods and Containers | Ensure that the root filesystem (or optional runtime filesystem) is mounted with project quotas enabled. For both XFS and ext4fs, the mount option is named prjquota.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8279"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\n7.5 - Resource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8280"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\n7.5 - Resource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8281"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\n7.6 - Organizing Cluster Access Using kubeconfig Files | The KUBECONFIG environment variable holds a list of kubeconfig files. For Linux and Mac, the list is colon-delimited. For Windows, the list is semicolon-delimited. The KUBECONFIG environment variable", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8282"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\n7.6 - Organizing Cluster Access Using kubeconfig Files | This page outlines the differences in how resources are managed between Linux and Windows.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8283"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# The per-mode level label indicates which policy level to apply for the mode.\n#\n# MODE must be one of `enforce`, `audit`, or `warn`.\n# LEVEL must be one of `privileged`, `baseline`, or `restricted`.\npod-security.kubernetes.io/<MODE>: <LEVEL>\n\n# Optional: per-mode version label that can be used to pin the policy to the\n# version that shipped with a given Kubernetes minor version (for example v1.34).\n#\n# MODE must be one of `enforce`, `audit`, or `warn`.\n# VERSION must be a valid Kubernetes minor version, or `latest`.\npod-security.kubernetes.io/<MODE>-version: <VERSION>\n```\n\n8.3 - Pod Security Admission | Check out Enforce Pod Security Standards with Namespace Labels to see example usage.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8284"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\n8.4 - Service Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8285"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets -A -o yaml\n```\n\n8.9 - Role Based Access Control Good Practices | Permission to create workloads (either Pods, or workload resources that manage Pods) in a namespace implicitly grants access to many other resources in that namespace, such as Secrets, ConfigMaps, and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8286"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\n8.13 - Hardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8287"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n9.1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8288"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8289"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8290"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nscopeSelector:\n    matchExpressions:\n      - scopeName: PriorityClass\n        operator: In\n        values:\n          - middle\n```\n\n9.2 - Resource Quotas | If the operator is Exists or DoesNotExist, the values field must NOT be specified.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8291"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8292"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8293"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8294"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\n9.2 - Resource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8295"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\n9.2 - Resource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8296"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8297"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8298"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8299"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\n9.2 - Resource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8300"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\n9.2 - Resource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8301"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n9.2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8302"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n```\n\n9.4 - Node Resource Managers | The pod above runs in the BestEffort QoS class because no resource requests or limits are specified. It runs in the shared pool.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8303"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n9.4 - Node Resource Managers | The pod above runs in the Burstable QoS class because resource requests do not equal limits and the cpu quantity is not specified. It runs in the shared pool.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8304"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n      requests:\n        memory: \"100Mi\"\n        cpu: \"1\"\n```\n\n9.4 - Node Resource Managers | The pod above runs in the Burstable QoS class because resource requests do not equal limits. It runs in the shared pool.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8305"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"2\"\n```\n\n9.4 - Node Resource Managers | The pod above runs in the Guaranteed QoS class because requests are equal to limits. And the container's resource limit for the CPU resource is an integer greater than or equal to one. The nginx conta", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8306"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"1.5\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"1.5\"\n```\n\n9.4 - Node Resource Managers | The pod above runs in the Guaranteed QoS class because requests are equal to limits. But the container's resource limit for the CPU resource is a fraction. It runs in the shared pool.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8307"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n```\n\n9.4 - Node Resource Managers | The pod above runs in the Guaranteed QoS class because only limits are specified and requests are set equal to limits when not explicitly specified. And the container's resource limit for the CPU reso", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8308"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8309"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8310"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: foo-scheduler\n    pluginConfig:\n      - name: NodeAffinity\n        args:\n          addedAffinity:\n            requiredDuringSchedulingIgnoredDuringExecution:\n              nodeSelectorTerms:\n              - matchExpressions:\n                - key: scheduler-profile\n                  operator: In\n                  values:\n                  - foo\n```\n\n10.2 - Assigning Pods to Nodes | The addedAffinity is applied to all Pods that set .spec.schedulerName to foo-scheduler, in addition to the NodeAffinity specified in the PodSpec. That is, in order to match the Pod, nodes need to sati", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8311"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8312"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: application-server\n...\nspec:\n  template:\n    spec:\n      affinity:\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - database\n            topologyKey: topology.kubernetes.io/zone\n            # Only Pods from a given rollout are taken into consideration when calculating pod affinity.\n            # If you update the Deployment, the replacement Pods follow their own affinity rules\n            # (if there are any defined in the new Pod template)\n            matchLabelKeys:\n            - pod-template-hash\n```\n\n10.2 - Assigning Pods to Nodes | The mismatchLabelKeys field is a beta-level field and is enabled by default in Kubernetes 1.34. When you want to disable it, you have to disable it explicitly via the MatchLabelKeysInPodAffinity featu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8313"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    # Assume that all relevant Pods have a \"tenant\" label set\n    tenant: tenant-a\n...\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant land on the correct node pool\n      - matchLabelKeys:\n          - tenant\n        topologyKey: node-pool\n    podAntiAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant can't schedule to nodes used for another tenant\n      - mismatchLabelKeys:\n        - tenant # whatever the value of the \"tenant\" label for this Pod, prevent\n                 # scheduling to nodes in any pool where any Pod from a different\n                 # tenant is running.\n        labelSelector:\n          # We have to have the labelSelector which selects only Pods with the tenant label,\n          # otherwise this Pod would have anti-affinity against Pods from daemonsets as well, for example,\n          # which aren't supposed to have the tenant label.\n          matchExpressions:\n          - key: tenant\n            operator: Exists\n        topologyKey: node-pool\n```\n\n10.2 - Assigning Pods to Nodes | Inter-pod affinity and anti-affinity can be even more useful when they are used with higher level collections such as ReplicaSets, StatefulSets, Deployments, etc. These rules allow you to configure th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8314"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-cache\nspec:\n  selector:\n    matchLabels:\n      app: store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: redis-server\n        image: redis:3.2-alpine\n```\n\n10.2 - Assigning Pods to Nodes | The following example Deployment for the web servers creates replicas with the label app=web-store. The Pod affinity rule tells the scheduler to place each replica on a node that has a Pod with the la", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8315"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: web-server\nspec:\n  selector:\n    matchLabels:\n      app: web-store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: web-store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - web-store\n            topologyKey: \"kubernetes.io/hostname\"\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: web-app\n        image: nginx:1.16-alpine\n```\n\n10.2 - Assigning Pods to Nodes | Creating the two preceding Deployments results in the following cluster layout, where each web server is co-located with a cache, on three separate nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8316"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n  nodeName: kube-01\n```\n\n10.2 - Assigning Pods to Nodes | The above Pod will only run on the node kube-01.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8317"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n...\nstatus:\n  nominatedNodeName: kube-01\n```\n\n10.2 - Assigning Pods to Nodes | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, or among any other topology domains that you define. You", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8318"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# You need to change this example to match the actual runtime name, and per-Pod\n# resource overhead, that the container runtime is adding in your cluster.\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: kata-fc\nhandler: kata-fc\noverhead:\n  podFixed:\n    memory: \"120Mi\"\n    cpu: \"250m\"\n```\n\n10.3 - Pod Overhead | Workloads which are created which specify the kata-fc RuntimeClass handler will take the memory and cpu overheads into account for resource quota calculations, node scheduling, as well as Pod cgroup s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8319"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  runtimeClassName: kata-fc\n  containers:\n  - name: busybox-ctr\n    image: busybox:1.28\n    stdin: true\n    tty: true\n    resources:\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  - name: nginx-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: 1500m\n        memory: 100Mi\n```\n\n10.3 - Pod Overhead | At admission time the RuntimeClass admission controller updates the workload's PodSpec to include the overhead as described in the RuntimeClass. If the PodSpec already has this field defined, the Pod", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8320"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.overhead}'\n```\n\n10.3 - Pod Overhead | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8321"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.containers[*].resources.limits}'\n```\n\n10.3 - Pod Overhead | The total container requests are 2000m CPU and 200MiB of memory:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8322"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe node | grep test-pod -B2\n```\n\n10.3 - Pod Overhead | The output shows requests for 2250m CPU, and for 320MiB of memory. The requests include Pod overhead:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8323"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\n# Run this on the node where the Pod is scheduled\nPOD_ID=\"$(sudo crictl pods --name test-pod -q)\"\n```\n\n10.3 - Pod Overhead | From this, you can determine the cgroup path for the Pod:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8324"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\n# Run this on the node where the Pod is scheduled\nsudo crictl inspectp -o=json $POD_ID | grep cgroupsPath\n```\n\n10.3 - Pod Overhead | The resulting cgroup path includes the Pod's pause container. The Pod level cgroup is one directory above.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8325"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\n# Run this on the node where the Pod is scheduled.\n# Also, change the name of the cgroup to match the cgroup allocated for your pod.\n cat /sys/fs/cgroup/memory/kubepods/podd7f4b509-cf94-4951-9417-d1087c92a5b2/memory.limit_in_bytes\n```\n\n10.3 - Pod Overhead | This is 320 MiB, as expected:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8326"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8327"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod\n```\n\n10.4 - Pod Scheduling Readiness | The output reveals it's in SchedulingGated state:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8328"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\n10.4 - Pod Scheduling Readiness | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8329"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8330"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\n10.4 - Pod Scheduling Readiness | The output is expected to be empty. And you can check its latest status by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8331"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o wide\n```\n\n10.4 - Pod Scheduling Readiness | Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get transited from previous SchedulingGated to Running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8332"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-pod\nspec:\n  # Configure a topology spread constraint\n  topologySpreadConstraints:\n    - maxSkew: <integer>\n      minDomains: <integer> # optional\n      topologyKey: <string>\n      whenUnsatisfiable: <string>\n      labelSelector: <object>\n      matchLabelKeys: <list> # optional; beta since v1.27\n      nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26\n      nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26\n  ### other Pod fields go here\n```\n\n10.5 - Pod Topology Spread Constraints | You can read more about this field by running kubectl explain Pod.spec.topologySpreadConstraints or refer to the scheduling section of the API reference for Pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8333"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl explain Pod.spec.topologySpreadConstraints\n```\n\n10.5 - Pod Topology Spread Constraints | You can define one or multiple topologySpreadConstraints entries to instruct the kube-scheduler how to place each incoming Pod in relation to the existing Pods across your cluster. Those fields are:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8334"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ntopologySpreadConstraints:\n        - maxSkew: 1\n          topologyKey: kubernetes.io/hostname\n          whenUnsatisfiable: DoNotSchedule\n          labelSelector:\n            matchLabels:\n              app: foo\n          matchLabelKeys:\n            - pod-template-hash\n```\n\n10.5 - Pod Topology Spread Constraints | The matchLabelKeys field is a beta-level field and enabled by default in 1.27. You can disable it by disabling the MatchLabelKeysInPodTopologySpread feature gate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8335"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nregion: us-east-1\n  zone: us-east-1a\n```\n\n10.5 - Pod Topology Spread Constraints | For brevity, this example doesn't use the well-known label keys topology.kubernetes.io/zone and topology.kubernetes.io/region. However, those registered label keys are nonetheless recommended rather t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8336"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8337"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8338"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8339"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints:\n            - maxSkew: 1\n              topologyKey: topology.kubernetes.io/zone\n              whenUnsatisfiable: ScheduleAnyway\n          defaultingType: List\n```\n\n10.5 - Pod Topology Spread Constraints | If you don't configure any cluster-level default constraints for pod topology spreading, then kube-scheduler acts as if you specified the following default topology constraints:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8340"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ndefaultConstraints:\n  - maxSkew: 3\n    topologyKey: \"kubernetes.io/hostname\"\n    whenUnsatisfiable: ScheduleAnyway\n  - maxSkew: 5\n    topologyKey: \"topology.kubernetes.io/zone\"\n    whenUnsatisfiable: ScheduleAnyway\n```\n\n10.5 - Pod Topology Spread Constraints | Also, the legacy SelectorSpread plugin, which provides an equivalent behavior, is disabled by default.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8341"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints: []\n          defaultingType: List\n```\n\n10.5 - Pod Topology Spread Constraints | In Kubernetes, inter-Pod affinity and anti-affinity control how Pods are scheduled in relation to one another - either more packed or more scattered.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8342"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoSchedule\"\n```\n\n10.6 - Taints and Tolerations | The default Kubernetes scheduler takes taints and tolerations into account when selecting a node to run a particular Pod. However, if you manually specify the .spec.nodeName for a Pod, that action byp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8343"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Exists\"\n  effect: \"NoSchedule\"\n```\n\n10.6 - Taints and Tolerations | The default Kubernetes scheduler takes taints and tolerations into account when selecting a node to run a particular Pod. However, if you manually specify the .spec.nodeName for a Pod, that action byp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8344"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\n10.6 - Taints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8345"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoSchedule\"\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoExecute\"\n```\n\n10.6 - Taints and Tolerations | In this case, the pod will not be able to schedule onto the node, because there is no toleration matching the third taint. But it will be able to continue running if it is already running on the node", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8346"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"key1\"\n  operator: \"Equal\"\n  value: \"value1\"\n  effect: \"NoExecute\"\n  tolerationSeconds: 3600\n```\n\n10.6 - Taints and Tolerations | means that if this pod is running and a matching taint is added to the node, then the pod will stay bound to the node for 3600 seconds, and then be evicted. If the taint is removed before that time, t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8347"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes nodename dedicated=groupName:NoSchedule\n```\n\n10.6 - Taints and Tolerations | Nodes with Special Hardware: In a cluster where a small subset of nodes have specialized hardware (for example GPUs), it is desirable to keep pods that don't need the specialized hardware off of those", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8348"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes nodename special=true:NoSchedule\n```\n\n10.6 - Taints and Tolerations | Taint based Evictions: A per-pod-configurable eviction behavior when there are node problems, which is described in the next section.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8349"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes nodename special=true:PreferNoSchedule\n```\n\n10.6 - Taints and Tolerations | Taint based Evictions: A per-pod-configurable eviction behavior when there are node problems, which is described in the next section.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8350"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- key: \"node.kubernetes.io/unreachable\"\n  operator: \"Exists\"\n  effect: \"NoExecute\"\n  tolerationSeconds: 6000\n```\n\n10.6 - Taints and Tolerations | Kubernetes automatically adds a toleration for node.kubernetes.io/not-ready and node.kubernetes.io/unreachable with tolerationSeconds=300, unless you, or a controller, set those tolerations explicitly", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8351"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: prioritized-list-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        firstAvailable:\n        - name: large-black\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"black\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"large\"                \n        - name: small-white\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"white\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"small\"                \n          count: 2\n```\n\n10.8 - Dynamic Resource Allocation | The decision is made on a per-Pod basis, so if the Pod is a member of a ReplicaSet or similar grouping, you cannot rely on all the members of the group having the same subrequest chosen. Your workload", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8352"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: cat-slice\nspec:\n  driver: \"resource-driver.example.com\"\n  pool:\n    generation: 1\n    name: \"black-cat-pool\"\n    resourceSliceCount: 1\n  # The allNodes field defines whether any node in the cluster can access the device.\n  allNodes: true\n  devices:\n  - name: \"large-black-cat\"\n    attributes:\n      color:\n        string: \"black\"\n      size:\n        string: \"large\"\n      cat:\n        boolean: true\n```\n\n10.8 - Dynamic Resource Allocation | This ResourceSlice is managed by the resource-driver.example.com driver in the black-cat-pool pool. The allNodes: true field indicates that any node in the cluster can access the devices. There's one", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8353"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-cats\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: name-of-the-intended-node\n  ...\n```\n\n10.8 - Dynamic Resource Allocation | You may also be able to mutate the incoming Pod, at admission time, to unset the .spec.nodeName field and to use a node selector instead.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8354"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: large-black-cat-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n          deviceClassName: resource.example.com\n          allocationMode: All\n          adminAccess: true\n```\n\n10.8 - Dynamic Resource Allocation | If this feature is disabled, the adminAccess field will be removed automatically when creating such a ResourceClaim.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8355"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel:\n      expression: device.driver == 'gpu.example.com' && device.attributes['gpu.example.com'].type\n        == 'gpu'\n  extendedResourceName: example.com/gpu\n```\n\n10.8 - Dynamic Resource Allocation | In addition, users can use a special extended resource to allocate devices without having to explicitly create a ResourceClaim. Using the extended resource name prefix deviceclass.resource.kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8356"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  sharedCounters:\n  - name: gpu-1-counters\n    counters:\n      memory:\n        value: 8Gi\n  devices:\n  - name: device-1\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n  - name: device-2\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n```\n\n10.8 - Dynamic Resource Allocation | Partitionable devices is an alpha feature and only enabled when the DRAPartitionableDevices feature gate is enabled in the kube-apiserver and kube-scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8357"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  devices:\n  - name: eth1\n    allowMultipleAllocations: true\n    attributes:\n      name:\n        string: \"eth1\"\n    capacity:\n      bandwidth:\n        requestPolicy:\n          default: \"1M\"\n          validRange:\n            min: \"1M\"\n            step: \"8\"\n        value: \"10G\"\n```\n\n10.8 - Dynamic Resource Allocation | The consumable capacity can be requested as shown in the below example.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8358"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: bandwidth-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n        - deviceClassName: resource.example.com\n          capacity:\n            requests:\n              bandwidth: 1G\n```\n\n10.8 - Dynamic Resource Allocation | The allocation result will include the consumed capacity and the identifier of the share.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8359"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\n...\nstatus:\n  allocation:\n    devices:\n      results:\n      - consumedCapacity:\n          bandwidth: 1G\n        device: eth1\n        shareID: \"a671734a-e8e5-11e4-8fde-42010af09327\"\n```\n\n10.8 - Dynamic Resource Allocation | In this example, a multiply-allocatable device was chosen. However, any resource.example.com device with at least the requested 1G bandwidth could have met the requirement. If a non-multiply-allocatab", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8360"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\nkind: DeviceTaintRule\nmetadata:\n  name: example\nspec:\n  # The entire hardware installation for this\n  # particular driver is broken.\n  # Evict all pods and don't schedule new ones.\n  deviceSelector:\n    driver: dra.example.com\n  taint:\n    key: dra.example.com/unhealthy\n    value: Broken\n    effect: NoExecute\n```\n\n10.8 - Dynamic Resource Allocation | Device Binding Conditions allow the Kubernetes scheduler to delay Pod binding until external resources, such as fabric-attached GPUs or reprogrammable FPGAs, are confirmed to be ready.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8361"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: gpu-slice\nspec:\n  driver: dra.example.com\n  nodeSelector:\n    accelerator-type: high-performance\n  pool:\n    name: gpu-pool\n    generation: 1\n    resourceSliceCount: 1\n  devices:\n    - name: gpu-1\n      attributes:\n        vendor:\n          string: \"example\"\n        model:\n          string: \"example-gpu\"\n      bindsToNode: true\n      bindingConditions:\n        - dra.example.com/is-prepared\n      bindingFailureConditions:\n        - dra.example.com/preparing-failed\n```\n\n10.8 - Dynamic Resource Allocation | This example ResourceSlice has the following properties:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8362"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system | grep kube-scheduler\n```\n\n10.9 - Scheduler Performance Tuning | to verify that the kube-scheduler component is healthy.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8363"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1alpha1\nkind: KubeSchedulerConfiguration\nalgorithmSource:\n  provider: DefaultProvider\n\n...\n\npercentageOfNodesToScore: 50\n```\n\n10.9 - Scheduler Performance Tuning | percentageOfNodesToScore must be a value between 1 and 100 with the default value being calculated based on the cluster size. There is also a hardcoded minimum value of 100 nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8364"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        - name: memory\n          weight: 1\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\n10.10 - Resource Bin Packing | To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8365"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        requestedToCapacityRatio:\n          shape:\n          - utilization: 0\n            score: 0\n          - utilization: 100\n            score: 10\n        type: RequestedToCapacityRatio\n    name: NodeResourcesFit\n```\n\n10.10 - Resource Bin Packing | Referencing the KubeSchedulerConfiguration file with the kube-scheduler flag --config=/path/to/config/file will pass the configuration to the scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8366"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nshape:\n  - utilization: 0\n    score: 0\n  - utilization: 100\n    score: 10\n```\n\n10.10 - Resource Bin Packing | The above arguments give the node a score of 0 if utilization is 0% and 10 for utilization 100%, thus enabling bin packing behavior. To enable least requested the score value must be reversed as follo", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8367"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nshape:\n  - utilization: 0\n    score: 10\n  - utilization: 100\n    score: 0\n```\n\n10.10 - Resource Bin Packing | resources is an optional parameter which defaults to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8368"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  - name: cpu\n    weight: 1\n  - name: memory\n    weight: 1\n```\n\n10.10 - Resource Bin Packing | It can be used to add extended resources as follows:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8369"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  - name: intel.com/foo\n    weight: 5\n  - name: cpu\n    weight: 3\n  - name: memory\n    weight: 1\n```\n\n10.10 - Resource Bin Packing | The weight parameter is optional and is set to 1 if not specified. Also, the weight cannot be set to a negative value.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8370"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for XYZ service pods only.\"\n```\n\n10.11 - Pod Priority and Preemption | Pods with preemptionPolicy: Never will be placed in the scheduling queue ahead of lower-priority pods, but they cannot preempt other pods. A non-preempting pod waiting to be scheduled will stay in the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8371"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority-nonpreempting\nvalue: 1000000\npreemptionPolicy: Never\nglobalDefault: false\ndescription: \"This priority class will not cause other pods to be preempted.\"\n```\n\n10.11 - Pod Priority and Preemption | After you have one or more PriorityClasses, you can create Pods that specify one of those PriorityClass names in their specifications. The priority admission controller uses the priorityClassName fiel", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8372"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  priorityClassName: high-priority\n```\n\n10.11 - Pod Priority and Preemption | When Pod priority is enabled, the scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. As a result, the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8373"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nevictionHard:\n  memory.available: \"500Mi\"\n  nodefs.available: \"1Gi\"\n  imagefs.available: \"100Gi\"\nevictionMinimumReclaim:\n  memory.available: \"0Mi\"\n  nodefs.available: \"500Mi\"\n  imagefs.available: \"2Gi\"\n```\n\n10.12 - Node-pressure Eviction | In this example, if the nodefs.available signal meets the eviction threshold, the kubelet reclaims the resource until the signal reaches the threshold of 1GiB, and then continues to reclaim the minimu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8374"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\ncurl -v -H 'Content-type: application/json' https://your-cluster-api-endpoint.example/api/v1/namespaces/default/pods/quux/eviction -d @eviction.json\n```\n\n10.13 - API-initiated Eviction | When you request an eviction using the API, the API server performs admission checks and responds in one of the following ways:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8375"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nshutdownGracePeriodByPodPriority:\n  - priority: 100000\n    shutdownGracePeriodSeconds: 10\n  - priority: 10000\n    shutdownGracePeriodSeconds: 180\n  - priority: 1000\n    shutdownGracePeriodSeconds: 120\n  - priority: 0\n    shutdownGracePeriodSeconds: 60\n```\n\n11.1 - Node Shutdowns | The above table implies that any pod with priority value >= 100000 will get just 10 seconds to shut down, any pod with value >= 10000 and < 100000 will get 180 seconds to shut down, any pod with value", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8376"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl top --show-swap\n```\n\n11.2 - Swap memory management | Querying metrics is valuable, but somewhat cumbersome, as these metrics are designed to be used by software rather than humans. In order to consume this data in a more user-friendly way, the kubectl t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8377"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8378"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8379"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8380"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous\n```\n\n11.8 - Logging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8381"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8382"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8383"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8384"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n11.8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8385"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n11.8 - Logging Architecture |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8386"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\n11.10 - Metrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8387"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n\"metric1,label2\": \"v1,v2,v3\"\n\"metric2,label1\": \"v1,v2,v3\"\n```\n\n11.10 - Metrics For Kubernetes System Components | Additionally, the cardinality_enforcement_unexpected_categorizations_total meta-metric records the count of unexpected categorizations during cardinality enforcement, that is, whenever a label value i", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8388"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ngroups:\n- name: Pod state\n  rules:\n  - alert: PodsBlockedInTerminatingState\n    expr: count(kube_pod_deletion_timestamp) by (namespace, pod) * count(kube_pod_status_reason{reason=\"NodeLost\"} == 0) by (namespace, pod) > 0\n    for: 5m\n    labels:\n      severity: page\n    annotations:\n      summary: Pod {{$labels.namespace}}/{{$labels.pod}} blocked in Terminating state.\n```\n\n11.11 - Metrics for Kubernetes Object States | System component logs record events happening in cluster, which can be very useful for debugging. You can configure log verbosity to see more or less detail. Logs can be as coarse-grained as showing e", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8389"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nreceivers:\n  otlp:\n    protocols:\n      grpc:\nexporters:\n  # Replace this exporter with the exporter for your backend\n  exporters:\n    debug:\n      verbosity: detailed\nservice:\n  pipelines:\n    traces:\n      receivers: [otlp]\n      exporters: [debug]\n```\n\n11.13 - Traces For Kubernetes System Components | To directly emit traces to a backend without utilizing a collector, specify the endpoint field in the Kubernetes tracing configuration file with the desired trace backend address. This method negates", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8390"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\n11.13 - Traces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8391"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\n11.13 - Traces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8392"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n11.15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8393"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n11.15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8394"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: win-webserver\n  labels:\n    app: win-webserver\nspec:\n  ports:\n    # the port that this service should serve on\n    - port: 80\n      targetPort: 80\n  selector:\n    app: win-webserver\n  type: NodePort\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: win-webserver\n  name: win-webserver\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: win-webserver\n  template:\n    metadata:\n      labels:\n        app: win-webserver\n      name: win-webserver\n    spec:\n     containers:\n      - name: windowswebserver\n        image: mcr.microsoft.com/windows/servercore:ltsc2019\n        command:\n        - powershell.exe\n        - -command\n        - \"<#code used from https://gist.github.com/19WAS85/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ;  ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus)  } ; \"\n     nodeSelector:\n      kubernetes.io/os: windows\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Check that all nodes are healthy:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8395"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f win-webserver.yaml\nkubectl get pods -o wide -w\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | When the service is deployed correctly both Pods are marked as Ready. To exit the watch command, press Ctrl+C.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8396"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nnodeSelector:\n    kubernetes.io/os: windows\n    node.kubernetes.io/windows-build: '10.0.17763'\ntolerations:\n    - key: \"os\"\n      operator: \"Equal\"\n      value: \"windows\"\n      effect: \"NoSchedule\"\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | The Windows Server version used by each pod must match that of the node. If you want to use multiple Windows Server versions in the same cluster, then you should set additional node labels and nodeSel", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8397"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: windows-2019\nhandler: example-container-runtime-handler\nscheduling:\n  nodeSelector:\n    kubernetes.io/os: 'windows'\n    kubernetes.io/arch: 'amd64'\n    node.kubernetes.io/windows-build: '10.0.17763'\n  tolerations:\n  - effect: NoSchedule\n    key: os\n    operator: Equal\n    value: \"windows\"\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Run kubectl create -f runtimeClasses.yml using as a cluster administrator", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8398"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f runtimeClasses.yml\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Add runtimeClassName: windows-2019 as appropriate to Pod specs", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8399"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: iis-2019\n  labels:\n    app: iis-2019\nspec:\n  replicas: 1\n  template:\n    metadata:\n      name: iis-2019\n      labels:\n        app: iis-2019\n    spec:\n      runtimeClassName: windows-2019\n      containers:\n      - name: iis\n        image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        resources:\n          limits:\n            cpu: 1\n            memory: 800Mi\n          requests:\n            cpu: .1\n            memory: 300Mi\n        ports:\n          - containerPort: 80\n selector:\n    matchLabels:\n      app: iis-2019\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: iis\nspec:\n  type: LoadBalancer\n  ports:\n  - protocol: TCP\n    port: 80\n  selector:\n    app: iis-2019\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Kubernetes is highly configurable and extensible. As a result, there is rarely a need to fork or submit patches to the Kubernetes project code.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8400"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubernetes.io/ingress-bandwidth: 1M\n    kubernetes.io/egress-bandwidth: 1M\n...\n```\n\n13.1.1 - Network Plugins | Kubernetes provides a device plugin framework that you can use to advertise system hardware resources to the Kubelet.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8401"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: demo-pod\nspec:\n  containers:\n    - name: demo-container-1\n      image: registry.k8s.io/pause:3.8\n      resources:\n        limits:\n          hardware-vendor.example/foo: 2\n#\n# This Pod needs 2 of the hardware-vendor.example/foo devices\n# and can only schedule onto a Node that's able to satisfy\n# that need.\n#\n# If the Node has more than 2 of those devices available, the\n# remainder would be available for other Pods to use.\n```\n\n13.1.2 - Device Plugins | The general workflow of a device plugin includes the following steps:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8402"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get my-object object-name\n```\n\n13.2.1 - Custom Resources | Kubernetes provides two ways to add custom resources to your cluster:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8403"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n13.2.1 - Custom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8404"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1.2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8405"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1.2 - Objects In Kubernetes | One way to create a Deployment using a manifest file like the one above is to use the kubectl apply command in the kubectl command-line interface, passing the .yaml file as an argument. Here's an exam", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8406"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n1.2 - Objects In Kubernetes | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8407"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image nginx\n```\n\n1.2.1 - Kubernetes Object Management | Advantages compared to object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8408"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nginx.yaml\n```\n\n1.2.1 - Kubernetes Object Management | Delete the objects defined in two configuration files:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8409"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f nginx.yaml -f redis.yaml\n```\n\n1.2.1 - Kubernetes Object Management | Update the objects defined in a configuration file by overwriting the live configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8410"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f nginx.yaml\n```\n\n1.2.1 - Kubernetes Object Management | Advantages compared to imperative commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8411"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f configs/\nkubectl apply -f configs/\n```\n\n1.2.1 - Kubernetes Object Management | Recursively process directories:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8412"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl diff -R -f configs/\nkubectl apply -R -f configs/\n```\n\n1.2.1 - Kubernetes Object Management | Advantages compared to imperative object configuration:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8413"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.2 - Object Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8414"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.3 - Labels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8415"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\n1.2.3 - Labels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8416"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\n1.2.3 - Labels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8417"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\n1.2.3 - Labels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8418"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\n1.2.3 - Labels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8419"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\n1.2.3 - Labels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8420"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\n1.2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8421"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\n1.2.3 - Labels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8422"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\n1.2.3 - Labels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8423"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\n1.2.3 - Labels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8424"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\n1.2.4 - Namespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8425"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\n1.2.4 - Namespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8426"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\n1.2.4 - Namespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8427"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotations-demo\n  annotations:\n    imageregistry: \"https://hub.docker.com/\"\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1.2.5 - Annotations | Field selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8428"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector status.phase=Running\n```\n\n1.2.6 - Field Selectors | Supported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8429"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress --field-selector foo.bar=baz\n```\n\n1.2.6 - Field Selectors | All custom resource types support the metadata.name and metadata.namespace fields.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8430"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get services  --all-namespaces --field-selector metadata.namespace!=default\n```\n\n1.2.6 - Field Selectors | As with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8431"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always\n```\n\n1.2.6 - Field Selectors | You can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8432"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default\n```\n\n1.2.6 - Field Selectors | Finalizers are namespaced keys that tell Kubernetes to wait until specific conditions are met before it fully deletes resources that are marked for deletion. Finalizers alert controllers to clean up r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8433"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# This is an excerpt\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n    app.kubernetes.io/managed-by: Helm\n```\n\n1.2.9 - Recommended Labels | An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, WordPress can be installed more than once where different websites are", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8434"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose the application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8435"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: myservice\n    app.kubernetes.io/instance: myservice-abcxyz\n...\n```\n\n1.2.9 - Recommended Labels | Consider a slightly more complicated application: a web application (WordPress) using a database (MySQL), installed using Helm. The following snippets illustrate the start of objects used to deploy th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8436"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8437"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: wordpress\n    app.kubernetes.io/instance: wordpress-abcxyz\n    app.kubernetes.io/version: \"4.9.4\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: server\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | MySQL is exposed as a StatefulSet with metadata for both it and the larger application it belongs to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8438"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | The Service is used to expose MySQL as part of WordPress:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8439"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: mysql\n    app.kubernetes.io/instance: mysql-abcxyz\n    app.kubernetes.io/version: \"5.7.21\"\n    app.kubernetes.io/managed-by: Helm\n    app.kubernetes.io/component: database\n    app.kubernetes.io/part-of: wordpress\n...\n```\n\n1.2.9 - Recommended Labels | With the MySQL StatefulSet and Service you'll notice information about both MySQL and WordPress, the broader application, are included.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8440"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl cordon $NODENAME\n```\n\n2.1 - Nodes | See Safely Drain a Node for more details.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8441"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\n2.1 - Nodes | See Node Status for more details.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8442"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease -l apiserver.kubernetes.io/identity=kube-apiserver\n```\n\n2.4 - Leases | The SHA256 hash used in the lease name is based on the OS hostname as seen by that API server. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instanc", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8443"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system get lease apiserver-07a5ea9b9b072c4a5f3d1c3702 -o yaml\n```\n\n2.4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8444"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\nkind: Lease\nmetadata:\n  creationTimestamp: \"2023-07-02T13:16:48Z\"\n  labels:\n    apiserver.kubernetes.io/identity: kube-apiserver\n    kubernetes.io/hostname: master-1\n  name: apiserver-07a5ea9b9b072c4a5f3d1c3702\n  namespace: kube-system\n  resourceVersion: \"334899\"\n  uid: 90870ab5-1ba9-4523-b215-e4d4e662acb1\nspec:\n  holderIdentity: apiserver-07a5ea9b9b072c4a5f3d1c3702_0c8914f7-0f35-440e-8676-7844977d3a05\n  leaseDurationSeconds: 3600\n  renewTime: \"2023-07-04T21:58:48.065888Z\"\n```\n\n2.4 - Leases | Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8445"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: cloud-controller-manager\nrules:\n- apiGroups:\n  - \"\"\n  resources:\n  - events\n  verbs:\n  - create\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes\n  verbs:\n  - '*'\n- apiGroups:\n  - \"\"\n  resources:\n  - nodes/status\n  verbs:\n  - patch\n- apiGroups:\n  - \"\"\n  resources:\n  - services\n  verbs:\n  - list\n  - watch\n- apiGroups:\n  - \"\"\n  resources:\n  - services/status\n  verbs:\n  - patch\n  - update\n- apiGroups:\n  - \"\"\n  resources:\n  - serviceaccounts\n  verbs:\n  - create\n- apiGroups:\n  - \"\"\n  resources:\n  - persistentvolumes\n  verbs:\n  - get\n  - list\n  - update\n  - watch\n```\n\n2.5 - Cloud Controller Manager | Cloud Controller Manager Administration has instructions on running and managing the cloud controller manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8446"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry <name> \\\n  --docker-server=<docker-registry-server> \\\n  --docker-username=<docker-user> \\\n  --docker-password=<docker-password> \\\n  --docker-email=<docker-email>\n```\n\n3.1 - Images | If you already have a Docker credentials file then, rather than using the above command, you can import the credentials file as a Kubernetes Secret. Create a Secret based on existing Docker credential", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8447"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: foo\n  namespace: awesomeapps\nspec:\n  containers:\n    - name: foo\n      image: janedoe/awesomeapp:v1\n  imagePullSecrets:\n    - name: myregistrykey\nEOF\n\ncat <<EOF >> ./kustomization.yaml\nresources:\n- pod.yaml\nEOF\n```\n\n3.1 - Images | This needs to be done for each Pod that is using a private registry.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8448"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# RuntimeClass is defined in the node.k8s.io API group\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  # The name the RuntimeClass will be referenced by.\n  # RuntimeClass is a non-namespaced resource.\n  name: myclass \n# The name of the corresponding CRI configuration\nhandler: myconfiguration\n```\n\n3.3 - Runtime Class | The name of a RuntimeClass object must be a valid DNS subdomain name.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8449"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  runtimeClassName: myclass\n  # ...\n```\n\n3.3 - Runtime Class | This will instruct the kubelet to use the named RuntimeClass to run this pod. If the named RuntimeClass does not exist, or the CRI cannot run the corresponding handler, the pod will enter the Failed t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8450"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/simple-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n4.1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8451"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n4.1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8452"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml\n```\n\n4.1 - Pods | Pods are generally not created directly and are created using workload resources. See Working with Pods for more information on how Pods are used with workload resources.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8453"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\n4.1 - Pods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8454"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\n4.1.1 - Pod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8455"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\n4.1.1 - Pod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8456"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\n4.1.1 - Pod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8457"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\n4.1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8458"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\n4.1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8459"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\n4.1.1 - Pod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8460"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\n4.1.2 - Init Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8461"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8462"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8463"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8464"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs myapp-pod -c init-myservice # Inspect the first init container\nkubectl logs myapp-pod -c init-mydb      # Inspect the second init container\n```\n\n4.1.2 - Init Containers | At this point, those init containers will be waiting to discover Services named mydb and myservice.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8465"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\n4.1.2 - Init Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8466"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f services.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8467"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n4.1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8468"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-sidecar.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8469"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8470"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napplication/job/job-sidecar.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8471"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n4.1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8472"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n4.1.6 - Pod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8473"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n4.1.6 - Pod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8474"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\n4.1.8 - User Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8475"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/nginx-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8476"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8477"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml\n```\n\n4.2.1 - Deployments | Run kubectl get deployments to check if the Deployment was created.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8478"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1\n```\n\n4.2.1 - Deployments | or use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8479"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n4.2.1 - Deployments | where deployment/nginx-deployment indicates the Deployment, nginx indicates the Container the update will take place and nginx:1.16.1 indicates the new image and its tag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8480"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8481"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8482"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8483"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.161\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8484"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8485"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8486"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8487"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment --revision=2\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8488"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8489"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment --to-revision=2\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8490"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8491"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8492"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=10\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8493"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment/nginx-deployment --min=10 --max=15 --cpu-percent=80\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8494"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:sometag\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8495"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8496"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8497"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8498"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8499"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8500"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --watch\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8501"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8502"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment/nginx-deployment -p '{\"spec\":{\"progressDeadlineSeconds\":600}}'\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8503"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8504"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n4.2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8505"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\n4.2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8506"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\n4.2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8507"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\n4.2.1 - Deployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8508"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/frontend.yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8509"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8510"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n4.2.2 - ReplicaSet | You can then get the current ReplicaSets deployed:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8511"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe rs/frontend\n```\n\n4.2.2 - ReplicaSet | And you will see output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8512"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods frontend-gbgfx -o yaml\n```\n\n4.2.2 - ReplicaSet | The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8513"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\n4.2.2 - ReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8514"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/pod-rs.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n4.2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8515"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n4.2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8516"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n4.2.2 - ReplicaSet | The new Pods will be acquired by the ReplicaSet, and then immediately terminated as the ReplicaSet would be over its desired count.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8517"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n4.2.2 - ReplicaSet | And then create the ReplicaSet however:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8518"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n4.2.2 - ReplicaSet | You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the number of its new Pods and the original matches its desired count. As fetching the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8519"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Foreground\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n4.2.2 - ReplicaSet | You can delete a ReplicaSet without affecting any of its Pods using kubectl delete with the --cascade=orphan option. When using the REST API or the client-go library, you must set propagationPolicy to", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8520"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Orphan\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n4.2.2 - ReplicaSet | Once the original is deleted, you can create a new ReplicaSet to replace it. As long as the old and new .spec.selector are the same, then the new one will adopt the old Pods. However, it will not make", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8521"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/hpa-rs.yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8522"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n4.2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8523"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/hpa-rs.yaml\n```\n\n4.2.2 - ReplicaSet | Alternatively, you can use the kubectl autoscale command to accomplish the same (and it's easier!)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8524"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50\n```\n\n4.2.2 - ReplicaSet | Deployment is an object which can own ReplicaSets and update them and their Pods via declarative, server-side rolling updates. While ReplicaSets can be used independently, today they're mainly used by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8525"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n4.2.3 - StatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8526"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\n4.2.3 - StatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8527"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\n4.2.3 - StatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8528"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\n4.2.3 - StatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8529"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n4.2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8530"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n4.2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8531"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n4.2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8532"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n4.2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8533"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/job.yaml\n```\n\n4.2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8534"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\n4.2.5 - Jobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8535"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-backoff-limit-per-index-example.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n4.2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8536"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n4.2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8537"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get -o yaml job job-backoff-limit-per-index-example\n```\n\n4.2.5 - Jobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8538"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-example.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n4.2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8539"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n4.2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8540"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-success-policy.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8541"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8542"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8543"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n4.2.5 - Jobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8544"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get job myjob -o yaml\n```\n\n4.2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8545"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\n4.2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8546"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":true}}'\n```\n\n4.2.5 - Jobs | Resume a suspended Job:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8547"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":false}}'\n```\n\n4.2.5 - Jobs | The Job's status can be used to determine if a Job is suspended or has been suspended in the past:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8548"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n4.2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8549"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\n4.2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8550"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/myjob\n```\n\n4.2.5 - Jobs | The last four events, particularly the \"Suspended\" and \"Resumed\" events, are directly a result of toggling the .spec.suspend field. In the time between these two events, we see that no Pods were creat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8551"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get job old -o yaml\n```\n\n4.2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8552"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n4.2.5 - Jobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8553"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n4.2.5 - Jobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8554"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\n4.2.5 - Jobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8555"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n4.2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8556"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\n4.2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8557"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napplication/job/cronjob.yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n4.2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8558"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n4.2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8559"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/replication.yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n4.2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8560"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n4.2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8561"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/replication.yaml\n```\n\n4.2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8562"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe replicationcontrollers/nginx\n```\n\n4.2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8563"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napplication/nginx-app.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8564"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4.4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8565"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4.4 - Managing Workloads | The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8566"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \\\n  -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4.4 - Managing Workloads | It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same direct", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8567"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4.4 - Managing Workloads | If you need to define more manifests, such as adding a ConfigMap, you can do that too.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8568"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4.4 - Managing Workloads | In the case of two resources, you can specify both resources on the command line using the resource/name syntax:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8569"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/my-nginx services/my-nginx-svc\n```\n\n4.4 - Managing Workloads | For larger numbers of resources, you'll find it easier to specify the selector (label query) specified using -l or --selector, to filter resources by their labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8570"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,services -l app=nginx\n```\n\n4.4 - Managing Workloads | Because kubectl outputs resource names in the same syntax it accepts, you can chain operations using $() or xargs:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8571"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ )\nkubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ | xargs -i kubectl get '{}'\n```\n\n4.4 - Managing Workloads | The output might be similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8572"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development\n```\n\n4.4 - Managing Workloads | Instead, specify the --recursive or -R command line argument along with the --filename/-f argument:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8573"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development --recursive\n```\n\n4.4 - Managing Workloads | The --recursive argument works with any operation that accepts the --filename/-f argument such as: kubectl create, kubectl get, kubectl delete, kubectl describe, or even kubectl rollout.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8574"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/namespaces -f project/k8s/development --recursive\n```\n\n4.4 - Managing Workloads | If you're interested in learning more about kubectl, go ahead and read Command line tool (kubectl).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8575"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-nginx --image=nginx:1.14.2\n```\n\n4.4 - Managing Workloads | Ensure that there is 1 replica:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8576"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas 1 deployments/my-nginx --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\": 1}}'\n```\n\n4.4 - Managing Workloads | and allow Kubernetes to add more temporary replicas during a rollout, by setting a surge maximum of 100%:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8577"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch --type='merge' -p '{\"spec\":{\"strategy\":{\"rollingUpdate\":{\"maxSurge\": \"100%\" }}}}'\n```\n\n4.4 - Managing Workloads | To update to version 1.16.1, change .spec.template.spec.containers[0].image from nginx:1.14.2 to nginx:1.16.1 using kubectl edit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8578"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n# Change the manifest to use the newer container image, then save your changes\n```\n\n4.4 - Managing Workloads | That's it! The Deployment will declaratively update the deployed nginx application progressively behind the scene. It ensures that only a certain number of old replicas may be down while they are bein", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8579"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-deployment.yaml\n\n# wait for rollout to finish\nkubectl rollout status deployment/my-deployment --timeout 10m # 10 minute timeout\n```\n\n4.4 - Managing Workloads | or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8580"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f backing-stateful-component.yaml\n\n# don't wait for rollout to finish, just check the status\nkubectl rollout status statefulsets/backing-stateful-component --watch=false\n```\n\n4.4 - Managing Workloads | You can also pause, resume or cancel a rollout. Visit kubectl rollout to learn more.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8581"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods my-nginx-v4-9gw19 description='my frontend running nginx'\nkubectl get pods my-nginx-v4-9gw19 -o yaml\n```\n\n4.4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8582"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: pod\nmetadata:\n  annotations:\n    description: my frontend running nginx\n...\n```\n\n4.4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8583"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/my-nginx --replicas=1\n```\n\n4.4 - Managing Workloads | Now you only have one pod managed by the deployment.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8584"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n4.4 - Managing Workloads | To have the system automatically choose the number of nginx replicas as needed, ranging from 1 to 3, do:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8585"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4.4 - Managing Workloads | To learn more about the underlying mechanism, read server-side apply.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8586"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n```\n\n4.4 - Managing Workloads | This is equivalent to first get the resource, edit it in text editor, and then apply the resource with the updated version:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8587"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment my-nginx -o yaml > /tmp/nginx.yaml\nvi /tmp/nginx.yaml\n# do some edit, and then save the file\n\nkubectl apply -f /tmp/nginx.yaml\ndeployment.apps/my-nginx configured\n\nrm /tmp/nginx.yaml\n```\n\n4.4 - Managing Workloads | This allows you to do more significant changes more easily. Note that you can specify the editor with your EDITOR or KUBE_EDITOR environment variables.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8588"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force\n```\n\n4.4 - Managing Workloads | The Kubernetes network model is built out of several pieces:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8589"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/simple-service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n5.1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8590"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n5.1 - Service | Applying this manifest creates a new Service named \"my-service\" with the default ClusterIP service type. The Service targets TCP port 9376 on any Pod with the app.kubernetes.io/name: MyApp label.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8591"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    app.kubernetes.io/name: proxy\nspec:\n  containers:\n  - name: nginx\n    image: nginx:stable\n    ports:\n      - containerPort: 80\n        name: http-web-svc\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app.kubernetes.io/name: proxy\n  ports:\n  - name: name-of-service-port\n    protocol: TCP\n    port: 80\n    targetPort: http-web-svc\n```\n\n5.1 - Service | This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers. This offers a lot of flexibility for d", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8592"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n```\n\n5.1 - Service | Because this Service has no selector, the corresponding EndpointSlice objects are not created automatically. You can map the Service to the network address and port where it's running, by adding an En", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8593"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: my-service-1 # by convention, use the name of the Service\n                     # as a prefix for the name of the EndpointSlice\n  labels:\n    # You should set the \"kubernetes.io/service-name\" label.\n    # Set its value to match the name of the Service\n    kubernetes.io/service-name: my-service\naddressType: IPv4\nports:\n  - name: http # should match with the name of the service port defined above\n    appProtocol: http\n    protocol: TCP\n    port: 9376\nendpoints:\n  - addresses:\n      - \"10.4.5.6\"\n  - addresses:\n      - \"10.1.2.3\"\n```\n\n5.1 - Service | When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice. Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8594"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 9376\n    - name: https\n      protocol: TCP\n      port: 443\n      targetPort: 9377\n```\n\n5.1 - Service | As with Kubernetes names in general, names for ports must only contain lowercase alphanumeric characters and -. Port names must also start and end with an alphanumeric character.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8595"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  type: NodePort\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - port: 80\n      # By default and for convenience, the `targetPort` is set to\n      # the same value as the `port` field.\n      targetPort: 80\n      # Optional field\n      # By default and for convenience, the Kubernetes control plane\n      # will allocate a port from a range (default: 30000-32767)\n      nodePort: 30007\n```\n\n5.1 - Service | The policy for assigning ports to NodePort services applies to both the auto-assignment and the manual assignment scenarios. When a user wants to create a NodePort service that uses a specific port, t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8596"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  clusterIP: 10.0.171.239\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 192.0.2.127\n```\n\n5.1 - Service | Traffic from the external load balancer is directed at the backend Pods. The cloud provider decides how it is load balanced.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8597"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: prod\nspec:\n  type: ExternalName\n  externalName: my.database.example.com\n```\n\n5.1 - Service | A Service of type: ExternalName accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8598"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - name: http\n      protocol: TCP\n      port: 80\n      targetPort: 49152\n  externalIPs:\n    - 198.51.100.32\n```\n\n5.1 - Service | Service is a top-level resource in the Kubernetes REST API. You can find more details about the Service API object.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8599"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/minimal-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8600"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: minimal-ingress\n  annotations:\n    nginx.ingress.kubernetes.io/rewrite-target: /\nspec:\n  ingressClassName: nginx-example\n  rules:\n  - http:\n      paths:\n      - path: /testpath\n        pathType: Prefix\n        backend:\n          service:\n            name: test\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress needs apiVersion, kind, metadata and spec fields. The name of an Ingress object must be a valid DNS subdomain name. For general information about working with config files, see deploying ap", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8601"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/ingress-resource-backend.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n5.2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8602"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource-backend\nspec:\n  defaultBackend:\n    resource:\n      apiGroup: k8s.example.com\n      kind: StorageBucket\n      name: static-assets\n  rules:\n    - http:\n        paths:\n          - path: /icons\n            pathType: ImplementationSpecific\n            backend:\n              resource:\n                apiGroup: k8s.example.com\n                kind: StorageBucket\n                name: icon-assets\n```\n\n5.2 - Ingress | After creating the Ingress above, you can view it with the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8603"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress ingress-resource-backend\n```\n\n5.2 - Ingress | Each path in an Ingress is required to have a corresponding path type. Paths that do not include an explicit pathType will fail validation. There are three supported path types:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8604"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/ingress-wildcard-host.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8605"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-wildcard-host\nspec:\n  rules:\n  - host: \"foo.bar.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/bar\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: \"*.foo.com\"\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/foo\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | Ingresses can be implemented by different controllers, often with different configuration. Each Ingress should specify a class, a reference to an IngressClass resource that contains additional configu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8606"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/external-lb.yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n5.2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8607"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    apiGroup: k8s.example.com\n    kind: IngressParameters\n    name: external-lb\n```\n\n5.2 - Ingress | The .spec.parameters field of an IngressClass lets you reference another resource that provides configuration related to that IngressClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8608"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-1\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in a\n    # ClusterIngressParameter (API group k8s.example.net) named\n    # \"external-config-1\". This definition tells Kubernetes to\n    # look for a cluster-scoped parameter resource.\n    scope: Cluster\n    apiGroup: k8s.example.net\n    kind: ClusterIngressParameter\n    name: external-config-1\n```\n\n5.2 - Ingress | FEATURE STATE: Kubernetes v1.23 [stable]If you set the .spec.parameters field and set .spec.parameters.scope to Namespace, then the IngressClass refers to a namespaced-scoped resource. You must also s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8609"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  name: external-lb-2\nspec:\n  controller: example.com/ingress-controller\n  parameters:\n    # The parameters for this IngressClass are specified in an\n    # IngressParameter (API group k8s.example.com) named \"external-config\",\n    # that's in the \"external-configuration\" namespace.\n    scope: Namespace\n    apiGroup: k8s.example.com\n    kind: IngressParameter\n    namespace: external-configuration\n    name: external-config\n```\n\n5.2 - Ingress | Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8610"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/default-ingressclass.yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n5.2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8611"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: IngressClass\nmetadata:\n  labels:\n    app.kubernetes.io/component: controller\n  name: nginx-example\n  annotations:\n    ingressclass.kubernetes.io/is-default-class: \"true\"\nspec:\n  controller: k8s.io/ingress-nginx\n```\n\n5.2 - Ingress | There are existing Kubernetes concepts that allow you to expose a single Service (see alternatives). You can also do this with an Ingress by specifying a default backend with no rules.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8612"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/test-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n5.2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8613"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: test-ingress\nspec:\n  defaultBackend:\n    service:\n      name: test\n      port:\n        number: 80\n```\n\n5.2 - Ingress | If you create it using kubectl apply -f you should be able to view the state of the Ingress you added:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8614"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get ingress test-ingress\n```\n\n5.2 - Ingress | Where 203.0.113.123 is the IP allocated by the Ingress controller to satisfy this Ingress.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8615"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/simple-fanout-example.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n5.2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8616"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: simple-fanout-example\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - path: /foo\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 4200\n      - path: /bar\n        pathType: Prefix\n        backend:\n          service:\n            name: service2\n            port:\n              number: 8080\n```\n\n5.2 - Ingress | When you create the Ingress with kubectl apply -f:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8617"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress simple-fanout-example\n```\n\n5.2 - Ingress | The Ingress controller provisions an implementation-specific load balancer that satisfies the Ingress, as long as the Services (service1, service2) exist. When it has done so, you can see the address", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8618"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/name-virtual-host-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8619"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress\nspec:\n  rules:\n  - host: foo.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: bar.foo.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n```\n\n5.2 - Ingress | If you create an Ingress resource without any hosts defined in the rules, then any web traffic to the IP address of your Ingress controller can be matched without a name based virtual host being requi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8620"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/name-virtual-host-ingress-no-third-host.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n5.2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8621"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: name-virtual-host-ingress-no-third-host\nspec:\n  rules:\n  - host: first.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n  - host: second.bar.com\n    http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service2\n            port:\n              number: 80\n  - http:\n      paths:\n      - pathType: Prefix\n        path: \"/\"\n        backend:\n          service:\n            name: service3\n            port:\n              number: 80\n```\n\n5.2 - Ingress | You can secure an Ingress by specifying a Secret that contains a TLS private key and certificate. The Ingress resource only supports a single TLS port, 443, and assumes TLS termination at the ingress", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8622"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: testsecret-tls\n  namespace: default\ndata:\n  tls.crt: base64 encoded cert\n  tls.key: base64 encoded key\ntype: kubernetes.io/tls\n```\n\n5.2 - Ingress | Referencing this secret in an Ingress tells the Ingress controller to secure the channel from the client to the load balancer using TLS. You need to make sure the TLS secret you created came from a ce", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8623"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/tls-example-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8624"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: tls-example-ingress\nspec:\n  tls:\n  - hosts:\n      - https-example.foo.com\n    secretName: testsecret-tls\n  rules:\n  - host: https-example.foo.com\n    http:\n      paths:\n      - path: /\n        pathType: Prefix\n        backend:\n          service:\n            name: service1\n            port:\n              number: 80\n```\n\n5.2 - Ingress | An Ingress controller is bootstrapped with some load balancing policy settings that it applies to all Ingress, such as the load balancing algorithm, backend weight scheme, and others. More advanced lo", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8625"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n5.2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8626"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl edit ingress test\n```\n\n5.2 - Ingress | This pops up an editor with the existing configuration in YAML format. Modify it to include the new Host:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8627"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe ingress test\n```\n\n5.2 - Ingress | You can achieve the same outcome by invoking kubectl replace -f on a modified Ingress YAML file.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8628"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GatewayClass\nmetadata:\n  name: example-class\nspec:\n  controllerName: example.com/gateway-controller\n```\n\n5.4 - Gateway API | In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses with the controller name example.com/gateway-controller. Gateways of this class will be managed by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8629"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: Gateway\nmetadata:\n  name: example-gateway\nspec:\n  gatewayClassName: example-class\n  listeners:\n  - name: http\n    protocol: HTTP\n    port: 80\n```\n\n5.4 - Gateway API | In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP traffic on port 80. Since the addresses field is unspecified, an address or hostname is assigned to the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8630"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: HTTPRoute\nmetadata:\n  name: example-httproute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"www.example.com\"\n  rules:\n  - matches:\n    - path:\n        type: PathPrefix\n        value: /login\n    backendRefs:\n    - name: example-svc\n      port: 8080\n```\n\n5.4 - Gateway API | In this example, HTTP traffic from Gateway example-gateway with the Host: header set to www.example.com and the request path specified as /login will be routed to Service example-svc on port 8080.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8631"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - backendRefs:\n    - name: example-svc\n      port: 50051\n```\n\n5.4 - Gateway API | In this example, gRPC traffic from Gateway example-gateway with the host set to svc.example.com will be directed to the service example-svc on port 50051 from the same namespace.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8632"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1\nkind: GRPCRoute\nmetadata:\n  name: example-grpcroute\nspec:\n  parentRefs:\n  - name: example-gateway\n  hostnames:\n  - \"svc.example.com\"\n  rules:\n  - matches:\n    - method:\n        service: com.example\n        method: Login\n    backendRefs:\n    - name: foo-svc\n      port: 50051\n```\n\n5.4 - Gateway API | In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules to forward the traffic to the correct backend. Since there is only one match specified,only requests", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8633"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-abc\n  labels:\n    kubernetes.io/service-name: example\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    nodeName: node-1\n    zone: us-west2-a\n```\n\n5.5 - EndpointSlices | By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8634"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/networkpolicy.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n5.6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8635"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: test-network-policy\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n  - Ingress\n  - Egress\n  ingress:\n  - from:\n    - ipBlock:\n        cidr: 172.17.0.0/16\n        except:\n        - 172.17.1.0/24\n    - namespaceSelector:\n        matchLabels:\n          project: myproject\n    - podSelector:\n        matchLabels:\n          role: frontend\n    ports:\n    - protocol: TCP\n      port: 6379\n  egress:\n  - to:\n    - ipBlock:\n        cidr: 10.0.0.0/24\n    ports:\n    - protocol: TCP\n      port: 5978\n```\n\n5.6 - Network Policies | Mandatory Fields: As with all other Kubernetes config, a NetworkPolicy needs apiVersion, kind, and metadata fields. For general information about working with config files, see Configure a Pod to Use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8636"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-ingress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8637"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-ingress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will still be isolated for ingress. This policy does not affect isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8638"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-allow-all-ingress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8639"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-ingress\nspec:\n  podSelector: {}\n  ingress:\n  - {}\n  policyTypes:\n  - Ingress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any incoming connection to those pods to be denied. This policy has no effect on isolation for egress from any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8640"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-egress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8641"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-egress\nspec:\n  podSelector: {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed egress traffic. This policy does not change the ingress isolation behavior of any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8642"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-allow-all-egress.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8643"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: allow-all-egress\nspec:\n  podSelector: {}\n  egress:\n  - {}\n  policyTypes:\n  - Egress\n```\n\n5.6 - Network Policies | With this policy in place, no additional policy or policies can cause any outgoing connection from those pods to be denied. This policy has no effect on isolation for ingress to any pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8644"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/network-policy-default-deny-all.yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8645"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\nspec:\n  podSelector: {}\n  policyTypes:\n  - Ingress\n  - Egress\n```\n\n5.6 - Network Policies | This ensures that even pods that aren't selected by any other NetworkPolicy will not be allowed ingress or egress traffic.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8646"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/networkpolicy-multiport-egress.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n5.6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8647"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: multi-port-egress\n  namespace: default\nspec:\n  podSelector:\n    matchLabels:\n      role: db\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - ipBlock:\n            cidr: 10.0.0.0/24\n      ports:\n        - protocol: TCP\n          port: 32000\n          endPort: 32768\n```\n\n5.6 - Network Policies | The above rule allows any Pod with label role=db on the namespace default to communicate with any IP within the range 10.0.0.0/24 over TCP, provided that the target port is between the range 32000 and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8648"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl label namespace frontend namespace=frontend\nkubectl label namespace backend namespace=backend\n```\n\n5.6 - Network Policies | Add the labels under namespaceSelector in your NetworkPolicy document. For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8649"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: egress-namespaces\nspec:\n  podSelector:\n    matchLabels:\n      app: myapp\n  policyTypes:\n  - Egress\n  egress:\n  - to:\n    - namespaceSelector:\n        matchExpressions:\n        - key: namespace\n          operator: In\n          values: [\"frontend\", \"backend\"]\n```\n\n5.6 - Network Policies | The Kubernetes control plane sets an immutable label kubernetes.io/metadata.name on all namespaces, the value of the label is the namespace name.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8650"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n5.7 - DNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8651"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\n5.7 - DNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8652"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/custom-dns.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n5.7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8653"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\n5.7 - DNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8654"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dns-example -- cat /etc/resolv.conf\n```\n\n5.7 - DNS for Services and Pods | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8655"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8656"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines PreferDualStack in .spec.ipFamilyPolicy. When you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6 addresses for the ser", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8657"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8658"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | This Service specification explicitly defines IPv6 and IPv4 in .spec.ipFamilies as well as defining PreferDualStack in .spec.ipFamilyPolicy. When Kubernetes assigns an IPv6 and IPv4 address in .spec.c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8659"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-ipfamilies-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8660"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  - IPv4\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | These examples demonstrate the default behavior when dual-stack is newly enabled on a cluster where Services already exist. (Upgrading an existing cluster to 1.21 or beyond will enable dual-stack.)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8661"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8662"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing service.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8663"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n5.8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8664"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 10.0.197.123\n  clusterIPs:\n  - 10.0.197.123\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n5.8 - IPv4/IPv6 dual-stack | When dual-stack is enabled on a cluster, existing headless Services with selectors are configured by the control plane to set .spec.ipFamilyPolicy to SingleStack and set .spec.ipFamilies to the addres", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8665"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8666"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n5.8 - IPv4/IPv6 dual-stack | You can validate this behavior by using kubectl to inspect an existing headless service with selectors.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8667"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n5.8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8668"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: None\n  clusterIPs:\n  - None\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n```\n\n5.8 - IPv4/IPv6 dual-stack | Services can be changed from single-stack to dual-stack and from dual-stack to single-stack.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8669"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\nkind: EndpointSlice\nmetadata:\n  name: example-hints\n  labels:\n    kubernetes.io/service-name: example-svc\naddressType: IPv4\nports:\n  - name: http\n    protocol: TCP\n    port: 80\nendpoints:\n  - addresses:\n      - \"10.1.2.3\"\n    conditions:\n      ready: true\n    hostname: pod-1\n    zone: zone-a\n    hints:\n      forZones:\n        - name: \"zone-a\"\n```\n\n5.9 - Topology Aware Routing | The kube-proxy component filters the endpoints it routes to based on the hints set by the EndpointSlice controller. In most cases, this means that the kube-proxy is able to route traffic to endpoints", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8670"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    k8s-app: kube-dns\n    kubernetes.io/cluster-service: \"true\"\n    kubernetes.io/name: CoreDNS\n  name: kube-dns\n  namespace: kube-system\nspec:\n  clusterIP: 10.96.0.10\n  ports:\n  - name: dns\n    port: 53\n    protocol: UDP\n    targetPort: 53\n  - name: dns-tcp\n    port: 53\n    protocol: TCP\n    targetPort: 53\n  selector:\n    k8s-app: kube-dns\n  type: ClusterIP\n```\n\n5.11 - Service ClusterIP allocation | But, as it was explained before, the IP address 10.96.0.10 has not been reserved. If other Services are created before or in parallel with dynamic allocation, there is a chance they can allocate this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8671"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 9376\n  internalTrafficPolicy: Local\n```\n\n5.12 - Service Internal Traffic Policy | The kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8672"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-pod\nspec:\n  containers:\n    - name: test\n      image: busybox:1.28\n      command: ['sh', '-c', 'echo \"The app is running!\" && tail -f /dev/null']\n      volumeMounts:\n        - name: config-vol\n          mountPath: /etc/config\n  volumes:\n    - name: config-vol\n      configMap:\n        name: log-config\n        items:\n          - key: log_level\n            path: log_level.conf\n```\n\n6.1 - Volumes | The log-config ConfigMap is mounted as a volume, and all contents stored in its log_level entry are mounted into the Pod at path /etc/config/log_level.conf. Note that this path is derived from the vol", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8673"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n```\n\n6.1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8674"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /cache\n      name: cache-volume\n  volumes:\n  - name: cache-volume\n    emptyDir:\n      sizeLimit: 500Mi\n      medium: Memory\n```\n\n6.1 - Volumes | An fc volume type allows an existing fibre channel block storage volume to be mounted in a Pod. You can specify single or multiple target world wide names (WWNs) using the parameter targetWWNs in your", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8675"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: server\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /mypath\n      name: git-volume\n  volumes:\n  - name: git-volume\n    gitRepo:\n      repository: \"git@somewhere:me/my-git-repository.git\"\n      revision: \"22f1d8406d464b0c0874075539c1f2e96c253775\"\n```\n\n6.1 - Volumes | Kubernetes 1.34 does not include a glusterfs volume type.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8676"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts /data/foo on the host as /foo inside the\n# single container that runs within the hostpath-example-linux Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-linux\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: example-container\n    image: registry.k8s.io/test-webserver\n    volumeMounts:\n    - mountPath: /foo\n      name: example-volume\n      readOnly: true\n  volumes:\n  - name: example-volume\n    # mount /data/foo, but only if that directory already exists\n    hostPath:\n      path: /data/foo # directory location on host\n      type: Directory # this field is optional\n```\n\n6.1 - Volumes | --- # This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the # single container that runs within the hostpath-example-windows Pod. # # The mount into the container is read-only. apiVersion", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8677"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\n# This manifest mounts C:\\Data\\foo on the host as C:\\foo, inside the\n# single container that runs within the hostpath-example-windows Pod.\n#\n# The mount into the container is read-only.\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostpath-example-windows\nspec:\n  os: { name: windows }\n  nodeSelector:\n    kubernetes.io/os: windows\n  containers:\n  - name: example-container\n    image: microsoft/windowsservercore:1709\n    volumeMounts:\n    - name: example-volume\n      mountPath: \"C:\\\\foo\"\n      readOnly: true\n  volumes:\n    # mount C:\\Data\\foo from the host, but only if that directory already exists\n  - name: example-volume\n    hostPath:\n      path: \"C:\\\\Data\\\\foo\" # directory location on host\n      type: Directory       # this field is optional\n```\n\n6.1 - Volumes | The following manifest defines a Pod that mounts /var/local/aaa inside the single container in the Pod. If the node does not already have a path /var/local/aaa, the kubelet creates it as a directory a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8678"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-webserver\nspec:\n  os: { name: linux }\n  nodeSelector:\n    kubernetes.io/os: linux\n  containers:\n  - name: test-webserver\n    image: registry.k8s.io/test-webserver:latest\n    volumeMounts:\n    - mountPath: /var/local/aaa\n      name: mydir\n    - mountPath: /var/local/aaa/1.txt\n      name: myfile\n  volumes:\n  - name: mydir\n    hostPath:\n      # Ensure the file directory is created.\n      path: /var/local/aaa\n      type: DirectoryOrCreate\n  - name: myfile\n    hostPath:\n      path: /var/local/aaa/1.txt\n      type: FileOrCreate\n```\n\n6.1 - Volumes | An image volume source represents an OCI object (a container image or artifact) which is available on the kubelet's host machine.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8679"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n6.1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8680"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n6.1 - Volumes | The volume is resolved at pod startup depending on which pullPolicy value is provided:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8681"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: example-pv\nspec:\n  capacity:\n    storage: 100Gi\n  volumeMode: Filesystem\n  accessModes:\n  - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Delete\n  storageClassName: local-storage\n  local:\n    path: /mnt/disks/ssd1\n  nodeAffinity:\n    required:\n      nodeSelectorTerms:\n      - matchExpressions:\n        - key: kubernetes.io/hostname\n          operator: In\n          values:\n          - example-node\n```\n\n6.1 - Volumes | You must set a PersistentVolume nodeAffinity when using local volumes. The Kubernetes scheduler uses the PersistentVolume nodeAffinity to schedule these Pods to the correct node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8682"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pd\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /my-nfs-data\n      name: test-volume\n  volumes:\n  - name: test-volume\n    nfs:\n      server: my-nfs-server.example.com\n      path: /my-nfs-volume\n      readOnly: true\n```\n\n6.1 - Volumes | You must have your own NFS server running with the share exported before you can use it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8683"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-portworx-volume-pod\nspec:\n  containers:\n  - image: registry.k8s.io/test-webserver\n    name: test-container\n    volumeMounts:\n    - mountPath: /mnt\n      name: pxvol\n  volumes:\n  - name: pxvol\n    # This Portworx volume must already exist.\n    portworxVolume:\n      volumeID: \"pxvol\"\n      fsType: \"<fs-type>\"\n```\n\n6.1 - Volumes | In Kubernetes 1.34, all operations for the in-tree Portworx volumes are redirected to the pxd.portworx.com Container Storage Interface (CSI) Driver by default.Portworx CSI Driver must be installed on", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8684"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-lamp-site\nspec:\n    containers:\n    - name: mysql\n      image: mysql\n      env:\n      - name: MYSQL_ROOT_PASSWORD\n        value: \"rootpasswd\"\n      volumeMounts:\n      - mountPath: /var/lib/mysql\n        name: site-data\n        subPath: mysql\n    - name: php\n      image: php:7.0-apache\n      volumeMounts:\n      - mountPath: /var/www/html\n        name: site-data\n        subPath: html\n    volumes:\n    - name: site-data\n      persistentVolumeClaim:\n        claimName: my-lamp-site-data\n```\n\n6.1 - Volumes | Use the subPathExpr field to construct subPath directory names from downward API environment variables. The subPath and subPathExpr properties are mutually exclusive.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8685"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\nspec:\n  containers:\n  - name: container1\n    env:\n    - name: POD_NAME\n      valueFrom:\n        fieldRef:\n          apiVersion: v1\n          fieldPath: metadata.name\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"while [ true ]; do echo 'Hello'; sleep 10; done | tee -a /logs/hello.txt\" ]\n    volumeMounts:\n    - name: workdir1\n      mountPath: /logs\n      # The variable expansion uses round brackets (not curly brackets).\n      subPathExpr: $(POD_NAME)\n  restartPolicy: Never\n  volumes:\n  - name: workdir1\n    hostPath:\n      path: /var/log/pods\n```\n\n6.1 - Volumes | The storage medium (such as Disk or SSD) of an emptyDir volume is determined by the medium of the filesystem holding the kubelet root dir (typically /var/lib/kubelet). There is no limit on how much sp", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8686"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/rro.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n6.1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8687"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: rro\nspec:\n  volumes:\n    - name: mnt\n      hostPath:\n        # tmpfs is mounted on /mnt/tmpfs\n        path: /mnt\n  containers:\n    - name: busybox\n      image: busybox\n      args: [\"sleep\", \"infinity\"]\n      volumeMounts:\n        # /mnt-rro/tmpfs is not writable\n        - name: mnt\n          mountPath: /mnt-rro\n          readOnly: true\n          mountPropagation: None\n          recursiveReadOnly: Enabled\n        # /mnt-ro/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-ro\n          readOnly: true\n        # /mnt-rw/tmpfs is writable\n        - name: mnt\n          mountPath: /mnt-rw\n```\n\n6.1 - Volumes | When this property is recognized by kubelet and kube-apiserver, the .status.containerStatuses[].volumeMounts[].recursiveReadOnly field is set to either Enabled or Disabled.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8688"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc hostpath\nName:          hostpath\nNamespace:     default\nStorageClass:  example-hostpath\nStatus:        Terminating\nVolume:\nLabels:        <none>\nAnnotations:   volume.beta.kubernetes.io/storage-class=example-hostpath\n               volume.beta.kubernetes.io/storage-provisioner=example.com/hostpath\nFinalizers:    [kubernetes.io/pvc-protection]\n...\n```\n\n6.2 - Persistent Volumes | You can see that a PV is protected when the PV's status is Terminating and the Finalizers list includes kubernetes.io/pv-protection too:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8689"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv task-pv-volume\nName:            task-pv-volume\nLabels:          type=local\nAnnotations:     <none>\nFinalizers:      [kubernetes.io/pv-protection]\nStorageClass:    standard\nStatus:          Terminating\nClaim:\nReclaim Policy:  Delete\nAccess Modes:    RWO\nCapacity:        1Gi\nMessage:\nSource:\n    Type:          HostPath (bare host directory volume)\n    Path:          /tmp/data\n    HostPathType:\nEvents:            <none>\n```\n\n6.2 - Persistent Volumes | When a user is done with their volume, they can delete the PVC objects from the API that allows reclamation of the resource. The reclaim policy for a PersistentVolume tells the cluster what to do with", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8690"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pv-recycler\n  namespace: default\nspec:\n  restartPolicy: Never\n  volumes:\n  - name: vol\n    hostPath:\n      path: /any/path/it/will/be/replaced\n  containers:\n  - name: pv-recycler\n    image: \"registry.k8s.io/busybox\"\n    command: [\"/bin/sh\", \"-c\", \"test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \\\"$(ls -A /scrub)\\\" || exit 1\"]\n    volumeMounts:\n    - name: vol\n      mountPath: /scrub\n```\n\n6.2 - Persistent Volumes | However, the particular path specified in the custom recycler Pod template in the volumes part is replaced with the particular path of the volume that is being recycled.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8691"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pv pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nName:            pvc-74a498d6-3929-47e8-8c02-078c1ece4d78\nLabels:          <none>\nAnnotations:     kubernetes.io/createdby: vsphere-volume-dynamic-provisioner\n                 pv.kubernetes.io/bound-by-controller: yes\n                 pv.kubernetes.io/provisioned-by: kubernetes.io/vsphere-volume\nFinalizers:      [kubernetes.io/pv-protection kubernetes.io/pv-controller]\nStorageClass:    vcp-sc\nStatus:          Bound\nClaim:           default/vcp-pvc-1\nReclaim Policy:  Delete\nAccess Modes:    RWO\nVolumeMode:      Filesystem\nCapacity:        1Gi\nNode Affinity:   <none>\nMessage:\nSource:\n    Type:               vSphereVolume (a Persistent Disk resource in vSphere)\n    VolumePath:         [vsanDatastore] d49c4a62-166f-ce12-c464-020077ba5d46/kubernetes-dynamic-pvc-74a498d6-3929-47e8-8c02-078c1ece4d78.vmdk\n    FSType:             ext4\n    StoragePolicyName:  vSAN Default Storage Policy\nEvents:                 <none>\n```\n\n6.2 - Persistent Volumes | The finalizer external-provisioner.volume.kubernetes.io/finalizer is added for CSI volumes. The following is an example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8692"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: foo\nspec:\n  storageClassName: \"\" # Empty string must be explicitly set otherwise default StorageClass will be set\n  volumeName: foo-pv\n  ...\n```\n\n6.2 - Persistent Volumes | This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8693"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: foo-pv\nspec:\n  storageClassName: \"\"\n  claimRef:\n    name: foo-pvc\n    namespace: foo\n  ...\n```\n\n6.2 - Persistent Volumes | This is useful if you want to consume PersistentVolumes that have their persistentVolumeReclaimPolicy set to Retain, including cases where you are reusing an existing PV.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8694"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-vol-default\nprovisioner: vendor-name.example/magicstorage\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n6.2 - Persistent Volumes | To request a larger volume for a PVC, edit the PVC object and specify a larger size. This triggers expansion of the volume that backs the underlying PersistentVolume. A new PersistentVolume is never c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8695"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv0003\nspec:\n  capacity:\n    storage: 5Gi\n  volumeMode: Filesystem\n  accessModes:\n    - ReadWriteOnce\n  persistentVolumeReclaimPolicy: Recycle\n  storageClassName: slow\n  mountOptions:\n    - hard\n    - nfsvers=4.1\n  nfs:\n    path: /tmp\n    server: 172.17.0.2\n```\n\n6.2 - Persistent Volumes | Generally, a PV will have a specific storage capacity. This is set using the PV's capacity attribute which is a Quantity value.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8696"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: myclaim\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 8Gi\n  storageClassName: slow\n  selector:\n    matchLabels:\n      release: \"stable\"\n    matchExpressions:\n      - {key: environment, operator: In, values: [dev]}\n```\n\n6.2 - Persistent Volumes | Claims use the same conventions as volumes when requesting storage with specific access modes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8697"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n    - name: myfrontend\n      image: nginx\n      volumeMounts:\n      - mountPath: \"/var/www/html\"\n        name: mypd\n  volumes:\n    - name: mypd\n      persistentVolumeClaim:\n        claimName: myclaim\n```\n\n6.2 - Persistent Volumes | PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with \"Many\" modes (ROX, RWX) is only possible within one namespace.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8698"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: block-pv\nspec:\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  persistentVolumeReclaimPolicy: Retain\n  fc:\n    targetWWNs: [\"50060e801049cfd1\"]\n    lun: 0\n    readOnly: false\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8699"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: block-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  volumeMode: Block\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8700"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-block-volume\nspec:\n  containers:\n    - name: fc-container\n      image: fedora:26\n      command: [\"/bin/sh\", \"-c\"]\n      args: [ \"tail -f /dev/null\" ]\n      volumeDevices:\n        - name: data\n          devicePath: /dev/xvda\n  volumes:\n    - name: data\n      persistentVolumeClaim:\n        claimName: block-pvc\n```\n\n6.2 - Persistent Volumes | If a user requests a raw block volume by indicating this using the volumeMode field in the PersistentVolumeClaim spec, the binding rules differ slightly from previous releases that didn't consider thi", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8701"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: restore-pvc\nspec:\n  storageClassName: csi-hostpath-sc\n  dataSource:\n    name: new-snapshot-test\n    kind: VolumeSnapshot\n    apiGroup: snapshot.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Volume Cloning only available for CSI volume plugins.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8702"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: cloned-pvc\nspec:\n  storageClassName: my-csi-plugin\n  dataSource:\n    name: existing-src-pvc-name\n    kind: PersistentVolumeClaim\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Kubernetes supports custom volume populators. To use custom volume populators, you must enable the AnyVolumeDataSource feature gate for the kube-apiserver and kube-controller-manager.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8703"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: populated-pvc\nspec:\n  dataSourceRef:\n    name: example-name\n    kind: ExampleDataSource\n    apiGroup: example.storage.k8s.io\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 10Gi\n```\n\n6.2 - Persistent Volumes | Because volume populators are external components, attempts to create a PVC that uses one can fail if not all the correct components are installed. External controllers should generate events on the P", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8704"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: gateway.networking.k8s.io/v1beta1\nkind: ReferenceGrant\nmetadata:\n  name: allow-ns1-pvc\n  namespace: default\nspec:\n  from:\n  - group: \"\"\n    kind: PersistentVolumeClaim\n    namespace: ns1\n  to:\n  - group: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n```\n\n6.2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8705"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: foo-pvc\n  namespace: ns1\nspec:\n  storageClassName: example\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n  dataSourceRef:\n    apiGroup: snapshot.storage.k8s.io\n    kind: VolumeSnapshot\n    name: new-snapshot-demo\n    namespace: default\n  volumeMode: Filesystem\n```\n\n6.2 - Persistent Volumes | If you're writing configuration templates or examples that run on a wide range of clusters and need persistent storage, it is recommended that you use the following pattern:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8706"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-secret-downwardapi-configmap.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8707"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - downwardAPI:\n          items:\n            - path: \"labels\"\n              fieldRef:\n                fieldPath: metadata.labels\n            - path: \"cpu_limit\"\n              resourceFieldRef:\n                containerName: container-test\n                resource: limits.cpu\n      - configMap:\n          name: myconfigmap\n          items:\n            - key: config\n              path: my-group/my-config\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8708"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-secrets-nondefault-permission-mode.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8709"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: volume-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: mysecret\n          items:\n            - key: username\n              path: my-group/my-username\n      - secret:\n          name: mysecret2\n          items:\n            - key: password\n              path: my-group/my-password\n              mode: 511\n```\n\n6.3 - Projected Volumes | Each projected volume source is listed in the spec under sources. The parameters are nearly the same with two exceptions:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8710"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-service-account-token.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n6.3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8711"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-token-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/service-account\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - serviceAccountToken:\n          audience: api\n          expirationSeconds: 3600\n          path: token\n```\n\n6.3 - Projected Volumes | The example Pod has a projected volume containing the injected service account token. Containers in this Pod can use that token to access the Kubernetes API server, authenticating with the identity of", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8712"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-clustertrustbundle.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n6.3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8713"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sa-ctb-name-test\nspec:\n  containers:\n  - name: container-test\n    image: busybox\n    command: [\"sleep\", \"3600\"]\n    volumeMounts:\n    - name: token-vol\n      mountPath: \"/root-certificates\"\n      readOnly: true\n  serviceAccountName: default\n  volumes:\n  - name: token-vol\n    projected:\n      sources:\n      - clusterTrustBundle:\n          name: example\n          path: example-roots.pem\n      - clusterTrustBundle:\n          signerName: \"example.com/mysigner\"\n          labelSelector:\n            matchLabels:\n              version: live\n          path: mysigner-roots.pem\n          optional: true\n```\n\n6.3 - Projected Volumes | The podCertificate projected volumes source securely provisions a private key and X.509 certificate chain for pod to use as client or server credentials. Kubelet will then handle refreshing the privat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8714"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected-podcertificate.yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n6.3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8715"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# Sample Pod spec that uses a podCertificate projection to request an ED25519\n# private key, a certificate from the `coolcert.example.com/foo` signer, and\n# write the results to `/var/run/my-x509-credentials/credentialbundle.pem`.\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: podcertificate-pod\nspec:\n  serviceAccountName: default\n  containers:\n  - image: debian\n    name: main\n    command: [\"sleep\", \"infinity\"]\n    volumeMounts:\n    - name: my-x509-credentials\n      mountPath: /var/run/my-x509-credentials\n  volumes:\n  - name: my-x509-credentials\n    projected:\n      defaultMode: 420\n      sources:\n      - podCertificate:\n          keyType: ED25519\n          signerName: coolcert.example.com/foo\n          credentialBundlePath: credentialbundle.pem\n```\n\n6.3 - Projected Volumes | The proposal for file permission handling in projected service account volume enhancement introduced the projected files having the correct owner permissions set.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8716"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\n6.4 - Ephemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8717"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\n6.4 - Ephemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8718"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass-low-latency.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n6.5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8719"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\n6.5 - Storage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8720"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/pod-volume-binding.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n6.5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8721"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n6.5 - Storage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8722"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-topology.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n6.5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8723"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\n6.5 - Storage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8724"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-ebs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n6.5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8725"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\n6.5 - Storage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8726"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-efs.yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n6.5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8727"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\n6.5 - Storage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8728"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-nfs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n6.5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8729"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\n6.5 - Storage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8730"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\n6.5 - Storage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8731"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\n6.5 - Storage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8732"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-ceph-rbd.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n6.5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8733"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\n6.5 - Storage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8734"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\n6.5 - Storage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8735"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-azure-file.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n6.5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8736"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\n6.5 - Storage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8737"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-portworx-volume.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8738"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8739"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-local.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8740"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\n6.5 - Storage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8741"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: silver\ndriverName: pd.csi.storage.gke.io\nparameters:\n  provisioned-iops: \"3000\"\n  provisioned-throughput: \"50\"\n```\n\n6.6 - Volume Attributes Classes | Each VolumeAttributesClass has a provisioner that determines what volume plugin is used for provisioning PVs. The field driverName must be specified.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8742"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: silver\n  …\n```\n\n6.6 - Volume Attributes Classes | A new VolumeAttributesClass gold is available in the cluster:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8743"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: VolumeAttributesClass\nmetadata:\n  name: gold\ndriverName: pd.csi.storage.gke.io\nparameters:\n  iops: \"4000\"\n  throughput: \"60\"\n```\n\n6.6 - Volume Attributes Classes | The end user can update the PVC with the new VolumeAttributesClass gold and apply:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8744"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: test-pv-claim\nspec:\n  …\n  volumeAttributesClassName: gold\n  …\n```\n\n6.6 - Volume Attributes Classes | To understand how the resizer works with VolumeAttributesClass, refer to the CSI external-resizer documentation.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8745"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: slow\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-standard\n```\n\n6.7 - Dynamic Volume Provisioning | The following manifest creates a storage class \"fast\" which provisions SSD-like persistent disks.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8746"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n```\n\n6.7 - Dynamic Volume Provisioning | Users request dynamically provisioned storage by including a storage class in their PersistentVolumeClaim. Before Kubernetes v1.6, this was done via the volume.beta.kubernetes.io/storage-class annotat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8747"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: claim1\nspec:\n  accessModes:\n    - ReadWriteOnce\n  storageClassName: fast\n  resources:\n    requests:\n      storage: 30Gi\n```\n\n6.7 - Dynamic Volume Provisioning | This claim results in an SSD-like Persistent Disk being automatically provisioned. When the claim is deleted, the volume is destroyed.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8748"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: new-snapshot-test\nspec:\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  source:\n    persistentVolumeClaimName: pvc-test\n```\n\n6.8 - Volume Snapshots | persistentVolumeClaimName is the name of the PersistentVolumeClaim data source for the snapshot. This field is required for dynamically provisioning a snapshot.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8749"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshot\nmetadata:\n  name: test-snapshot\nspec:\n  source:\n    volumeSnapshotContentName: test-content\n```\n\n6.8 - Volume Snapshots | Each VolumeSnapshotContent contains a spec and status. In dynamic provisioning, the snapshot common controller creates VolumeSnapshotContent objects. Here is an example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8750"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: snapcontent-72d9a349-aacd-42d2-a240-d775650d2455\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotClassName: csi-hostpath-snapclass\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n    uid: 72d9a349-aacd-42d2-a240-d775650d2455\n```\n\n6.8 - Volume Snapshots | volumeHandle is the unique identifier of the volume created on the storage backend and returned by the CSI driver during the volume creation. This field is required for dynamically provisioning a snap", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8751"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n6.8 - Volume Snapshots | snapshotHandle is the unique identifier of the volume snapshot created on the storage backend. This field is required for the pre-provisioned snapshots. It specifies the CSI snapshot id on the storage", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8752"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotContent\nmetadata:\n  name: new-snapshot-content-test\n  annotations:\n    - snapshot.storage.kubernetes.io/allow-volume-mode-change: \"true\"\nspec:\n  deletionPolicy: Delete\n  driver: hostpath.csi.k8s.io\n  source:\n    snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002\n  sourceVolumeMode: Filesystem\n  volumeSnapshotRef:\n    name: new-snapshot-test\n    namespace: default\n```\n\n6.8 - Volume Snapshots | You can provision a new volume, pre-populated with data from a snapshot, by using the dataSource field in the PersistentVolumeClaim object.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8753"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n6.9 - Volume Snapshot Classes | Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don't request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: \"true\" an", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8754"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: snapshot.storage.k8s.io/v1\nkind: VolumeSnapshotClass\nmetadata:\n  name: csi-hostpath-snapclass\n  annotations:\n    snapshot.storage.kubernetes.io/is-default-class: \"true\"\ndriver: hostpath.csi.k8s.io\ndeletionPolicy: Delete\nparameters:\n```\n\n6.9 - Volume Snapshot Classes | If multiple CSI drivers exist, a default VolumeSnapshotClass can be specified for each of them.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8755"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n    name: clone-of-pvc-1\n    namespace: myns\nspec:\n  accessModes:\n  - ReadWriteOnce\n  storageClassName: cloning\n  resources:\n    requests:\n      storage: 5Gi\n  dataSource:\n    kind: PersistentVolumeClaim\n    name: pvc-1\n```\n\n6.10 - CSI Volume Cloning | The result is a new PVC with the name clone-of-pvc-1 that has the exact same content as the specified source pvc-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8756"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: CSIDriver\nmetadata:\n  name: hostpath.csi.k8s.io\nspec:\n  nodeAllocatableUpdatePeriodSeconds: 60\n```\n\n6.12 - Node-specific Volume Limits | Kubelet will periodically call the corresponding CSI driver’s NodeGetInfo endpoint to refresh the maximum number of attachable volumes, using the interval specified in nodeAllocatableUpdatePeriodSecon", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8757"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: game-demo\ndata:\n  # property-like keys; each key maps to a simple value\n  player_initial_lives: \"3\"\n  ui_properties_file_name: \"user-interface.properties\"\n\n  # file-like keys\n  game.properties: |\n    enemy.types=aliens,monsters\n    player.maximum-lives=5    \n  user-interface.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n```\n\n7.2 - ConfigMaps | There are four different ways that you can use a ConfigMap to configure a container inside a Pod:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8758"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configure-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n7.2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8759"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: configmap-demo-pod\nspec:\n  containers:\n    - name: demo\n      image: alpine\n      command: [\"sleep\", \"3600\"]\n      env:\n        # Define the environment variable\n        - name: PLAYER_INITIAL_LIVES # Notice that the case is different here\n                                     # from the key name in the ConfigMap.\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo           # The ConfigMap this value comes from.\n              key: player_initial_lives # The key to fetch.\n        - name: UI_PROPERTIES_FILE_NAME\n          valueFrom:\n            configMapKeyRef:\n              name: game-demo\n              key: ui_properties_file_name\n      volumeMounts:\n      - name: config\n        mountPath: \"/config\"\n        readOnly: true\n  volumes:\n  # You set volumes at the Pod level, then mount them into containers inside that Pod\n  - name: config\n    configMap:\n      # Provide the name of the ConfigMap you want to mount.\n      name: game-demo\n      # An array of keys from the ConfigMap to create as files\n      items:\n      - key: \"game.properties\"\n        path: \"game.properties\"\n      - key: \"user-interface.properties\"\n        path: \"user-interface.properties\"\n```\n\n7.2 - ConfigMaps | A ConfigMap doesn't differentiate between single line property values and multi-line file-like values. What matters is how Pods and other objects consume those values.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8760"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    configMap:\n      name: myconfigmap\n```\n\n7.2 - ConfigMaps | Each ConfigMap you want to use needs to be referred to in .spec.volumes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8761"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: myconfigmap\ndata:\n  username: k8s-admin\n  access_level: \"1\"\n```\n\n7.2 - ConfigMaps | The following command will create the ConfigMap object:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8762"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myconfigmap.yaml\n```\n\n7.2 - ConfigMaps | The following Pod consumes the content of the ConfigMap as environment variables:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8763"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/env-configmap.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n7.2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8764"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n    - name: app\n      command: [\"/bin/sh\", \"-c\", \"printenv\"]\n      image: busybox:latest\n      envFrom:\n        - configMapRef:\n            name: myconfigmap\n```\n\n7.2 - ConfigMaps | The envFrom field instructs Kubernetes to create environment variables from the sources nested within it. The inner configMapRef refers to a ConfigMap by its name and selects all its key-value pairs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8765"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f env-configmap.yaml\n```\n\n7.2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8766"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/ env-configmap\n```\n\n7.2 - ConfigMaps | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8767"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-configmap\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: CONFIGMAP_USERNAME\n      valueFrom:\n        configMapKeyRef:\n          name: myconfigmap\n          key: username\n```\n\n7.2 - ConfigMaps | In the Pod created from this manifest, you will see that the environment variable CONFIGMAP_USERNAME is set to the value of the username value from the ConfigMap. Other keys from the ConfigMap data ar", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8768"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  ...\ndata:\n  ...\nimmutable: true\n```\n\n7.2 - ConfigMaps | Once a ConfigMap is marked as immutable, it is not possible to revert this change nor to mutate the contents of the data or the binaryData field. You can only delete and recreate the ConfigMap. Becaus", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8769"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/dotfile-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n7.3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8770"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: dotfile-secret\ndata:\n  .secret-file: dmFsdWUtMg0KDQo=\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-dotfiles-pod\nspec:\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: dotfile-secret\n  containers:\n    - name: dotfile-test-container\n      image: registry.k8s.io/busybox\n      command:\n        - ls\n        - \"-l\"\n        - \"/etc/secret-volume\"\n      volumeMounts:\n        - name: secret-volume\n          readOnly: true\n          mountPath: \"/etc/secret-volume\"\n```\n\n7.3 - Secrets | Consider a program that needs to handle HTTP requests, do some complex business logic, and then sign some messages with an HMAC. Because it has complex application logic, there might be an unnoticed r", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8771"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic empty-secret\nkubectl get secret empty-secret\n```\n\n7.3 - Secrets | The output looks like:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8772"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/serviceaccount-token-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n7.3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8773"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-sa-sample\n  annotations:\n    kubernetes.io/service-account.name: \"sa-name\"\ntype: kubernetes.io/service-account-token\ndata:\n  extra: YmFyCg==\n```\n\n7.3 - Secrets | After creating the Secret, wait for Kubernetes to populate the token key in the data field.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8774"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/dockercfg-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n7.3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8775"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-dockercfg\ntype: kubernetes.io/dockercfg\ndata:\n  .dockercfg: |\n    eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo=\n```\n\n7.3 - Secrets | When you create Docker config Secrets using a manifest, the API server checks whether the expected key exists in the data field, and it verifies if the value provided can be parsed as a valid JSON. Th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8776"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry secret-tiger-docker \\\n  --docker-email=tiger@acme.example \\\n  --docker-username=tiger \\\n  --docker-password=pass1234 \\\n  --docker-server=my-registry.example:5000\n```\n\n7.3 - Secrets | This command creates a Secret of type kubernetes.io/dockerconfigjson.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8777"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret-tiger-docker -o jsonpath='{.data.*}' | base64 -d\n```\n\n7.3 - Secrets | The output is equivalent to the following JSON document (which is also a valid Docker configuration file):", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8778"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/basicauth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n7.3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8779"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-basic-auth\ntype: kubernetes.io/basic-auth\nstringData:\n  username: admin # required field for kubernetes.io/basic-auth\n  password: t0p-Secret # required field for kubernetes.io/basic-auth\n```\n\n7.3 - Secrets | The basic authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for basic authentication. However, using the defined and public Secret type (k", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8780"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/ssh-auth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n7.3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8781"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-ssh-auth\ntype: kubernetes.io/ssh-auth\ndata:\n  # the data is abbreviated in this example\n  ssh-privatekey: |\n    UG91cmluZzYlRW1vdGljb24lU2N1YmE=\n```\n\n7.3 - Secrets | The SSH authentication Secret type is provided only for convenience. You can create an Opaque type for credentials used for SSH authentication. However, using the defined and public Secret type (kuber", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8782"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/tls-auth-secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n7.3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8783"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: secret-tls\ntype: kubernetes.io/tls\ndata:\n  # values are base64 encoded, which obscures them but does NOT provide\n  # any useful level of confidentiality\n  # Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n7.3 - Secrets | The TLS Secret type is provided only for convenience. You can create an Opaque type for credentials used for TLS authentication. However, using the defined and public Secret type (kubernetes.io/tls) h", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8784"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls my-tls-secret \\\n  --cert=path/to/cert/file \\\n  --key=path/to/key/file\n```\n\n7.3 - Secrets | The public/private key pair must exist before hand. The public key certificate for --cert must be .PEM encoded and must match the given private key for --key.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8785"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/bootstrap-token-secret-base64.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n7.3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8786"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: bootstrap-token-5emitj\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\ndata:\n  auth-extra-groups: c3lzdGVtOmJvb3RzdHJhcHBlcnM6a3ViZWFkbTpkZWZhdWx0LW5vZGUtdG9rZW4=\n  expiration: MjAyMC0wOS0xM1QwNDozOToxMFo=\n  token-id: NWVtaXRq\n  token-secret: a3E0Z2lodnN6emduMXAwcg==\n  usage-bootstrap-authentication: dHJ1ZQ==\n  usage-bootstrap-signing: dHJ1ZQ==\n```\n\n7.3 - Secrets | A bootstrap token Secret has the following keys specified under data:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8787"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/bootstrap-token-secret-literal.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n7.3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8788"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Note how the Secret is named\n  name: bootstrap-token-5emitj\n  # A bootstrap token Secret usually resides in the kube-system namespace\n  namespace: kube-system\ntype: bootstrap.kubernetes.io/token\nstringData:\n  auth-extra-groups: \"system:bootstrappers:kubeadm:default-node-token\"\n  expiration: \"2020-09-13T04:39:10Z\"\n  # This token ID is used in the name\n  token-id: \"5emitj\"\n  token-secret: \"kq4gihvszzgn1p0r\"\n  # This token can be used for authentication\n  usage-bootstrap-authentication: \"true\"\n  # and it can be used for signing\n  usage-bootstrap-signing: \"true\"\n```\n\n7.3 - Secrets | There are several options to create a Secret:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8789"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nsecret/optional-secret.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n7.3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8790"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      optional: true\n```\n\n7.3 - Secrets | By default, Secrets are required. None of a Pod's containers will start until all non-optional Secrets are available.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8791"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: ...\ndata: ...\nimmutable: true\n```\n\n7.3 - Secrets | You can also update any existing mutable Secret to make it immutable.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8792"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        memory: \"64Mi\"\n        cpu: \"250m\"\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n```\n\n7.5 - Resource Management for Pods and Containers | This feature can be enabled by setting the PodLevelResources feature gate. The following Pod has an explicit request of 1 CPU and 100 MiB of memory, and an explicit limit of 1 CPU and 200 MiB of memor", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8793"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n7.5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8794"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n7.5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum capacity for each of the resource types: the amount of CPU and memory it can provide for P", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8795"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: frontend\nspec:\n  containers:\n  - name: app\n    image: images.my-company.example/app:v4\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  - name: log-aggregator\n    image: images.my-company.example/log-aggregator:v6\n    resources:\n      requests:\n        ephemeral-storage: \"2Gi\"\n      limits:\n        ephemeral-storage: \"4Gi\"\n    volumeMounts:\n    - name: ephemeral\n      mountPath: \"/tmp\"\n  volumes:\n    - name: ephemeral\n      emptyDir:\n        sizeLimit: 500Mi\n```\n\n7.5 - Resource Management for Pods and Containers | When you create a Pod, the Kubernetes scheduler selects a node for the Pod to run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. For more information, see Node", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8796"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  containers:\n  - name: my-container\n    image: myimage\n    resources:\n      requests:\n        cpu: 2\n        example.com/foo: 1\n      limits:\n        example.com/foo: 1\n```\n\n7.5 - Resource Management for Pods and Containers | Process ID (PID) limits allow for the configuration of a kubelet to limit the number of PIDs that a given Pod can consume. See PID Limiting for information.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8797"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod frontend | grep -A 9999999999 Events\n```\n\n7.5 - Resource Management for Pods and Containers | In the preceding example, the Pod named \"frontend\" fails to be scheduled due to insufficient CPU resource on any node. Similar error messages can also suggest failure due to insufficient memory (PodEx", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8798"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes e2e-test-node-pool-4lw4\n```\n\n7.5 - Resource Management for Pods and Containers | In the preceding output, you can see that if a Pod requests more than 1.120 CPUs or more than 6.23Gi of memory, that Pod will not fit on the node.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8799"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod simmemleak-hra99\n```\n\n7.5 - Resource Management for Pods and Containers | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8800"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\n\nclusters:\n- cluster:\n    proxy-url: http://proxy.example.org:3128\n    server: https://k8s.example.org/k8s/clusters/c-xxyyzz\n  name: development\n\nusers:\n- name: developer\n\ncontexts:\n- context:\n  name: development\n```\n\n7.6 - Organizing Cluster Access Using kubeconfig Files | This page outlines the differences in how resources are managed between Linux and Windows.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8801"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubernetes.io/enforce-mountable-secrets: \"true\"\n  name: my-serviceaccount\n  namespace: my-namespace\n```\n\n8.4 - Service Accounts | When this annotation is set to \"true\", the Kubernetes control plane ensures that the Secrets from this ServiceAccount are subject to certain mounting restrictions.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8802"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: my-scheduler\n    plugins:\n      # Disable specific plugins for different extension points\n      # You can disable all plugins for an extension point using \"*\"\n      queueSort:\n        disabled:\n        - name: \"*\"             # Disable all queueSort plugins\n      # - name: \"PrioritySort\"  # Disable specific queueSort plugin\n      filter:\n        disabled:\n        - name: \"*\"                 # Disable all filter plugins\n      # - name: \"NodeResourcesFit\"  # Disable specific filter plugin\n      permit:\n        disabled:\n        - name: \"*\"               # Disables all permit plugins\n      # - name: \"TaintToleration\" # Disable specific permit plugin\n```\n\n8.13 - Hardening Guide - Scheduler Configuration | This creates a scheduler profile my-custom-scheduler. Whenever the .spec of a Pod does not have a value for .spec.schedulerName, the kube-scheduler runs for that Pod, using its main configuration, and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8803"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/problematic-limit-range.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n9.1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8804"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-resource-constraint\nspec:\n  limits:\n  - default: # this section defines default limits\n      cpu: 500m\n    defaultRequest: # this section defines default requests\n      cpu: 500m\n    max: # max and min define the limit range\n      cpu: \"1\"\n    min:\n      cpu: 100m\n    type: Container\n```\n\n9.1 - Limit Ranges | along with a Pod that declares a CPU resource request of 700m, but not a limit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8805"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/example-conflict-with-limitrange-cpu.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8806"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | then that Pod will not be scheduled, failing with an error similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8807"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nconcepts/policy/limit-range/example-no-conflict-with-limitrange-cpu.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8808"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-no-conflict-with-limitrange-cpu\nspec:\n  containers:\n  - name: demo\n    image: registry.k8s.io/pause:3.8\n    resources:\n      requests:\n        cpu: 700m\n      limits:\n        cpu: 700m\n```\n\n9.1 - Limit Ranges | Examples of policies that could be created using LimitRange are:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8809"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npolicy/quota.yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8810"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-high\n  spec:\n    hard:\n      cpu: \"1000\"\n      memory: \"200Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"high\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-medium\n  spec:\n    hard:\n      cpu: \"10\"\n      memory: \"20Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"medium\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pods-low\n  spec:\n    hard:\n      cpu: \"5\"\n      memory: \"10Gi\"\n      pods: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: PriorityClass\n        values: [\"low\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8811"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota.yaml\n```\n\n9.2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8812"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Create a pod with priority \"high\". Save the following YAML to a file high-priority-pod.yaml.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8813"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npolicy/high-priority-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8814"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: high-priority\nspec:\n  containers:\n  - name: high-priority\n    image: ubuntu\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"while true; do echo hello; sleep 10;done\"]\n    resources:\n      requests:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n      limits:\n        memory: \"10Gi\"\n        cpu: \"500m\"\n  priorityClassName: high\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8815"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./high-priority-pod.yaml\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"high\" priority quota, pods-high, has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8816"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Operators can use CrossNamespacePodAffinity quota scope to limit which namespaces are allowed to have pods with affinity terms that cross namespaces. Specifically, it controls which pods are allowed t", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8817"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: disable-cross-namespace-affinity\n  namespace: foo-ns\nspec:\n  hard:\n    pods: \"0\"\n  scopeSelector:\n    matchExpressions:\n    - scopeName: CrossNamespacePodAffinity\n      operator: Exists\n```\n\n9.2 - Resource Quotas | If operators want to disallow using namespaces and namespaceSelector by default, and only allow it for specific namespaces, they could configure CrossNamespacePodAffinity as a limited resource by sett", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8818"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: CrossNamespacePodAffinity\n        operator: Exists\n```\n\n9.2 - Resource Quotas | With the above configuration, pods can use namespaces and namespaceSelector in pod affinity only if the namespace where they are created have a resource quota object with CrossNamespacePodAffinity sco", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8819"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npolicy/quota-vac.yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8820"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nitems:\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-gold\n  spec:\n    hard:\n      requests.storage: \"10Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"gold\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-silver\n  spec:\n    hard:\n      requests.storage: \"20Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"silver\"]\n- apiVersion: v1\n  kind: ResourceQuota\n  metadata:\n    name: pvcs-copper\n  spec:\n    hard:\n      requests.storage: \"30Gi\"\n      persistentvolumeclaims: \"10\"\n    scopeSelector:\n      matchExpressions:\n      - operator: In\n        scopeName: VolumeAttributesClass\n        values: [\"copper\"]\n```\n\n9.2 - Resource Quotas | Apply the YAML using kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8821"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./quota-vac.yaml\n```\n\n9.2 - Resource Quotas | Verify that Used quota is 0 using kubectl describe quota.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8822"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Create a pvc with volume attributes class \"gold\". Save the following YAML to a file gold-vac-pvc.yaml.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8823"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npolicy/gold-vac-pvc.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8824"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName:  # change this to the name of the storage class you want to use\n  volumeAttributesClassName: gold\n```\n\n9.2 - Resource Quotas | Apply it with kubectl create.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8825"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./gold-vac-pvc.yaml\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"gold\" volume attributes class quota, pvcs-gold has changed and that the other two quotas are unchanged.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8826"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Once the PVC is bound, it is allowed to modify the desired volume attributes class. Let's change it to \"silver\" with kubectl patch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8827"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"silver\"}}'\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"silver\" volume attributes class quota, pvcs-silver has changed, pvcs-copper is unchanged, and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8828"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Let's change it to \"copper\" with kubectl patch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8829"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl patch pvc gold-vac-pvc --type='merge' -p '{\"spec\":{\"volumeAttributesClassName\":\"copper\"}}'\n```\n\n9.2 - Resource Quotas | Verify that \"Used\" stats for \"copper\" volume attributes class quota, pvcs-copper has changed, pvcs-silver and pvcs-gold might be unchanged or released, which depends on the PVC's status.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8830"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | Print the manifest of the PVC using the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8831"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc gold-vac-pvc -o yaml\n```\n\n9.2 - Resource Quotas | It might show the following output:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8832"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: gold-vac-pvc\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 2Gi\n  storageClassName: default\n  volumeAttributesClassName: copper\nstatus:\n  accessModes:\n    - ReadWriteOnce\n  capacity:\n    storage: 2Gi\n  currentVolumeAttributesClassName: gold\n  phase: Bound\n  modifyVolumeStatus:\n    status: InProgress\n    targetVolumeAttributesClassName: silver\n  storageClassName: default\n```\n\n9.2 - Resource Quotas | Wait a moment for the volume modification to complete, then verify the quota again.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8833"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota\n```\n\n9.2 - Resource Quotas | When allocating compute resources, each container may specify a request and a limit value for either CPU or memory. The quota can be configured to quota either value.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8834"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8835"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > compute-resources.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: compute-resources\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: \"1Gi\"\n    limits.cpu: \"2\"\n    limits.memory: \"2Gi\"\n    requests.nvidia.com/gpu: 4\nEOF\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8836"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./compute-resources.yaml --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8837"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > object-counts.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-counts\nspec:\n  hard:\n    configmaps: \"10\"\n    persistentvolumeclaims: \"4\"\n    pods: \"4\"\n    replicationcontrollers: \"20\"\n    secrets: \"10\"\n    services: \"10\"\n    services.loadbalancers: \"2\"\nEOF\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8838"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./object-counts.yaml --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8839"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get quota --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8840"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota compute-resources --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8841"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota object-counts --namespace=myspace\n```\n\n9.2 - Resource Quotas | kubectl also supports object count quota for all standard namespaced resources using the syntax count/<resource>.<group>:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8842"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace myspace\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8843"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create quota test --hard=count/deployments.apps=2,count/replicasets.apps=4,count/pods=3,count/secrets=4 --namespace=myspace\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8844"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx --namespace=myspace --replicas=2\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8845"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe quota --namespace=myspace\n```\n\n9.2 - Resource Quotas | ResourceQuotas are independent of the cluster capacity. They are expressed in absolute units. So, if you add nodes to your cluster, this does not automatically give each namespace the ability to consu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8846"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: \"ResourceQuota\"\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: ResourceQuotaConfiguration\n    limitedResources:\n    - resource: pods\n      matchScopes:\n      - scopeName: PriorityClass\n        operator: In\n        values: [\"cluster-services\"]\n```\n\n9.2 - Resource Quotas | Then, create a resource quota object in the kube-system namespace:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8847"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npolicy/priority-class-resourcequota.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n9.2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8848"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pods-cluster-services\nspec:\n  scopeSelector:\n    matchExpressions:\n      - operator : In\n        scopeName: PriorityClass\n        values: [\"cluster-services\"]\n```\n\n9.2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8849"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/policy/priority-class-resourcequota.yaml -n kube-system\n```\n\n9.2 - Resource Quotas | In this case, a pod creation will be allowed if:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8850"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-node-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8851"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-node-affinity\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: topology.kubernetes.io/zone\n            operator: In\n            values:\n            - antarctica-east1\n            - antarctica-west1\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: another-node-label-key\n            operator: In\n            values:\n            - another-node-label-value\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | In this example, the following rules apply:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8852"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-affinity-preferred-weight.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8853"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-affinity-preferred-weight\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: kubernetes.io/os\n            operator: In\n            values:\n            - linux\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: label-1\n            operator: In\n            values:\n            - key-1\n      - weight: 50\n        preference:\n          matchExpressions:\n          - key: label-2\n            operator: In\n            values:\n            - key-2\n  containers:\n  - name: with-node-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | If there are two possible nodes that match the preferredDuringSchedulingIgnoredDuringExecution rule, one with the label-1:key-1 label and another with the label-2:key-2 label, the scheduler considers", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8854"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: foo-scheduler\n    pluginConfig:\n      - name: NodeAffinity\n        args:\n          addedAffinity:\n            requiredDuringSchedulingIgnoredDuringExecution:\n              nodeSelectorTerms:\n              - matchExpressions:\n                - key: scheduler-profile\n                  operator: In\n                  values:\n                  - foo\n```\n\n10.2 - Assigning Pods to Nodes | The addedAffinity is applied to all Pods that set .spec.schedulerName to foo-scheduler, in addition to the NodeAffinity specified in the PodSpec. That is, in order to match the Pod, nodes need to sati", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8855"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-pod-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8856"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: with-pod-affinity\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n          - key: security\n            operator: In\n            values:\n            - S1\n        topologyKey: topology.kubernetes.io/zone\n    podAntiAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 100\n        podAffinityTerm:\n          labelSelector:\n            matchExpressions:\n            - key: security\n              operator: In\n              values:\n              - S2\n          topologyKey: topology.kubernetes.io/zone\n  containers:\n  - name: with-pod-affinity\n    image: registry.k8s.io/pause:3.8\n```\n\n10.2 - Assigning Pods to Nodes | This example defines one Pod affinity rule and one Pod anti-affinity rule. The Pod affinity rule uses the \"hard\" requiredDuringSchedulingIgnoredDuringExecution, while the anti-affinity rule uses the \"", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8857"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: application-server\n...\nspec:\n  template:\n    spec:\n      affinity:\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - database\n            topologyKey: topology.kubernetes.io/zone\n            # Only Pods from a given rollout are taken into consideration when calculating pod affinity.\n            # If you update the Deployment, the replacement Pods follow their own affinity rules\n            # (if there are any defined in the new Pod template)\n            matchLabelKeys:\n            - pod-template-hash\n```\n\n10.2 - Assigning Pods to Nodes | The mismatchLabelKeys field is a beta-level field and is enabled by default in Kubernetes 1.34. When you want to disable it, you have to disable it explicitly via the MatchLabelKeysInPodAffinity featu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8858"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    # Assume that all relevant Pods have a \"tenant\" label set\n    tenant: tenant-a\n...\nspec:\n  affinity:\n    podAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant land on the correct node pool\n      - matchLabelKeys:\n          - tenant\n        topologyKey: node-pool\n    podAntiAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n      # ensure that Pods associated with this tenant can't schedule to nodes used for another tenant\n      - mismatchLabelKeys:\n        - tenant # whatever the value of the \"tenant\" label for this Pod, prevent\n                 # scheduling to nodes in any pool where any Pod from a different\n                 # tenant is running.\n        labelSelector:\n          # We have to have the labelSelector which selects only Pods with the tenant label,\n          # otherwise this Pod would have anti-affinity against Pods from daemonsets as well, for example,\n          # which aren't supposed to have the tenant label.\n          matchExpressions:\n          - key: tenant\n            operator: Exists\n        topologyKey: node-pool\n```\n\n10.2 - Assigning Pods to Nodes | Inter-pod affinity and anti-affinity can be even more useful when they are used with higher level collections such as ReplicaSets, StatefulSets, Deployments, etc. These rules allow you to configure th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8859"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-cache\nspec:\n  selector:\n    matchLabels:\n      app: store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: redis-server\n        image: redis:3.2-alpine\n```\n\n10.2 - Assigning Pods to Nodes | The following example Deployment for the web servers creates replicas with the label app=web-store. The Pod affinity rule tells the scheduler to place each replica on a node that has a Pod with the la", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8860"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: web-server\nspec:\n  selector:\n    matchLabels:\n      app: web-store\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: web-store\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - web-store\n            topologyKey: \"kubernetes.io/hostname\"\n        podAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n          - labelSelector:\n              matchExpressions:\n              - key: app\n                operator: In\n                values:\n                - store\n            topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: web-app\n        image: nginx:1.16-alpine\n```\n\n10.2 - Assigning Pods to Nodes | Creating the two preceding Deployments results in the following cluster layout, where each web server is co-located with a cache, on three separate nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8861"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n  nodeName: kube-01\n```\n\n10.2 - Assigning Pods to Nodes | The above Pod will only run on the node kube-01.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8862"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n...\nstatus:\n  nominatedNodeName: kube-01\n```\n\n10.2 - Assigning Pods to Nodes | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, or among any other topology domains that you define. You", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8863"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n# You need to change this example to match the actual runtime name, and per-Pod\n# resource overhead, that the container runtime is adding in your cluster.\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: kata-fc\nhandler: kata-fc\noverhead:\n  podFixed:\n    memory: \"120Mi\"\n    cpu: \"250m\"\n```\n\n10.3 - Pod Overhead | Workloads which are created which specify the kata-fc RuntimeClass handler will take the memory and cpu overheads into account for resource quota calculations, node scheduling, as well as Pod cgroup s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8864"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  runtimeClassName: kata-fc\n  containers:\n  - name: busybox-ctr\n    image: busybox:1.28\n    stdin: true\n    tty: true\n    resources:\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  - name: nginx-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: 1500m\n        memory: 100Mi\n```\n\n10.3 - Pod Overhead | At admission time the RuntimeClass admission controller updates the workload's PodSpec to include the overhead as described in the RuntimeClass. If the PodSpec already has this field defined, the Pod", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8865"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.overhead}'\n```\n\n10.3 - Pod Overhead | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8866"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.containers[*].resources.limits}'\n```\n\n10.3 - Pod Overhead | The total container requests are 2000m CPU and 200MiB of memory:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8867"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl describe node | grep test-pod -B2\n```\n\n10.3 - Pod Overhead | The output shows requests for 2250m CPU, and for 320MiB of memory. The requests include Pod overhead:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8868"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-scheduling-gates.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8869"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  schedulingGates:\n  - name: example.com/foo\n  - name: example.com/bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | After the Pod's creation, you can check its state using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8870"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod\n```\n\n10.4 - Pod Scheduling Readiness | The output reveals it's in SchedulingGated state:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8871"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\n10.4 - Pod Scheduling Readiness | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8872"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/pod-without-scheduling-gates.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8873"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-pod\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.6\n```\n\n10.4 - Pod Scheduling Readiness | You can check if the schedulingGates is cleared by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8874"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o jsonpath='{.spec.schedulingGates}'\n```\n\n10.4 - Pod Scheduling Readiness | The output is expected to be empty. And you can check its latest status by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8875"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o wide\n```\n\n10.4 - Pod Scheduling Readiness | Given the test-pod doesn't request any CPU/memory resources, it's expected that this Pod's state get transited from previous SchedulingGated to Running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8876"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-pod\nspec:\n  # Configure a topology spread constraint\n  topologySpreadConstraints:\n    - maxSkew: <integer>\n      minDomains: <integer> # optional\n      topologyKey: <string>\n      whenUnsatisfiable: <string>\n      labelSelector: <object>\n      matchLabelKeys: <list> # optional; beta since v1.27\n      nodeAffinityPolicy: [Honor|Ignore] # optional; beta since v1.26\n      nodeTaintsPolicy: [Honor|Ignore] # optional; beta since v1.26\n  ### other Pod fields go here\n```\n\n10.5 - Pod Topology Spread Constraints | You can read more about this field by running kubectl explain Pod.spec.topologySpreadConstraints or refer to the scheduling section of the API reference for Pod.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8877"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/topology-spread-constraints/one-constraint.yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8878"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | From that manifest, topologyKey: zone implies the even distribution will only be applied to nodes that are labeled zone: <any value> (nodes that don't have a zone label are skipped). The field whenUns", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8879"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/topology-spread-constraints/two-constraints.yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8880"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  - maxSkew: 1\n    topologyKey: node\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | In this case, to match the first constraint, the incoming Pod can only be placed onto nodes in zone B; while in terms of the second constraint, the incoming Pod can only be scheduled to the node node4", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8881"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/topology-spread-constraints/one-constraint-with-nodeaffinity.yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8882"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: mypod\n  labels:\n    foo: bar\nspec:\n  topologySpreadConstraints:\n  - maxSkew: 1\n    topologyKey: zone\n    whenUnsatisfiable: DoNotSchedule\n    labelSelector:\n      matchLabels:\n        foo: bar\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: zone\n            operator: NotIn\n            values:\n            - zoneC\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.1\n```\n\n10.5 - Pod Topology Spread Constraints | There are some implicit conventions worth noting here:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8883"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints:\n            - maxSkew: 1\n              topologyKey: topology.kubernetes.io/zone\n              whenUnsatisfiable: ScheduleAnyway\n          defaultingType: List\n```\n\n10.5 - Pod Topology Spread Constraints | If you don't configure any cluster-level default constraints for pod topology spreading, then kube-scheduler acts as if you specified the following default topology constraints:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8884"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\n\nprofiles:\n  - schedulerName: default-scheduler\n    pluginConfig:\n      - name: PodTopologySpread\n        args:\n          defaultConstraints: []\n          defaultingType: List\n```\n\n10.5 - Pod Topology Spread Constraints | In Kubernetes, inter-Pod affinity and anti-affinity control how Pods are scheduled in relation to one another - either more packed or more scattered.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8885"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\n```\n\n10.6 - Taints and Tolerations | places a taint on node node1. The taint has key key1, value value1, and taint effect NoSchedule. This means that no pod will be able to schedule onto node1 unless it has a matching toleration.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8886"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule-\n```\n\n10.6 - Taints and Tolerations | You specify a toleration for a pod in the PodSpec. Both of the following tolerations \"match\" the taint created by the kubectl taint line above, and thus a pod with either toleration would be able to s", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8887"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npods/pod-with-toleration.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\n10.6 - Taints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8888"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  tolerations:\n  - key: \"example-key\"\n    operator: \"Exists\"\n    effect: \"NoSchedule\"\n```\n\n10.6 - Taints and Tolerations | The default value for operator is Equal.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8889"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes node1 key1=value1:NoSchedule\nkubectl taint nodes node1 key1=value1:NoExecute\nkubectl taint nodes node1 key2=value2:NoSchedule\n```\n\n10.6 - Taints and Tolerations | And a pod has two tolerations:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8890"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: prioritized-list-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        firstAvailable:\n        - name: large-black\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"black\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"large\"                \n        - name: small-white\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"white\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"small\"                \n          count: 2\n```\n\n10.8 - Dynamic Resource Allocation | The decision is made on a per-Pod basis, so if the Pod is a member of a ReplicaSet or similar grouping, you cannot rely on all the members of the group having the same subrequest chosen. Your workload", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8891"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: cat-slice\nspec:\n  driver: \"resource-driver.example.com\"\n  pool:\n    generation: 1\n    name: \"black-cat-pool\"\n    resourceSliceCount: 1\n  # The allNodes field defines whether any node in the cluster can access the device.\n  allNodes: true\n  devices:\n  - name: \"large-black-cat\"\n    attributes:\n      color:\n        string: \"black\"\n      size:\n        string: \"large\"\n      cat:\n        boolean: true\n```\n\n10.8 - Dynamic Resource Allocation | This ResourceSlice is managed by the resource-driver.example.com driver in the black-cat-pool pool. The allNodes: true field indicates that any node in the cluster can access the devices. There's one", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8892"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-cats\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: name-of-the-intended-node\n  ...\n```\n\n10.8 - Dynamic Resource Allocation | You may also be able to mutate the incoming Pod, at admission time, to unset the .spec.nodeName field and to use a node selector instead.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8893"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: large-black-cat-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n          deviceClassName: resource.example.com\n          allocationMode: All\n          adminAccess: true\n```\n\n10.8 - Dynamic Resource Allocation | If this feature is disabled, the adminAccess field will be removed automatically when creating such a ResourceClaim.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8894"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel:\n      expression: device.driver == 'gpu.example.com' && device.attributes['gpu.example.com'].type\n        == 'gpu'\n  extendedResourceName: example.com/gpu\n```\n\n10.8 - Dynamic Resource Allocation | In addition, users can use a special extended resource to allocate devices without having to explicitly create a ResourceClaim. Using the extended resource name prefix deviceclass.resource.kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8895"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  sharedCounters:\n  - name: gpu-1-counters\n    counters:\n      memory:\n        value: 8Gi\n  devices:\n  - name: device-1\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n  - name: device-2\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n```\n\n10.8 - Dynamic Resource Allocation | Partitionable devices is an alpha feature and only enabled when the DRAPartitionableDevices feature gate is enabled in the kube-apiserver and kube-scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8896"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  devices:\n  - name: eth1\n    allowMultipleAllocations: true\n    attributes:\n      name:\n        string: \"eth1\"\n    capacity:\n      bandwidth:\n        requestPolicy:\n          default: \"1M\"\n          validRange:\n            min: \"1M\"\n            step: \"8\"\n        value: \"10G\"\n```\n\n10.8 - Dynamic Resource Allocation | The consumable capacity can be requested as shown in the below example.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8897"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: bandwidth-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n        - deviceClassName: resource.example.com\n          capacity:\n            requests:\n              bandwidth: 1G\n```\n\n10.8 - Dynamic Resource Allocation | The allocation result will include the consumed capacity and the identifier of the share.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8898"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\n...\nstatus:\n  allocation:\n    devices:\n      results:\n      - consumedCapacity:\n          bandwidth: 1G\n        device: eth1\n        shareID: \"a671734a-e8e5-11e4-8fde-42010af09327\"\n```\n\n10.8 - Dynamic Resource Allocation | In this example, a multiply-allocatable device was chosen. However, any resource.example.com device with at least the requested 1G bandwidth could have met the requirement. If a non-multiply-allocatab", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8899"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\nkind: DeviceTaintRule\nmetadata:\n  name: example\nspec:\n  # The entire hardware installation for this\n  # particular driver is broken.\n  # Evict all pods and don't schedule new ones.\n  deviceSelector:\n    driver: dra.example.com\n  taint:\n    key: dra.example.com/unhealthy\n    value: Broken\n    effect: NoExecute\n```\n\n10.8 - Dynamic Resource Allocation | Device Binding Conditions allow the Kubernetes scheduler to delay Pod binding until external resources, such as fabric-attached GPUs or reprogrammable FPGAs, are confirmed to be ready.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8900"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: gpu-slice\nspec:\n  driver: dra.example.com\n  nodeSelector:\n    accelerator-type: high-performance\n  pool:\n    name: gpu-pool\n    generation: 1\n    resourceSliceCount: 1\n  devices:\n    - name: gpu-1\n      attributes:\n        vendor:\n          string: \"example\"\n        model:\n          string: \"example-gpu\"\n      bindsToNode: true\n      bindingConditions:\n        - dra.example.com/is-prepared\n      bindingFailureConditions:\n        - dra.example.com/preparing-failed\n```\n\n10.8 - Dynamic Resource Allocation | This example ResourceSlice has the following properties:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8901"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system | grep kube-scheduler\n```\n\n10.9 - Scheduler Performance Tuning | to verify that the kube-scheduler component is healthy.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8902"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1alpha1\nkind: KubeSchedulerConfiguration\nalgorithmSource:\n  provider: DefaultProvider\n\n...\n\npercentageOfNodesToScore: 50\n```\n\n10.9 - Scheduler Performance Tuning | percentageOfNodesToScore must be a value between 1 and 100 with the default value being calculated based on the cluster size. There is also a hardcoded minimum value of 100 nodes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8903"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        - name: memory\n          weight: 1\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\n10.10 - Resource Bin Packing | To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8904"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        requestedToCapacityRatio:\n          shape:\n          - utilization: 0\n            score: 0\n          - utilization: 100\n            score: 10\n        type: RequestedToCapacityRatio\n    name: NodeResourcesFit\n```\n\n10.10 - Resource Bin Packing | Referencing the KubeSchedulerConfiguration file with the kube-scheduler flag --config=/path/to/config/file will pass the configuration to the scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8905"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for XYZ service pods only.\"\n```\n\n10.11 - Pod Priority and Preemption | Pods with preemptionPolicy: Never will be placed in the scheduling queue ahead of lower-priority pods, but they cannot preempt other pods. A non-preempting pod waiting to be scheduled will stay in the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8906"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: high-priority-nonpreempting\nvalue: 1000000\npreemptionPolicy: Never\nglobalDefault: false\ndescription: \"This priority class will not cause other pods to be preempted.\"\n```\n\n10.11 - Pod Priority and Preemption | After you have one or more PriorityClasses, you can create Pods that specify one of those PriorityClass names in their specifications. The priority admission controller uses the priorityClassName fiel", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8907"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  priorityClassName: high-priority\n```\n\n10.11 - Pod Priority and Preemption | When Pod priority is enabled, the scheduler orders pending Pods by their priority and a pending Pod is placed ahead of other pending Pods with lower priority in the scheduling queue. As a result, the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8908"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nevictionHard:\n  memory.available: \"500Mi\"\n  nodefs.available: \"1Gi\"\n  imagefs.available: \"100Gi\"\nevictionMinimumReclaim:\n  memory.available: \"0Mi\"\n  nodefs.available: \"500Mi\"\n  imagefs.available: \"2Gi\"\n```\n\n10.12 - Node-pressure Eviction | In this example, if the nodefs.available signal meets the eviction threshold, the kubelet reclaims the resource until the signal reaches the threshold of 1GiB, and then continues to reclaim the minimu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8909"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl top nodes --show-swap\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8910"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -n kube-system --show-swap\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8911"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o go-template='{{range .items}}{{.metadata.name}}: {{if .status.nodeInfo.swap.capacity}}{{.status.nodeInfo.swap.capacity}}{{else}}<unknown>{{end}}{{\"\\n\"}}{{end}}'\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8912"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o jsonpath='{range .items[?(@.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap)]}{.metadata.name}{\"\\t\"}{.metadata.labels.feature\\.node\\.kubernetes\\.io/memory-swap}{\"\\n\"}{end}'\n```\n\n11.2 - Swap memory management | This will result in an output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8913"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get mutatingwebhookconfigurations\n```\n\n11.6 - Admission Webhook Good Practices | The output lists any mutating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8914"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get validatingwebhookconfigurations\n```\n\n11.6 - Admission Webhook Good Practices | The output lists any validating admission controllers in the cluster.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8915"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ndebug/counter-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8916"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8917"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod.yaml\n```\n\n11.8 - Logging Architecture | The output is:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8918"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter -c count\n```\n\n11.8 - Logging Architecture | As an alpha feature, the kubelet can split out the logs from the two standard streams produced by a container: standard output and standard error. To use this behavior, you must enable the PodLogsQuer", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8919"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ndebug/counter-pod-err.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8920"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter-err\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args: [/bin/sh, -c,\n            'i=0; while true; do echo \"$i: $(date)\"; echo \"$i: err\" >&2 ; i=$((i+1)); sleep 1; done']\n```\n\n11.8 - Logging Architecture | To run this pod, use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8921"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/counter-pod-err.yaml\n```\n\n11.8 - Logging Architecture | To fetch only the stderr log stream, you can run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8922"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/namespaces/default/pods/counter-err/log?stream=Stderr\"\n```\n\n11.8 - Logging Architecture | See the kubectl logs documentation for more details.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8923"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8924"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | It is not recommended to write log entries with different formats to the same log stream, even if you managed to redirect both components to the stdout stream of the container. Instead, you can create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8925"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod-streaming-sidecar.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8926"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-1\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-log-2\n    image: busybox:1.28\n    args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  volumes:\n  - name: varlog\n    emptyDir: {}\n```\n\n11.8 - Logging Architecture | Now when you run this pod, you can access each log stream separately by running the following commands:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8927"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-1\n```\n\n11.8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8928"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl logs counter count-log-2\n```\n\n11.8 - Logging Architecture | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8929"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/fluentd-sidecar-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n11.8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8930"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: fluentd-config\ndata:\n  fluentd.conf: |\n    <source>\n      type tail\n      format none\n      path /var/log/1.log\n      pos_file /var/log/1.log.pos\n      tag count.format1\n    </source>\n\n    <source>\n      type tail\n      format none\n      path /var/log/2.log\n      pos_file /var/log/2.log.pos\n      tag count.format2\n    </source>\n\n    <match **>\n      type google_cloud\n    </match>\n```\n\n11.8 - Logging Architecture | The second manifest describes a pod that has a sidecar container running fluentd. The pod mounts a volume where fluentd can pick up its configuration data.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8931"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\nadmin/logging/two-files-counter-pod-agent-sidecar.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n11.8 - Logging Architecture |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8932"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: counter\nspec:\n  containers:\n  - name: count\n    image: busybox:1.28\n    args:\n    - /bin/sh\n    - -c\n    - >\n      i=0;\n      while true;\n      do\n        echo \"$i: $(date)\" >> /var/log/1.log;\n        echo \"$(date) INFO $i\" >> /var/log/2.log;\n        i=$((i+1));\n        sleep 1;\n      done      \n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n  - name: count-agent\n    image: registry.k8s.io/fluentd-gcp:1.30\n    env:\n    - name: FLUENTD_ARGS\n      value: -c /etc/fluentd-config/fluentd.conf\n    volumeMounts:\n    - name: varlog\n      mountPath: /var/log\n    - name: config-volume\n      mountPath: /etc/fluentd-config\n  volumes:\n  - name: varlog\n    emptyDir: {}\n  - name: config-volume\n    configMap:\n      name: fluentd-config\n```\n\n11.8 - Logging Architecture |", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8933"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: prometheus\nrules:\n  - nonResourceURLs:\n      - \"/metrics\"\n    verbs:\n      - get\n```\n\n11.10 - Metrics For Kubernetes System Components | Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deleted metric", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8934"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/<insert-node-name-here>/proxy/logs/?query=/<insert-log-file-name-here>\"\n```\n\n11.12 - System Logs | The kubelet uses heuristics to retrieve logs. This helps if you are not aware whether a given system service is writing logs to the operating system's native logger like journald or to a log file in /", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8935"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: TracingConfiguration\n# default value\n#endpoint: localhost:4317\nsamplingRatePerMillion: 100\n```\n\n11.13 - Traces For Kubernetes System Components | For more information about the TracingConfiguration struct, see API server config API (v1).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8936"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\ntracing:\n  # default value\n  #endpoint: localhost:4317\n  samplingRatePerMillion: 100\n```\n\n11.13 - Traces For Kubernetes System Components | If the samplingRatePerMillion is set to one million (1000000), then every span will be sent to the exporter.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8937"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npriority-and-fairness/health-for-strangers.yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n11.15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8938"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: health-for-strangers\nspec:\n  matchingPrecedence: 1000\n  priorityLevelConfiguration:\n    name: exempt\n  rules:\n    - nonResourceRules:\n      - nonResourceURLs:\n          - \"/healthz\"\n          - \"/livez\"\n          - \"/readyz\"\n        verbs:\n          - \"*\"\n      subjects:\n        - kind: Group\n          group:\n            name: \"system:unauthenticated\"\n```\n\n11.15 - API Priority and Fairness | When you enable the API Priority and Fairness feature, the kube-apiserver exports additional metrics. Monitoring these can help you determine whether your configuration is inappropriately throttling i", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8939"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\npriority-and-fairness/list-events-default-service-account.yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n11.15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8940"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\nkind: FlowSchema\nmetadata:\n  name: list-events-default-service-account\nspec:\n  distinguisherMethod:\n    type: ByUser\n  matchingPrecedence: 8000\n  priorityLevelConfiguration:\n    name: catch-all\n  rules:\n    - resourceRules:\n      - apiGroups:\n          - '*'\n        namespaces:\n          - default\n        resources:\n          - events\n        verbs:\n          - list\n      subjects:\n        - kind: ServiceAccount\n          serviceAccount:\n            name: default\n            namespace: default\n```\n\n11.15 - API Priority and Fairness | Add-ons extend the functionality of Kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8941"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: win-webserver\n  labels:\n    app: win-webserver\nspec:\n  ports:\n    # the port that this service should serve on\n    - port: 80\n      targetPort: 80\n  selector:\n    app: win-webserver\n  type: NodePort\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: win-webserver\n  name: win-webserver\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: win-webserver\n  template:\n    metadata:\n      labels:\n        app: win-webserver\n      name: win-webserver\n    spec:\n     containers:\n      - name: windowswebserver\n        image: mcr.microsoft.com/windows/servercore:ltsc2019\n        command:\n        - powershell.exe\n        - -command\n        - \"<#code used from https://gist.github.com/19WAS85/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ;  ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus)  } ; \"\n     nodeSelector:\n      kubernetes.io/os: windows\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Check that all nodes are healthy:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8942"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f win-webserver.yaml\nkubectl get pods -o wide -w\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | When the service is deployed correctly both Pods are marked as Ready. To exit the watch command, press Ctrl+C.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8943"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: node.k8s.io/v1\nkind: RuntimeClass\nmetadata:\n  name: windows-2019\nhandler: example-container-runtime-handler\nscheduling:\n  nodeSelector:\n    kubernetes.io/os: 'windows'\n    kubernetes.io/arch: 'amd64'\n    node.kubernetes.io/windows-build: '10.0.17763'\n  tolerations:\n  - effect: NoSchedule\n    key: os\n    operator: Equal\n    value: \"windows\"\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Run kubectl create -f runtimeClasses.yml using as a cluster administrator", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8944"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: iis-2019\n  labels:\n    app: iis-2019\nspec:\n  replicas: 1\n  template:\n    metadata:\n      name: iis-2019\n      labels:\n        app: iis-2019\n    spec:\n      runtimeClassName: windows-2019\n      containers:\n      - name: iis\n        image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        resources:\n          limits:\n            cpu: 1\n            memory: 800Mi\n          requests:\n            cpu: .1\n            memory: 300Mi\n        ports:\n          - containerPort: 80\n selector:\n    matchLabels:\n      app: iis-2019\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: iis\nspec:\n  type: LoadBalancer\n  ports:\n  - protocol: TCP\n    port: 80\n  selector:\n    app: iis-2019\n```\n\n12.2 - Guide for Running Windows Containers in Kubernetes | Kubernetes is highly configurable and extensible. As a result, there is rarely a need to fork or submit patches to the Kubernetes project code.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8945"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubernetes.io/ingress-bandwidth: 1M\n    kubernetes.io/egress-bandwidth: 1M\n...\n```\n\n13.1.1 - Network Plugins | Kubernetes provides a device plugin framework that you can use to advertise system hardware resources to the Kubelet.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8946"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: demo-pod\nspec:\n  containers:\n    - name: demo-container-1\n      image: registry.k8s.io/pause:3.8\n      resources:\n        limits:\n          hardware-vendor.example/foo: 2\n#\n# This Pod needs 2 of the hardware-vendor.example/foo devices\n# and can only schedule onto a Node that's able to satisfy\n# that need.\n#\n# If the Node has more than 2 of those devices available, the\n# remainder would be available for other Pods to use.\n```\n\n13.1.2 - Device Plugins | The general workflow of a device plugin includes the following steps:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8947"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\ncustomresourcedefinition/shirt-resource-definition.yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n13.2.1 - Custom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8948"}
{"instruction": "Write a yaml example for concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n13.2.1 - Custom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8949"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\n13.2.1 - Custom Resources | The output should be:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8950"}
{"instruction": "Write a bash example for concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get SampleDB                   # find configured databases\n\nkubectl edit SampleDB/example-database # manually change some settings\n```\n\n13.3 - Operator pattern | …and that's it! The operator will take care of applying the changes as well as keeping the existing service in good shape.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/_print/", "id": "k8s_00617_code_8951"}
{"instruction": "What is the reference documentation for getting started?", "response": "Kubectl Reference Docs GETTING STARTEDcreateclusterroleclusterrolebindingconfigmapcronjobdeploymentingressjobnamespacepoddisruptionbudgetpriorityclassquotarolerolebindingsecretsecret docker-registrysecret genericsecret tlsserviceservice clusteripservice externalnameservice loadbalancerservice nodeportserviceaccountgetrunexposedeleteAPP MANAGEMENTapplyedit-last-appliedset-last-appliedview-last-appliedannotateautoscaledebugdiffeditkustomizelabelpatchreplacerollouthistorypauserestartresumestatusundoscalesetenvimageresourcesselectorserviceaccountsubjectwaitWORKING WITH APPSattachauthcan-ireconcilecpdescribeexeclogsport-forwardproxytopnodepodCLUSTER MANAGEMENTapi-versionscertificateapprovedenycluster-infodumpcordondraintaintuncordonKUBECTL SETTINGS AND USAGEalphaapi-resourcescompletionconfigcurrent-contextdelete-clusterdelete-contextdelete-userget-clustersget-contextsget-usersrename-contextsetset-clusterset-contextset-credentialsunsetuse-contextviewexplainoptionspluginlistversionCopyright 2020 The Kubernetes Authors. example GETTING STARTED This section contains the most basic commands for getting a workload running on your cluster. run will start running 1 or more instances of a container image on your cluster. expose will load balance traffic across the running instances, and can create a HA proxy for accessing the containers from outside the cluster. Once your workloads are running, you can use the commands in the WORKING WITH APPS section to inspect them. create Create a pod using the data in pod.json kubectl create -f ./pod.json Create a pod based on the JSON passed into stdin cat pod.json | kubectl create -f - Edit the data in docker-registry.yaml in JSON then create the resource using the edited data kubectl create -f docker-registry.yaml --edit -o json Create a resource from a file or from stdin. JSON and YAML formats are accepted. Usage $ kubectl create -f FILENAME Flags Name Shorthand Default Usage allow-missing-template-keys true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. dry-run none Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. edit false Edit the API resource before creating field-manager kubectl-create Name of the manager used to track field ownership. filename f [] Filename, directory, or URL to files to use to create the resource kustomize k Process the kustomization directory. This flag can't be used together with -f or -R. output o Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. raw Raw URI to POST to the server. Uses the transport specified by the kubeconfig file. record false Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. recursive R false Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. selector l Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) show-managed-fields false If true, keep the managedFields when printing objects in JSON or YAML format. template Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. validate true If true, use a schema to validate the input before sending it windows-line-endings ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./pod.json\n```\n\ncreate | Create a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8953"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f docker-registry.yaml --edit -o json\n```\n\ncreate | Create a resource from a file or from stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8954"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\ncreate | Create a cluster role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8955"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a cluster role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8956"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a cluster role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8957"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a cluster role name \"foo\" with NonResourceURL specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8958"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\ncreate | Create a cluster role name \"monitoring\" with AggregationRule specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8959"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\ncreate | Create a cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8960"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a cluster role binding for a particular cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8961"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config with specified keys instead of file basenames on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8962"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt\n```\n\ncreate | Create a new config map named my-config with key1=config1 and key2=config2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8963"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2\n```\n\ncreate | Create a new config map named my-config from the key=value pairs in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8964"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8965"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-env-file=path/to/bar.env\n```\n\ncreate | Create a config map based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8966"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\"\n```\n\ncreate | Create a cron job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8967"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" -- date\n```\n\ncreate | Create a cron job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8968"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox\n```\n\ncreate | Create a deployment with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8969"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox -- date\n```\n\ncreate | Create a deployment named my-dep that runs the nginx image with 3 replicas", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8970"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=nginx --replicas=3\n```\n\ncreate | Create a deployment named my-dep that runs the busybox image and expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8971"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox --port=5701\n```\n\ncreate | Create a deployment with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8972"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress simple --rule=\"foo.com/bar=svc1:8080,tls=my-cert\"\n```\n\ncreate | Create a catch all ingress of \"/path\" pointing to service svc:port and Ingress Class as \"otheringress\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8973"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress catch-all --class=otheringress --rule=\"/path=svc:port\"\n```\n\ncreate | Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8974"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress annotated --class=default --rule=\"foo.com/bar=svc:port\" \\\n--annotation ingress.annotation1=foo \\\n--annotation ingress.annotation2=bla\n```\n\ncreate | Create an ingress with the same host and multiple paths", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8975"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress multipath --class=default \\\n--rule=\"foo.com/=svc:port\" \\\n--rule=\"foo.com/admin/=svcadmin:portadmin\"\n```\n\ncreate | Create an ingress with multiple hosts and the pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8976"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingress1 --class=default \\\n--rule=\"foo.com/path*=svc:8080\" \\\n--rule=\"bar.com/admin*=svc2:http\"\n```\n\ncreate | Create an ingress with TLS enabled using the default ingress certificate and different path types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8977"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingtls --class=default \\\n--rule=\"foo.com/=svc:https,tls\" \\\n--rule=\"foo.com/path/subpath*=othersvc:8080\"\n```\n\ncreate | Create an ingress with TLS enabled using a specific secret and pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8978"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingsecret --class=default \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with a default backend", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8979"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingdefault --class=default \\\n--default-backend=defaultsvc:http \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8980"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox\n```\n\ncreate | Create a job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8981"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox -- date\n```\n\ncreate | Create a job from a cron job named \"a-cronjob\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8982"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job test-job --from=cronjob/a-cronjob\n```\n\ncreate | Create a job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8983"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace my-namespace\n```\n\ncreate | Create a namespace with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8984"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1\n```\n\ncreate | Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8985"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create pdb my-pdb --selector=app=nginx --min-available=50%\n```\n\ncreate | Create a pod disruption budget with the specified name, selector, and desired minimum available pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8986"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\"\n```\n\ncreate | Create a priority class named default-priority that is considered as the global default priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8987"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass default-priority --value=1000 --global-default=true --description=\"default priority\"\n```\n\ncreate | Create a priority class named high-priority that cannot preempt pods with lower priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8988"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\" --preemption-policy=\"Never\"\n```\n\ncreate | Create a priority class with the specified name, value, globalDefault and description.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8989"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10\n```\n\ncreate | Create a new resource quota named best-effort", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8990"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota best-effort --hard=pods=100 --scopes=BestEffort\n```\n\ncreate | Create a resource quota with the specified name, hard limits, and optional scopes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8991"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\ncreate | Create a role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8992"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8993"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8994"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a role with single rule.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8995"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a role binding for a particular role or cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8996"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL\n```\n\ncreate | Create a new secret named my-secret from ~/.docker/config.json", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8997"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json\n```\n\ncreate | Create a new secret for use with Docker registries.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8998"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=path/to/bar\n```\n\ncreate | Create a new secret named my-secret with specified keys instead of names on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_8999"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub\n```\n\ncreate | Create a new secret named my-secret with key1=supersecret and key2=topsecret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9000"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret\n```\n\ncreate | Create a new secret named my-secret using a combination of a file and a literal", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9001"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret\n```\n\ncreate | Create a new secret named my-secret from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9002"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-env-file=path/to/bar.env\n```\n\ncreate | Create a secret based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9003"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key\n```\n\ncreate | Create a TLS secret from the given public/private key pair.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9004"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --tcp=5678:8080\n```\n\ncreate | Create a new ClusterIP service named my-cs (in headless mode)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9005"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --clusterip=\"None\"\n```\n\ncreate | Create a ClusterIP service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9006"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname my-ns --external-name bar.com\n```\n\ncreate | Create an ExternalName service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9007"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer my-lbs --tcp=5678:8080\n```\n\ncreate | Create a LoadBalancer service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9008"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport my-ns --tcp=5678:8080\n```\n\ncreate | Create a NodePort service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9009"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount my-service-account\n```\n\ncreate | Create a service account with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9010"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nget | List a single replication controller with specified NAME in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9011"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get replicationcontroller web\n```\n\nget | List deployments in JSON output format, in the \"v1\" version of the \"apps\" API group", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9012"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments.v1.apps -o json\n```\n\nget | List a single pod in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9013"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o json pod web-pod-13je7\n```\n\nget | List a pod identified by type and name specified in \"pod.yaml\" in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9014"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -f pod.yaml -o json\n```\n\nget | List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9015"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}\n```\n\nget | List resource information in custom columns", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9016"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image\n```\n\nget | List all replication controllers and services together in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9017"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc,services\n```\n\nget | List one or more resources by their type and names", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9018"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc/web service/frontend pods/web-pod-13je7\n```\n\nget | Display one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9019"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx\n```\n\nrun | Start a hazelcast pod and let the container expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9020"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --port=5701\n```\n\nrun | Start a hazelcast pod and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9021"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --env=\"DNS_DOMAIN=cluster\" --env=\"POD_NAMESPACE=default\"\n```\n\nrun | Start a hazelcast pod and set labels \"app=hazelcast\" and \"env=prod\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9022"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --labels=\"app=hazelcast,env=prod\"\n```\n\nrun | Dry run; print the corresponding API objects without creating them", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9023"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --dry-run=client\n```\n\nrun | Start a nginx pod, but overload the spec with a partial set of values parsed from JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9024"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\": \"v1\", \"spec\": { ... } }'\n```\n\nrun | Start a busybox pod and keep it in the foreground, don't restart it if it exits", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9025"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run -i -t busybox --image=busybox --restart=Never\n```\n\nrun | Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9026"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>\n```\n\nrun | Start the nginx pod using a different command and custom arguments", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9027"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>\n```\n\nrun | Create and run a particular image in a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9028"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9029"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose -f nginx-controller.yaml --port=80 --target-port=8000\n```\n\nexpose | Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9030"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod valid-pod --port=444 --name=frontend\n```\n\nexpose | Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9031"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https\n```\n\nexpose | Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9032"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream\n```\n\nexpose | Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9033"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rs nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9034"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80 --target-port=8000\n```\n\nexpose | Expose a resource as a new Kubernetes service.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9035"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json\n```\n\ndelete | Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9036"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -k dir\n```\n\ndelete | Delete a pod based on the type and name in the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9037"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod,service baz foo\n```\n\ndelete | Delete pods and services with label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9038"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods,services -l name=myLabel\n```\n\ndelete | Delete a pod with minimal delay", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9039"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --now\n```\n\ndelete | Force delete a pod on a dead node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9040"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --force\n```\n\ndelete | Delete all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9041"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods --all\n```\n\ndelete | Delete resources by file names, stdin, resources and names, or by resources and label selector.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9042"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./pod.json\n```\n\napply | Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9043"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k dir/\n```\n\napply | Apply the JSON passed into stdin to a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9044"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml -l app=nginx\n```\n\napply | Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9045"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap\n```\n\napply | Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initia", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9046"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/nginx\n```\n\napply | Edit the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9047"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied -f deploy.yaml -o json\n```\n\napply | Edit the latest last-applied-configuration annotations of resources from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9048"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml\n```\n\napply | Execute set-last-applied against each configuration file in a directory", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9049"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f path/\n```\n\napply | Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9050"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml --create-annotation=true\n```\n\napply | Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run,", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9051"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied deployment/nginx\n```\n\napply | View the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9052"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied -f deploy.yaml -o json\n```\n\napply | View the latest last-applied-configuration annotations by type/name or file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9053"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend'\n```\n\nannotate | Update a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9054"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate -f pod.json description='my frontend'\n```\n\nannotate | Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9055"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate --overwrite pods foo description='my frontend running nginx'\n```\n\nannotate | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9056"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods --all description='my frontend running nginx'\n```\n\nannotate | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9057"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend running nginx' --resource-version=1\n```\n\nannotate | Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9058"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description-\n```\n\nannotate | Update the annotations on one or more resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9059"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment foo --min=2 --max=10\n```\n\nautoscale | Auto scale a replication controller \"foo\", with the number of pods between 1 and 5, target CPU utilization at 80%", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9060"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rc foo --max=5 --cpu-percent=80\n```\n\nautoscale | Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9061"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox\n```\n\ndebug | Create a debug container named debugger using a custom automated debugging image. # (requires the EphemeralContainers feature to be enabled in the cluster)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9062"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug --image=myproj/debug-tools -c debugger mypod\n```\n\ndebug | Create a copy of mypod adding a debug container and attach to it", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9063"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox --copy-to=my-debugger\n```\n\ndebug | Create a copy of mypod changing the command of mycontainer", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9064"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh\n```\n\ndebug | Create a copy of mypod changing all container images to busybox", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9065"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod --copy-to=my-debugger --set-image=*=busybox\n```\n\ndebug | Create a copy of mypod adding a debug container and changing container images", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9066"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug\n```\n\ndebug | Create an interactive debugging session on a node and immediately attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at /host", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9067"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=busybox\n```\n\ndebug | Debug cluster resources using interactive debugging containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9068"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f pod.json\n```\n\ndiff | Diff file read from stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9069"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry\n```\n\nedit | Use an alternative editor", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9070"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit job.v1.batch/myjob -o json\n```\n\nedit | Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9071"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/mydeployment -o yaml --save-config\n```\n\nedit | Edit a resource from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9072"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize /home/config/production\n```\n\nkustomize | Build from github", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9073"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6\n```\n\nkustomize | Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying sa", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9074"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo unhealthy=true\n```\n\nlabel | Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9075"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite pods foo status=unhealthy\n```\n\nlabel | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9076"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods --all status=unhealthy\n```\n\nlabel | Update a pod identified by the type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9077"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label -f pod.json status=unhealthy\n```\n\nlabel | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9078"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo status=unhealthy --resource-version=1\n```\n\nlabel | Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9079"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo bar-\n```\n\nlabel | Update the labels on a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9080"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Partially update a node using a strategic merge patch, specifying the patch as YAML", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9081"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p $'spec:\\n unschedulable: true'\n```\n\npatch | Partially update a node identified by the type and name specified in \"node.json\" using strategic merge patch", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9082"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch -f node.json -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Update a container's image; spec.containers[*].name is required because it's a merge key", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9083"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n```\n\npatch | Update a container's image using a JSON patch with positional arrays", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9084"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n```\n\npatch | Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9085"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f ./pod.json\n```\n\nreplace | Replace a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9086"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n```\n\nreplace | Force replace, delete and then re-create the resource", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9087"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace --force -f ./pod.json\n```\n\nreplace | Replace a resource by file name or stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9088"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Check the rollout status of a daemonset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9089"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status daemonset/foo\n```\n\nrollout | Manage the rollout of a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9090"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/abc\n```\n\nrollout | View the details of daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9091"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset/abc --revision=3\n```\n\nrollout | View previous rollout revisions and configurations.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9092"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx\n```\n\nrollout | Mark the provided resource as paused.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9093"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment/nginx\n```\n\nrollout | Restart a daemon set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9094"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart daemonset/abc\n```\n\nrollout | Restart a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9095"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx\n```\n\nrollout | Resume a paused resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9096"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx\n```\n\nrollout | Show the status of the rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9097"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Roll back to daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9098"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset/abc --to-revision=3\n```\n\nrollout | Roll back to the previous deployment with dry-run", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9099"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo --dry-run=server deployment/abc\n```\n\nrollout | Roll back to a previous rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9100"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo\n```\n\nscale | Scale a resource identified by type and name specified in \"foo.yaml\" to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9101"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 -f foo.yaml\n```\n\nscale | If the deployment named mysql's current size is 2, scale mysql to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9102"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql\n```\n\nscale | Scale multiple replication controllers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9103"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz\n```\n\nscale | Scale stateful set named 'web' to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9104"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 statefulset/web\n```\n\nscale | Set a new size for a deployment, replica set, replication controller, or stateful set.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9105"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/registry STORAGE_DIR=/local\n```\n\nset | List the environment variables defined on a deployments 'sample-build'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9106"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build --list\n```\n\nset | List the environment variables defined on all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9107"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env pods --all --list\n```\n\nset | Output modified deployment in YAML, and does not alter the object on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9108"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml\n```\n\nset | Update all containers in all replication controllers in the project to have ENV=prod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9109"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env rc --all ENV=prod\n```\n\nset | Import environment from a secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9110"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=secret/mysecret deployment/myapp\n```\n\nset | Import environment from a config map with a prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9111"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp\n```\n\nset | Import specific keys from a config map", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9112"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp\n```\n\nset | Remove the environment variable ENV from container 'c1' in all deployment configs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9113"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployments --all --containers=\"c1\" ENV-\n```\n\nset | Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9114"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env -f deploy.json ENV-\n```\n\nset | Set some of the local shell environment into a deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9115"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1\n```\n\nset | Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9116"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments,rc nginx=nginx:1.9.1 --all\n```\n\nset | Update image of all containers of daemonset abc to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9117"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image daemonset abc *=nginx:1.9.1\n```\n\nset | Print result (in yaml format) of updating nginx container image from local file, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9118"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml\n```\n\nset | Update existing container image(s) of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9119"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nset | Set the resource request and limits for all containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9120"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi\n```\n\nset | Remove the resource requests for resources on containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9121"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0\n```\n\nset | Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9122"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml\n```\n\nset | Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9123"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\nkubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -\n```\n\nset | Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9124"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount deployment nginx-deployment serviceaccount1\n```\n\nset | Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9125"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml\n```\n\nset | Update the service account of pod template resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9126"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1\n```\n\nset | Update a role binding for user1, user2, and group1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9127"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1\n```\n\nset | Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9128"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml\n```\n\nset | Update the user, group, or service account in a role binding or cluster role binding.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9129"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready pod/busybox1\n```\n\nwait | The default value of status condition is true; you can set it to false", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9130"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready=false pod/busybox1\n```\n\nwait | Wait for the pod \"busybox1\" to be deleted, with a timeout of 60s, after having issued the \"delete\" command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9131"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/busybox1\nkubectl wait --for=delete pod/busybox1 --timeout=60s\n```\n\nwait | Experimental: Wait for a specific condition on one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9132"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container\n```\n\nattach | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9133"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container -i -t\n```\n\nattach | Get output from the first pod of a replica set named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9134"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach rs/nginx\n```\n\nattach | Attach to a process that is already running inside an existing container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9135"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create pods --all-namespaces\n```\n\nauth | Check to see if I can list deployments in my current namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9136"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list deployments.apps\n```\n\nauth | Check to see if I can do everything in my current namespace (\"*\" means all)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9137"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i '*' '*'\n```\n\nauth | Check to see if I can get the job named \"bar\" in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9138"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list jobs.batch/bar -n foo\n```\n\nauth | Check to see if I can read pod logs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9139"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get pods --subresource=log\n```\n\nauth | Check to see if I can access the URL /logs/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9140"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get /logs/\n```\n\nauth | List all allowed actions in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9141"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i --list --namespace=foo\n```\n\nauth | Check whether an action is allowed.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9142"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nauth | Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9143"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar\n```\n\ncp | Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9144"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9145"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9146"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar\n```\n\ncp | Copy /tmp/foo from a remote pod to /tmp/bar locally", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9147"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar\n```\n\ncp | Copy files and directories to and from containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9148"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes kubernetes-node-emt8.c.myproject.internal\n```\n\ndescribe | Describe a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9149"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods/nginx\n```\n\ndescribe | Describe a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9150"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f pod.json\n```\n\ndescribe | Describe all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9151"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\ndescribe | Describe pods by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9152"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe po -l name=myLabel\n```\n\ndescribe | Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9153"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods frontend\n```\n\ndescribe | Show details of a specific resource or group of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9154"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -- date\n```\n\nexec | Get output from running the 'date' command in ruby-container from pod mypod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9155"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -- date\n```\n\nexec | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9156"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -i -t -- bash -il\n```\n\nexec | List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9157"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -i -t -- ls -t /usr\n```\n\nexec | Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9158"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec deploy/mydeployment -- date\n```\n\nexec | Get output from running 'date' command from the first pod of the service myservice, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9159"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec svc/myservice -- date\n```\n\nexec | Execute a command in a container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9160"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs nginx --all-containers=true\n```\n\nlogs | Return snapshot logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9161"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app=nginx --all-containers=true\n```\n\nlogs | Return snapshot of previous terminated ruby container logs from pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9162"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -p -c ruby web-1\n```\n\nlogs | Begin streaming the logs of the ruby container in pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9163"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -c ruby web-1\n```\n\nlogs | Begin streaming the logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9164"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l app=nginx --all-containers=true\n```\n\nlogs | Display only the most recent 20 lines of output in pod nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9165"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --tail=20 nginx\n```\n\nlogs | Show all logs from pod nginx written in the last hour", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9166"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --since=1h nginx\n```\n\nlogs | Show logs from a kubelet with an expired serving certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9167"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --insecure-skip-tls-verify-backend nginx\n```\n\nlogs | Return snapshot logs from first container of a job named hello", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9168"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs job/hello\n```\n\nlogs | Return snapshot logs from container nginx-1 of a deployment named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9169"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/nginx -c nginx-1\n```\n\nlogs | Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9170"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 5000 6000\n```\n\nport-forward | Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9171"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mydeployment 5000 6000\n```\n\nport-forward | Listen on port 8443 locally, forwarding to the targetPort of the service's port named \"https\" in a pod selected by the service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9172"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/myservice 8443:https\n```\n\nport-forward | Listen on port 8888 locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9173"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on all addresses, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9174"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9175"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000\n```\n\nport-forward | Listen on a random port locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9176"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod :5000\n```\n\nport-forward | Forward one or more local ports to a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9177"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/\n```\n\nproxy | To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9178"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/\n```\n\nproxy | To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9179"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/custom/\n```\n\nproxy | Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9180"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8011 --www=./local/www/\n```\n\nproxy | Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9181"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=0\n```\n\nproxy | Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9182"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/k8s-api\n```\n\nproxy | Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through on", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9183"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top node NODE_NAME\n```\n\ntop | Display resource (CPU/memory) usage of nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9184"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod --namespace=NAMESPACE\n```\n\ntop | Show metrics for a given pod and its containers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9185"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod POD_NAME --containers\n```\n\ntop | Show metrics for the pods defined by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9186"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -l name=myLabel\n```\n\ntop | Display resource (CPU/memory) usage of pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9187"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve csr-sqgzp\n```\n\ncertificate | Approve a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9188"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny csr-sqgzp\n```\n\ncertificate | Deny a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9189"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\ncluster-info | Dump current cluster state to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9190"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump all namespaces to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9191"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --all-namespaces\n```\n\ncluster-info | Dump a set of namespaces to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9192"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you sp", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9193"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --force\n```\n\ndrain | As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9194"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --grace-period=900\n```\n\ndrain | Drain node in preparation for maintenance.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9195"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\ntaint | Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9196"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated:NoSchedule-\n```\n\ntaint | Remove from node 'foo' all the taints with key 'dedicated'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9197"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated-\n```\n\ntaint | Add a taint with key 'dedicated' on nodes having label mylabel=X", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9198"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint node -l myLabel=X  dedicated=foo:PreferNoSchedule\n```\n\ntaint | Add to node 'foo' a taint with key 'bar' and no value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9199"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo bar:NoSchedule\n```\n\ntaint | Update the taints on one or more nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9200"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\napi-resources | Print the supported API resources with more information", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9201"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources -o wide\n```\n\napi-resources | Print the supported API resources sorted by a column", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9202"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --sort-by=name\n```\n\napi-resources | Print the supported namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9203"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true\n```\n\napi-resources | Print the supported non-namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9204"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=false\n```\n\napi-resources | Print the supported API resources with a specific APIGroup", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9205"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --api-group=extensions\n```\n\napi-resources | Print the supported API resources on the server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9206"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl\n```\n\ncompletion | Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion co", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9207"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > ~/.kube/completion.bash.inc\nprintf \"\n```\n\ncompletion | Kubectl shell completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9208"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh > \"${fpath[1]}/_kubectl\"\n```\n\ncompletion | Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .b", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9209"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nconfig | Display the current-context.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9210"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster minikube\n```\n\nconfig | Delete the specified cluster from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9211"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context minikube\n```\n\nconfig | Delete the specified context from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9212"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user minikube\n```\n\nconfig | Delete the specified user from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9213"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters\n```\n\nconfig | Display clusters defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9214"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nconfig | Describe one context in your kubeconfig file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9215"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts my-context\n```\n\nconfig | Display one or many contexts from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9216"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users\n```\n\nconfig | Display users defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9217"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context old-name new-name\n```\n\nconfig | Renames a context from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9218"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.server https://1.2.3.4\n```\n\nconfig | Set the certificate-authority-data field on the my-cluster cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9219"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.certificate-authority-data $(echo \"cert_data_here\" | base64 -i -)\n```\n\nconfig | Set the cluster field in the my-context context to my-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9220"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set contexts.my-context.cluster my-cluster\n```\n\nconfig | Set the client-key-data field in the cluster-admin user using --set-raw-bytes option", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9221"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true\n```\n\nconfig | Set an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9222"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --server=https://1.2.3.4\n```\n\nconfig | Embed certificate authority data for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9223"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt\n```\n\nconfig | Disable cert checking for the dev cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9224"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --insecure-skip-tls-verify=true\n```\n\nconfig | Set custom TLS server name to use for validation for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9225"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --tls-server-name=my-cluster-name\n```\n\nconfig | Set a cluster entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9226"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context gce --user=cluster-admin\n```\n\nconfig | Set a context entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9227"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key\n```\n\nconfig | Set basic auth for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9228"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif\n```\n\nconfig | Embed client certificate data in the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9229"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true\n```\n\nconfig | Enable the Google Compute Platform auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9230"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=gcp\n```\n\nconfig | Enable the OpenID Connect auth provider for the \"cluster-admin\" entry with additional args", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9231"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar\n```\n\nconfig | Remove the \"client-secret\" config value for the OpenID Connect auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9232"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-\n```\n\nconfig | Enable new exec auth plugin for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9233"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1\n```\n\nconfig | Define new exec auth plugin args for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9234"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2\n```\n\nconfig | Create or update exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9235"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2\n```\n\nconfig | Remove exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9236"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=var-to-remove-\n```\n\nconfig | Set a user entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9237"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset current-context\n```\n\nconfig | Unset namespace in foo context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9238"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset contexts.foo.namespace\n```\n\nconfig | Unset an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9239"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context minikube\n```\n\nconfig | Set the current-context in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9240"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view --raw\n```\n\nconfig | Get the password for the e2e user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9241"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n```\n\nconfig | Display merged kubeconfig settings or a specified kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9242"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl explain pods.spec.containers\n```\n\nexplain | List the fields for supported resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9243"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./pod.json\n```\n\ncreate | Create a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9244"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f docker-registry.yaml --edit -o json\n```\n\ncreate | Create a resource from a file or from stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9245"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\ncreate | Create a cluster role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9246"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a cluster role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9247"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a cluster role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9248"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a cluster role name \"foo\" with NonResourceURL specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9249"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\ncreate | Create a cluster role name \"monitoring\" with AggregationRule specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9250"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\ncreate | Create a cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9251"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a cluster role binding for a particular cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9252"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config with specified keys instead of file basenames on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9253"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt\n```\n\ncreate | Create a new config map named my-config with key1=config1 and key2=config2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9254"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2\n```\n\ncreate | Create a new config map named my-config from the key=value pairs in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9255"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9256"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-env-file=path/to/bar.env\n```\n\ncreate | Create a config map based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9257"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\"\n```\n\ncreate | Create a cron job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9258"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" -- date\n```\n\ncreate | Create a cron job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9259"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox\n```\n\ncreate | Create a deployment with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9260"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox -- date\n```\n\ncreate | Create a deployment named my-dep that runs the nginx image with 3 replicas", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9261"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=nginx --replicas=3\n```\n\ncreate | Create a deployment named my-dep that runs the busybox image and expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9262"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox --port=5701\n```\n\ncreate | Create a deployment with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9263"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress simple --rule=\"foo.com/bar=svc1:8080,tls=my-cert\"\n```\n\ncreate | Create a catch all ingress of \"/path\" pointing to service svc:port and Ingress Class as \"otheringress\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9264"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress catch-all --class=otheringress --rule=\"/path=svc:port\"\n```\n\ncreate | Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9265"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress annotated --class=default --rule=\"foo.com/bar=svc:port\" \\\n--annotation ingress.annotation1=foo \\\n--annotation ingress.annotation2=bla\n```\n\ncreate | Create an ingress with the same host and multiple paths", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9266"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress multipath --class=default \\\n--rule=\"foo.com/=svc:port\" \\\n--rule=\"foo.com/admin/=svcadmin:portadmin\"\n```\n\ncreate | Create an ingress with multiple hosts and the pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9267"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingress1 --class=default \\\n--rule=\"foo.com/path*=svc:8080\" \\\n--rule=\"bar.com/admin*=svc2:http\"\n```\n\ncreate | Create an ingress with TLS enabled using the default ingress certificate and different path types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9268"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingtls --class=default \\\n--rule=\"foo.com/=svc:https,tls\" \\\n--rule=\"foo.com/path/subpath*=othersvc:8080\"\n```\n\ncreate | Create an ingress with TLS enabled using a specific secret and pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9269"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingsecret --class=default \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with a default backend", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9270"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingdefault --class=default \\\n--default-backend=defaultsvc:http \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9271"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox\n```\n\ncreate | Create a job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9272"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox -- date\n```\n\ncreate | Create a job from a cron job named \"a-cronjob\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9273"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job test-job --from=cronjob/a-cronjob\n```\n\ncreate | Create a job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9274"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace my-namespace\n```\n\ncreate | Create a namespace with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9275"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1\n```\n\ncreate | Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9276"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create pdb my-pdb --selector=app=nginx --min-available=50%\n```\n\ncreate | Create a pod disruption budget with the specified name, selector, and desired minimum available pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9277"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\"\n```\n\ncreate | Create a priority class named default-priority that is considered as the global default priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9278"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass default-priority --value=1000 --global-default=true --description=\"default priority\"\n```\n\ncreate | Create a priority class named high-priority that cannot preempt pods with lower priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9279"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\" --preemption-policy=\"Never\"\n```\n\ncreate | Create a priority class with the specified name, value, globalDefault and description.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9280"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10\n```\n\ncreate | Create a new resource quota named best-effort", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9281"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota best-effort --hard=pods=100 --scopes=BestEffort\n```\n\ncreate | Create a resource quota with the specified name, hard limits, and optional scopes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9282"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\ncreate | Create a role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9283"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9284"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9285"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a role with single rule.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9286"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a role binding for a particular role or cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9287"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL\n```\n\ncreate | Create a new secret named my-secret from ~/.docker/config.json", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9288"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json\n```\n\ncreate | Create a new secret for use with Docker registries.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9289"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=path/to/bar\n```\n\ncreate | Create a new secret named my-secret with specified keys instead of names on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9290"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub\n```\n\ncreate | Create a new secret named my-secret with key1=supersecret and key2=topsecret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9291"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret\n```\n\ncreate | Create a new secret named my-secret using a combination of a file and a literal", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9292"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret\n```\n\ncreate | Create a new secret named my-secret from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9293"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-env-file=path/to/bar.env\n```\n\ncreate | Create a secret based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9294"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key\n```\n\ncreate | Create a TLS secret from the given public/private key pair.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9295"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --tcp=5678:8080\n```\n\ncreate | Create a new ClusterIP service named my-cs (in headless mode)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9296"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --clusterip=\"None\"\n```\n\ncreate | Create a ClusterIP service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9297"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname my-ns --external-name bar.com\n```\n\ncreate | Create an ExternalName service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9298"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer my-lbs --tcp=5678:8080\n```\n\ncreate | Create a LoadBalancer service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9299"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport my-ns --tcp=5678:8080\n```\n\ncreate | Create a NodePort service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9300"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount my-service-account\n```\n\ncreate | Create a service account with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9301"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nget | List a single replication controller with specified NAME in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9302"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get replicationcontroller web\n```\n\nget | List deployments in JSON output format, in the \"v1\" version of the \"apps\" API group", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9303"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments.v1.apps -o json\n```\n\nget | List a single pod in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9304"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o json pod web-pod-13je7\n```\n\nget | List a pod identified by type and name specified in \"pod.yaml\" in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9305"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -f pod.yaml -o json\n```\n\nget | List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9306"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}\n```\n\nget | List resource information in custom columns", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9307"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image\n```\n\nget | List all replication controllers and services together in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9308"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc,services\n```\n\nget | List one or more resources by their type and names", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9309"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc/web service/frontend pods/web-pod-13je7\n```\n\nget | Display one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9310"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx\n```\n\nrun | Start a hazelcast pod and let the container expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9311"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --port=5701\n```\n\nrun | Start a hazelcast pod and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9312"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --env=\"DNS_DOMAIN=cluster\" --env=\"POD_NAMESPACE=default\"\n```\n\nrun | Start a hazelcast pod and set labels \"app=hazelcast\" and \"env=prod\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9313"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --labels=\"app=hazelcast,env=prod\"\n```\n\nrun | Dry run; print the corresponding API objects without creating them", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9314"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --dry-run=client\n```\n\nrun | Start a nginx pod, but overload the spec with a partial set of values parsed from JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9315"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\": \"v1\", \"spec\": { ... } }'\n```\n\nrun | Start a busybox pod and keep it in the foreground, don't restart it if it exits", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9316"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run -i -t busybox --image=busybox --restart=Never\n```\n\nrun | Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9317"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>\n```\n\nrun | Start the nginx pod using a different command and custom arguments", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9318"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>\n```\n\nrun | Create and run a particular image in a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9319"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9320"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose -f nginx-controller.yaml --port=80 --target-port=8000\n```\n\nexpose | Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9321"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod valid-pod --port=444 --name=frontend\n```\n\nexpose | Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9322"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https\n```\n\nexpose | Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9323"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream\n```\n\nexpose | Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9324"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rs nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9325"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80 --target-port=8000\n```\n\nexpose | Expose a resource as a new Kubernetes service.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9326"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json\n```\n\ndelete | Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9327"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -k dir\n```\n\ndelete | Delete a pod based on the type and name in the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9328"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod,service baz foo\n```\n\ndelete | Delete pods and services with label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9329"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods,services -l name=myLabel\n```\n\ndelete | Delete a pod with minimal delay", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9330"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --now\n```\n\ndelete | Force delete a pod on a dead node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9331"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --force\n```\n\ndelete | Delete all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9332"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods --all\n```\n\ndelete | Delete resources by file names, stdin, resources and names, or by resources and label selector.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9333"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./pod.json\n```\n\napply | Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9334"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k dir/\n```\n\napply | Apply the JSON passed into stdin to a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9335"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml -l app=nginx\n```\n\napply | Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9336"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap\n```\n\napply | Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initia", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9337"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/nginx\n```\n\napply | Edit the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9338"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied -f deploy.yaml -o json\n```\n\napply | Edit the latest last-applied-configuration annotations of resources from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9339"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml\n```\n\napply | Execute set-last-applied against each configuration file in a directory", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9340"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f path/\n```\n\napply | Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9341"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml --create-annotation=true\n```\n\napply | Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run,", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9342"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied deployment/nginx\n```\n\napply | View the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9343"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied -f deploy.yaml -o json\n```\n\napply | View the latest last-applied-configuration annotations by type/name or file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9344"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend'\n```\n\nannotate | Update a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9345"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate -f pod.json description='my frontend'\n```\n\nannotate | Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9346"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate --overwrite pods foo description='my frontend running nginx'\n```\n\nannotate | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9347"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods --all description='my frontend running nginx'\n```\n\nannotate | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9348"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend running nginx' --resource-version=1\n```\n\nannotate | Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9349"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description-\n```\n\nannotate | Update the annotations on one or more resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9350"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment foo --min=2 --max=10\n```\n\nautoscale | Auto scale a replication controller \"foo\", with the number of pods between 1 and 5, target CPU utilization at 80%", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9351"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rc foo --max=5 --cpu-percent=80\n```\n\nautoscale | Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9352"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox\n```\n\ndebug | Create a debug container named debugger using a custom automated debugging image. # (requires the EphemeralContainers feature to be enabled in the cluster)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9353"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug --image=myproj/debug-tools -c debugger mypod\n```\n\ndebug | Create a copy of mypod adding a debug container and attach to it", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9354"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox --copy-to=my-debugger\n```\n\ndebug | Create a copy of mypod changing the command of mycontainer", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9355"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh\n```\n\ndebug | Create a copy of mypod changing all container images to busybox", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9356"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod --copy-to=my-debugger --set-image=*=busybox\n```\n\ndebug | Create a copy of mypod adding a debug container and changing container images", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9357"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug\n```\n\ndebug | Create an interactive debugging session on a node and immediately attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at /host", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9358"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=busybox\n```\n\ndebug | Debug cluster resources using interactive debugging containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9359"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f pod.json\n```\n\ndiff | Diff file read from stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9360"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry\n```\n\nedit | Use an alternative editor", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9361"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit job.v1.batch/myjob -o json\n```\n\nedit | Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9362"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/mydeployment -o yaml --save-config\n```\n\nedit | Edit a resource from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9363"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize /home/config/production\n```\n\nkustomize | Build from github", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9364"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6\n```\n\nkustomize | Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying sa", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9365"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo unhealthy=true\n```\n\nlabel | Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9366"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite pods foo status=unhealthy\n```\n\nlabel | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9367"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods --all status=unhealthy\n```\n\nlabel | Update a pod identified by the type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9368"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label -f pod.json status=unhealthy\n```\n\nlabel | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9369"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo status=unhealthy --resource-version=1\n```\n\nlabel | Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9370"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo bar-\n```\n\nlabel | Update the labels on a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9371"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Partially update a node using a strategic merge patch, specifying the patch as YAML", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9372"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p $'spec:\\n unschedulable: true'\n```\n\npatch | Partially update a node identified by the type and name specified in \"node.json\" using strategic merge patch", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9373"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch -f node.json -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Update a container's image; spec.containers[*].name is required because it's a merge key", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9374"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n```\n\npatch | Update a container's image using a JSON patch with positional arrays", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9375"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n```\n\npatch | Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9376"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f ./pod.json\n```\n\nreplace | Replace a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9377"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n```\n\nreplace | Force replace, delete and then re-create the resource", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9378"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace --force -f ./pod.json\n```\n\nreplace | Replace a resource by file name or stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9379"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Check the rollout status of a daemonset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9380"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status daemonset/foo\n```\n\nrollout | Manage the rollout of a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9381"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/abc\n```\n\nrollout | View the details of daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9382"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset/abc --revision=3\n```\n\nrollout | View previous rollout revisions and configurations.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9383"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx\n```\n\nrollout | Mark the provided resource as paused.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9384"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment/nginx\n```\n\nrollout | Restart a daemon set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9385"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart daemonset/abc\n```\n\nrollout | Restart a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9386"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx\n```\n\nrollout | Resume a paused resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9387"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx\n```\n\nrollout | Show the status of the rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9388"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Roll back to daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9389"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset/abc --to-revision=3\n```\n\nrollout | Roll back to the previous deployment with dry-run", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9390"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo --dry-run=server deployment/abc\n```\n\nrollout | Roll back to a previous rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9391"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo\n```\n\nscale | Scale a resource identified by type and name specified in \"foo.yaml\" to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9392"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 -f foo.yaml\n```\n\nscale | If the deployment named mysql's current size is 2, scale mysql to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9393"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql\n```\n\nscale | Scale multiple replication controllers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9394"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz\n```\n\nscale | Scale stateful set named 'web' to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9395"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 statefulset/web\n```\n\nscale | Set a new size for a deployment, replica set, replication controller, or stateful set.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9396"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/registry STORAGE_DIR=/local\n```\n\nset | List the environment variables defined on a deployments 'sample-build'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9397"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build --list\n```\n\nset | List the environment variables defined on all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9398"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env pods --all --list\n```\n\nset | Output modified deployment in YAML, and does not alter the object on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9399"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml\n```\n\nset | Update all containers in all replication controllers in the project to have ENV=prod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9400"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env rc --all ENV=prod\n```\n\nset | Import environment from a secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9401"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=secret/mysecret deployment/myapp\n```\n\nset | Import environment from a config map with a prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9402"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp\n```\n\nset | Import specific keys from a config map", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9403"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp\n```\n\nset | Remove the environment variable ENV from container 'c1' in all deployment configs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9404"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployments --all --containers=\"c1\" ENV-\n```\n\nset | Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9405"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env -f deploy.json ENV-\n```\n\nset | Set some of the local shell environment into a deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9406"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1\n```\n\nset | Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9407"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments,rc nginx=nginx:1.9.1 --all\n```\n\nset | Update image of all containers of daemonset abc to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9408"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image daemonset abc *=nginx:1.9.1\n```\n\nset | Print result (in yaml format) of updating nginx container image from local file, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9409"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml\n```\n\nset | Update existing container image(s) of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9410"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nset | Set the resource request and limits for all containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9411"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi\n```\n\nset | Remove the resource requests for resources on containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9412"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0\n```\n\nset | Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9413"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml\n```\n\nset | Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9414"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\nkubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -\n```\n\nset | Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9415"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount deployment nginx-deployment serviceaccount1\n```\n\nset | Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9416"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml\n```\n\nset | Update the service account of pod template resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9417"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1\n```\n\nset | Update a role binding for user1, user2, and group1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9418"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1\n```\n\nset | Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9419"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml\n```\n\nset | Update the user, group, or service account in a role binding or cluster role binding.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9420"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready pod/busybox1\n```\n\nwait | The default value of status condition is true; you can set it to false", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9421"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready=false pod/busybox1\n```\n\nwait | Wait for the pod \"busybox1\" to be deleted, with a timeout of 60s, after having issued the \"delete\" command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9422"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/busybox1\nkubectl wait --for=delete pod/busybox1 --timeout=60s\n```\n\nwait | Experimental: Wait for a specific condition on one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9423"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container\n```\n\nattach | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9424"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container -i -t\n```\n\nattach | Get output from the first pod of a replica set named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9425"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach rs/nginx\n```\n\nattach | Attach to a process that is already running inside an existing container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9426"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create pods --all-namespaces\n```\n\nauth | Check to see if I can list deployments in my current namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9427"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list deployments.apps\n```\n\nauth | Check to see if I can do everything in my current namespace (\"*\" means all)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9428"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i '*' '*'\n```\n\nauth | Check to see if I can get the job named \"bar\" in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9429"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list jobs.batch/bar -n foo\n```\n\nauth | Check to see if I can read pod logs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9430"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get pods --subresource=log\n```\n\nauth | Check to see if I can access the URL /logs/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9431"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get /logs/\n```\n\nauth | List all allowed actions in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9432"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i --list --namespace=foo\n```\n\nauth | Check whether an action is allowed.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9433"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nauth | Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9434"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar\n```\n\ncp | Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9435"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9436"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9437"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar\n```\n\ncp | Copy /tmp/foo from a remote pod to /tmp/bar locally", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9438"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar\n```\n\ncp | Copy files and directories to and from containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9439"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes kubernetes-node-emt8.c.myproject.internal\n```\n\ndescribe | Describe a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9440"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods/nginx\n```\n\ndescribe | Describe a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9441"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f pod.json\n```\n\ndescribe | Describe all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9442"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\ndescribe | Describe pods by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9443"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe po -l name=myLabel\n```\n\ndescribe | Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9444"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods frontend\n```\n\ndescribe | Show details of a specific resource or group of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9445"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -- date\n```\n\nexec | Get output from running the 'date' command in ruby-container from pod mypod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9446"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -- date\n```\n\nexec | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9447"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -i -t -- bash -il\n```\n\nexec | List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9448"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -i -t -- ls -t /usr\n```\n\nexec | Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9449"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec deploy/mydeployment -- date\n```\n\nexec | Get output from running 'date' command from the first pod of the service myservice, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9450"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec svc/myservice -- date\n```\n\nexec | Execute a command in a container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9451"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs nginx --all-containers=true\n```\n\nlogs | Return snapshot logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9452"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app=nginx --all-containers=true\n```\n\nlogs | Return snapshot of previous terminated ruby container logs from pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9453"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -p -c ruby web-1\n```\n\nlogs | Begin streaming the logs of the ruby container in pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9454"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -c ruby web-1\n```\n\nlogs | Begin streaming the logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9455"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l app=nginx --all-containers=true\n```\n\nlogs | Display only the most recent 20 lines of output in pod nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9456"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --tail=20 nginx\n```\n\nlogs | Show all logs from pod nginx written in the last hour", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9457"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --since=1h nginx\n```\n\nlogs | Show logs from a kubelet with an expired serving certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9458"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --insecure-skip-tls-verify-backend nginx\n```\n\nlogs | Return snapshot logs from first container of a job named hello", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9459"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs job/hello\n```\n\nlogs | Return snapshot logs from container nginx-1 of a deployment named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9460"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/nginx -c nginx-1\n```\n\nlogs | Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9461"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 5000 6000\n```\n\nport-forward | Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9462"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mydeployment 5000 6000\n```\n\nport-forward | Listen on port 8443 locally, forwarding to the targetPort of the service's port named \"https\" in a pod selected by the service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9463"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/myservice 8443:https\n```\n\nport-forward | Listen on port 8888 locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9464"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on all addresses, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9465"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9466"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000\n```\n\nport-forward | Listen on a random port locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9467"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod :5000\n```\n\nport-forward | Forward one or more local ports to a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9468"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/\n```\n\nproxy | To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9469"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/\n```\n\nproxy | To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9470"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/custom/\n```\n\nproxy | Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9471"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8011 --www=./local/www/\n```\n\nproxy | Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9472"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=0\n```\n\nproxy | Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9473"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/k8s-api\n```\n\nproxy | Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through on", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9474"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top node NODE_NAME\n```\n\ntop | Display resource (CPU/memory) usage of nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9475"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod --namespace=NAMESPACE\n```\n\ntop | Show metrics for a given pod and its containers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9476"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod POD_NAME --containers\n```\n\ntop | Show metrics for the pods defined by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9477"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -l name=myLabel\n```\n\ntop | Display resource (CPU/memory) usage of pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9478"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve csr-sqgzp\n```\n\ncertificate | Approve a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9479"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny csr-sqgzp\n```\n\ncertificate | Deny a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9480"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\ncluster-info | Dump current cluster state to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9481"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump all namespaces to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9482"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --all-namespaces\n```\n\ncluster-info | Dump a set of namespaces to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9483"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you sp", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9484"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --force\n```\n\ndrain | As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9485"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --grace-period=900\n```\n\ndrain | Drain node in preparation for maintenance.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9486"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\ntaint | Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9487"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated:NoSchedule-\n```\n\ntaint | Remove from node 'foo' all the taints with key 'dedicated'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9488"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated-\n```\n\ntaint | Add a taint with key 'dedicated' on nodes having label mylabel=X", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9489"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint node -l myLabel=X  dedicated=foo:PreferNoSchedule\n```\n\ntaint | Add to node 'foo' a taint with key 'bar' and no value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9490"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo bar:NoSchedule\n```\n\ntaint | Update the taints on one or more nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9491"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\napi-resources | Print the supported API resources with more information", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9492"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources -o wide\n```\n\napi-resources | Print the supported API resources sorted by a column", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9493"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --sort-by=name\n```\n\napi-resources | Print the supported namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9494"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true\n```\n\napi-resources | Print the supported non-namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9495"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=false\n```\n\napi-resources | Print the supported API resources with a specific APIGroup", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9496"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --api-group=extensions\n```\n\napi-resources | Print the supported API resources on the server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9497"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl\n```\n\ncompletion | Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion co", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9498"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > ~/.kube/completion.bash.inc\nprintf \"\n```\n\ncompletion | Kubectl shell completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9499"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh > \"${fpath[1]}/_kubectl\"\n```\n\ncompletion | Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .b", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9500"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nconfig | Display the current-context.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9501"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster minikube\n```\n\nconfig | Delete the specified cluster from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9502"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context minikube\n```\n\nconfig | Delete the specified context from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9503"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user minikube\n```\n\nconfig | Delete the specified user from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9504"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters\n```\n\nconfig | Display clusters defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9505"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nconfig | Describe one context in your kubeconfig file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9506"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts my-context\n```\n\nconfig | Display one or many contexts from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9507"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users\n```\n\nconfig | Display users defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9508"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context old-name new-name\n```\n\nconfig | Renames a context from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9509"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.server https://1.2.3.4\n```\n\nconfig | Set the certificate-authority-data field on the my-cluster cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9510"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.certificate-authority-data $(echo \"cert_data_here\" | base64 -i -)\n```\n\nconfig | Set the cluster field in the my-context context to my-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9511"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set contexts.my-context.cluster my-cluster\n```\n\nconfig | Set the client-key-data field in the cluster-admin user using --set-raw-bytes option", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9512"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true\n```\n\nconfig | Set an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9513"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --server=https://1.2.3.4\n```\n\nconfig | Embed certificate authority data for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9514"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt\n```\n\nconfig | Disable cert checking for the dev cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9515"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --insecure-skip-tls-verify=true\n```\n\nconfig | Set custom TLS server name to use for validation for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9516"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --tls-server-name=my-cluster-name\n```\n\nconfig | Set a cluster entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9517"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context gce --user=cluster-admin\n```\n\nconfig | Set a context entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9518"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key\n```\n\nconfig | Set basic auth for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9519"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif\n```\n\nconfig | Embed client certificate data in the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9520"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true\n```\n\nconfig | Enable the Google Compute Platform auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9521"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=gcp\n```\n\nconfig | Enable the OpenID Connect auth provider for the \"cluster-admin\" entry with additional args", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9522"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar\n```\n\nconfig | Remove the \"client-secret\" config value for the OpenID Connect auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9523"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-\n```\n\nconfig | Enable new exec auth plugin for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9524"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1\n```\n\nconfig | Define new exec auth plugin args for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9525"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2\n```\n\nconfig | Create or update exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9526"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2\n```\n\nconfig | Remove exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9527"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=var-to-remove-\n```\n\nconfig | Set a user entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9528"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset current-context\n```\n\nconfig | Unset namespace in foo context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9529"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset contexts.foo.namespace\n```\n\nconfig | Unset an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9530"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context minikube\n```\n\nconfig | Set the current-context in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9531"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view --raw\n```\n\nconfig | Get the password for the e2e user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9532"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n```\n\nconfig | Display merged kubeconfig settings or a specified kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9533"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl explain pods.spec.containers\n```\n\nexplain | List the fields for supported resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9534"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./pod.json\n```\n\ncreate | Create a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9535"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create -f docker-registry.yaml --edit -o json\n```\n\ncreate | Create a resource from a file or from stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9536"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\ncreate | Create a cluster role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9537"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a cluster role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9538"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a cluster role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9539"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a cluster role name \"foo\" with NonResourceURL specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9540"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\ncreate | Create a cluster role name \"monitoring\" with AggregationRule specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9541"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\ncreate | Create a cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9542"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a cluster role binding for a particular cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9543"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config with specified keys instead of file basenames on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9544"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt\n```\n\ncreate | Create a new config map named my-config with key1=config1 and key2=config2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9545"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2\n```\n\ncreate | Create a new config map named my-config from the key=value pairs in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9546"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-file=path/to/bar\n```\n\ncreate | Create a new config map named my-config from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9547"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap my-config --from-env-file=path/to/bar.env\n```\n\ncreate | Create a config map based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9548"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\"\n```\n\ncreate | Create a cron job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9549"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob my-job --image=busybox --schedule=\"*/1 * * * *\" -- date\n```\n\ncreate | Create a cron job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9550"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox\n```\n\ncreate | Create a deployment with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9551"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox -- date\n```\n\ncreate | Create a deployment named my-dep that runs the nginx image with 3 replicas", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9552"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=nginx --replicas=3\n```\n\ncreate | Create a deployment named my-dep that runs the busybox image and expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9553"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-dep --image=busybox --port=5701\n```\n\ncreate | Create a deployment with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9554"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress simple --rule=\"foo.com/bar=svc1:8080,tls=my-cert\"\n```\n\ncreate | Create a catch all ingress of \"/path\" pointing to service svc:port and Ingress Class as \"otheringress\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9555"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress catch-all --class=otheringress --rule=\"/path=svc:port\"\n```\n\ncreate | Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9556"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress annotated --class=default --rule=\"foo.com/bar=svc:port\" \\\n--annotation ingress.annotation1=foo \\\n--annotation ingress.annotation2=bla\n```\n\ncreate | Create an ingress with the same host and multiple paths", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9557"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress multipath --class=default \\\n--rule=\"foo.com/=svc:port\" \\\n--rule=\"foo.com/admin/=svcadmin:portadmin\"\n```\n\ncreate | Create an ingress with multiple hosts and the pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9558"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingress1 --class=default \\\n--rule=\"foo.com/path*=svc:8080\" \\\n--rule=\"bar.com/admin*=svc2:http\"\n```\n\ncreate | Create an ingress with TLS enabled using the default ingress certificate and different path types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9559"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingtls --class=default \\\n--rule=\"foo.com/=svc:https,tls\" \\\n--rule=\"foo.com/path/subpath*=othersvc:8080\"\n```\n\ncreate | Create an ingress with TLS enabled using a specific secret and pathType as Prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9560"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingsecret --class=default \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with a default backend", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9561"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress ingdefault --class=default \\\n--default-backend=defaultsvc:http \\\n--rule=\"foo.com/*=svc:8080,tls=secret1\"\n```\n\ncreate | Create an ingress with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9562"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox\n```\n\ncreate | Create a job with a command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9563"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job my-job --image=busybox -- date\n```\n\ncreate | Create a job from a cron job named \"a-cronjob\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9564"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create job test-job --from=cronjob/a-cronjob\n```\n\ncreate | Create a job with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9565"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace my-namespace\n```\n\ncreate | Create a namespace with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9566"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1\n```\n\ncreate | Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label # and require at least half of the pods selected to be available at any point in time", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9567"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create pdb my-pdb --selector=app=nginx --min-available=50%\n```\n\ncreate | Create a pod disruption budget with the specified name, selector, and desired minimum available pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9568"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\"\n```\n\ncreate | Create a priority class named default-priority that is considered as the global default priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9569"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass default-priority --value=1000 --global-default=true --description=\"default priority\"\n```\n\ncreate | Create a priority class named high-priority that cannot preempt pods with lower priority", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9570"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass high-priority --value=1000 --description=\"high priority\" --preemption-policy=\"Never\"\n```\n\ncreate | Create a priority class with the specified name, value, globalDefault and description.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9571"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10\n```\n\ncreate | Create a new resource quota named best-effort", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9572"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create quota best-effort --hard=pods=100 --scopes=BestEffort\n```\n\ncreate | Create a resource quota with the specified name, hard limits, and optional scopes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9573"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\ncreate | Create a role named \"pod-reader\" with ResourceName specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9574"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\ncreate | Create a role named \"foo\" with API Group specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9575"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=rs.extensions\n```\n\ncreate | Create a role named \"foo\" with SubResource specified", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9576"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\ncreate | Create a role with single rule.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9577"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1\n```\n\ncreate | Create a role binding for a particular role or cluster role.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9578"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL\n```\n\ncreate | Create a new secret named my-secret from ~/.docker/config.json", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9579"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json\n```\n\ncreate | Create a new secret for use with Docker registries.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9580"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=path/to/bar\n```\n\ncreate | Create a new secret named my-secret with specified keys instead of names on disk", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9581"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub\n```\n\ncreate | Create a new secret named my-secret with key1=supersecret and key2=topsecret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9582"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret\n```\n\ncreate | Create a new secret named my-secret using a combination of a file and a literal", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9583"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret\n```\n\ncreate | Create a new secret named my-secret from an env file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9584"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-env-file=path/to/bar.env\n```\n\ncreate | Create a secret based on a file, directory, or specified literal value.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9585"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key\n```\n\ncreate | Create a TLS secret from the given public/private key pair.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9586"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --tcp=5678:8080\n```\n\ncreate | Create a new ClusterIP service named my-cs (in headless mode)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9587"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-cs --clusterip=\"None\"\n```\n\ncreate | Create a ClusterIP service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9588"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname my-ns --external-name bar.com\n```\n\ncreate | Create an ExternalName service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9589"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer my-lbs --tcp=5678:8080\n```\n\ncreate | Create a LoadBalancer service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9590"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport my-ns --tcp=5678:8080\n```\n\ncreate | Create a NodePort service with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9591"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount my-service-account\n```\n\ncreate | Create a service account with the specified name.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9592"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\nget | List a single replication controller with specified NAME in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9593"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get replicationcontroller web\n```\n\nget | List deployments in JSON output format, in the \"v1\" version of the \"apps\" API group", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9594"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments.v1.apps -o json\n```\n\nget | List a single pod in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9595"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o json pod web-pod-13je7\n```\n\nget | List a pod identified by type and name specified in \"pod.yaml\" in JSON output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9596"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -f pod.yaml -o json\n```\n\nget | List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9597"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}\n```\n\nget | List resource information in custom columns", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9598"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image\n```\n\nget | List all replication controllers and services together in ps output format", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9599"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc,services\n```\n\nget | List one or more resources by their type and names", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9600"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get rc/web service/frontend pods/web-pod-13je7\n```\n\nget | Display one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9601"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx\n```\n\nrun | Start a hazelcast pod and let the container expose port 5701", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9602"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --port=5701\n```\n\nrun | Start a hazelcast pod and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9603"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --env=\"DNS_DOMAIN=cluster\" --env=\"POD_NAMESPACE=default\"\n```\n\nrun | Start a hazelcast pod and set labels \"app=hazelcast\" and \"env=prod\" in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9604"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run hazelcast --image=hazelcast/hazelcast --labels=\"app=hazelcast,env=prod\"\n```\n\nrun | Dry run; print the corresponding API objects without creating them", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9605"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --dry-run=client\n```\n\nrun | Start a nginx pod, but overload the spec with a partial set of values parsed from JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9606"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --overrides='{ \"apiVersion\": \"v1\", \"spec\": { ... } }'\n```\n\nrun | Start a busybox pod and keep it in the foreground, don't restart it if it exits", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9607"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run -i -t busybox --image=busybox --restart=Never\n```\n\nrun | Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9608"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>\n```\n\nrun | Start the nginx pod using a different command and custom arguments", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9609"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>\n```\n\nrun | Create and run a particular image in a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9610"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for a replication controller identified by type and name specified in \"nginx-controller.yaml\", which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9611"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose -f nginx-controller.yaml --port=80 --target-port=8000\n```\n\nexpose | Create a service for a pod valid-pod, which serves on port 444 with the name \"frontend\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9612"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod valid-pod --port=444 --name=frontend\n```\n\nexpose | Create a second service based on the above service, exposing the container port 8443 as port 443 with the name \"nginx-https\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9613"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https\n```\n\nexpose | Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9614"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream\n```\n\nexpose | Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9615"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose rs nginx --port=80 --target-port=8000\n```\n\nexpose | Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9616"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80 --target-port=8000\n```\n\nexpose | Expose a resource as a new Kubernetes service.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9617"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json\n```\n\ndelete | Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9618"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete -k dir\n```\n\ndelete | Delete a pod based on the type and name in the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9619"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod,service baz foo\n```\n\ndelete | Delete pods and services with label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9620"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods,services -l name=myLabel\n```\n\ndelete | Delete a pod with minimal delay", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9621"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --now\n```\n\ndelete | Force delete a pod on a dead node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9622"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod foo --force\n```\n\ndelete | Delete all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9623"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods --all\n```\n\ndelete | Delete resources by file names, stdin, resources and names, or by resources and label selector.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9624"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./pod.json\n```\n\napply | Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9625"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k dir/\n```\n\napply | Apply the JSON passed into stdin to a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9626"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml -l app=nginx\n```\n\napply | Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9627"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap\n```\n\napply | Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initia", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9628"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/nginx\n```\n\napply | Edit the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9629"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied -f deploy.yaml -o json\n```\n\napply | Edit the latest last-applied-configuration annotations of resources from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9630"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml\n```\n\napply | Execute set-last-applied against each configuration file in a directory", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9631"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f path/\n```\n\napply | Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9632"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f deploy.yaml --create-annotation=true\n```\n\napply | Set the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f ' was run,", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9633"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied deployment/nginx\n```\n\napply | View the last-applied-configuration annotations by file in JSON", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9634"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied -f deploy.yaml -o json\n```\n\napply | View the latest last-applied-configuration annotations by type/name or file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9635"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend'\n```\n\nannotate | Update a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9636"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate -f pod.json description='my frontend'\n```\n\nannotate | Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9637"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate --overwrite pods foo description='my frontend running nginx'\n```\n\nannotate | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9638"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods --all description='my frontend running nginx'\n```\n\nannotate | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9639"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description='my frontend running nginx' --resource-version=1\n```\n\nannotate | Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9640"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods foo description-\n```\n\nannotate | Update the annotations on one or more resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9641"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment foo --min=2 --max=10\n```\n\nautoscale | Auto scale a replication controller \"foo\", with the number of pods between 1 and 5, target CPU utilization at 80%", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9642"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rc foo --max=5 --cpu-percent=80\n```\n\nautoscale | Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9643"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox\n```\n\ndebug | Create a debug container named debugger using a custom automated debugging image. # (requires the EphemeralContainers feature to be enabled in the cluster)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9644"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug --image=myproj/debug-tools -c debugger mypod\n```\n\ndebug | Create a copy of mypod adding a debug container and attach to it", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9645"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --image=busybox --copy-to=my-debugger\n```\n\ndebug | Create a copy of mypod changing the command of mycontainer", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9646"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh\n```\n\ndebug | Create a copy of mypod changing all container images to busybox", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9647"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod --copy-to=my-debugger --set-image=*=busybox\n```\n\ndebug | Create a copy of mypod adding a debug container and changing container images", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9648"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug\n```\n\ndebug | Create an interactive debugging session on a node and immediately attach to it. # The container will run in the host namespaces and the host's filesystem will be mounted at /host", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9649"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=busybox\n```\n\ndebug | Debug cluster resources using interactive debugging containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9650"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f pod.json\n```\n\ndiff | Diff file read from stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9651"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry\n```\n\nedit | Use an alternative editor", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9652"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit job.v1.batch/myjob -o json\n```\n\nedit | Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9653"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/mydeployment -o yaml --save-config\n```\n\nedit | Edit a resource from the default editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9654"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize /home/config/production\n```\n\nkustomize | Build from github", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9655"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6\n```\n\nkustomize | Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying sa", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9656"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo unhealthy=true\n```\n\nlabel | Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9657"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite pods foo status=unhealthy\n```\n\nlabel | Update all pods in the namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9658"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods --all status=unhealthy\n```\n\nlabel | Update a pod identified by the type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9659"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label -f pod.json status=unhealthy\n```\n\nlabel | Update pod 'foo' only if the resource is unchanged from version 1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9660"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo status=unhealthy --resource-version=1\n```\n\nlabel | Update pod 'foo' by removing a label named 'bar' if it exists # Does not require the --overwrite flag", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9661"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl label pods foo bar-\n```\n\nlabel | Update the labels on a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9662"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Partially update a node using a strategic merge patch, specifying the patch as YAML", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9663"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch node k8s-node-1 -p $'spec:\\n unschedulable: true'\n```\n\npatch | Partially update a node identified by the type and name specified in \"node.json\" using strategic merge patch", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9664"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch -f node.json -p '{\"spec\":{\"unschedulable\":true}}'\n```\n\npatch | Update a container's image; spec.containers[*].name is required because it's a merge key", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9665"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n```\n\npatch | Update a container's image using a JSON patch with positional arrays", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9666"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n```\n\npatch | Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9667"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f ./pod.json\n```\n\nreplace | Replace a pod based on the JSON passed into stdin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9668"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n```\n\nreplace | Force replace, delete and then re-create the resource", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9669"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl replace --force -f ./pod.json\n```\n\nreplace | Replace a resource by file name or stdin.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9670"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Check the rollout status of a daemonset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9671"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status daemonset/foo\n```\n\nrollout | Manage the rollout of a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9672"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/abc\n```\n\nrollout | View the details of daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9673"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset/abc --revision=3\n```\n\nrollout | View previous rollout revisions and configurations.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9674"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx\n```\n\nrollout | Mark the provided resource as paused.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9675"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment/nginx\n```\n\nrollout | Restart a daemon set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9676"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart daemonset/abc\n```\n\nrollout | Restart a resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9677"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx\n```\n\nrollout | Resume a paused resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9678"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx\n```\n\nrollout | Show the status of the rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9679"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/abc\n```\n\nrollout | Roll back to daemonset revision 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9680"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset/abc --to-revision=3\n```\n\nrollout | Roll back to the previous deployment with dry-run", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9681"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo --dry-run=server deployment/abc\n```\n\nrollout | Roll back to a previous rollout.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9682"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo\n```\n\nscale | Scale a resource identified by type and name specified in \"foo.yaml\" to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9683"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 -f foo.yaml\n```\n\nscale | If the deployment named mysql's current size is 2, scale mysql to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9684"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql\n```\n\nscale | Scale multiple replication controllers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9685"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz\n```\n\nscale | Scale stateful set named 'web' to 3", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9686"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 statefulset/web\n```\n\nscale | Set a new size for a deployment, replica set, replication controller, or stateful set.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9687"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/registry STORAGE_DIR=/local\n```\n\nset | List the environment variables defined on a deployments 'sample-build'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9688"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build --list\n```\n\nset | List the environment variables defined on all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9689"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env pods --all --list\n```\n\nset | Output modified deployment in YAML, and does not alter the object on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9690"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml\n```\n\nset | Update all containers in all replication controllers in the project to have ENV=prod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9691"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env rc --all ENV=prod\n```\n\nset | Import environment from a secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9692"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=secret/mysecret deployment/myapp\n```\n\nset | Import environment from a config map with a prefix", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9693"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp\n```\n\nset | Import specific keys from a config map", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9694"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp\n```\n\nset | Remove the environment variable ENV from container 'c1' in all deployment configs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9695"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env deployments --all --containers=\"c1\" ENV-\n```\n\nset | Remove the environment variable ENV from a deployment definition on disk and # update the deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9696"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set env -f deploy.json ENV-\n```\n\nset | Set some of the local shell environment into a deployment config on the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9697"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1\n```\n\nset | Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9698"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments,rc nginx=nginx:1.9.1 --all\n```\n\nset | Update image of all containers of daemonset abc to 'nginx:1.9.1'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9699"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image daemonset abc *=nginx:1.9.1\n```\n\nset | Print result (in yaml format) of updating nginx container image from local file, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9700"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml\n```\n\nset | Update existing container image(s) of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9701"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\nset | Set the resource request and limits for all containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9702"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi\n```\n\nset | Remove the resource requests for resources on containers in nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9703"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0\n```\n\nset | Print the result (in yaml format) of updating nginx container limits from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9704"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml\n```\n\nset | Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9705"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\nkubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -\n```\n\nset | Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation of 'set selector'.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9706"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount deployment nginx-deployment serviceaccount1\n```\n\nset | Print the result (in YAML format) of updated nginx deployment with the service account from local file, without hitting the API server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9707"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml\n```\n\nset | Update the service account of pod template resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9708"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1\n```\n\nset | Update a role binding for user1, user2, and group1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9709"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1\n```\n\nset | Print the result (in YAML format) of updating rolebinding subjects from a local, without hitting the server", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9710"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml\n```\n\nset | Update the user, group, or service account in a role binding or cluster role binding.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9711"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready pod/busybox1\n```\n\nwait | The default value of status condition is true; you can set it to false", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9712"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl wait --for=condition=Ready=false pod/busybox1\n```\n\nwait | Wait for the pod \"busybox1\" to be deleted, with a timeout of 60s, after having issued the \"delete\" command", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9713"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/busybox1\nkubectl wait --for=delete pod/busybox1 --timeout=60s\n```\n\nwait | Experimental: Wait for a specific condition on one or many resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9714"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container\n```\n\nattach | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9715"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach mypod -c ruby-container -i -t\n```\n\nattach | Get output from the first pod of a replica set named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9716"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl attach rs/nginx\n```\n\nattach | Attach to a process that is already running inside an existing container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9717"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create pods --all-namespaces\n```\n\nauth | Check to see if I can list deployments in my current namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9718"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list deployments.apps\n```\n\nauth | Check to see if I can do everything in my current namespace (\"*\" means all)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9719"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i '*' '*'\n```\n\nauth | Check to see if I can get the job named \"bar\" in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9720"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list jobs.batch/bar -n foo\n```\n\nauth | Check to see if I can read pod logs", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9721"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get pods --subresource=log\n```\n\nauth | Check to see if I can access the URL /logs/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9722"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i get /logs/\n```\n\nauth | List all allowed actions in namespace \"foo\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9723"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i --list --namespace=foo\n```\n\nauth | Check whether an action is allowed.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9724"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nauth | Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9725"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar\n```\n\ncp | Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9726"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9727"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>\n```\n\ncp | Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9728"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar\n```\n\ncp | Copy /tmp/foo from a remote pod to /tmp/bar locally", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9729"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar\n```\n\ncp | Copy files and directories to and from containers.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9730"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes kubernetes-node-emt8.c.myproject.internal\n```\n\ndescribe | Describe a pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9731"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods/nginx\n```\n\ndescribe | Describe a pod identified by type and name in \"pod.json\"", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9732"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f pod.json\n```\n\ndescribe | Describe all pods", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9733"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\ndescribe | Describe pods by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9734"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe po -l name=myLabel\n```\n\ndescribe | Describe all pods managed by the 'frontend' replication controller (rc-created pods # get the name of the rc as a prefix in the pod the name)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9735"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods frontend\n```\n\ndescribe | Show details of a specific resource or group of resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9736"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -- date\n```\n\nexec | Get output from running the 'date' command in ruby-container from pod mypod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9737"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -- date\n```\n\nexec | Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod # and sends stdout/stderr from 'bash' back to the client", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9738"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -c ruby-container -i -t -- bash -il\n```\n\nexec | List contents of /usr from the first container of pod mypod and sort by modification time # If the command you want to execute in the pod has any flags in common (e.g. -i), # you must use two dashes (", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9739"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec mypod -i -t -- ls -t /usr\n```\n\nexec | Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9740"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec deploy/mydeployment -- date\n```\n\nexec | Get output from running 'date' command from the first pod of the service myservice, using the first container by default", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9741"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl exec svc/myservice -- date\n```\n\nexec | Execute a command in a container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9742"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs nginx --all-containers=true\n```\n\nlogs | Return snapshot logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9743"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app=nginx --all-containers=true\n```\n\nlogs | Return snapshot of previous terminated ruby container logs from pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9744"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -p -c ruby web-1\n```\n\nlogs | Begin streaming the logs of the ruby container in pod web-1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9745"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -c ruby web-1\n```\n\nlogs | Begin streaming the logs from all containers in pods defined by label app=nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9746"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l app=nginx --all-containers=true\n```\n\nlogs | Display only the most recent 20 lines of output in pod nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9747"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --tail=20 nginx\n```\n\nlogs | Show all logs from pod nginx written in the last hour", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9748"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --since=1h nginx\n```\n\nlogs | Show logs from a kubelet with an expired serving certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9749"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs --insecure-skip-tls-verify-backend nginx\n```\n\nlogs | Return snapshot logs from first container of a job named hello", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9750"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs job/hello\n```\n\nlogs | Return snapshot logs from container nginx-1 of a deployment named nginx", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9751"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/nginx -c nginx-1\n```\n\nlogs | Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9752"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 5000 6000\n```\n\nport-forward | Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9753"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mydeployment 5000 6000\n```\n\nport-forward | Listen on port 8443 locally, forwarding to the targetPort of the service's port named \"https\" in a pod selected by the service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9754"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/myservice 8443:https\n```\n\nport-forward | Listen on port 8888 locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9755"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on all addresses, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9756"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000\n```\n\nport-forward | Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9757"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000\n```\n\nport-forward | Listen on a random port locally, forwarding to 5000 in the pod", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9758"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pod/mypod :5000\n```\n\nport-forward | Forward one or more local ports to a pod.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9759"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/\n```\n\nproxy | To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9760"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/\n```\n\nproxy | To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9761"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/custom/\n```\n\nproxy | Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9762"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8011 --www=./local/www/\n```\n\nproxy | Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9763"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=0\n```\n\nproxy | Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9764"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --api-prefix=/k8s-api\n```\n\nproxy | Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through on", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9765"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top node NODE_NAME\n```\n\ntop | Display resource (CPU/memory) usage of nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9766"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod --namespace=NAMESPACE\n```\n\ntop | Show metrics for a given pod and its containers", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9767"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod POD_NAME --containers\n```\n\ntop | Show metrics for the pods defined by label name=myLabel", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9768"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl top pod -l name=myLabel\n```\n\ntop | Display resource (CPU/memory) usage of pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9769"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve csr-sqgzp\n```\n\ncertificate | Approve a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9770"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny csr-sqgzp\n```\n\ncertificate | Deny a certificate signing request.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9771"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\ncluster-info | Dump current cluster state to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9772"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump all namespaces to stdout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9773"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --all-namespaces\n```\n\ncluster-info | Dump a set of namespaces to /path/to/cluster-state", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9774"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state\n```\n\ncluster-info | Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you sp", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9775"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --force\n```\n\ndrain | As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9776"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl drain foo --grace-period=900\n```\n\ndrain | Drain node in preparation for maintenance.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9777"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\ntaint | Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9778"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated:NoSchedule-\n```\n\ntaint | Remove from node 'foo' all the taints with key 'dedicated'", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9779"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo dedicated-\n```\n\ntaint | Add a taint with key 'dedicated' on nodes having label mylabel=X", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9780"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint node -l myLabel=X  dedicated=foo:PreferNoSchedule\n```\n\ntaint | Add to node 'foo' a taint with key 'bar' and no value", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9781"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes foo bar:NoSchedule\n```\n\ntaint | Update the taints on one or more nodes.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9782"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\napi-resources | Print the supported API resources with more information", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9783"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources -o wide\n```\n\napi-resources | Print the supported API resources sorted by a column", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9784"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --sort-by=name\n```\n\napi-resources | Print the supported namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9785"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true\n```\n\napi-resources | Print the supported non-namespaced resources", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9786"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=false\n```\n\napi-resources | Print the supported API resources with a specific APIGroup", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9787"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --api-group=extensions\n```\n\napi-resources | Print the supported API resources on the server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9788"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl\n```\n\ncompletion | Installing bash completion on Linux ## If bash-completion is not installed on Linux, install the 'bash-completion' package ## via your distribution's package manager. ## Load the kubectl completion co", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9789"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash > ~/.kube/completion.bash.inc\nprintf \"\n```\n\ncompletion | Kubectl shell completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9790"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh > \"${fpath[1]}/_kubectl\"\n```\n\ncompletion | Output shell completion code for the specified shell (bash or zsh). The shell code must be evaluated to provide interactive completion of kubectl commands. This can be done by sourcing it from the .b", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9791"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\nconfig | Display the current-context.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9792"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster minikube\n```\n\nconfig | Delete the specified cluster from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9793"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context minikube\n```\n\nconfig | Delete the specified context from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9794"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user minikube\n```\n\nconfig | Delete the specified user from the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9795"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters\n```\n\nconfig | Display clusters defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9796"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\nconfig | Describe one context in your kubeconfig file", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9797"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts my-context\n```\n\nconfig | Display one or many contexts from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9798"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users\n```\n\nconfig | Display users defined in the kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9799"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context old-name new-name\n```\n\nconfig | Renames a context from the kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9800"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.server https://1.2.3.4\n```\n\nconfig | Set the certificate-authority-data field on the my-cluster cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9801"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set clusters.my-cluster.certificate-authority-data $(echo \"cert_data_here\" | base64 -i -)\n```\n\nconfig | Set the cluster field in the my-context context to my-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9802"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set contexts.my-context.cluster my-cluster\n```\n\nconfig | Set the client-key-data field in the cluster-admin user using --set-raw-bytes option", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9803"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true\n```\n\nconfig | Set an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9804"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --server=https://1.2.3.4\n```\n\nconfig | Embed certificate authority data for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9805"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt\n```\n\nconfig | Disable cert checking for the dev cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9806"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --insecure-skip-tls-verify=true\n```\n\nconfig | Set custom TLS server name to use for validation for the e2e cluster entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9807"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster e2e --tls-server-name=my-cluster-name\n```\n\nconfig | Set a cluster entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9808"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context gce --user=cluster-admin\n```\n\nconfig | Set a context entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9809"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key\n```\n\nconfig | Set basic auth for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9810"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif\n```\n\nconfig | Embed client certificate data in the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9811"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true\n```\n\nconfig | Enable the Google Compute Platform auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9812"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=gcp\n```\n\nconfig | Enable the OpenID Connect auth provider for the \"cluster-admin\" entry with additional args", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9813"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar\n```\n\nconfig | Remove the \"client-secret\" config value for the OpenID Connect auth provider for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9814"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-\n```\n\nconfig | Enable new exec auth plugin for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9815"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1\n```\n\nconfig | Define new exec auth plugin args for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9816"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2\n```\n\nconfig | Create or update exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9817"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2\n```\n\nconfig | Remove exec auth plugin environment variables for the \"cluster-admin\" entry", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9818"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials cluster-admin --exec-env=var-to-remove-\n```\n\nconfig | Set a user entry in kubeconfig.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9819"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset current-context\n```\n\nconfig | Unset namespace in foo context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9820"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config unset contexts.foo.namespace\n```\n\nconfig | Unset an individual value in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9821"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context minikube\n```\n\nconfig | Set the current-context in a kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9822"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view --raw\n```\n\nconfig | Get the password for the e2e user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9823"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n```\n\nconfig | Display merged kubeconfig settings or a specified kubeconfig file.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9824"}
{"instruction": "Write a bash example for getting started", "response": "Here's a bash example:\n\n```bash\nkubectl explain pods.spec.containers\n```\n\nexplain | List the fields for supported resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kubectl-cmds/", "id": "k8s_00618_code_9825"}
{"instruction": "Explain  in Kubernetes", "response": "Requirements:You need a machine that is running Linux or macOS.You need to have these tools installed:Python v3.7.x+GitGolang version 1.13+Pip used to install PyYAMLPyYAML v5.1.2makegcc compiler/linkerDocker (Required only for kubectl command reference)Your PATH environment variable must include the required build tools, such as the Go binary and python.You need to know how to create a pull request to a GitHub repository. This involves creating your own fork of the repository. For more information, see Work from a local clone.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/prerequisites-ref-docs/", "id": "k8s_00619"}
{"instruction": "How do you auditing in Kubernetes?", "response": "AuditingKubernetes auditing provides a security-relevant, chronological set of records documenting the sequence of actions in a cluster. The cluster audits the activities generated by users, by applications that use the Kubernetes API, and by the control plane itself.Auditing allows cluster administrators to answer the following questions:what happened?when did it happen?who initiated it?on what did it happen?where was it observed?from where was it initiated?to where was it going?Audit records begin their lifecycle inside the kube-apiserver component. Each request on each stage of its execution generates an audit event, which is then pre-processed according to a certain policy and written to a backend. The policy determines what's recorded and the backends persist the records. The current backend implementations include logs files and webhooks.Each request can be recorded with an associated stage. The defined stages are:RequestReceived - The stage for events generated as soon as the audit handler receives the request, and before it is delegated down the handler chain.ResponseStarted - Once the response headers are sent, but before the response body is sent. This stage is only generated for long-running requests (e.g. watch).ResponseComplete - The response body has been completed and no more bytes will be sent.Panic - Events generated when a panic occurred.Note:The configuration of an Audit Event configuration is different from the Event API object.The audit logging feature increases the memory consumption of the API server because some context required for auditing is stored for each request. Memory consumption depends on the audit logging configuration.Audit policyAudit policy defines rules about what events should be recorded and what data they should include. The audit policy object structure is defined in the audit.k8s.io API group. When an event is processed, it's compared against the list of rules in order. The first matching rule sets the audit level of the event. The defined audit levels are:None - don't log events that match this rule.Metadata - log events with metadata (requesting user, timestamp, resource, verb, etc.) but not request or response body.Request - log events with request metadata and body but not response body. This does not apply for non-resource requests.RequestResponse - log events with request metadata, request body and response body. This does not apply for non-resource requests.You can pass a file with the policy to kube-apiserver using the --audit-policy-file flag. If the flag is omitted, no events are logged. Note that the rules field must be provided in the audit policy file. A policy with no (0) rules is treated as illegal.Below is an example audit policy file:audit/audit-policy.yaml apiVersion: audit.k8s.io/v1 # This is required. kind: Policy # Don't generate audit events for all requests in RequestReceived stage. omitStages: - \"RequestReceived\" rules: # Log pod changes at RequestResponse level - level: RequestResponse resources: - group: \"\" # Resource \"pods\" doesn't match requests to any subresource of pods, # which is consistent with the RBAC policy. resources: [\"pods\"] # Log \"pods/log\", \"pods/status\" at Metadata level - level: Metadata resources: - group: \"\" resources: [\"pods/log\", \"pods/status\"] # Don't log requests to a configmap called \"controller-leader\" - level: None resources: - group: \"\" resources: [\"configmaps\"] resourceNames: [\"controller-leader\"] # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services - level: None users: [\"system:kube-proxy\"] verbs: [\"watch\"] resources: - group: \"\" # core API group resources: [\"endpoints\", \"services\"] # Don't log authenticated requests to certain non-resource URL paths. - level: None userGroups: [\"system:authenticated\"] nonResourceURLs: - \"/api*\" # Wildcard matching. - \"/version\" # Log the request body of configmap changes in kube-system. - level: Request resources: - group: \"\" # core API group resources: [\"configmaps\"] # ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\nAuditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9828"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\n# Log all requests at the Metadata level.\napiVersion: audit.k8s.io/v1\nkind: Policy\nrules:\n- level: Metadata\n```\n\nAuditing | If you're crafting your own audit profile, you can use the audit profile for Google Container-Optimized OS as a starting point. You can check the configure-helper.sh script, which generates an audit p", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9829"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\nAuditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9830"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\n# Log all requests at the Metadata level.\napiVersion: audit.k8s.io/v1\nkind: Policy\nrules:\n- level: Metadata\n```\n\nAuditing | If you're crafting your own audit profile, you can use the audit profile for Google Container-Optimized OS as a starting point. You can check the configure-helper.sh script, which generates an audit p", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9831"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\n- --audit-policy-file=/etc/kubernetes/audit-policy.yaml\n  - --audit-log-path=/var/log/kubernetes/audit/audit.log\n```\n\nAuditing | then mount the volumes:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9832"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\n...\nvolumeMounts:\n  - mountPath: /etc/kubernetes/audit-policy.yaml\n    name: audit\n    readOnly: true\n  - mountPath: /var/log/kubernetes/audit/\n    name: audit-log\n    readOnly: false\n```\n\nAuditing | and finally configure the hostPath:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9833"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\n...\nvolumes:\n- name: audit\n  hostPath:\n    path: /etc/kubernetes/audit-policy.yaml\n    type: File\n\n- name: audit-log\n  hostPath:\n    path: /var/log/kubernetes/audit/\n    type: DirectoryOrCreate\n```\n\nAuditing | The webhook audit backend sends audit events to a remote web API, which is assumed to be a form of the Kubernetes API, including means of authentication. You can configure a webhook audit backend usin", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9834"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\naudit/audit-policy.yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\nAuditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9835"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\nAuditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9836"}
{"instruction": "Write a yaml example for auditing", "response": "Here's a yaml example:\n\n```yaml\n# Log all requests at the Metadata level.\napiVersion: audit.k8s.io/v1\nkind: Policy\nrules:\n- level: Metadata\n```\n\nAuditing | If you're crafting your own audit profile, you can use the audit profile for Google Container-Optimized OS as a starting point. You can check the configure-helper.sh script, which generates an audit p", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/", "id": "k8s_00620_code_9837"}
{"instruction": "What is the reference documentation for horizontalpodautoscaler?", "response": "HorizontalPodAutoscalerHorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified.apiVersion: autoscaling/v2import \"k8s.io/api/autoscaling/v2\"HorizontalPodAutoscalerHorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified.apiVersion: autoscaling/v2kind: HorizontalPodAutoscalermetadata (ObjectMeta)metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (HorizontalPodAutoscalerSpec)spec is the specification for the behaviour of the autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.status (HorizontalPodAutoscalerStatus)status is the current information about the autoscaler.HorizontalPodAutoscalerSpecHorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.maxReplicas (int32), requiredmaxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that minReplicas.scaleTargetRef (CrossVersionObjectReference), requiredscaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count.CrossVersionObjectReference contains enough information to let you identify the referred resource.scaleTargetRef.kind (string), requiredkind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsscaleTargetRef.name (string), requiredname is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#namesscaleTargetRef.apiVersion (string)apiVersion is the API version of the referentminReplicas (int32)minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.behavior (HorizontalPodAutoscalerBehavior)behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). If not set, the default HPAScalingRules for scale up and scale down are used.HorizontalPodAutoscalerBehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively).behavior.scaleDown (HPAScalingRules)scaleDown is scaling policy for scaling Down. If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used).*HPAScalingRules configures the scaling behavior for one direction via scaling Policy Rules and a configurable metric tolerance.Scaling Policy Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen.The tolerance is applied to the metric values and prevents scaling too eagerly for small metric variations. (Note that setting a tolerance requires enabling the alpha HPAConfigurableTolerance feature gate.)*behavior.scaleDown.policies ([]HPAScalingPolicy)Atomic: will be replaced during a mergepolicies is a list of potential scaling polices which can be used during scaling. If not set, use the default values: - For scale up: allow doubling the number of", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v2/", "id": "k8s_00621"}
{"instruction": "Write a yaml example for horizontalpodautoscaler", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\n```\n\nHorizontalPodAutoscaler | import \"k8s.io/api/autoscaling/v2\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v2/", "id": "k8s_00621_code_9839"}
{"instruction": "What is the reference documentation for kubectl apply?", "response": "kubectl applySynopsisApply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.JSON and YAML formats are accepted.Alpha Disclaimer: the --prune functionality is not yet complete. Do not use unless you are aware of what the current state is. See https://issues.k8s.io/34274.kubectl apply (-f FILENAME | -k DIRECTORY) Examples # Apply the configuration in pod.json to a pod kubectl apply -f ./pod.json # Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml kubectl apply -k dir/ # Apply the JSON passed into stdin to a pod cat pod.json | kubectl apply -f - # Apply the configuration from all files that end with '.json' kubectl apply -f '*.json' # Note: --prune is still in Alpha # Apply the configuration in manifest.yaml that matches label app=nginx and delete all other resources that are not in the file and match label app=nginx kubectl apply --prune -f manifest.yaml -l app=nginx # Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file kubectl apply --prune -f manifest.yaml --all --prune-allowlist=core/v1/ConfigMap Options--allSelect all resources in the namespace of the specified resource types.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--cascade string[=\"background\"] Default: \"background\"Must be \"background\", \"orphan\", or \"foreground\". Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-client-side-apply\"Name of the manager used to track field ownership.-f, --filename stringsThe files that contain the configurations to apply.--forceIf true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation.--force-conflictsIf true, server-side apply will force the changes against conflicts.--grace-period int Default: -1Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion).-h, --helphelp for apply-k, --kustomize stringProcess a kustomization directory. This flag can't be used together with -f or -R.--openapi-patch Default: trueIf true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--overwrite Default: trueAutomatically resolve conflicts between the modified and live configuration by using values from the modified configuration--pruneAutomatically delete resource objects, that do not appear in the configs and are created by either apply or create --save-config. Should be used with either -l or --all.--prune-allowlist stringsOverwrite the default allowlist with <group/version/kind> for --prune-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.-", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/", "id": "k8s_00622"}
{"instruction": "Write a bash example for kubectl apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply (-f FILENAME | -k DIRECTORY)\n```\n\nkubectl apply | Select all resources in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/", "id": "k8s_00622_code_9841"}
{"instruction": "Write a bash example for kubectl apply", "response": "Here's a bash example:\n\n```bash\nkubectl apply (-f FILENAME | -k DIRECTORY)\n```\n\nkubectl apply | Select all resources in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/", "id": "k8s_00622_code_9842"}
{"instruction": "Explain the Kubernetes concept: Resource Bin Packing", "response": "Resource Bin PackingIn the scheduling-plugin NodeResourcesFit of kube-scheduler, there are two scoring strategies that support the bin packing of resources: MostAllocated and RequestedToCapacityRatio.Enabling bin packing using MostAllocated strategyThe MostAllocated strategy scores the nodes based on the utilization of resources, favoring the ones with higher allocation. For each resource type, you can set a weight to modify its influence in the node score.To set the MostAllocated strategy for the NodeResourcesFit plugin, use a scheduler configuration similar to the following:apiVersion: kubescheduler.config.k8s.io/v1 kind: KubeSchedulerConfiguration profiles: - pluginConfig: - args: scoringStrategy: resources: - name: cpu weight: 1 - name: memory weight: 1 - name: intel.com/foo weight: 3 - name: intel.com/bar weight: 3 type: MostAllocated name: NodeResourcesFit To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.Enabling bin packing using RequestedToCapacityRatioThe RequestedToCapacityRatio strategy allows the users to specify the resources along with weights for each resource to score nodes based on the request to capacity ratio. This allows users to bin pack extended resources by using appropriate parameters to improve the utilization of scarce resources in large clusters. It favors nodes according to a configured function of the allocated resources. The behavior of the RequestedToCapacityRatio in the NodeResourcesFit score function can be controlled by the scoringStrategy field. Within the scoringStrategy field, you can configure two parameters: requestedToCapacityRatio and resources. The shape in the requestedToCapacityRatio parameter allows the user to tune the function as least requested or most requested based on utilization and score values. The resources parameter comprises both the name of the resource to be considered during scoring and its corresponding weight, which specifies the weight of each resource.Below is an example configuration that sets the bin packing behavior for extended resources intel.com/foo and intel.com/bar using the requestedToCapacityRatio field.apiVersion: kubescheduler.config.k8s.io/v1 kind: KubeSchedulerConfiguration profiles: - pluginConfig: - args: scoringStrategy: resources: - name: intel.com/foo weight: 3 - name: intel.com/bar weight: 3 requestedToCapacityRatio: shape: - utilization: 0 score: 0 - utilization: 100 score: 10 type: RequestedToCapacityRatio name: NodeResourcesFit Referencing the KubeSchedulerConfiguration file with the kube-scheduler flag --config=/path/to/config/file will pass the configuration to the scheduler.To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.Tuning the score functionshape is used to specify the behavior of the RequestedToCapacityRatio function.shape: - utilization: 0 score: 0 - utilization: 100 score: 10 The above arguments give the node a score of 0 if utilization is 0% and 10 for utilization 100%, thus enabling bin packing behavior. To enable least requested the score value must be reversed as follows.shape: - utilization: 0 score: 10 - utilization: 100 score: 0 resources is an optional parameter which defaults to:resources: - name: cpu weight: 1 - name: memory weight: 1 It can be used to add extended resources as follows:resources: - name: intel.com/foo weight: 5 - name: cpu weight: 3 - name: memory weight: 1 The weight parameter is optional and is set to 1 if not specified. Also, the weight cannot be set to a negative value.Node scoring for capacity allocationThis section is intended for those who want to understand the internal details of this feature. Below is an example of how the node score is calculated for a given set of values.Requested resources:intel.com/foo : 2 memory: 256MB cpu: 2 Resource weights:intel.com/foo : 5 memory: 1 cpu: 3 FunctionShapePoint {{0, 0}, {100, 10}}Node 1 spec:Available: intel.com/", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        - name: memory\n          weight: 1\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\nResource Bin Packing | To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9844"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        requestedToCapacityRatio:\n          shape:\n          - utilization: 0\n            score: 0\n          - utilization: 100\n            score: 10\n        type: RequestedToCapacityRatio\n    name: NodeResourcesFit\n```\n\nResource Bin Packing | Referencing the KubeSchedulerConfiguration file with the kube-scheduler flag --config=/path/to/config/file will pass the configuration to the scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9845"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        - name: memory\n          weight: 1\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\nResource Bin Packing | To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9846"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        requestedToCapacityRatio:\n          shape:\n          - utilization: 0\n            score: 0\n          - utilization: 100\n            score: 10\n        type: RequestedToCapacityRatio\n    name: NodeResourcesFit\n```\n\nResource Bin Packing | Referencing the KubeSchedulerConfiguration file with the kube-scheduler flag --config=/path/to/config/file will pass the configuration to the scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9847"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\nshape:\n  - utilization: 0\n    score: 0\n  - utilization: 100\n    score: 10\n```\n\nResource Bin Packing | The above arguments give the node a score of 0 if utilization is 0% and 10 for utilization 100%, thus enabling bin packing behavior. To enable least requested the score value must be reversed as follo", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9848"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\nshape:\n  - utilization: 0\n    score: 10\n  - utilization: 100\n    score: 0\n```\n\nResource Bin Packing | resources is an optional parameter which defaults to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9849"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  - name: cpu\n    weight: 1\n  - name: memory\n    weight: 1\n```\n\nResource Bin Packing | It can be used to add extended resources as follows:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9850"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  - name: intel.com/foo\n    weight: 5\n  - name: cpu\n    weight: 3\n  - name: memory\n    weight: 1\n```\n\nResource Bin Packing | The weight parameter is optional and is set to 1 if not specified. Also, the weight cannot be set to a negative value.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9851"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        - name: memory\n          weight: 1\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\nResource Bin Packing | To learn more about other parameters and their default configuration, see the API documentation for NodeResourcesFitArgs.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9852"}
{"instruction": "Write a yaml example for resource bin packing", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: intel.com/foo\n          weight: 3\n        - name: intel.com/bar\n          weight: 3\n        requestedToCapacityRatio:\n          shape:\n          - utilization: 0\n            score: 0\n          - utilization: 100\n            score: 10\n        type: RequestedToCapacityRatio\n    name: NodeResourcesFit\n```\n\nResource Bin Packing | Referencing the KubeSchedulerConfiguration file with the kube-scheduler flag --config=/path/to/config/file will pass the configuration to the scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/resource-bin-packing/", "id": "k8s_00623_code_9853"}
{"instruction": "How do you debug a statefulset in Kubernetes?", "response": "Debug a StatefulSetThis task shows you how to debug a StatefulSet.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster.You should have a StatefulSet running that you want to investigate.Debugging a StatefulSetIn order to list all the pods which belong to a StatefulSet, which have a label app.kubernetes.io/name=MyApp set on them, you can use the following:kubectl get pods -l app.kubernetes.io/name=MyApp If you find that any Pods listed are in Unknown or Terminating state for an extended period of time, refer to the Deleting StatefulSet Pods task for instructions on how to deal with them. You can debug individual Pods in a StatefulSet using the Debugging Pods guide.What's nextLearn more about debugging an init-container.", "category": "tasks", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-statefulset/", "id": "k8s_00624"}
{"instruction": "Write a bash example for debug a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app.kubernetes.io/name=MyApp\n```\n\nDebug a StatefulSet | If you find that any Pods listed are in Unknown or Terminating state for an extended period of time, refer to the Deleting StatefulSet Pods task for instructions on how to deal with them. You can debu", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-statefulset/", "id": "k8s_00624_code_9855"}
{"instruction": "Write a bash example for debug a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app.kubernetes.io/name=MyApp\n```\n\nDebug a StatefulSet | If you find that any Pods listed are in Unknown or Terminating state for an extended period of time, refer to the Deleting StatefulSet Pods task for instructions on how to deal with them. You can debu", "category": "tasks_code", "subcategory": "monitor-log-debug", "source": "https://kubernetes.io/docs/tasks/debug/debug-application/debug-statefulset/", "id": "k8s_00624_code_9856"}
{"instruction": "How do you control cpu management policies on the node in Kubernetes?", "response": "Control CPU Management Policies on the NodeFEATURE STATE: Kubernetes v1.26 [stable]Kubernetes keeps many aspects of how pods execute on nodes abstracted from the user. This is by design. However, some workloads require stronger guarantees in terms of latency and/or performance in order to operate acceptably. The kubelet provides methods to enable more complex workload placement policies while keeping the abstraction free from explicit placement directives.For detailed information on resource management, please refer to the Resource Management for Pods and Containers documentation.For detailed information on how the kubelet implements resource management, please refer to the Node ResourceManagers documentation.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.26.To check the version, enter kubectl version.If you are running an older version of Kubernetes, please look at the documentation for the version you are actually running.Configuring CPU management policiesBy default, the kubelet uses CFS quota to enforce pod CPU limits. When the node runs many CPU-bound pods, the workload can move to different CPU cores depending on whether the pod is throttled and which CPU cores are available at scheduling time. Many workloads are not sensitive to this migration and thus work fine without any intervention.However, in workloads where CPU cache affinity and scheduling latency significantly affect workload performance, the kubelet allows alternative CPU management policies to determine some placement preferences on the node.Windows SupportFEATURE STATE: Kubernetes v1.32 [alpha] (enabled by default: false)CPU Manager support can be enabled on Windows by using the WindowsCPUAndMemoryAffinity feature gate and it requires support in the container runtime. Once the feature gate is enabled, follow the steps below to configure the CPU manager policy.ConfigurationThe CPU Manager policy is set with the --cpu-manager-policy kubelet flag or the cpuManagerPolicy field in KubeletConfiguration. There are two supported policies:none: the default policy.static: allows pods with certain resource characteristics to be granted increased CPU affinity and exclusivity on the node.The CPU manager periodically writes resource updates through the CRI in order to reconcile in-memory CPU assignments with cgroupfs. The reconcile frequency is set through a new Kubelet configuration value --cpu-manager-reconcile-period. If not specified, it defaults to the same duration as --node-status-update-frequency.The behavior of the static policy can be fine-tuned using the --cpu-manager-policy-options flag. The flag takes a comma-separated list of key=value policy options. If you disable the CPUManagerPolicyOptions feature gate then you cannot fine-tune CPU manager policies. In that case, the CPU manager operates only using its default settings.In addition to the top-level CPUManagerPolicyOptions feature gate, the policy options are split into two groups: alpha quality (hidden by default) and beta quality (visible by default). The groups are guarded respectively by the CPUManagerPolicyAlphaOptions and CPUManagerPolicyBetaOptions feature gates. Diverging from the Kubernetes standard, these feature gates guard groups of options, because it would have been too cumbersome to add a feature gate for each individual option.Changing the CPU Manager PolicySince the CPU manager policy can only be applied when kubelet spawns new pods, simply changing from \"none\" to \"static\" won't apply to existing pods. So in order to properly change the CPU manage", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/", "id": "k8s_00625"}
{"instruction": "What is the reference documentation for event?", "response": "EventEvent is a report of an event somewhere in the cluster.apiVersion: events.k8s.io/v1import \"k8s.io/api/events/v1\"EventEvent is a report of an event somewhere in the cluster. It generally denotes some state change in the system. Events have a limited retention time and triggers and messages may evolve with time. Event consumers should not rely on the timing of an event with a given Reason reflecting a consistent underlying trigger, or the continued existence of events with that Reason. Events should be treated as informative, best-effort, supplemental data.apiVersion: events.k8s.io/v1kind: Eventmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataeventTime (MicroTime), requiredeventTime is the time when this Event was first observed. It is required.MicroTime is version of Time with microsecond level precision.action (string)action is what action was taken/failed regarding to the regarding object. It is machine-readable. This field cannot be empty for new Events and it can have at most 128 characters.deprecatedCount (int32)deprecatedCount is the deprecated field assuring backward compatibility with core.v1 Event type.deprecatedFirstTimestamp (Time)deprecatedFirstTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.deprecatedLastTimestamp (Time)deprecatedLastTimestamp is the deprecated field assuring backward compatibility with core.v1 Event type.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.deprecatedSource (EventSource)deprecatedSource is the deprecated field assuring backward compatibility with core.v1 Event type.EventSource contains information for an event.deprecatedSource.component (string)Component from which the event is generated.deprecatedSource.host (string)Node name on which the event is generated.note (string)note is a human-readable description of the status of this operation. Maximal length of the note is 1kB, but libraries should be prepared to handle values up to 64kB.reason (string)reason is why the action was taken. It is human-readable. This field cannot be empty for new Events and it can have at most 128 characters.regarding (ObjectReference)regarding contains the object this Event is about. In most cases it's an Object reporting controller implements, e.g. ReplicaSetController implements ReplicaSets and this event is emitted because it acts on some changes in a ReplicaSet object.related (ObjectReference)related is the optional secondary object for more complex actions. E.g. when regarding object triggers a creation or deletion of related object.reportingController (string)reportingController is the name of the controller that emitted this Event, e.g. kubernetes.io/kubelet. This field cannot be empty for new Events.reportingInstance (string)reportingInstance is the ID of the controller instance, e.g. kubelet-xyzf. This field cannot be empty for new Events and it can have at most 128 characters.series (EventSeries)series is data about the Event series this event represents or nil if it's a singleton Event.EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time. How often to update the EventSeries is up to the event reporters. The default event reporter in \"k8s.io/client-go/tools/events/event_broadcaster.go\" shows how this struct is updated on heartbeats and can guide customized reporter implementations.series.count (int32), requiredcount is the number of occurrences in this series up to the last heartbeat time.series.lastObservedTime (MicroTime), requiredlastObservedTime is the time when last Event from the series was seen befor", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/event-v1/", "id": "k8s_00626"}
{"instruction": "Write a yaml example for event", "response": "Here's a yaml example:\n\n```yaml\napiVersion: events.k8s.io/v1\n```\n\nEvent | import \"k8s.io/api/events/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/event-v1/", "id": "k8s_00626_code_9859"}
{"instruction": "What is the reference documentation for kubectl config set-context?", "response": "kubectl config set-contextSynopsisSet a context entry in kubeconfig.Specifying a name that already exists will merge new fields on top of existing values for those fields.kubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace] Examples # Set the user field on the gce context entry without touching other values kubectl config set-context gce --user=cluster-admin Options--cluster stringcluster for the context entry in kubeconfig--currentModify the current context-h, --helphelp for set-context--namespace stringnamespace for the context entry in kubeconfig--user stringuser for the context entry in kubeconfigParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-context/", "id": "k8s_00627"}
{"instruction": "Write a bash example for kubectl config set-context", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]\n```\n\nkubectl config set-context | cluster for the context entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-context/", "id": "k8s_00627_code_9861"}
{"instruction": "Write a bash example for kubectl config set-context", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]\n```\n\nkubectl config set-context | cluster for the context entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_set-context/", "id": "k8s_00627_code_9862"}
{"instruction": "How do you share a cluster with namespaces in Kubernetes?", "response": "Share a Cluster with NamespacesThis page shows how to view, work in, and delete namespaces. The page also shows how to use Kubernetes namespaces to subdivide your cluster.Before you beginHave an existing Kubernetes cluster.You have a basic understanding of Kubernetes Pods, Services, and Deployments.Viewing namespacesList the current namespaces in a cluster using:kubectl get namespaces NAME STATUS AGE default Active 11d kube-node-lease Active 11d kube-public Active 11d kube-system Active 11d Kubernetes starts with four initial namespaces:default The default namespace for objects with no other namespacekube-node-lease This namespace holds Lease objects associated with each node. Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.kube-public This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.kube-system The namespace for objects created by the Kubernetes systemYou can also get the summary of a specific namespace using:kubectl get namespaces <name> Or you can get detailed information with:kubectl describe namespaces <name> Name: default Labels: <none> Annotations: <none> Status: Active No resource quota. Resource Limits Type Resource Min Max Default ---- -------- --- --- --- Container cpu - - 100m Note that these details show both resource quota (if present) as well as resource limit ranges.Resource quota tracks aggregate usage of resources in the Namespace and allows cluster operators to define Hard resource usage limits that a Namespace may consume.A limit range defines min/max constraints on the amount of resources a single entity can consume in a Namespace.See Admission control: Limit RangeA namespace can be in one of two phases:Active the namespace is in useTerminating the namespace is being deleted, and can not be used for new objectsFor more details, see Namespace in the API reference.Creating a new namespaceNote:Avoid creating namespace with prefix kube-, since it is reserved for Kubernetes system namespaces.Create a new YAML file called my-namespace.yaml with the contents:apiVersion: v1 kind: Namespace metadata: name: <insert-namespace-name-here> Then run:kubectl create -f ./my-namespace.yaml Alternatively, you can create namespace using below command:kubectl create namespace <insert-namespace-name-here> The name of your namespace must be a valid DNS label.There's an optional field finalizers, which allows observables to purge resources whenever the namespace is deleted. Keep in mind that if you specify a nonexistent finalizer, the namespace will be created but will get stuck in the Terminating state if the user tries to delete it.More information on finalizers can be found in the namespace design doc.Deleting a namespaceDelete a namespace withkubectl delete namespaces <insert-some-namespace-name> Warning:This deletes everything under the namespace!This delete is asynchronous, so for a time you will see the namespace in the Terminating state.Subdividing your cluster using Kubernetes namespacesBy default, a Kubernetes cluster will instantiate a default namespace when provisioning the cluster to hold the default set of Pods, Services, and Deployments used by the cluster.Assuming you have a fresh cluster, you can introspect the available namespaces by doing the following:kubectl get namespaces NAME STATUS AGE default Active 13m Create new namespacesFor this exercise, we will create two additional Kubernetes namespaces to hold our content.In a scenario where an organization is using a shared Kubernetes cluster for development and production use cases:The development team would like to maintain a space in the cluster where they can get a view on the list of Pods, Services, and Deployments they use to bu", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\nShare a Cluster with Namespaces | Kubernetes starts with four initial namespaces:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9864"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces <name>\n```\n\nShare a Cluster with Namespaces | Or you can get detailed information with:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9865"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl describe namespaces <name>\n```\n\nShare a Cluster with Namespaces | Note that these details show both resource quota (if present) as well as resource limit ranges.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9866"}
{"instruction": "Write a yaml example for share a cluster with namespaces", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: <insert-namespace-name-here>\n```\n\nShare a Cluster with Namespaces | Then run:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9867"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./my-namespace.yaml\n```\n\nShare a Cluster with Namespaces | Alternatively, you can create namespace using below command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9868"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace <insert-namespace-name-here>\n```\n\nShare a Cluster with Namespaces | The name of your namespace must be a valid DNS label.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9869"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespaces <insert-some-namespace-name>\n```\n\nShare a Cluster with Namespaces | This delete is asynchronous, so for a time you will see the namespace in the Terminating state.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9870"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\nShare a Cluster with Namespaces | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9871"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.json\n```\n\nShare a Cluster with Namespaces | And then let's create the production namespace using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9872"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.json\n```\n\nShare a Cluster with Namespaces | To be sure things are right, list all of the namespaces in our cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9873"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\nShare a Cluster with Namespaces | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster. Users interacting with one namespace do not see the content in another namespace. To demonstrate this, let", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9874"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment snowflake \\\n  --image=registry.k8s.io/serve_hostname \\\n  -n=development --replicas=2\n```\n\nShare a Cluster with Namespaces | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9875"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=development\n```\n\nShare a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9876"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake -n=development\n```\n\nShare a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9877"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=production\nkubectl get pods -n=production\n```\n\nShare a Cluster with Namespaces | Production likes to run cattle, so let's create some cattle pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9878"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname -n=production\nkubectl scale deployment cattle --replicas=5 -n=production\n\nkubectl get deployment -n=production\n```\n\nShare a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9879"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle -n=production\n```\n\nShare a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9880"}
{"instruction": "Write a yaml example for share a cluster with namespaces", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: <insert-namespace-name-here>\n```\n\nShare a Cluster with Namespaces | Then run:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9881"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\nShare a Cluster with Namespaces | Kubernetes starts with four initial namespaces:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9882"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces <name>\n```\n\nShare a Cluster with Namespaces | Or you can get detailed information with:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9883"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl describe namespaces <name>\n```\n\nShare a Cluster with Namespaces | Note that these details show both resource quota (if present) as well as resource limit ranges.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9884"}
{"instruction": "Write a yaml example for share a cluster with namespaces", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: <insert-namespace-name-here>\n```\n\nShare a Cluster with Namespaces | Then run:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9885"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./my-namespace.yaml\n```\n\nShare a Cluster with Namespaces | Alternatively, you can create namespace using below command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9886"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace <insert-namespace-name-here>\n```\n\nShare a Cluster with Namespaces | The name of your namespace must be a valid DNS label.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9887"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespaces <insert-some-namespace-name>\n```\n\nShare a Cluster with Namespaces | This delete is asynchronous, so for a time you will see the namespace in the Terminating state.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9888"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\nShare a Cluster with Namespaces | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9889"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.json\n```\n\nShare a Cluster with Namespaces | And then let's create the production namespace using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9890"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.json\n```\n\nShare a Cluster with Namespaces | To be sure things are right, list all of the namespaces in our cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9891"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\nShare a Cluster with Namespaces | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster. Users interacting with one namespace do not see the content in another namespace. To demonstrate this, let", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9892"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment snowflake \\\n  --image=registry.k8s.io/serve_hostname \\\n  -n=development --replicas=2\n```\n\nShare a Cluster with Namespaces | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9893"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=development\n```\n\nShare a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9894"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake -n=development\n```\n\nShare a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9895"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=production\nkubectl get pods -n=production\n```\n\nShare a Cluster with Namespaces | Production likes to run cattle, so let's create some cattle pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9896"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname -n=production\nkubectl scale deployment cattle --replicas=5 -n=production\n\nkubectl get deployment -n=production\n```\n\nShare a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9897"}
{"instruction": "Write a bash example for share a cluster with namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle -n=production\n```\n\nShare a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", "id": "k8s_00628_code_9898"}
{"instruction": "How do you reconfiguring a kubeadm cluster in Kubernetes?", "response": "Reconfiguring a kubeadm clusterkubeadm does not support automated ways of reconfiguring components that were deployed on managed nodes. One way of automating this would be by using a custom operator.To modify the components configuration you must manually edit associated cluster objects and files on disk.This guide shows the correct sequence of steps that need to be performed to achieve kubeadm cluster reconfiguration.Before you beginYou need a cluster that was deployed using kubeadmHave administrator credentials (/etc/kubernetes/admin.conf) and network connectivity to a running kube-apiserver in the cluster from a host that has kubectl installedHave a text editor installed on all hostsReconfiguring the clusterkubeadm writes a set of cluster wide component configuration options in ConfigMaps and other objects. These objects must be manually edited. The command kubectl edit can be used for that.The kubectl edit command will open a text editor where you can edit and save the object directly.You can use the environment variables KUBECONFIG and KUBE_EDITOR to specify the location of the kubectl consumed kubeconfig file and preferred text editor.For example:KUBECONFIG=/etc/kubernetes/admin.conf KUBE_EDITOR=nano kubectl edit <parameters> Note:Upon saving any changes to these cluster objects, components running on nodes may not be automatically updated. The steps below instruct you on how to perform that manually.Warning:Component configuration in ConfigMaps is stored as unstructured data (YAML string). This means that validation will not be performed upon updating the contents of a ConfigMap. You have to be careful to follow the documented API format for a particular component configuration and avoid introducing typos and YAML indentation mistakes.Applying cluster configuration changesUpdating the ClusterConfigurationDuring cluster creation and upgrade, kubeadm writes its ClusterConfiguration in a ConfigMap called kubeadm-config in the kube-system namespace.To change a particular option in the ClusterConfiguration you can edit the ConfigMap with this command:kubectl edit cm -n kube-system kubeadm-config The configuration is located under the data.ClusterConfiguration key.Note:The ClusterConfiguration includes a variety of options that affect the configuration of individual components such as kube-apiserver, kube-scheduler, kube-controller-manager, CoreDNS, etcd and kube-proxy. Changes to the configuration must be reflected on node components manually.Reflecting ClusterConfiguration changes on control plane nodeskubeadm manages the control plane components as static Pod manifests located in the directory /etc/kubernetes/manifests. Any changes to the ClusterConfiguration under the apiServer, controllerManager, scheduler or etcd keys must be reflected in the associated files in the manifests directory on a control plane node.Such changes may include:extraArgs - requires updating the list of flags passed to a component containerextraVolumes - requires updating the volume mounts for a component container*SANs - requires writing new certificates with updated Subject Alternative NamesBefore proceeding with these changes, make sure you have backed up the directory /etc/kubernetes/.To write new certificates you can use:kubeadm init phase certs <component-name> --config <config-file> To write new manifest files in /etc/kubernetes/manifests you can use:# For Kubernetes control plane components kubeadm init phase control-plane <component-name> --config <config-file> # For local etcd kubeadm init phase etcd local --config <config-file> The <config-file> contents must match the updated ClusterConfiguration. The <component-name> value must be a name of a Kubernetes control plane component (apiserver, controller-manager or scheduler).Note:Updating a file in /etc/kubernetes/manifests will tell the kubelet to restart the static Pod for the corresponding component. Try doing these changes one node at a time to leave the cluster without downtime.Applyi", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubeadm-config\n```\n\nReconfiguring a kubeadm cluster | The configuration is located under the data.ClusterConfiguration key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9900"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubelet-config\n```\n\nReconfiguring a kubeadm cluster | The configuration is located under the data.kubelet key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9901"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kube-proxy\n```\n\nReconfiguring a kubeadm cluster | The configuration is located under the data.config.conf key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9902"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete po -n kube-system -l k8s-app=kube-proxy\n```\n\nReconfiguring a kubeadm cluster | New Pods that use the updated ConfigMap will be created.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9903"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment -n kube-system coredns\nkubectl edit service -n kube-system kube-dns\n```\n\nReconfiguring a kubeadm cluster | Once the CoreDNS changes are applied you can restart the CoreDNS deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9904"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment -n kube-system coredns\n```\n\nReconfiguring a kubeadm cluster | During the execution of kubeadm upgrade on a managed node, kubeadm might overwrite configuration that was applied after the cluster was created (reconfiguration).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9905"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit no <node-name>\n```\n\nReconfiguring a kubeadm cluster | During kubeadm upgrade the contents of such a Node might get overwritten. If you would like to persist your modifications to the Node object after upgrade, you can prepare a kubectl patch and apply it", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9906"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl patch no <node-name> --patch-file <patch-file>\n```\n\nReconfiguring a kubeadm cluster | The main source of control plane configuration is the ClusterConfiguration object stored in the cluster. To extend the static Pod manifests configuration, patches can be used.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9907"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubeadm-config\n```\n\nReconfiguring a kubeadm cluster | The configuration is located under the data.ClusterConfiguration key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9908"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubelet-config\n```\n\nReconfiguring a kubeadm cluster | The configuration is located under the data.kubelet key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9909"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kube-proxy\n```\n\nReconfiguring a kubeadm cluster | The configuration is located under the data.config.conf key.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9910"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete po -n kube-system -l k8s-app=kube-proxy\n```\n\nReconfiguring a kubeadm cluster | New Pods that use the updated ConfigMap will be created.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9911"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment -n kube-system coredns\nkubectl edit service -n kube-system kube-dns\n```\n\nReconfiguring a kubeadm cluster | Once the CoreDNS changes are applied you can restart the CoreDNS deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9912"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment -n kube-system coredns\n```\n\nReconfiguring a kubeadm cluster | During the execution of kubeadm upgrade on a managed node, kubeadm might overwrite configuration that was applied after the cluster was created (reconfiguration).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9913"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl edit no <node-name>\n```\n\nReconfiguring a kubeadm cluster | During kubeadm upgrade the contents of such a Node might get overwritten. If you would like to persist your modifications to the Node object after upgrade, you can prepare a kubectl patch and apply it", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9914"}
{"instruction": "Write a bash example for reconfiguring a kubeadm cluster", "response": "Here's a bash example:\n\n```bash\nkubectl patch no <node-name> --patch-file <patch-file>\n```\n\nReconfiguring a kubeadm cluster | The main source of control plane configuration is the ClusterConfiguration object stored in the cluster. To extend the static Pod manifests configuration, patches can be used.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure/", "id": "k8s_00629_code_9915"}
{"instruction": "How do you configure default memory requests and limits for a namespace in Kubernetes?", "response": "Configure Default Memory Requests and Limits for a NamespaceDefine a default memory resource limit for a namespace, so that every new Pod in that namespace has a memory resource limit configured.This page shows how to configure default memory requests and limits for a namespace.A Kubernetes cluster can be divided into namespaces. Once you have a namespace that has a default memory limit, and you then try to create a Pod with a container that does not specify its own memory limit, then the control plane assigns the default memory limit to that container.Kubernetes assigns a default memory request under certain conditions that are explained later in this topic.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 2 GiB of memory.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace default-mem-example Create a LimitRange and a PodHere's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.admin/resource/memory-defaults.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-limit-range spec: limits: - default: memory: 512Mi defaultRequest: memory: 256Mi type: Container Create the LimitRange in the default-mem-example namespace:kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies default values: a memory request of 256MiB and a memory limit of 512MiB.Here's an example manifest for a Pod that has one container. The container does not specify a memory request and limit.admin/resource/memory-defaults-pod.yaml apiVersion: v1 kind: Pod metadata: name: default-mem-demo spec: containers: - name: default-mem-demo-ctr image: nginx Create the Pod.kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example View detailed information about the Pod:kubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.containers: - image: nginx imagePullPolicy: Always name: default-mem-demo-ctr resources: limits: memory: 512Mi requests: memory: 256Mi Delete your Pod:kubectl delete pod default-mem-demo --namespace=default-mem-example What if you specify a container's limit, but not its request?Here's a manifest for a Pod that has one container. The container specifies a memory limit, but not a request:admin/resource/memory-defaults-pod-2.yaml apiVersion: v1 kind: Pod metadata: name: default-mem-demo-2 spec: containers: - name: default-mem-demo-2-ctr image: nginx resources: limits: memory: \"1Gi\" Create the Pod:kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-2.yaml --namespace=default-mem-example View detailed information about the Pod:kubectl get pod default-mem-demo-2 --output=yaml --namespace=default-mem-example The output shows that the container's memory request is set to match its memory limit. Notice that the container was not assigned the default memory request value of 256Mi.resources: limits: memory: 1Gi requests: memory: 1Gi What if you specify a container's request, but not its limit?Here's a manifest fo", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9917"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9918"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies defa", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9919"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9920"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9921"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9922"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-mem-demo --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory limit, but not a request:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9923"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9924"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-2.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9925"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-2 --output=yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to match its memory limit. Notice that the container was not assigned the default memory request value of 256Mi.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9926"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9927"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-3.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9928"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-3 --output=yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to the value specified in the container's manifest. The container is limited to use no more than 512MiB of memory, which matches the default", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9929"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Configure Default CPU Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9930"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9931"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9932"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9933"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9934"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9935"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9936"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9937"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies defa", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9938"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9939"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9940"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9941"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9942"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-mem-demo --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory limit, but not a request:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9943"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9944"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9945"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-2.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9946"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-2 --output=yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to match its memory limit. Notice that the container was not assigned the default memory request value of 256Mi.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9947"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9948"}
{"instruction": "Write a yaml example for configure default memory requests and limits for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9949"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-3.yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9950"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-3 --output=yaml --namespace=default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to the value specified in the container's manifest. The container is limited to use no more than 512MiB of memory, which matches the default", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9951"}
{"instruction": "Write a bash example for configure default memory requests and limits for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-mem-example\n```\n\nConfigure Default Memory Requests and Limits for a Namespace | Configure Default CPU Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/", "id": "k8s_00630_code_9952"}
{"instruction": "What is the reference documentation for kubectl config delete-cluster?", "response": "kubectl config delete-clusterSynopsisDelete the specified cluster from the kubeconfig.kubectl config delete-cluster NAME Examples # Delete the minikube cluster kubectl config delete-cluster minikube Options-h, --helphelp for delete-clusterParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-cluster/", "id": "k8s_00631"}
{"instruction": "Write a bash example for kubectl config delete-cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster NAME\n```\n\nkubectl config delete-cluster | help for delete-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-cluster/", "id": "k8s_00631_code_9954"}
{"instruction": "Write a bash example for kubectl config delete-cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster NAME\n```\n\nkubectl config delete-cluster | help for delete-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-cluster/", "id": "k8s_00631_code_9955"}
{"instruction": "How do you assign memory resources to containers and pods in Kubernetes?", "response": "Assign Memory Resources to Containers and PodsThis page shows how to assign a memory request and a memory limit to a Container. A Container is guaranteed to have as much memory as it requests, but is not allowed to use more memory than its limit.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Each node in your cluster must have at least 300 MiB of memory.A few of the steps on this page require you to run the metrics-server service in your cluster. If you have the metrics-server running, you can skip those steps.If you are running Minikube, run the following command to enable the metrics-server:minikube addons enable metrics-server To see whether the metrics-server is running, or another provider of the resource metrics API (metrics.k8s.io), run the following command:kubectl get apiservices If the resource metrics API is available, the output includes a reference to metrics.k8s.io.NAME v1beta1.metrics.k8s.io Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace mem-example Specify a memory request and a memory limitTo specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.In this exercise, you create a Pod that has one Container. The Container has a memory request of 100 MiB and a memory limit of 200 MiB. Here's the configuration file for the Pod:pods/resource/memory-request-limit.yaml apiVersion: v1 kind: Pod metadata: name: memory-demo namespace: mem-example spec: containers: - name: memory-demo-ctr image: polinux/stress resources: requests: memory: \"100Mi\" limits: memory: \"200Mi\" command: [\"stress\"] args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"] The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example Verify that the Pod Container is running:kubectl get pod memory-demo --namespace=mem-example View detailed information about the Pod:kubectl get pod memory-demo --output=yaml --namespace=mem-example The output shows that the one Container in the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.... resources: requests: memory: 100Mi limits: memory: 200Mi ... Run kubectl top to fetch the metrics for the pod:kubectl top pod memory-demo --namespace=mem-example The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.NAME CPU(cores) MEMORY(bytes) memory-demo <something> 162856960 Delete your Pod:kubectl delete pod memory-demo --namespace=mem-example Exceed a Container's memory limitA Container can exceed its memory request if the Node has memory available. But a Container is not allowed to use more than its memory limit. If a Container allocates more memory than its limit, the Container becomes a candidate for termination. If the Container continues to consume memory beyond its limit, the Container is terminated. If a terminated Container can be restarted, the kubelet restarts it, as with any other type of runtime failure.In this exercise, you create a Pod that attempts to allocate more memory than its limit. Here is the configuration file for a Pod that has one Container with a memory request o", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\nAssign Memory Resources to Containers and Pods | If the resource metrics API is available, the output includes a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9957"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace mem-example\n```\n\nAssign Memory Resources to Containers and Pods | To specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9958"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9959"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9960"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9961"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the one Container in the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9962"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9963"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | A Container can exceed its memory request if the Node has memory available. But a Container is not allowed to use more than its memory limit. If a Container allocates more memory than its limit, the C", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9964"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9965"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-2.yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9966"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | At this point, the Container might be running or killed. Repeat the preceding command until the Container is killed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9967"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --output=yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container was killed because it is out of memory (OOM):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9968"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container is killed, restarted, killed again, restarted again, and so on:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9969"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS      RESTARTS   AGE\nmemory-demo-2   0/1       OOMKilled   1          37s\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9970"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-2   1/1       Running   2          40s\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9971"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container starts and fails repeatedly:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9972"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\nAssign Memory Resources to Containers and Pods | The output includes a record of the Container being killed because of an out-of-memory condition:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9973"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | Memory requests and limits are associated with Containers, but it is useful to think of a Pod as having a memory request and limit. The memory request for the Pod is the sum of the memory requests for", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9974"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9975"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-3.yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9976"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Pod status is PENDING. That is, the Pod is not scheduled to run on any Node, and it will remain in the PENDING state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9977"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-3   0/1       Pending   0          25s\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod, including events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9978"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-3 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient memory on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9979"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-3 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | If you do not specify a memory limit for a Container, one of the following situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9980"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace mem-example\n```\n\nAssign Memory Resources to Containers and Pods | Assign CPU Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9981"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9982"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\n...\nresources:\n  requests:\n    memory: 100Mi\n  limits:\n    memory: 200Mi\n...\n```\n\nAssign Memory Resources to Containers and Pods | Run kubectl top to fetch the metrics for the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9983"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9984"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\nlastState:\n   terminated:\n     containerID: 65183c1877aaec2e8427bc95609cc52677a454b56fcb24340dbd22917c23b10f\n     exitCode: 137\n     finishedAt: 2017-06-20T20:52:19Z\n     reason: OOMKilled\n     startedAt: null\n```\n\nAssign Memory Resources to Containers and Pods | The Container in this exercise can be restarted, so the kubelet restarts it. Repeat this command several times to see that the Container is repeatedly killed and restarted:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9985"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS      RESTARTS   AGE\nmemory-demo-2   0/1       OOMKilled   1          37s\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9986"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-2   1/1       Running   2          40s\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9987"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container starts and fails repeatedly:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9988"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\nAssign Memory Resources to Containers and Pods | The output includes a record of the Container being killed because of an out-of-memory condition:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9989"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9990"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-3   0/1       Pending   0          25s\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod, including events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9991"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\nAssign Memory Resources to Containers and Pods | If the resource metrics API is available, the output includes a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9992"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace mem-example\n```\n\nAssign Memory Resources to Containers and Pods | To specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9993"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9994"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9995"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9996"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9997"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the one Container in the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9998"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_9999"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | A Container can exceed its memory request if the Node has memory available. But a Container is not allowed to use more than its memory limit. If a Container allocates more memory than its limit, the C", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10000"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10001"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10002"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-2.yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10003"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | At this point, the Container might be running or killed. Repeat the preceding command until the Container is killed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10004"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --output=yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container was killed because it is out of memory (OOM):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10005"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container is killed, restarted, killed again, restarted again, and so on:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10006"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-2 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | Memory requests and limits are associated with Containers, but it is useful to think of a Pod as having a memory request and limit. The memory request for the Pod is the sum of the memory requests for", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10007"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10008"}
{"instruction": "Write a yaml example for assign memory resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\nAssign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10009"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-3.yaml --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10010"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Pod status is PENDING. That is, the Pod is not scheduled to run on any Node, and it will remain in the PENDING state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10011"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-3 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient memory on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10012"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-3 --namespace=mem-example\n```\n\nAssign Memory Resources to Containers and Pods | If you do not specify a memory limit for a Container, one of the following situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10013"}
{"instruction": "Write a bash example for assign memory resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace mem-example\n```\n\nAssign Memory Resources to Containers and Pods | Assign CPU Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/", "id": "k8s_00632_code_10014"}
{"instruction": "Explain the Kubernetes concept: Scheduling Framework", "response": "Scheduling FrameworkFEATURE STATE: Kubernetes v1.19 [stable]The scheduling framework is a pluggable architecture for the Kubernetes scheduler. It consists of a set of \"plugin\" APIs that are compiled directly into the scheduler. These APIs allow most scheduling features to be implemented as plugins, while keeping the scheduling \"core\" lightweight and maintainable. Refer to the design proposal of the scheduling framework for more technical information on the design of the framework.Framework workflowThe Scheduling Framework defines a few extension points. Scheduler plugins register to be invoked at one or more extension points. Some of these plugins can change the scheduling decisions and some are informational only.Each attempt to schedule one Pod is split into two phases, the scheduling cycle and the binding cycle.Scheduling cycle & binding cycleThe scheduling cycle selects a node for the Pod, and the binding cycle applies that decision to the cluster. Together, a scheduling cycle and binding cycle are referred to as a \"scheduling context\".Scheduling cycles are run serially, while binding cycles may run concurrently.A scheduling or binding cycle can be aborted if the Pod is determined to be unschedulable or if there is an internal error. The Pod will be returned to the queue and retried.InterfacesThe following picture shows the scheduling context of a Pod and the interfaces that the scheduling framework exposes.One plugin may implement multiple interfaces to perform more complex or stateful tasks.Some interfaces match the scheduler extension points which can be configured through Scheduler Configuration.Scheduling framework extension pointsPreEnqueueThese plugins are called prior to adding Pods to the internal active queue, where Pods are marked as ready for scheduling.Only when all PreEnqueue plugins return Success, the Pod is allowed to enter the active queue. Otherwise, it's placed in the internal unschedulable Pods list, and doesn't get an Unschedulable condition.For more details about how internal scheduler queues work, read Scheduling queue in kube-scheduler.EnqueueExtensionEnqueueExtension is the interface where the plugin can control whether to retry scheduling of Pods rejected by this plugin, based on changes in the cluster. Plugins that implement PreEnqueue, PreFilter, Filter, Reserve or Permit should implement this interface.QueueingHintFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)QueueingHint is a callback function for deciding whether a Pod can be requeued to the active queue or backoff queue. It's executed every time a certain kind of event or change happens in the cluster. When the QueueingHint finds that the event might make the Pod schedulable, the Pod is put into the active queue or the backoff queue so that the scheduler will retry the scheduling of the Pod.QueueSortThese plugins are used to sort Pods in the scheduling queue. A queue sort plugin essentially provides a Less(Pod1, Pod2) function. Only one queue sort plugin may be enabled at a time.PreFilterThese plugins are used to pre-process info about the Pod, or to check certain conditions that the cluster or the Pod must meet. If a PreFilter plugin returns an error, the scheduling cycle is aborted.FilterThese plugins are used to filter out nodes that cannot run the Pod. For each node, the scheduler will call filter plugins in their configured order. If any filter plugin marks the node as infeasible, the remaining plugins will not be called for that node. Nodes may be evaluated concurrently.PostFilterThese plugins are called after the Filter phase, but only when no feasible nodes were found for the pod. Plugins are called in their configured order. If any postFilter plugin marks the node as Schedulable, the remaining plugins will not be called. A typical PostFilter implementation is preemption, which tries to make the pod schedulable by preempting other Pods.PreScoreThese plugins are used to perform \"pre-scoring\" work, which generates", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/scheduling-framework/", "id": "k8s_00633"}
{"instruction": "Explain the Kubernetes concept: Container Environment", "response": "Container EnvironmentThis page describes the resources available to Containers in the Container environment.Container environmentThe Kubernetes Container environment provides several important resources to Containers:A filesystem, which is a combination of an image and one or more volumes.Information about the Container itself.Information about other objects in the cluster.Container informationThe hostname of a Container is the name of the Pod in which the Container is running. It is available through the hostname command or the gethostname function call in libc.The Pod name and namespace are available as environment variables through the downward API.User defined environment variables from the Pod definition are also available to the Container, as are any environment variables specified statically in the container image.Cluster informationA list of all services that were running when a Container was created is available to that Container as environment variables. This list is limited to services within the same namespace as the new Container's Pod and Kubernetes control plane services.For a service named foo that maps to a Container named bar, the following variables are defined:FOO_SERVICE_HOST=<the host the service is running on> FOO_SERVICE_PORT=<the port the service is running on> Services have dedicated IP addresses and are available to the Container via DNS, if DNS addon is enabled. What's nextLearn more about Container lifecycle hooks.Get hands-on experience attaching handlers to Container lifecycle events.", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/containers/container-environment/", "id": "k8s_00634"}
{"instruction": "How do you windows debugging tips in Kubernetes?", "response": "Windows debugging tipsNode-level troubleshootingMy Pods are stuck at \"Container Creating\" or restarting over and overEnsure that your pause image is compatible with your Windows OS version. See Pause container to see the latest / recommended pause image and/or get more information.Note:If using containerd as your container runtime the pause image is specified in the plugins.plugins.cri.sandbox_image field of the of config.toml configuration file.My pods show status as ErrImgPull or ImagePullBackOffEnsure that your Pod is getting scheduled to a compatible Windows Node.More information on how to specify a compatible node for your Pod can be found in this guide.Network troubleshootingMy Windows Pods do not have network connectivityIf you are using virtual machines, ensure that MAC spoofing is enabled on all the VM network adapter(s).My Windows Pods cannot ping external resourcesWindows Pods do not have outbound rules programmed for the ICMP protocol. However, TCP/UDP is supported. When trying to demonstrate connectivity to resources outside of the cluster, substitute ping <IP> with corresponding curl <IP> commands.If you are still facing problems, most likely your network configuration in cni.conf deserves some extra attention. You can always edit this static file. The configuration update will apply to any new Kubernetes resources.One of the Kubernetes networking requirements (see Kubernetes model) is for cluster communication to occur without NAT internally. To honor this requirement, there is an ExceptionList for all the communication where you do not want outbound NAT to occur. However, this also means that you need to exclude the external IP you are trying to query from the ExceptionList. Only then will the traffic originating from your Windows pods be SNAT'ed correctly to receive a response from the outside world. In this regard, your ExceptionList in cni.conf should look as follows:\"ExceptionList\": [ \"10.244.0.0/16\", # Cluster subnet \"10.96.0.0/12\", # Service subnet \"10.127.130.0/24\" # Management (host) subnet ] My Windows node cannot access NodePort type ServicesLocal NodePort access from the node itself fails. This is a known limitation. NodePort access works from other nodes or external clients.vNICs and HNS endpoints of containers are being deletedThis issue can be caused when the hostname-override parameter is not passed to kube-proxy. To resolve it, users need to pass the hostname to kube-proxy as follows:C:\\k\\kube-proxy.exe --hostname-override=$(hostname) My Windows node cannot access my services using the service IPThis is a known limitation of the networking stack on Windows. However, Windows Pods can access the Service IP.No network adapter is found when starting the kubeletThe Windows networking stack needs a virtual adapter for Kubernetes networking to work. If the following commands return no results (in an admin shell), virtual network creation — a necessary prerequisite for the kubelet to work — has failed:Get-HnsNetwork | ? Name -ieq \"cbr0\" Get-NetAdapter | ? Name -Like \"vEthernet (Ethernet*\" Often it is worthwhile to modify the InterfaceName parameter of the start.ps1 script, in cases where the host's network adapter isn't \"Ethernet\". Otherwise, consult the output of the start-kubelet.ps1 script to see if there are errors during virtual network creation.DNS resolution is not properly workingCheck the DNS limitations for Windows in this section.kubectl port-forward fails with \"unable to do port forwarding: wincat not found\"This was implemented in Kubernetes 1.15 by including wincat.exe in the pause infrastructure container mcr.microsoft.com/oss/kubernetes/pause:3.6. Be sure to use a supported version of Kubernetes. If you would like to build your own pause infrastructure container be sure to include wincat.My Kubernetes installation is failing because my Windows Server node is behind a proxyIf you are behind a proxy, the following PowerShell environment variables must be defined:[Environment]::SetEnvironmen", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/windows/", "id": "k8s_00635"}
{"instruction": "What is the reference documentation for api overview?", "response": "API OverviewThis section provides reference information for the Kubernetes API.The REST API is the fundamental fabric of Kubernetes. All operations and communications between components, and external user commands are REST API calls that the API Server handles. Consequently, everything in the Kubernetes platform is treated as an API object and has a corresponding entry in the API.The Kubernetes API reference lists the API for Kubernetes version v1.34.For general background information, read The Kubernetes API. Controlling Access to the Kubernetes API describes how clients can authenticate to the Kubernetes API server, and how their requests are authorized.API versioningThe JSON and Protobuf serialization schemas follow the same guidelines for schema changes. The following descriptions cover both formats.The API versioning and software versioning are indirectly related. The API and release versioning proposal describes the relationship between API versioning and software versioning.Different API versions indicate different levels of stability and support. You can find more information about the criteria for each level in the API Changes documentation.Here's a summary of each level:Alpha:The version names contain alpha (for example, v1alpha1).Built-in alpha API versions are disabled by default and must be explicitly enabled in the kube-apiserver configuration to be used.The software may contain bugs. Enabling a feature may expose bugs.Support for an alpha API may be dropped at any time without notice.The API may change in incompatible ways in a later software release without notice.The software is recommended for use only in short-lived testing clusters, due to increased risk of bugs and lack of long-term support.Beta:The version names contain beta (for example, v2beta3).Built-in beta API versions are disabled by default and must be explicitly enabled in the kube-apiserver configuration to be used (except for beta versions of APIs introduced prior to Kubernetes 1.22, which were enabled by default).Built-in beta API versions have a maximum lifetime of 9 months or 3 minor releases (whichever is longer) from introduction to deprecation, and 9 months or 3 minor releases (whichever is longer) from deprecation to removal.The software is well tested. Enabling a feature is considered safe.The support for a feature will not be dropped, though the details may change.The schema and/or semantics of objects may change in incompatible ways in a subsequent beta or stable API version. When this happens, migration instructions are provided. Adapting to a subsequent beta or stable API version may require editing or re-creating API objects, and may not be straightforward. The migration may require downtime for applications that rely on the feature.The software is not recommended for production uses. Subsequent releases may introduce incompatible changes. Use of beta API versions is required to transition to subsequent beta or stable API versions once the beta API version is deprecated and no longer served.Note:Please try beta features and provide", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/", "id": "k8s_00636"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: $GROUP_NAME/$VERSION\n```\n\nAPI Overview | Certain resources and API groups are enabled by default. You can enable or disable them by setting --runtime-config on the API server. The --runtime-config flag accepts comma separated <key>[=<value>]", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/", "id": "k8s_00636_code_10019"}
{"instruction": "What is the reference documentation for using rbac authorization?", "response": "Using RBAC AuthorizationRole-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within your organization.RBAC authorization uses the rbac.authorization.k8s.io API group to drive authorization decisions, allowing you to dynamically configure policies through the Kubernetes API.To enable RBAC, start the API server with the --authorization-config flag set to a file that includes the RBAC authorizer; for example:apiVersion: apiserver.config.k8s.io/v1 kind: AuthorizationConfiguration authorizers: ... - type: RBAC ... Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes RBAC; for example:kube-apiserver --authorization-mode=...,RBAC --other-options --more-options API objectsThe RBAC API declares four kinds of Kubernetes object: Role, ClusterRole, RoleBinding and ClusterRoleBinding. You can describe or amend the RBAC objects using tools such as kubectl, just like any other Kubernetes object.Caution:These objects, by design, impose access restrictions. If you are making changes to a cluster as you learn, see privilege escalation prevention and bootstrapping to understand how those restrictions can prevent you making some changes.Role and ClusterRoleAn RBAC Role or ClusterRole contains rules that represent a set of permissions. Permissions are purely additive (there are no \"deny\" rules).A Role always sets permissions within a particular namespace; when you create a Role, you have to specify the namespace it belongs in.ClusterRole, by contrast, is a non-namespaced resource. The resources have different names (Role and ClusterRole) because a Kubernetes object always has to be either namespaced or not namespaced; it can't be both.ClusterRoles have several uses. You can use a ClusterRole to:define permissions on namespaced resources and be granted access within individual namespace(s)define permissions on namespaced resources and be granted access across all namespacesdefine permissions on cluster-scoped resourcesIf you want to define a role within a namespace, use a Role; if you want to define a role cluster-wide, use a ClusterRole.Role exampleHere's an example Role in the \"default\" namespace that can be used to grant read access to pods:access/simple-role.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: default name: pod-reader rules: - apiGroups: [\"\"] # \"\" indicates the core API group resources: [\"pods\"] verbs: [\"get\", \"watch\", \"list\"] ClusterRole exampleA ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:cluster-scoped resources (like nodes)non-resource endpoints (like /healthz)namespaced resources (like Pods), across all namespacesFor example: you can use a ClusterRole to allow a particular user to run kubectl get pods --all-namespacesHere is an example of a ClusterRole that can be used to grant read access to secrets in any particular namespace, or across all namespaces (depending on how it is bound):access/simple-clusterrole.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: # \"namespace\" omitted since ClusterRoles are not namespaced name: secret-reader rules: - apiGroups: [\"\"] # # at the HTTP level, the name of the resource for accessing Secret # objects is \"secrets\" resources: [\"secrets\"] verbs: [\"get\", \"watch\", \"list\"] The name of a Role or a ClusterRole object must be a valid path segment name.RoleBinding and ClusterRoleBindingA role binding grants the permissions defined in a role to a user or set of users. It holds a list of subjects (users, groups, or service accounts), and a reference to the role being granted. A RoleBinding grants permissions within a specific namespace whereas a ClusterRoleBinding grants that access cluster-wide.A RoleBinding may reference any Role in the same namespace. Alternatively, a RoleBinding can reference a ClusterRole and", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: RBAC\n  ...\n```\n\nUsing RBAC Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes RBAC; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10021"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10022"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10023"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10024"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10025"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10026"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-and-pod-logs-reader\nrules:\n- apiGroups: [\"\"]\n  resources: [\"pods\", \"pods/log\"]\n  verbs: [\"get\", \"list\"]\n```\n\nUsing RBAC Authorization | You can also refer to resources by name for certain requests through the resourceNames list. When specified, requests can be restricted to individual instances of a resource. Here is an example that r", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10027"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: configmap-updater\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-configmap\"]\n  verbs: [\"update\", \"get\"]\n```\n\nUsing RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10028"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE\nrules:\n- apiGroups: [\"example.com\"]\n  resources: [\"*\"]\n  verbs: [\"*\"]\n```\n\nUsing RBAC Authorization | You can aggregate several ClusterRoles into one combined ClusterRole. A controller, running as part of the cluster control plane, watches for ClusterRole objects with an aggregationRule set. The aggre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10029"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring\naggregationRule:\n  clusterRoleSelectors:\n  - matchLabels:\n      rbac.example.com/aggregate-to-monitoring: \"true\"\nrules: [] # The control plane automatically fills in the rules\n```\n\nUsing RBAC Authorization | If you create a new ClusterRole that matches the label selector of an existing aggregated ClusterRole, that change triggers adding the new rules into the aggregated ClusterRole. Here is an example tha", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10030"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring-endpoints\n  labels:\n    rbac.example.com/aggregate-to-monitoring: \"true\"\n# When you create the \"monitoring-endpoints\" ClusterRole,\n# the rules below will be added to the \"monitoring\" ClusterRole.\nrules:\n- apiGroups: [\"\"]\n  resources: [\"services\", \"endpointslices\", \"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | The default user-facing roles use ClusterRole aggregation. This lets you, as a cluster administrator, include rules for custom resources, such as those served by CustomResourceDefinitions or aggregate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10031"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: aggregate-cron-tabs-edit\n  labels:\n    # Add these permissions to the \"admin\" and \"edit\" default roles.\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: aggregate-cron-tabs-view\n  labels:\n    # Add these permissions to the \"view\" default role.\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | The following examples are excerpts from Role or ClusterRole objects, showing only the rules section.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10032"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: User\n  name: \"alice@example.com\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For a group named frontend-admins:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10033"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: \"frontend-admins\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For the default service account in the \"kube-system\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10034"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: kube-system\n```\n\nUsing RBAC Authorization | For all service accounts in the \"qa\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10035"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts:qa\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all service accounts in any namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10036"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all authenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10037"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all unauthenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10038"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10039"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | API servers create a set of default ClusterRole and ClusterRoleBinding objects. Many of these are system: prefixed, which indicates that the resource is directly managed by the cluster control plane.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10040"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl get clusterroles system:discovery -o yaml\n```\n\nUsing RBAC Authorization | Some of the default ClusterRoles are not system: prefixed. These are intended to be user-facing roles. They include super-user roles (cluster-admin), roles intended to be granted cluster-wide using Cl", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10041"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: role-grantor\nrules:\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"rolebindings\"]\n  verbs: [\"create\"]\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"clusterroles\"]\n  verbs: [\"bind\"]\n  # omit resourceNames to allow binding any ClusterRole\n  resourceNames: [\"admin\",\"edit\",\"view\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: role-grantor-binding\n  namespace: user-1-namespace\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: role-grantor\nsubjects:\n- apiGroup: rbac.authorization.k8s.io\n  kind: User\n  name: user-1\n```\n\nUsing RBAC Authorization | When bootstrapping the first roles and role bindings, it is necessary for the initial user to grant permissions they do not yet have. To bootstrap initial roles and role bindings:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10042"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\nUsing RBAC Authorization | Create a Role named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10043"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\nUsing RBAC Authorization | Create a Role named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10044"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=replicasets.apps\n```\n\nUsing RBAC Authorization | Create a Role named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10045"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\nUsing RBAC Authorization | Create a Role named \"my-component-lease-holder\" with permissions to get/update a resource with a specific name:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10046"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role my-component-lease-holder --verb=get,list,watch,update --resource=lease --resource-name=my-component\n```\n\nUsing RBAC Authorization | Creates a ClusterRole. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10047"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10048"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10049"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=replicasets.apps\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10050"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"foo\" with nonResourceURL specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10051"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"monitoring\" with an aggregationRule specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10052"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\nUsing RBAC Authorization | Grants a Role or ClusterRole within a specific namespace. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10053"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding bob-admin-binding --clusterrole=admin --user=bob --namespace=acme\n```\n\nUsing RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to the service account in the namespace \"acme\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10054"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp --namespace=acme\n```\n\nUsing RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to a service account in the namespace \"myappnamespace\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10055"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myappnamespace-myapp-view-binding --clusterrole=view --serviceaccount=myappnamespace:myapp --namespace=acme\n```\n\nUsing RBAC Authorization | Grants a ClusterRole across the entire cluster (all namespaces). Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10056"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding root-cluster-admin-binding --clusterrole=cluster-admin --user=root\n```\n\nUsing RBAC Authorization | Across the entire cluster, grant the permissions in the \"system:node-proxier\" ClusterRole to a user named \"system:kube-proxy\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10057"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding kube-proxy-binding --clusterrole=system:node-proxier --user=system:kube-proxy\n```\n\nUsing RBAC Authorization | Across the entire cluster, grant the permissions in the \"view\" ClusterRole to a service account named \"myapp\" in the namespace \"acme\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10058"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp\n```\n\nUsing RBAC Authorization | Creates or updates rbac.authorization.k8s.io/v1 API objects from a manifest file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10059"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --dry-run=client\n```\n\nUsing RBAC Authorization | Apply a manifest file of RBAC objects, preserving any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10060"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nUsing RBAC Authorization | Apply a manifest file of RBAC objects, removing any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10061"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --remove-extra-subjects --remove-extra-permissions\n```\n\nUsing RBAC Authorization | Default RBAC policies grant scoped permissions to control-plane components, nodes, and controllers, but grant no permissions to service accounts outside the kube-system namespace (beyond the permissio", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10062"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding my-sa-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:my-sa \\\n  --namespace=my-namespace\n```\n\nUsing RBAC Authorization | Grant a role to the \"default\" service account in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10063"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding default-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:default \\\n  --namespace=my-namespace\n```\n\nUsing RBAC Authorization | Many add-ons run as the \"default\" service account in the kube-system namespace. To allow those add-ons to run with super-user access, grant cluster-admin permissions to the \"default\" service account i", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10064"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding add-on-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --serviceaccount=kube-system:default\n```\n\nUsing RBAC Authorization | Grant a role to all service accounts in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10065"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n  --group=system:serviceaccounts:my-namespace \\\n  --namespace=my-namespace\n```\n\nUsing RBAC Authorization | Grant a limited role to all service accounts cluster-wide (discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10066"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n --group=system:serviceaccounts\n```\n\nUsing RBAC Authorization | Grant super-user access to all service accounts cluster-wide (strongly discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10067"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --group=system:serviceaccounts\n```\n\nUsing RBAC Authorization | Kubernetes clusters created before Kubernetes v1.22 include write access to EndpointSlices (and the now-deprecated Endpoints API) in the aggregated \"edit\" and \"admin\" roles. As a mitigation for CVE-20", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10068"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\nUsing RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10069"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding permissive-binding \\\n  --clusterrole=cluster-admin \\\n  --user=admin \\\n  --user=kubelet \\\n  --group=system:serviceaccounts\n```\n\nUsing RBAC Authorization | After you have transitioned to use RBAC, you should adjust the access controls for your cluster to ensure that these meet your information security needs.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10070"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: RBAC\n  ...\n```\n\nUsing RBAC Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes RBAC; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10071"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10072"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces\n```\n\nUsing RBAC Authorization | Here is an example of a ClusterRole that can be used to grant read access to secrets in any particular namespace, or across all namespaces (depending on how it is bound):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10073"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10074"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10075"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10076"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10077"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile\n```\n\nUsing RBAC Authorization | In the Kubernetes API, most resources are represented and accessed using a string representation of their object name, such as pods for a Pod. RBAC refers to resources using exactly the same name that", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10078"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-and-pod-logs-reader\nrules:\n- apiGroups: [\"\"]\n  resources: [\"pods\", \"pods/log\"]\n  verbs: [\"get\", \"list\"]\n```\n\nUsing RBAC Authorization | You can also refer to resources by name for certain requests through the resourceNames list. When specified, requests can be restricted to individual instances of a resource. Here is an example that r", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10079"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: configmap-updater\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-configmap\"]\n  verbs: [\"update\", \"get\"]\n```\n\nUsing RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10080"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps --field-selector=metadata.name=my-configmap\n```\n\nUsing RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10081"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE\nrules:\n- apiGroups: [\"example.com\"]\n  resources: [\"*\"]\n  verbs: [\"*\"]\n```\n\nUsing RBAC Authorization | You can aggregate several ClusterRoles into one combined ClusterRole. A controller, running as part of the cluster control plane, watches for ClusterRole objects with an aggregationRule set. The aggre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10082"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring\naggregationRule:\n  clusterRoleSelectors:\n  - matchLabels:\n      rbac.example.com/aggregate-to-monitoring: \"true\"\nrules: [] # The control plane automatically fills in the rules\n```\n\nUsing RBAC Authorization | If you create a new ClusterRole that matches the label selector of an existing aggregated ClusterRole, that change triggers adding the new rules into the aggregated ClusterRole. Here is an example tha", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10083"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring-endpoints\n  labels:\n    rbac.example.com/aggregate-to-monitoring: \"true\"\n# When you create the \"monitoring-endpoints\" ClusterRole,\n# the rules below will be added to the \"monitoring\" ClusterRole.\nrules:\n- apiGroups: [\"\"]\n  resources: [\"services\", \"endpointslices\", \"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | The default user-facing roles use ClusterRole aggregation. This lets you, as a cluster administrator, include rules for custom resources, such as those served by CustomResourceDefinitions or aggregate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10084"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: aggregate-cron-tabs-edit\n  labels:\n    # Add these permissions to the \"admin\" and \"edit\" default roles.\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: aggregate-cron-tabs-view\n  labels:\n    # Add these permissions to the \"view\" default role.\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | The following examples are excerpts from Role or ClusterRole objects, showing only the rules section.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10085"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Pod\n  # objects is \"pods\"\n  resources: [\"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | Allow reading/writing Deployments (at the HTTP level: objects with \"deployments\" in the resource part of their URL) in the \"apps\" API groups:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10086"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"apps\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Deployment\n  # objects is \"deployments\"\n  resources: [\"deployments\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\nUsing RBAC Authorization | Allow reading Pods in the core API group, as well as reading or writing Job resources in the \"batch\" API group:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10087"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Pod\n  # objects is \"pods\"\n  resources: [\"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n- apiGroups: [\"batch\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Job\n  # objects is \"jobs\"\n  resources: [\"jobs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\nUsing RBAC Authorization | Allow reading a ConfigMap named \"my-config\" (must be bound with a RoleBinding to limit to a single ConfigMap in a single namespace):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10088"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-config\"]\n  verbs: [\"get\"]\n```\n\nUsing RBAC Authorization | Allow reading the resource \"nodes\" in the core group (because a Node is cluster-scoped, this must be in a ClusterRole bound with a ClusterRoleBinding to be effective):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10089"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Node\n  # objects is \"nodes\"\n  resources: [\"nodes\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | Allow GET and POST requests to the non-resource endpoint /healthz and all subpaths (must be in a ClusterRole bound with a ClusterRoleBinding to be effective):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10090"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- nonResourceURLs: [\"/healthz\", \"/healthz/*\"] # '*' in a nonResourceURL is a suffix glob match\n  verbs: [\"get\", \"post\"]\n```\n\nUsing RBAC Authorization | A RoleBinding or ClusterRoleBinding binds a role to subjects. Subjects can be groups, users or ServiceAccounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10091"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: User\n  name: \"alice@example.com\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For a group named frontend-admins:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10092"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: \"frontend-admins\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For the default service account in the \"kube-system\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10093"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: kube-system\n```\n\nUsing RBAC Authorization | For all service accounts in the \"qa\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10094"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts:qa\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all service accounts in any namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10095"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all authenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10096"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all unauthenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10097"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10098"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | API servers create a set of default ClusterRole and ClusterRoleBinding objects. Many of these are system: prefixed, which indicates that the resource is directly managed by the cluster control plane.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10099"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  labels:\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\n```\n\nUsing RBAC Authorization | If used in a RoleBinding, allows read/write access to most resources in a namespace, including the ability to create roles and role bindings within the namespace. This role does not allow write access", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10100"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: role-grantor\nrules:\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"rolebindings\"]\n  verbs: [\"create\"]\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"clusterroles\"]\n  verbs: [\"bind\"]\n  # omit resourceNames to allow binding any ClusterRole\n  resourceNames: [\"admin\",\"edit\",\"view\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: role-grantor-binding\n  namespace: user-1-namespace\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: role-grantor\nsubjects:\n- apiGroup: rbac.authorization.k8s.io\n  kind: User\n  name: user-1\n```\n\nUsing RBAC Authorization | When bootstrapping the first roles and role bindings, it is necessary for the initial user to grant permissions they do not yet have. To bootstrap initial roles and role bindings:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10101"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole\n```\n\nUsing RBAC Authorization | Creates a ClusterRole. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10102"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding\n```\n\nUsing RBAC Authorization | Grants a Role or ClusterRole within a specific namespace. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10103"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding\n```\n\nUsing RBAC Authorization | Grants a ClusterRole across the entire cluster (all namespaces). Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10104"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile\n```\n\nUsing RBAC Authorization | Creates or updates rbac.authorization.k8s.io/v1 API objects from a manifest file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10105"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount\n```\n\nUsing RBAC Authorization | For example, grant read-only permission within \"my-namespace\" to the \"my-sa\" service account:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10106"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\nUsing RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10107"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole\n```\n\nUsing RBAC Authorization | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10108"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding\n```\n\nUsing RBAC Authorization | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10109"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding\n```\n\nUsing RBAC Authorization | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10110"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile\n```\n\nUsing RBAC Authorization | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10111"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: RBAC\n  ...\n```\n\nUsing RBAC Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes RBAC; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10112"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-role.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10113"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10114"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10115"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\nUsing RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10116"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-rolebinding-with-role.yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10117"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10118"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-rolebinding-with-clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10119"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10120"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-clusterrolebinding.yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10121"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10122"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-and-pod-logs-reader\nrules:\n- apiGroups: [\"\"]\n  resources: [\"pods\", \"pods/log\"]\n  verbs: [\"get\", \"list\"]\n```\n\nUsing RBAC Authorization | You can also refer to resources by name for certain requests through the resourceNames list. When specified, requests can be restricted to individual instances of a resource. Here is an example that r", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10123"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: configmap-updater\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-configmap\"]\n  verbs: [\"update\", \"get\"]\n```\n\nUsing RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10124"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE\nrules:\n- apiGroups: [\"example.com\"]\n  resources: [\"*\"]\n  verbs: [\"*\"]\n```\n\nUsing RBAC Authorization | You can aggregate several ClusterRoles into one combined ClusterRole. A controller, running as part of the cluster control plane, watches for ClusterRole objects with an aggregationRule set. The aggre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10125"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring\naggregationRule:\n  clusterRoleSelectors:\n  - matchLabels:\n      rbac.example.com/aggregate-to-monitoring: \"true\"\nrules: [] # The control plane automatically fills in the rules\n```\n\nUsing RBAC Authorization | If you create a new ClusterRole that matches the label selector of an existing aggregated ClusterRole, that change triggers adding the new rules into the aggregated ClusterRole. Here is an example tha", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10126"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring-endpoints\n  labels:\n    rbac.example.com/aggregate-to-monitoring: \"true\"\n# When you create the \"monitoring-endpoints\" ClusterRole,\n# the rules below will be added to the \"monitoring\" ClusterRole.\nrules:\n- apiGroups: [\"\"]\n  resources: [\"services\", \"endpointslices\", \"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | The default user-facing roles use ClusterRole aggregation. This lets you, as a cluster administrator, include rules for custom resources, such as those served by CustomResourceDefinitions or aggregate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10127"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: aggregate-cron-tabs-edit\n  labels:\n    # Add these permissions to the \"admin\" and \"edit\" default roles.\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: aggregate-cron-tabs-view\n  labels:\n    # Add these permissions to the \"view\" default role.\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\nUsing RBAC Authorization | The following examples are excerpts from Role or ClusterRole objects, showing only the rules section.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10128"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: User\n  name: \"alice@example.com\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For a group named frontend-admins:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10129"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: \"frontend-admins\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For the default service account in the \"kube-system\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10130"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: kube-system\n```\n\nUsing RBAC Authorization | For all service accounts in the \"qa\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10131"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts:qa\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all service accounts in any namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10132"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all authenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10133"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all unauthenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10134"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | For all users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10135"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\nUsing RBAC Authorization | API servers create a set of default ClusterRole and ClusterRoleBinding objects. Many of these are system: prefixed, which indicates that the resource is directly managed by the cluster control plane.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10136"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl get clusterroles system:discovery -o yaml\n```\n\nUsing RBAC Authorization | Some of the default ClusterRoles are not system: prefixed. These are intended to be user-facing roles. They include super-user roles (cluster-admin), roles intended to be granted cluster-wide using Cl", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10137"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: role-grantor\nrules:\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"rolebindings\"]\n  verbs: [\"create\"]\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"clusterroles\"]\n  verbs: [\"bind\"]\n  # omit resourceNames to allow binding any ClusterRole\n  resourceNames: [\"admin\",\"edit\",\"view\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: role-grantor-binding\n  namespace: user-1-namespace\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: role-grantor\nsubjects:\n- apiGroup: rbac.authorization.k8s.io\n  kind: User\n  name: user-1\n```\n\nUsing RBAC Authorization | When bootstrapping the first roles and role bindings, it is necessary for the initial user to grant permissions they do not yet have. To bootstrap initial roles and role bindings:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10138"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\nUsing RBAC Authorization | Create a Role named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10139"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\nUsing RBAC Authorization | Create a Role named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10140"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=replicasets.apps\n```\n\nUsing RBAC Authorization | Create a Role named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10141"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\nUsing RBAC Authorization | Create a Role named \"my-component-lease-holder\" with permissions to get/update a resource with a specific name:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10142"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create role my-component-lease-holder --verb=get,list,watch,update --resource=lease --resource-name=my-component\n```\n\nUsing RBAC Authorization | Creates a ClusterRole. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10143"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10144"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10145"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=replicasets.apps\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10146"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"foo\" with nonResourceURL specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10147"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\nUsing RBAC Authorization | Create a ClusterRole named \"monitoring\" with an aggregationRule specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10148"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\nUsing RBAC Authorization | Grants a Role or ClusterRole within a specific namespace. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10149"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding bob-admin-binding --clusterrole=admin --user=bob --namespace=acme\n```\n\nUsing RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to the service account in the namespace \"acme\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10150"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp --namespace=acme\n```\n\nUsing RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to a service account in the namespace \"myappnamespace\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10151"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myappnamespace-myapp-view-binding --clusterrole=view --serviceaccount=myappnamespace:myapp --namespace=acme\n```\n\nUsing RBAC Authorization | Grants a ClusterRole across the entire cluster (all namespaces). Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10152"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding root-cluster-admin-binding --clusterrole=cluster-admin --user=root\n```\n\nUsing RBAC Authorization | Across the entire cluster, grant the permissions in the \"system:node-proxier\" ClusterRole to a user named \"system:kube-proxy\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10153"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding kube-proxy-binding --clusterrole=system:node-proxier --user=system:kube-proxy\n```\n\nUsing RBAC Authorization | Across the entire cluster, grant the permissions in the \"view\" ClusterRole to a service account named \"myapp\" in the namespace \"acme\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10154"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp\n```\n\nUsing RBAC Authorization | Creates or updates rbac.authorization.k8s.io/v1 API objects from a manifest file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10155"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --dry-run=client\n```\n\nUsing RBAC Authorization | Apply a manifest file of RBAC objects, preserving any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10156"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\nUsing RBAC Authorization | Apply a manifest file of RBAC objects, removing any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10157"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --remove-extra-subjects --remove-extra-permissions\n```\n\nUsing RBAC Authorization | Default RBAC policies grant scoped permissions to control-plane components, nodes, and controllers, but grant no permissions to service accounts outside the kube-system namespace (beyond the permissio", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10158"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding my-sa-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:my-sa \\\n  --namespace=my-namespace\n```\n\nUsing RBAC Authorization | Grant a role to the \"default\" service account in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10159"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding default-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:default \\\n  --namespace=my-namespace\n```\n\nUsing RBAC Authorization | Many add-ons run as the \"default\" service account in the kube-system namespace. To allow those add-ons to run with super-user access, grant cluster-admin permissions to the \"default\" service account i", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10160"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding add-on-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --serviceaccount=kube-system:default\n```\n\nUsing RBAC Authorization | Grant a role to all service accounts in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10161"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n  --group=system:serviceaccounts:my-namespace \\\n  --namespace=my-namespace\n```\n\nUsing RBAC Authorization | Grant a limited role to all service accounts cluster-wide (discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10162"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n --group=system:serviceaccounts\n```\n\nUsing RBAC Authorization | Grant super-user access to all service accounts cluster-wide (strongly discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10163"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --group=system:serviceaccounts\n```\n\nUsing RBAC Authorization | Kubernetes clusters created before Kubernetes v1.22 include write access to EndpointSlices (and the now-deprecated Endpoints API) in the aggregated \"edit\" and \"admin\" roles. As a mitigation for CVE-20", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10164"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\naccess/endpoints-aggregated.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\nUsing RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10165"}
{"instruction": "Write a yaml example for using rbac authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\nUsing RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10166"}
{"instruction": "Write a bash example for using rbac authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding permissive-binding \\\n  --clusterrole=cluster-admin \\\n  --user=admin \\\n  --user=kubelet \\\n  --group=system:serviceaccounts\n```\n\nUsing RBAC Authorization | After you have transitioned to use RBAC, you should adjust the access controls for your cluster to ensure that these meet your information security needs.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/rbac/", "id": "k8s_00637_code_10167"}
{"instruction": "How do you debugging kubernetes nodes with crictl in Kubernetes?", "response": "Debugging Kubernetes nodes with crictlFEATURE STATE: Kubernetes v1.11 [stable]crictl is a command-line interface for CRI-compatible container runtimes. You can use it to inspect and debug container runtimes and applications on a Kubernetes node. crictl and its source are hosted in the cri-tools repository.Before you begincrictl requires a Linux operating system with a CRI runtime.Installing crictlYou can download a compressed archive crictl from the cri-tools release page, for several different architectures. Download the version that corresponds to your version of Kubernetes. Extract it and move it to a location on your system path, such as /usr/local/bin/.General usageThe crictl command has several subcommands and runtime flags. Use crictl help or crictl <subcommand> help for more details.You can set the endpoint for crictl by doing one of the following:Set the --runtime-endpoint and --image-endpoint flags.Set the CONTAINER_RUNTIME_ENDPOINT and IMAGE_SERVICE_ENDPOINT environment variables.Set the endpoint in the configuration file /etc/crictl.yaml. To specify a different file, use the --config=PATH_TO_FILE flag when you run crictl.Note:If you don't set an endpoint, crictl attempts to connect to a list of known endpoints, which might result in an impact to performance.You can also specify timeout values when connecting to the server and enable or disable debugging, by specifying timeout or debug values in the configuration file or using the --timeout and --debug command-line flags.To view or edit the current configuration, view or edit the contents of /etc/crictl.yaml. For example, the configuration when using the containerd container runtime would be similar to this:runtime-endpoint: unix:///var/run/containerd/containerd.sock image-endpoint: unix:///var/run/containerd/containerd.sock timeout: 10 debug: true To learn more about crictl, refer to the crictl documentation.Example crictl commandsThe following examples show some crictl commands and example output.List podsList all pods:crictl pods The output is similar to this:POD ID CREATED STATE NAME NAMESPACE ATTEMPT 926f1b5a1d33a About a minute ago Ready sh-84d7dcf559-4r2gq default 0 4dccb216c4adb About a minute ago Ready nginx-65899c769f-wv2gp default 0 a86316e96fa89 17 hours ago Ready kube-proxy-gblk4 kube-system 0 919630b8f81f1 17 hours ago Ready nvidia-device-plugin-zgbbv kube-system 0 List pods by name:crictl pods --name nginx-65899c769f-wv2gp The output is similar to this:POD ID CREATED STATE NAME NAMESPACE ATTEMPT 4dccb216c4adb 2 minutes ago Ready nginx-65899c769f-wv2gp default 0 List pods by label:crictl pods --label run=nginx The output is similar to this:POD ID CREATED STATE NAME NAMESPACE ATTEMPT 4dccb216c4adb 2 minutes ago Ready nginx-65899c769f-wv2gp default 0 List imagesList all images:crictl images The output is similar to this:IMAGE TAG IMAGE ID SIZE busybox latest 8c811b4aec35f 1.15MB k8s-gcrio.azureedge.net/hyperkube-amd64 v1.10.3 e179bbfe5d238 665MB k8s-gcrio.azureedge.net/pause-amd64 3.1 da86e6ba6ca19 742kB nginx latest cd5239a0906a6 109MB List images by repository:crictl images nginx The output is similar to this:IMAGE TAG IMAGE ID SIZE nginx latest cd5239a0906a6 109MB Only list image IDs:crictl images -q The output is similar to this:sha256:8c811b4aec35f259572d0f79207bc0678df4c736eeec50bc9fec37ed936a472a sha256:e179bbfe5d238de6069f3b03fccbecc3fb4f2019af741bfff1233c4d7b2970c5 sha256:da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e sha256:cd5239a0906a6ccf0562354852fae04bc5b52d72a2aff9a871ddb6bd57553569 List containersList all containers:crictl ps -a The output is similar to this:CONTAINER ID IMAGE CREATED STATE NAME ATTEMPT 1f73f2d81bf98 busybox@sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47 7 minutes ago Running sh 1 9c5951df22c78 busybox@sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47 8 minutes ago Exited sh 0 87d3992f84f74 nginx@sha256:d0a8828cccb73397acb0073bf34f4d7d8aa315263f1e7806bf8c55d", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/crictl/", "id": "k8s_00638"}
{"instruction": "What is the reference documentation for clusterrole?", "response": "ClusterRoleClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.apiVersion: rbac.authorization.k8s.io/v1import \"k8s.io/api/rbac/v1\"ClusterRoleClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata (ObjectMeta)Standard object's metadata.aggregationRule (AggregationRule)AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRoleaggregationRule.clusterRoleSelectors ([]LabelSelector)Atomic: will be replaced during a mergeClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be addedrules ([]PolicyRule)Atomic: will be replaced during a mergeRules holds all the PolicyRules for this ClusterRolePolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.rules.apiGroups ([]string)Atomic: will be replaced during a mergeAPIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"\" represents the core API group and \"*\" represents all API groups.rules.resources ([]string)Atomic: will be replaced during a mergeResources is a list of resources this rule applies to. '*' represents all resources.rules.verbs ([]string), requiredAtomic: will be replaced during a mergeVerbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs.rules.resourceNames ([]string)Atomic: will be replaced during a mergeResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.rules.nonResourceURLs ([]string)Atomic: will be replaced during a mergeNonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.ClusterRoleListClusterRoleList is a collection of ClusterRolesapiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleListmetadata (ListMeta)Standard object's metadata.items ([]ClusterRole), requiredItems is a list of ClusterRolesOperationsget read the specified ClusterRoleHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}Parametersname (in path): string, requiredname of the ClusterRolepretty (in query): stringprettyResponse200 (ClusterRole): OK401: Unauthorizedlist list or watch objects of kind ClusterRoleHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/clusterrolesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ClusterRoleList): OK401: Unauthorizedcreate create a ClusterRoleHTTP RequestPOST /apis/rbac.authorization.k8s.io/v1/clusterrolesParametersbody: ClusterRole, requireddryRun (in query): stringdryRunfieldManager (in query)", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/", "id": "k8s_00639"}
{"instruction": "Write a yaml example for clusterrole", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\nClusterRole | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/", "id": "k8s_00639_code_10170"}
{"instruction": "Explain the Kubernetes concept: Owners and Dependents", "response": "Owners and DependentsIn Kubernetes, some objects are owners of other objects. For example, a ReplicaSet is the owner of a set of Pods. These owned objects are dependents of their owner.Ownership is different from the labels and selectors mechanism that some resources also use. For example, consider a Service that creates EndpointSlice objects. The Service uses labels to allow the control plane to determine which EndpointSlice objects are used for that Service. In addition to the labels, each EndpointSlice that is managed on behalf of a Service has an owner reference. Owner references help different parts of Kubernetes avoid interfering with objects they don’t control.Owner references in object specificationsDependent objects have a metadata.ownerReferences field that references their owner object. A valid owner reference consists of the object name and a UID within the same namespace as the dependent object. Kubernetes sets the value of this field automatically for objects that are dependents of other objects like ReplicaSets, DaemonSets, Deployments, Jobs and CronJobs, and ReplicationControllers. You can also configure these relationships manually by changing the value of this field. However, you usually don't need to and can allow Kubernetes to automatically manage the relationships.Dependent objects also have an ownerReferences.blockOwnerDeletion field that takes a boolean value and controls whether specific dependents can block garbage collection from deleting their owner object. Kubernetes automatically sets this field to true if a controller (for example, the Deployment controller) sets the value of the metadata.ownerReferences field. You can also set the value of the blockOwnerDeletion field manually to control which dependents block garbage collection.A Kubernetes admission controller controls user access to change this field for dependent resources, based on the delete permissions of the owner. This control prevents unauthorized users from delaying owner object deletion.Note:Cross-namespace owner references are disallowed by design. Namespaced dependents can specify cluster-scoped or namespaced owners. A namespaced owner must exist in the same namespace as the dependent. If it does not, the owner reference is treated as absent, and the dependent is subject to deletion once all owners are verified absent.Cluster-scoped dependents can only specify cluster-scoped owners. In v1.20+, if a cluster-scoped dependent specifies a namespaced kind as an owner, it is treated as having an unresolvable owner reference, and is not able to be garbage collected.In v1.20+, if the garbage collector detects an invalid cross-namespace ownerReference, or a cluster-scoped dependent with an ownerReference referencing a namespaced kind, a warning Event with a reason of OwnerRefInvalidNamespace and an involvedObject of the invalid dependent is reported. You can check for that kind of Event by running kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace.Ownership and finalizersWhen you tell Kubernetes to delete a resource, the API server allows the managing controller to process any finalizer rules for the resource. Finalizers prevent accidental deletion of resources your cluster may still need to function correctly. For example, if you try to delete a PersistentVolume that is still in use by a Pod, the deletion does not happen immediately because the PersistentVolume has the kubernetes.io/pv-protection finalizer on it. Instead, the volume remains in the Terminating status until Kubernetes clears the finalizer, which only happens after the PersistentVolume is no longer bound to a Pod.Kubernetes also adds finalizers to an owner resource when you use either foreground or orphan cascading deletion. In foreground deletion, it adds the foreground finalizer so that the controller must delete dependent resources that also have ownerReferences.blockOwnerDeletion=true before it deletes the owner. If you specify an orphan deletion policy", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/", "id": "k8s_00640"}
{"instruction": "Write a bash example for owners and dependents", "response": "Here's a bash example:\n\n```bash\nkubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace\n```\n\nOwners and Dependents | When you tell Kubernetes to delete a resource, the API server allows the managing controller to process any finalizer rules for the resource. Finalizers prevent accidental deletion of resources your c", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/", "id": "k8s_00640_code_10172"}
{"instruction": "Explain the Kubernetes concept: Device Plugins", "response": "Device PluginsDevice plugins let you configure your cluster with support for devices or resources that require vendor-specific setup, such as GPUs, NICs, FPGAs, or non-volatile main memory.FEATURE STATE: Kubernetes v1.26 [stable]Kubernetes provides a device plugin framework that you can use to advertise system hardware resources to the Kubelet.Instead of customizing the code for Kubernetes itself, vendors can implement a device plugin that you deploy either manually or as a DaemonSet. The targeted devices include GPUs, high-performance NICs, FPGAs, InfiniBand adapters, and other similar computing resources that may require vendor specific initialization and setup.Device plugin registrationThe kubelet exports a Registration gRPC service:service Registration { rpc Register(RegisterRequest) returns (Empty) {} } A device plugin can register itself with the kubelet through this gRPC service. During the registration, the device plugin needs to send:The name of its Unix socket.The Device Plugin API version against which it was built.The ResourceName it wants to advertise. Here ResourceName needs to follow the extended resource naming scheme as vendor-domain/resourcetype. (For example, an NVIDIA GPU is advertised as nvidia.com/gpu.)Following a successful registration, the device plugin sends the kubelet the list of devices it manages, and the kubelet is then in charge of advertising those resources to the API server as part of the kubelet node status update. For example, after a device plugin registers hardware-vendor.example/foo with the kubelet and reports two healthy devices on a node, the node status is updated to advertise that the node has 2 \"Foo\" devices installed and available.Then, users can request devices as part of a Pod specification (see container). Requesting extended resources is similar to how you manage requests and limits for other resources, with the following differences:Extended resources are only supported as integer resources and cannot be overcommitted.Devices cannot be shared between containers.ExampleSuppose a Kubernetes cluster is running a device plugin that advertises resource hardware-vendor.example/foo on certain nodes. Here is an example of a pod requesting this resource to run a demo workload:--- apiVersion: v1 kind: Pod metadata: name: demo-pod spec: containers: - name: demo-container-1 image: registry.k8s.io/pause:3.8 resources: limits: hardware-vendor.example/foo: 2 # # This Pod needs 2 of the hardware-vendor.example/foo devices # and can only schedule onto a Node that's able to satisfy # that need. # # If the Node has more than 2 of those devices available, the # remainder would be available for other Pods to use. Device plugin implementationThe general workflow of a device plugin includes the following steps:Initialization. During this phase, the device plugin performs vendor-specific initialization and setup to make sure the devices are in a ready state.The plugin starts a gRPC service, with a Unix socket under the host path /var/lib/kubelet/device-plugins/, that implements the following interfaces:service DevicePlugin { // GetDevicePluginOptions returns options to be communicated with Device Manager. rpc GetDevicePluginOptions(Empty) returns (DevicePluginOptions) {} // ListAndWatch returns a stream of List of Devices // Whenever a Device state change or a Device disappears, ListAndWatch // returns the new list rpc ListAndWatch(Empty) returns (stream ListAndWatchResponse) {} // Allocate is called during container creation so that the Device // Plugin can run device specific operations and instruct Kubelet // of the steps to make the Device available in the container rpc Allocate(AllocateRequest) returns (AllocateResponse) {} // GetPreferredAllocation returns a preferred set of devices to allocate // from a list of available ones. The resulting preferred allocation is not // guaranteed to be the allocation ultimately performed by the // devicemanager. It is only designed to help the devicemanager", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/", "id": "k8s_00641"}
{"instruction": "Write a yaml example for device plugins", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: demo-pod\nspec:\n  containers:\n    - name: demo-container-1\n      image: registry.k8s.io/pause:3.8\n      resources:\n        limits:\n          hardware-vendor.example/foo: 2\n#\n# This Pod needs 2 of the hardware-vendor.example/foo devices\n# and can only schedule onto a Node that's able to satisfy\n# that need.\n#\n# If the Node has more than 2 of those devices available, the\n# remainder would be available for other Pods to use.\n```\n\nDevice Plugins | The general workflow of a device plugin includes the following steps:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/", "id": "k8s_00641_code_10174"}
{"instruction": "Write a yaml example for device plugins", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: demo-pod\nspec:\n  containers:\n    - name: demo-container-1\n      image: registry.k8s.io/pause:3.8\n      resources:\n        limits:\n          hardware-vendor.example/foo: 2\n#\n# This Pod needs 2 of the hardware-vendor.example/foo devices\n# and can only schedule onto a Node that's able to satisfy\n# that need.\n#\n# If the Node has more than 2 of those devices available, the\n# remainder would be available for other Pods to use.\n```\n\nDevice Plugins | The general workflow of a device plugin includes the following steps:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/", "id": "k8s_00641_code_10175"}
{"instruction": "Write a yaml example for device plugins", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: demo-pod\nspec:\n  containers:\n    - name: demo-container-1\n      image: registry.k8s.io/pause:3.8\n      resources:\n        limits:\n          hardware-vendor.example/foo: 2\n#\n# This Pod needs 2 of the hardware-vendor.example/foo devices\n# and can only schedule onto a Node that's able to satisfy\n# that need.\n#\n# If the Node has more than 2 of those devices available, the\n# remainder would be available for other Pods to use.\n```\n\nDevice Plugins | The general workflow of a device plugin includes the following steps:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/", "id": "k8s_00641_code_10176"}
{"instruction": "How do you assign cpu resources to containers and pods in Kubernetes?", "response": "Assign CPU Resources to Containers and PodsThis page shows how to assign a CPU request and a CPU limit to a container. Containers cannot use more CPU than the configured limit. Provided the system has CPU time free, a container is guaranteed to be allocated as much CPU as it requests.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Your cluster must have at least 1 CPU available for use to run the task examples.A few of the steps on this page require you to run the metrics-server service in your cluster. If you have the metrics-server running, you can skip those steps.If you are running Minikube, run the following command to enable metrics-server:minikube addons enable metrics-server To see whether metrics-server (or another provider of the resource metrics API, metrics.k8s.io) is running, type the following command:kubectl get apiservices If the resource metrics API is available, the output will include a reference to metrics.k8s.io.NAME v1beta1.metrics.k8s.io Create a namespaceCreate a Namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace cpu-example Specify a CPU request and a CPU limitTo specify a CPU request for a container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.In this exercise, you create a Pod that has one container. The container has a request of 0.5 CPU and a limit of 1 CPU. Here is the configuration file for the Pod:pods/resource/cpu-request-limit.yaml apiVersion: v1 kind: Pod metadata: name: cpu-demo namespace: cpu-example spec: containers: - name: cpu-demo-ctr image: vish/stress resources: limits: cpu: \"1\" requests: cpu: \"0.5\" args: - -cpus - \"2\" The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example Verify that the Pod is running:kubectl get pod cpu-demo --namespace=cpu-example View detailed information about the Pod:kubectl get pod cpu-demo --output=yaml --namespace=cpu-example The output shows that the one container in the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.resources: limits: cpu: \"1\" requests: cpu: 500m Use kubectl top to fetch the metrics for the Pod:kubectl top pod cpu-demo --namespace=cpu-example This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.NAME CPU(cores) MEMORY(bytes) cpu-demo 974m <something> Recall that by setting -cpu \"2\", you configured the Container to attempt to use 2 CPUs, but the Container is only being allowed to use about 1 CPU. The container's CPU use is being throttled, because the container is attempting to use more CPU resources than its limit.Note:Another possible explanation for the CPU use being below 1.0 is that the Node might not have enough CPU resources available. Recall that the prerequisites for this exercise require your cluster to have at least 1 CPU available for use. If your Container runs on a Node that has only 1 CPU, the Container cannot use more than 1 CPU regardless of the CPU limit specified for the Container.CPU unitsThe CPU resource is measured in CPU units. One CPU, in Kubernetes, is equivalent to:1 AWS vCPU1 GCP Core1 Azure vCore1 Hyperthread on a bare-metal Intel processor with HyperthreadingFractional values are allowed. A Container that re", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\nAssign CPU Resources to Containers and Pods | If the resource metrics API is available, the output will include a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10178"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | To specify a CPU request for a container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10179"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10180"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10181"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10182"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | The output shows that the one container in the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10183"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10184"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | CPU requests and limits are associated with Containers, but it is useful to think of a Pod as having a CPU request and limit. The CPU request for a Pod is the sum of the CPU requests for all the Conta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10185"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10186"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10187"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo-2 --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | The output shows that the Pod status is Pending. That is, the Pod has not been scheduled to run on any Node, and it will remain in the Pending state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10188"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod cpu-demo-2 --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient CPU resources on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10189"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo-2 --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | If you do not specify a CPU limit for a Container, then one of these situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10190"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10191"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10192"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n    cpu: \"1\"\n  requests:\n    cpu: 500m\n```\n\nAssign CPU Resources to Containers and Pods | Use kubectl top to fetch the metrics for the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10193"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10194"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\nAssign CPU Resources to Containers and Pods | If the resource metrics API is available, the output will include a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10195"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | To specify a CPU request for a container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10196"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\npods/resource/cpu-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10197"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10198"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10199"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10200"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | The output shows that the one container in the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10201"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10202"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | CPU requests and limits are associated with Containers, but it is useful to think of a Pod as having a CPU request and limit. The CPU request for a Pod is the sum of the CPU requests for all the Conta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10203"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\npods/resource/cpu-request-limit-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10204"}
{"instruction": "Write a yaml example for assign cpu resources to containers and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\nAssign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10205"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10206"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo-2 --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | The output shows that the Pod status is Pending. That is, the Pod has not been scheduled to run on any Node, and it will remain in the Pending state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10207"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod cpu-demo-2 --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient CPU resources on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10208"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo-2 --namespace=cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | If you do not specify a CPU limit for a Container, then one of these situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10209"}
{"instruction": "Write a bash example for assign cpu resources to containers and pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace cpu-example\n```\n\nAssign CPU Resources to Containers and Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/", "id": "k8s_00642_code_10210"}
{"instruction": "Explain the Kubernetes concept: Autoscaling Workloads", "response": "Autoscaling WorkloadsWith autoscaling, you can automatically update your workloads in one way or another. This allows your cluster to react to changes in resource demand more elastically and efficiently.In Kubernetes, you can scale a workload depending on the current demand of resources. This allows your cluster to react to changes in resource demand more elastically and efficiently.When you scale a workload, you can either increase or decrease the number of replicas managed by the workload, or adjust the resources available to the replicas in-place.The first approach is referred to as horizontal scaling, while the second is referred to as vertical scaling.There are manual and automatic ways to scale your workloads, depending on your use case.Scaling workloads manuallyKubernetes supports manual scaling of workloads. Horizontal scaling can be done using the kubectl CLI. For vertical scaling, you need to patch the resource definition of your workload.See below for examples of both strategies.Horizontal scaling: Running multiple instances of your appVertical scaling: Resizing CPU and memory resources assigned to containersScaling workloads automaticallyKubernetes also supports automatic scaling of workloads, which is the focus of this page.The concept of Autoscaling in Kubernetes refers to the ability to automatically update an object that manages a set of Pods (for example a Deployment).Scaling workloads horizontallyIn Kubernetes, you can automatically scale a workload horizontally using a HorizontalPodAutoscaler (HPA).It is implemented as a Kubernetes API resource and a controller and periodically adjusts the number of replicas in a workload to match observed resource utilization such as CPU or memory usage.There is a walkthrough tutorial of configuring a HorizontalPodAutoscaler for a Deployment.Scaling workloads verticallyFEATURE STATE: Kubernetes v1.25 [stable]You can automatically scale a workload vertically using a VerticalPodAutoscaler (VPA). Unlike the HPA, the VPA doesn't come with Kubernetes by default, but is a separate project that can be found on GitHub.Once installed, it allows you to create CustomResourceDefinitions (CRDs) for your workloads which define how and when to scale the resources of the managed replicas.Note:You will need to have the Metrics Server installed to your cluster for the VPA to work.At the moment, the VPA can operate in four different modes:Different modes of the VPAModeDescriptionAutoCurrently Recreate. This might change to in-place updates in the future.RecreateThe VPA assigns resource requests on pod creation as well as updates them on existing pods by evicting them when the requested resources differ significantly from the new recommendationInitialThe VPA only assigns resource requests on pod creation and never changes them later.OffThe VPA does not automatically change the resource requirements of the pods. The recommendations are calculated and can be inspected in the VPA object.In-place pod vertical scalingFEATURE STATE: Kubernetes v1.33 [beta] (enabled by default: true)As of Kubernetes 1.34, VPA does not support resizing pods in-place, but this integration is being worked on. For manually resizing pods in-place, see Resize Container Resources In-Place.Autoscaling based on cluster sizeFor workloads that need to be scaled based on the size of the cluster (for example cluster-dns or other system components), you can use the Cluster Proportional Autoscaler. Just like the VPA, it is not part of the Kubernetes core, but hosted as its own project on GitHub.The Cluster Proportional Autoscaler watches the number of schedulable nodes and cores and scales the number of replicas of the target workload accordingly.If the number of replicas should stay the same, you can scale your workloads vertically according to the cluster size using the Cluster Proportional Vertical Autoscaler. The project is currently in beta and can be found on GitHub.While the Cluster Proportional Autoscaler scales the number ", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/autoscaling/", "id": "k8s_00643"}
{"instruction": "How do you weave net for networkpolicy in Kubernetes?", "response": "Weave Net for NetworkPolicyThis page shows how to use Weave Net for NetworkPolicy.Before you beginYou need to have a Kubernetes cluster. Follow the kubeadm getting started guide to bootstrap one.Install the Weave Net addonFollow the Integrating Kubernetes via the Addon guide.The Weave Net addon for Kubernetes comes with a Network Policy Controller that automatically monitors Kubernetes for any NetworkPolicy annotations on all namespaces and configures iptables rules to allow or block traffic as directed by the policies.Test the installationVerify that the weave works.Enter the following command:kubectl get pods -n kube-system -o wide The output is similar to this:NAME READY STATUS RESTARTS AGE IP NODE weave-net-1t1qg 2/2 Running 0 9d 192.168.2.10 worknode3 weave-net-231d7 2/2 Running 1 7d 10.2.0.17 worknodegpu weave-net-7nmwt 2/2 Running 3 9d 192.168.2.131 masternode weave-net-pmw8w 2/2 Running 0 9d 192.168.2.216 worknode2 Each Node has a weave Pod, and all Pods are Running and 2/2 READY. (2/2 means that each Pod has weave and weave-npc.)What's nextOnce you have installed the Weave Net addon, you can follow the Declare Network Policy to try out Kubernetes NetworkPolicy. If you have any question, contact us at #weave-community on Slack or Weave User Group.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/weave-network-policy/", "id": "k8s_00644"}
{"instruction": "Write a bash example for weave net for networkpolicy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system -o wide\n```\n\nWeave Net for NetworkPolicy | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/weave-network-policy/", "id": "k8s_00644_code_10213"}
{"instruction": "Write a bash example for weave net for networkpolicy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system -o wide\n```\n\nWeave Net for NetworkPolicy | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/weave-network-policy/", "id": "k8s_00644_code_10214"}
{"instruction": "Explain documentation style guide in Kubernetes", "response": "Documentation Style GuideThis page gives writing style guidelines for the Kubernetes documentation. These are guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.For additional information on creating new content for the Kubernetes documentation, read the Documentation Content Guide.Changes to the style guide are made by SIG Docs as a group. To propose a change or addition, add it to the agenda for an upcoming SIG Docs meeting, and attend the meeting to participate in the discussion.Note:Kubernetes documentation uses Goldmark Markdown Renderer with some adjustments along with a few Hugo Shortcodes to support glossary entries, tabs, and representing feature state.LanguageKubernetes documentation has been translated into multiple languages (see Localization READMEs).The way of localizing the docs for a different language is described in Localizing Kubernetes Documentation.The English-language documentation uses U.S. English spelling and grammar.Documentation formatting standardsUse upper camel case for API objectsWhen you refer specifically to interacting with an API object, use UpperCamelCase, also known as Pascal case. You may see different capitalization, such as \"configMap\", in the API Reference. When writing general documentation, it's better to use upper camel case, calling it \"ConfigMap\" instead.When you are generally discussing an API object, use sentence-style capitalization.The following examples focus on capitalization. For more information about formatting API object names, review the related guidance on Code Style.Do and Don't - Use Pascal case for API objectsDoDon'tThe HorizontalPodAutoscaler resource is responsible for ...The Horizontal pod autoscaler is responsible for ...A PodList object is a list of pods.A Pod List object is a list of pods.The Volume object contains a hostPath field.The volume object contains a hostPath field.Every ConfigMap object is part of a namespace.Every configMap object is part of a namespace.For managing confidential data, consider using the Secret API.For managing confidential data, consider using the secret API.Use angle brackets for placeholdersUse angle brackets for placeholders. Tell the reader what a placeholder represents, for example:Display information about a pod:kubectl describe pod <pod-name> -n <namespace> If the namespace of the pod is default, you can omit the '-n' parameter.Use bold for user interface elementsDo and Don't - Bold interface elementsDoDon'tClick Fork.Click \"Fork\".Select Other.Select \"Other\".Use italics to define or introduce new termsDo and Don't - Use italics for new termsDoDon'tA cluster is a set of nodes ...A \"cluster\" is a set of nodes ...These components form the control plane.These components form the control plane.Use code style for filenames, directories, and pathsDo and Don't - Use code style for filenames, directories, and pathsDoDon'tOpen the envars.yaml file.Open the envars.yaml file.Go to the /docs/tutorials directory.Go to the /docs/tutorials directory.Open the /_data/concepts.yaml file.Open the /_data/concepts.yaml file.Use the international standard for punctuation inside quotesDo and Don't - Use the international standard for punctuation inside quotesDoDon'tevents are recorded with an associated \"stage\".events are recorded with an associated \"stage.\"The copy is called a \"fork\".The copy is called a \"fork.\"Inline code formattingUse code style for inline code, commandsFor inline code in an HTML document, use the <code> tag. In a Markdown document, use the backtick (`). However, API kinds such as StatefulSet or ConfigMap are written verbatim (no backticks); this allows using possessive apostrophes.Do and Don't - Use code style for inline code, commands, and API objectsDoDon'tThe kubectl run command creates a Pod.The \"kubectl run\" command creates a Pod.The kubelet on each node acquires a Lease…The kubelet on each node acquires a Lease…A PersistentVolume represents durable storage…A P", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645"}
{"instruction": "Write a bash example for documentation style guide", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name> -n <namespace>\n```\n\nDocumentation Style Guide | If the namespace of the pod is default, you can omit the '-n' parameter.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10216"}
{"instruction": "Write a bash example for documentation style guide", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nDocumentation Style Guide | The output is similar to this:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10217"}
{"instruction": "Write a yaml example for documentation style guide", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1 # earlier versions use...\nkind: Pod\n...\n```\n\nDocumentation Style Guide | You can use the Docsy support for diagrams and formulae.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10218"}
{"instruction": "Write a yaml example for documentation style guide", "response": "Here's a yaml example:\n\n```yaml\n---\ntitle: <your tutorial title here>\nmin-kubernetes-server-version: v1.8\n---\n```\n\nDocumentation Style Guide | In code and configuration examples, do not include comments about alternative versions. Be careful to not include incorrect statements in your examples as comments, such as:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10219"}
{"instruction": "Write a yaml example for documentation style guide", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1 # earlier versions use...\nkind: Pod\n...\n```\n\nDocumentation Style Guide | You can use the Docsy support for diagrams and formulae.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10220"}
{"instruction": "Write a bash example for documentation style guide", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name> -n <namespace>\n```\n\nDocumentation Style Guide | If the namespace of the pod is default, you can omit the '-n' parameter.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10221"}
{"instruction": "Write a bash example for documentation style guide", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\nDocumentation Style Guide | The output is similar to this:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10222"}
{"instruction": "Write a yaml example for documentation style guide", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1 # earlier versions use...\nkind: Pod\n...\n```\n\nDocumentation Style Guide | You can use the Docsy support for diagrams and formulae.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/style/style-guide/", "id": "k8s_00645_code_10223"}
{"instruction": "Explain the Kubernetes concept: Pod Lifecycle", "response": "Pod LifecycleThis page describes the lifecycle of a Pod. Pods follow a defined lifecycle, starting in the Pending phase, moving through Running if at least one of its primary containers starts OK, and then through either the Succeeded or Failed phases depending on whether any container in the Pod terminated in failure.Like individual application containers, Pods are considered to be relatively ephemeral (rather than durable) entities. Pods are created, assigned a unique ID (UID), and scheduled to run on nodes where they remain until termination (according to restart policy) or deletion. If a Node dies, the Pods running on (or scheduled to run on) that node are marked for deletion. The control plane marks the Pods for removal after a timeout period.Pod lifetimeWhilst a Pod is running, the kubelet is able to restart containers to handle some kind of faults. Within a Pod, Kubernetes tracks different container states and determines what action to take to make the Pod healthy again.In the Kubernetes API, Pods have both a specification and an actual status. The status for a Pod object consists of a set of Pod conditions. You can also inject custom readiness information into the condition data for a Pod, if that is useful to your application.Pods are only scheduled once in their lifetime; assigning a Pod to a specific node is called binding, and the process of selecting which node to use is called scheduling. Once a Pod has been scheduled and is bound to a node, Kubernetes tries to run that Pod on the node. The Pod runs on that node until it stops, or until the Pod is terminated; if Kubernetes isn't able to start the Pod on the selected node (for example, if the node crashes before the Pod starts), then that particular Pod never starts.You can use Pod Scheduling Readiness to delay scheduling for a Pod until all its scheduling gates are removed. For example, you might want to define a set of Pods but only trigger scheduling once all the Pods have been created.Pods and fault recoveryIf one of the containers in the Pod fails, then Kubernetes may try to restart that specific container. Read How Pods handle problems with containers to learn more.Pods can however fail in a way that the cluster cannot recover from, and in that case Kubernetes does not attempt to heal the Pod further; instead, Kubernetes deletes the Pod and relies on other components to provide automatic healing.If a Pod is scheduled to a node and that node then fails, the Pod is treated as unhealthy and Kubernetes eventually deletes the Pod. A Pod won't survive an eviction due to a lack of resources or Node maintenance.Kubernetes uses a higher-level abstraction, called a controller, that handles the work of managing the relatively disposable Pod instances.A given Pod (as defined by a UID) is never \"rescheduled\" to a different node; instead, that Pod can be replaced by a new, near-identical Pod. If you make a replacement Pod, it can even have same name (as in .metadata.name) that the old Pod had, but the replacement would have a different .metadata.uid from the old Pod.Kubernetes does not guarantee that a replacement for an existing Pod would be scheduled to the same node as the old Pod that was being replaced.Associated lifetimesWhen something is said to have the same lifetime as a Pod, such as a volume, that means that the thing exists as long as that specific Pod (with that exact UID) exists. If that Pod is deleted for any reason, and even if an identical replacement is created, the related thing (a volume, in this example) is also destroyed and created anew.Figure 1.A multi-container Pod that contains a file puller sidecar and a web server. The Pod uses an ephemeral emptyDir volume for shared storage between the containers.Pod phaseA Pod's status field is a PodStatus object, which has a phase field.The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The phase is not intended to be a comprehensive rollup of observations of container or", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\nPod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10225"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\nPod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10226"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\nPod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10227"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\nPod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10228"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\nPod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10229"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\nPod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10230"}
{"instruction": "Write a bash example for pod lifecycle", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <name-of-pod>\n```\n\nPod Lifecycle | Each state has a specific meaning:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10231"}
{"instruction": "Write a bash example for pod lifecycle", "response": "Here's a bash example:\n\n```bash\nkubectl logs <name-of-pod>\n```\n\nPod Lifecycle | When a container in your Pod stops, or experiences failure, Kubernetes can restart it. A restart isn't always appropriate; for example, init containers run only once, during Pod startup.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10232"}
{"instruction": "Write a bash example for pod lifecycle", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <name-of-pod>\n```\n\nPod Lifecycle | When a container in your Pod stops, or experiences failure, Kubernetes can restart it. A restart isn't always appropriate; for example, init containers run only once, during Pod startup.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10233"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\nPod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10234"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\nPod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10235"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\nPod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10236"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\nPod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10237"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\nPod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10238"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\nPod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10239"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  os:\n    name: linux\n  containers:\n    - name: my-container\n      image: container-image:latest\n      lifecycle:\n        stopSignal: SIGUSR1\n```\n\nPod Lifecycle | If a stop signal is defined in the lifecycle, this will override the signal defined in the container image. If no stop signal is defined in the container spec, the container would fall back to the def", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10240"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\nPod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10241"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\nPod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10242"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\nPod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10243"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\nPod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10244"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\nPod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10245"}
{"instruction": "Write a yaml example for pod lifecycle", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\nPod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/", "id": "k8s_00646_code_10246"}
{"instruction": "How do you tasks in Kubernetes?", "response": "This section of the Kubernetes documentation contains pages that show how to do individual tasks. A task page shows how to do a single thing, typically by giving a short sequence of steps.If you would like to write a task page, see Creating a Documentation Pull Request.Install ToolsSet up Kubernetes tools on your computer.Administer a ClusterLearn common tasks for administering a cluster.Configure Pods and ContainersPerform common configuration tasks for Pods and containers.Monitoring, Logging, and DebuggingSet up monitoring and logging to troubleshoot a cluster, or debug a containerized application.Manage Kubernetes ObjectsDeclarative and imperative paradigms for interacting with the Kubernetes API.Managing SecretsManaging confidential settings data using Secrets.Inject Data Into ApplicationsSpecify configuration and other data for the Pods that run your workload.Run ApplicationsRun and manage both stateless and stateful applications.Run JobsRun Jobs using parallel processing.Access Applications in a ClusterConfigure load balancing, port forwarding, or setup firewall or DNS configurations to access applications in a cluster.Extend KubernetesUnderstand advanced ways to adapt your Kubernetes cluster to the needs of your work environment.TLSUnderstand how to protect traffic within your cluster using Transport Layer Security (TLS).Manage Cluster DaemonsPerform common tasks for managing a DaemonSet, such as performing a rolling update.NetworkingLearn how to configure networking for your cluster.Extend kubectl with pluginsExtend kubectl by creating and installing kubectl plugins.Manage HugePagesConfigure and manage huge pages as a schedulable resource in a cluster.Schedule GPUsConfigure and schedule GPUs for use as a resource by nodes in a cluster.", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/", "id": "k8s_00647"}
{"instruction": "What is the reference documentation for kubectl kustomize?", "response": "kubectl kustomizeSynopsisBuild a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix specifying same with respect to the repository root. If DIR is omitted, '.' is assumed.kubectl kustomize DIR [flags] Examples # Build the current working directory kubectl kustomize # Build some shared configuration directory kubectl kustomize /home/config/production # Build from github kubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6 Options--as-current-useruse the uid and gid of the command executor to run the function in the container--enable-alpha-pluginsenable kustomize plugins--enable-helmEnable use of the Helm chart inflator generator.-e, --env stringsa list of environment variables to be used by functions--helm-api-versions stringsKubernetes api versions used by Helm for Capabilities.APIVersions--helm-command string Default: \"helm\"helm command (path to executable)--helm-debugEnable debug output from the Helm chart inflator generator.--helm-kube-version stringKubernetes version used by Helm for Capabilities.KubeVersion-h, --helphelp for kustomize--load-restrictor string Default: \"LoadRestrictionsRootOnly\"if set to 'LoadRestrictionsNone', local kustomizations may load files from outside their root. This does, however, break the relocatability of the kustomization.--mount stringsa list of storage options read from the filesystem--networkenable network access for functions that declare it--network-name string Default: \"bridge\"the docker network to run the container in-o, --output stringIf specified, write output to this path.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secur", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_kustomize/", "id": "k8s_00648"}
{"instruction": "Write a bash example for kubectl kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize DIR [flags]\n```\n\nkubectl kustomize | use the uid and gid of the command executor to run the function in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_kustomize/", "id": "k8s_00648_code_10249"}
{"instruction": "Write a bash example for kubectl kustomize", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize DIR [flags]\n```\n\nkubectl kustomize | use the uid and gid of the command executor to run the function in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_kustomize/", "id": "k8s_00648_code_10250"}
{"instruction": "What is the reference documentation for clusterrolebinding?", "response": "ClusterRoleBindingClusterRoleBinding references a ClusterRole, but not contain it.apiVersion: rbac.authorization.k8s.io/v1import \"k8s.io/api/rbac/v1\"ClusterRoleBindingClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject.apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata (ObjectMeta)Standard object's metadata.roleRef (RoleRef), requiredRoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error. This field is immutable.RoleRef contains information that points to the role being usedroleRef.apiGroup (string), requiredAPIGroup is the group for the resource being referencedroleRef.kind (string), requiredKind is the type of resource being referencedroleRef.name (string), requiredName is the name of resource being referencedsubjects ([]Subject)Atomic: will be replaced during a mergeSubjects holds references to the objects the role applies to.Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.subjects.kind (string), requiredKind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.subjects.name (string), requiredName of the object being referenced.subjects.apiGroup (string)APIGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.subjects.namespace (string)Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.ClusterRoleBindingListClusterRoleBindingList is a collection of ClusterRoleBindingsapiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingListmetadata (ListMeta)Standard object's metadata.items ([]ClusterRoleBinding), requiredItems is a list of ClusterRoleBindingsOperationsget read the specified ClusterRoleBindingHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}Parametersname (in path): string, requiredname of the ClusterRoleBindingpretty (in query): stringprettyResponse200 (ClusterRoleBinding): OK401: Unauthorizedlist list or watch objects of kind ClusterRoleBindingHTTP RequestGET /apis/rbac.authorization.k8s.io/v1/clusterrolebindingsParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ClusterRoleBindingList): OK401: Unauthorizedcreate create a ClusterRoleBindingHTTP RequestPOST /apis/rbac.authorization.k8s.io/v1/clusterrolebindingsParametersbody: ClusterRoleBinding, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (ClusterRoleBinding): OK201 (ClusterRoleBinding): Created202 (ClusterRoleBinding): Accepted401: Unauthorizedupdate replace the specified ClusterRoleBindingHTTP RequestPUT /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}Parametersname (in path): string, requiredname of the ClusterRoleBindingbody: ClusterRoleBinding, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (ClusterRoleBi", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-binding-v1/", "id": "k8s_00649"}
{"instruction": "Write a yaml example for clusterrolebinding", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\nClusterRoleBinding | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-binding-v1/", "id": "k8s_00649_code_10252"}
{"instruction": "Explain getting started in Kubernetes", "response": "This section lists the different ways to set up and run Kubernetes. When you install Kubernetes, choose an installation type based on: ease of maintenance, security, control, available resources, and expertise required to operate and manage a cluster.You can download Kubernetes to deploy a Kubernetes cluster on a local machine, into the cloud, or for your own datacenter.Several Kubernetes components such as kube-apiserver or kube-proxy can also be deployed as container images within the cluster.It is recommended to run Kubernetes components as container images wherever that is possible, and to have Kubernetes manage those components. Components that run containers - notably, the kubelet - can't be included in this category.If you don't want to manage a Kubernetes cluster yourself, you could pick a managed service, including certified platforms. There are also other standardized and custom solutions across a wide range of cloud and bare metal environments.Learning environmentIf you're learning Kubernetes, use the tools supported by the Kubernetes community, or tools in the ecosystem to set up a Kubernetes cluster on a local machine. See Install tools.Production environmentWhen evaluating a solution for a production environment, consider which aspects of operating a Kubernetes cluster (or abstractions) you want to manage yourself and which you prefer to hand off to a provider.For a cluster you're managing yourself, the officially supported tool for deploying Kubernetes is kubeadm.What's nextDownload KubernetesDownload and install tools including kubectlSelect a container runtime for your new clusterLearn about best practices for cluster setupKubernetes is designed for its control plane to run on Linux. Within your cluster you can run applications on Linux or other operating systems, including Windows.Learn to set up clusters with Windows nodes", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/", "id": "k8s_00650"}
{"instruction": "How do you share process namespace between containers in a pod in Kubernetes?", "response": "Share Process Namespace between Containers in a PodThis page shows how to configure process namespace sharing for a pod. When process namespace sharing is enabled, processes in a container are visible to all other containers in the same pod.You can use this feature to configure cooperating containers, such as a log handler sidecar container, or to troubleshoot container images that don't include debugging utilities like a shell.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesConfigure a PodProcess namespace sharing is enabled using the shareProcessNamespace field of .spec for a Pod. For example:pods/share-process-namespace.yaml apiVersion: v1 kind: Pod metadata: name: nginx spec: shareProcessNamespace: true containers: - name: nginx image: nginx - name: shell image: busybox:1.28 command: [\"sleep\", \"3600\"] securityContext: capabilities: add: - SYS_PTRACE stdin: true tty: true Create the pod nginx on your cluster:kubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml Attach to the shell container and run ps:kubectl exec -it nginx -c shell -- /bin/sh If you don't see a command prompt, try pressing enter. In the container shell:# run this inside the \"shell\" container ps ax The output is similar to this:PID USER TIME COMMAND 1 root 0:00 /pause 8 root 0:00 nginx: master process nginx -g daemon off; 14 101 0:00 nginx: worker process 15 root 0:00 sh 21 root 0:00 ps ax You can signal processes in other containers. For example, send SIGHUP to nginx to restart the worker process. This requires the SYS_PTRACE capability.# run this inside the \"shell\" container kill -HUP 8 # change \"8\" to match the PID of the nginx leader process, if necessary ps ax The output is similar to this:PID USER TIME COMMAND 1 root 0:00 /pause 8 root 0:00 nginx: master process nginx -g daemon off; 15 root 0:00 sh 22 101 0:00 nginx: worker process 23 root 0:00 ps ax It's even possible to access the file system of another container using the /proc/$pid/root link.# run this inside the \"shell\" container # change \"8\" to the PID of the Nginx process, if necessary head /proc/8/root/etc/nginx/nginx.conf The output is similar to this:user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; Understanding process namespace sharingPods share many resources so it makes sense they would also share a process namespace. Some containers may expect to be isolated from others, though, so it's important to understand the differences:The container process no longer has PID 1. Some containers refuse to start without PID 1 (for example, containers using systemd) or run commands like kill -HUP 1 to signal the container process. In pods with a shared process namespace, kill -HUP 1 will signal the pod sandbox (/pause in the above example).Processes are visible to other containers in the pod. This includes all information visible in /proc, such as passwords that were passed as arguments or environment variables. These are protected only by regular Unix permissions.Container filesystems are visible to other containers in the pod through the /proc/$pid/root link. This makes debugging easier, but it also means that filesystem secrets are protected only by filesystem permissions.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651"}
{"instruction": "Write a yaml example for share process namespace between containers in a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\nShare Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10255"}
{"instruction": "Write a bash example for share process namespace between containers in a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml\n```\n\nShare Process Namespace between Containers in a Pod | Attach to the shell container and run ps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10256"}
{"instruction": "Write a bash example for share process namespace between containers in a pod", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it nginx -c shell -- /bin/sh\n```\n\nShare Process Namespace between Containers in a Pod | If you don't see a command prompt, try pressing enter. In the container shell:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10257"}
{"instruction": "Write a yaml example for share process namespace between containers in a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\nShare Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10258"}
{"instruction": "Write a yaml example for share process namespace between containers in a pod", "response": "Here's a yaml example:\n\n```yaml\npods/share-process-namespace.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\nShare Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10259"}
{"instruction": "Write a yaml example for share process namespace between containers in a pod", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\nShare Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10260"}
{"instruction": "Write a bash example for share process namespace between containers in a pod", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml\n```\n\nShare Process Namespace between Containers in a Pod | Attach to the shell container and run ps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10261"}
{"instruction": "Write a bash example for share process namespace between containers in a pod", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it nginx -c shell -- /bin/sh\n```\n\nShare Process Namespace between Containers in a Pod | If you don't see a command prompt, try pressing enter. In the container shell:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/", "id": "k8s_00651_code_10262"}
{"instruction": "What is the reference documentation for kubectl create service nodeport?", "response": "kubectl create service nodeportSynopsisCreate a NodePort service with the specified name.kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none] Examples # Create a new NodePort service named my-ns kubectl create service nodeport my-ns --tcp=5678:8080 Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for nodeport--node-port intPort used to expose the service on each node in a cluster.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--tcp stringsPort pairs can be specified as '<port>:<targetPort>'.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server reque", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_nodeport/", "id": "k8s_00652"}
{"instruction": "Write a bash example for kubectl create service nodeport", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\nkubectl create service nodeport | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_nodeport/", "id": "k8s_00652_code_10264"}
{"instruction": "Write a bash example for kubectl create service nodeport", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\nkubectl create service nodeport | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_service_nodeport/", "id": "k8s_00652_code_10265"}
{"instruction": "What is the reference documentation for client authentication (v1)?", "response": "Client Authentication (v1)Resource TypesExecCredentialExecCredentialExecCredential is used by exec-based plugins to communicate credentials to HTTP transports.FieldDescriptionapiVersionstringclient.authentication.k8s.io/v1kindstringExecCredentialspec [Required]ExecCredentialSpecSpec holds information passed to the plugin by the transport.statusExecCredentialStatusStatus is filled in by the plugin and holds the credentials that the transport should use to contact the API.ClusterAppears in:ExecCredentialSpecCluster contains information to allow an exec plugin to communicate with the kubernetes cluster being authenticated to.To ensure that this struct contains everything someone would need to communicate with a kubernetes cluster (just like they would via a kubeconfig), the fields should shadow \"k8s.io/client-go/tools/clientcmd/api/v1\".Cluster, with the exception of CertificateAuthority, since CA data will always be passed to the plugin as bytes.FieldDescriptionserver [Required]stringServer is the address of the kubernetes cluster (https://hostname:port).tls-server-namestringTLSServerName is passed to the server for SNI and is used in the client to check server certificates against. If ServerName is empty, the hostname used to contact the server is used.insecure-skip-tls-verifyboolInsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure.certificate-authority-data[]byteCAData contains PEM-encoded certificate authority certificates. If empty, system roots should be used.proxy-urlstringProxyURL is the URL to the proxy to be used for all requests to this cluster.disable-compressionboolDisableCompression allows client to opt-out of response compression for all requests to the server. This is useful to speed up requests (specifically lists) when client-server network bandwidth is ample, by saving time on compression (server-side) and decompression (client-side): https://github.com/kubernetes/kubernetes/issues/112296.configk8s.io/apimachinery/pkg/runtime.RawExtensionConfig holds additional config data that is specific to the exec plugin with regards to the cluster being authenticated to.This data is sourced from the clientcmd Cluster object's extensions[client.authentication.k8s.io/exec] field:clusters:name: my-cluster cluster: ... extensions:name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config extension: audience: 06e3fbd18de8 # arbitrary configIn some environments, the user config may be exactly the same across many clusters (i.e. call this exec plugin) minus some details that are specific to each cluster such as the audience. This field allows the per cluster config to be directly specified with the cluster info. Using this field to store secret data is not recommended as one of the prime benefits of exec plugins is that no secrets need to be stored directly in the kubeconfig.ExecCredentialSpecAppears in:ExecCredentialExecCredentialSpec holds request and runtime specific information provided by the transport.FieldDescriptionclusterClusterCluster contains information to allow an exec plugin to communicate with the kubernetes cluster being authenticated to. Note that Cluster is non-nil only when provideClusterInfo is set to true in the exec provider config (i.e., ExecConfig.ProvideClusterInfo).interactive [Required]boolInteractive declares whether stdin has been passed to this exec plugin.ExecCredentialStatusAppears in:ExecCredentialExecCredentialStatus holds credentials for the transport to use.Token and ClientKeyData are sensitive fields. This data should only be transmitted in-memory between client and exec plugin process. Exec plugin itself should at least be protected via file permissions.FieldDescriptionexpirationTimestampmeta/v1.TimeExpirationTimestamp indicates a time when the provided credentials expire.token [Required]stringToken is a bearer token used by the client for request authentication.clientCertificateData [Requ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/client-authentication.v1/", "id": "k8s_00653"}
{"instruction": "Explain the Kubernetes concept: Pod Security Standards", "response": "Pod Security StandardsA detailed look at the different policy levels defined in the Pod Security Standards.The Pod Security Standards define three different policies to broadly cover the security spectrum. These policies are cumulative and range from highly-permissive to highly-restrictive. This guide outlines the requirements of each policy.ProfileDescriptionPrivilegedUnrestricted policy, providing the widest possible level of permissions. This policy allows for known privilege escalations.BaselineMinimally restrictive policy which prevents known privilege escalations. Allows the default (minimally specified) Pod configuration.RestrictedHeavily restricted policy, following current Pod hardening best practices.Profile DetailsPrivilegedThe Privileged policy is purposely-open, and entirely unrestricted. This type of policy is typically aimed at system- and infrastructure-level workloads managed by privileged, trusted users.The Privileged policy is defined by an absence of restrictions. If you define a Pod where the Privileged security policy applies, the Pod you define is able to bypass typical container isolation mechanisms. For example, you can define a Pod that has access to the node's host network.BaselineThe Baseline policy is aimed at ease of adoption for common containerized workloads while preventing known privilege escalations. This policy is targeted at application operators and developers of non-critical applications. The following listed controls should be enforced/disallowed:Note:In this table, wildcards (*) indicate all elements in a list. For example, spec.containers[*].securityContext refers to the Security Context object for all defined containers. If any of the listed containers fails to meet the requirements, the entire pod will fail validation.Baseline policy specificationControlPolicyHostProcessWindows Pods offer the ability to run HostProcess containers which enables privileged access to the Windows host machine. Privileged access to the host is disallowed in the Baseline policy.FEATURE STATE: Kubernetes v1.26 [stable]Restricted Fieldsspec.securityContext.windowsOptions.hostProcessspec.containers[*].securityContext.windowsOptions.hostProcessspec.initContainers[*].securityContext.windowsOptions.hostProcessspec.ephemeralContainers[*].securityContext.windowsOptions.hostProcessAllowed ValuesUndefined/nilfalseHost NamespacesSharing the host namespaces must be disallowed.Restricted Fieldsspec.hostNetworkspec.hostPIDspec.hostIPCAllowed ValuesUndefined/nilfalsePrivileged ContainersPrivileged Pods disable most security mechanisms and must be disallowed.Restricted Fieldsspec.containers[*].securityContext.privilegedspec.initContainers[*].securityContext.privilegedspec.ephemeralContainers[*].securityContext.privilegedAllowed ValuesUndefined/nilfalseCapabilitiesAdding additional capabilities beyond those listed below must be disallowed.Restricted Fieldsspec.containers[*].securityContext.capabilities.addspec.initContainers[*].securityContext.capabilities.addspec.ephemeralContainers[*].securityContext.capabilities.addAllowed ValuesUndefined/nilAUDIT_WRITECHOWNDAC_OVERRIDEFOWNERFSETIDKILLMKNODNET_BIND_SERVICESETFCAPSETGIDSETPCAPSETUIDSYS_CHROOTHostPath VolumesHostPath volumes must be forbidden.Restricted Fieldsspec.volumes[*].hostPathAllowed ValuesUndefined/nilHost PortsHostPorts should be disallowed entirely (recommended) or restricted to a known listRestricted Fieldsspec.containers[*].ports[*].hostPortspec.initContainers[*].ports[*].hostPortspec.ephemeralContainers[*].ports[*].hostPortAllowed ValuesUndefined/nilKnown list (not supported by the built-in Pod Security Admission controller)0Host Probes / Lifecycle Hooks (v1.34+)The Host field in probes and lifecycle hooks must be disallowed.Restricted Fieldsspec.containers[*].livenessProbe.httpGet.hostspec.containers[*].readinessProbe.httpGet.hostspec.containers[*].startupProbe.httpGet.hostspec.containers[*].livenessProbe.tcpSocket.hostspec.containers[*].readinessProbe.tcpSo", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/security/pod-security-standards/", "id": "k8s_00654"}
{"instruction": "What is the reference documentation for kubectl create secret tls?", "response": "kubectl create secret tlsSynopsisCreate a TLS secret from the given public/private key pair.The public/private key pair must exist beforehand. The public key certificate must be .PEM encoded and match the given private key.kubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none] Examples # Create a new TLS secret named tls-secret with the given key pair kubectl create secret tls tls-secret --cert=path/to/tls.crt --key=path/to/tls.key Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--append-hashAppend a hash of the secret to its name.--cert stringPath to PEM encoded public key certificate.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.-h, --helphelp for tls--key stringPath to private key associated with given certificate.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_tls/", "id": "k8s_00655"}
{"instruction": "Write a bash example for kubectl create secret tls", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]\n```\n\nkubectl create secret tls | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_tls/", "id": "k8s_00655_code_10269"}
{"instruction": "Write a bash example for kubectl create secret tls", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]\n```\n\nkubectl create secret tls | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_tls/", "id": "k8s_00655_code_10270"}
{"instruction": "How do you validate ipv4/ipv6 dual-stack in Kubernetes?", "response": "Validate IPv4/IPv6 dual-stackThis document shares how to validate IPv4/IPv6 dual-stack enabled Kubernetes clusters.Before you beginProvider support for dual-stack networking (Cloud provider or otherwise must be able to provide Kubernetes nodes with routable IPv4/IPv6 network interfaces)A network plugin that supports dual-stack networking.Dual-stack enabled clusterYour Kubernetes server must be at or later than version v1.23.To check the version, enter kubectl version.Note:While you can validate with an earlier version, the feature is only GA and officially supported since v1.23.Validate addressingValidate node addressingEach dual-stack Node should have a single IPv4 block and a single IPv6 block allocated. Validate that IPv4/IPv6 Pod address ranges are configured by running the following command. Replace the sample node name with a valid dual-stack Node from your cluster. In this example, the Node's name is k8s-linuxpool1-34450317-0:kubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .spec.podCIDRs}}{{printf \"%s\\n\" .}}{{end}}' 10.244.1.0/24 2001:db8::/64 There should be one IPv4 block and one IPv6 block allocated.Validate that the node has an IPv4 and IPv6 interface detected. Replace node name with a valid node from the cluster. In this example the node name is k8s-linuxpool1-34450317-0:kubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .status.addresses}}{{printf \"%s: %s\\n\" .type .address}}{{end}}' Hostname: k8s-linuxpool1-34450317-0 InternalIP: 10.0.0.5 InternalIP: 2001:db8:10::5 Validate Pod addressingValidate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with a valid Pod in your cluster. In this example the Pod name is pod01:kubectl get pods pod01 -o go-template --template='{{range .status.podIPs}}{{printf \"%s\\n\" .ip}}{{end}}' 10.244.1.4 2001:db8::4 You can also validate Pod IPs using the Downward API via the status.podIPs fieldPath. The following snippet demonstrates how you can expose the Pod IPs via an environment variable called MY_POD_IPS within a container. env: - name: MY_POD_IPS valueFrom: fieldRef: fieldPath: status.podIPs The following command prints the value of the MY_POD_IPS environment variable from within a container. The value is a comma separated list that corresponds to the Pod's IPv4 and IPv6 addresses.kubectl exec -it pod01 -- set | grep MY_POD_IPS MY_POD_IPS=10.244.1.4,2001:db8::4 The Pod's IP addresses will also be written to /etc/hosts within a container. The following command executes a cat on /etc/hosts on a dual stack Pod. From the output you can verify both the IPv4 and IPv6 IP address for the Pod.kubectl exec -it pod01 -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.244.1.4 pod01 2001:db8::4 pod01 Validate ServicesCreate the following Service that does not explicitly define .spec.ipFamilyPolicy. Kubernetes will assign a cluster IP for the Service from the first configured service-cluster-ip-range and set the .spec.ipFamilyPolicy to SingleStack.service/networking/dual-stack-default-svc.yaml apiVersion: v1 kind: Service metadata: name: my-service labels: app.kubernetes.io/name: MyApp spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 Use kubectl to view the YAML for the Service.kubectl get svc my-service -o yaml The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv4 address from the first configured range set via --service-cluster-ip-range flag on kube-controller-manager.apiVersion: v1 kind: Service metadata: name: my-service namespace: default spec: clusterIP: 10.0.217.164 clusterIPs: - 10.0.217.164 ipFamilies: - IPv4 ipFamilyPolicy: SingleStack ports: - port: 80 protocol: TCP targetPort: 9376 selector: app.kubernetes.io/name: MyApp sessionAffinity: None type: ClusterIP status: loadBalancer: {} Create t", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .spec.podCIDRs}}{{printf \"%s\\n\" .}}{{end}}'\n```\n\nValidate IPv4/IPv6 dual-stack | There should be one IPv4 block and one IPv6 block allocated.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10272"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .status.addresses}}{{printf \"%s: %s\\n\" .type .address}}{{end}}'\n```\n\nValidate IPv4/IPv6 dual-stack | Validate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with a valid Pod in your cluster. In this example the Pod name is pod01:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10273"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get pods pod01 -o go-template --template='{{range .status.podIPs}}{{printf \"%s\\n\" .ip}}{{end}}'\n```\n\nValidate IPv4/IPv6 dual-stack | You can also validate Pod IPs using the Downward API via the status.podIPs fieldPath. The following snippet demonstrates how you can expose the Pod IPs via an environment variable called MY_POD_IPS wi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10274"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- set | grep MY_POD_IPS\n```\n\nValidate IPv4/IPv6 dual-stack | The Pod's IP addresses will also be written to /etc/hosts within a container. The following command executes a cat on /etc/hosts on a dual stack Pod. From the output you can verify both the IPv4 and I", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10275"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- cat /etc/hosts\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that does not explicitly define .spec.ipFamilyPolicy. Kubernetes will assign a cluster IP for the Service from the first configured service-cluster-ip-range and set the .s", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10276"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10277"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nValidate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv4 address from the first configured range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10278"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: default\nspec:\n  clusterIP: 10.0.217.164\n  clusterIPs:\n  - 10.0.217.164\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 9376\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines IPv6 as the first array element in .spec.ipFamilies. Kubernetes will assign a cluster IP for the Service from the IPv6 range configured service-clu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10279"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10280"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nValidate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv6 address from the IPv6 range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10281"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 2001:db8:fd00::5118\n  clusterIPs:\n  - 2001:db8:fd00::5118\n  ipFamilies:\n  - IPv6\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines PreferDualStack in .spec.ipFamilyPolicy. Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and select th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10282"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10283"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\nValidate IPv4/IPv6 dual-stack | Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using kubectl describe. You may then validate access to the service via the IPs and ports.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10284"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc -l app.kubernetes.io/name=MyApp\n```\n\nValidate IPv4/IPv6 dual-stack | If the cloud provider supports the provisioning of IPv6 enabled external load balancers, create the following Service with PreferDualStack in .spec.ipFamilyPolicy, IPv6 as the first element of the .sp", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10285"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10286"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\nValidate IPv4/IPv6 dual-stack | Validate that the Service receives a CLUSTER-IP address from the IPv6 address block along with an EXTERNAL-IP. You may then validate access to the service via the IP and port.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10287"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nenv:\n        - name: MY_POD_IPS\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIPs\n```\n\nValidate IPv4/IPv6 dual-stack | The following command prints the value of the MY_POD_IPS environment variable from within a container. The value is a comma separated list that corresponds to the Pod's IPv4 and IPv6 addresses.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10288"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10289"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: default\nspec:\n  clusterIP: 10.0.217.164\n  clusterIPs:\n  - 10.0.217.164\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 9376\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines IPv6 as the first array element in .spec.ipFamilies. Kubernetes will assign a cluster IP for the Service from the IPv6 range configured service-clu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10290"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10291"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 2001:db8:fd00::5118\n  clusterIPs:\n  - 2001:db8:fd00::5118\n  ipFamilies:\n  - IPv6\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines PreferDualStack in .spec.ipFamilyPolicy. Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and select th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10292"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10293"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10294"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .spec.podCIDRs}}{{printf \"%s\\n\" .}}{{end}}'\n```\n\nValidate IPv4/IPv6 dual-stack | There should be one IPv4 block and one IPv6 block allocated.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10295"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .status.addresses}}{{printf \"%s: %s\\n\" .type .address}}{{end}}'\n```\n\nValidate IPv4/IPv6 dual-stack | Validate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with a valid Pod in your cluster. In this example the Pod name is pod01:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10296"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get pods pod01 -o go-template --template='{{range .status.podIPs}}{{printf \"%s\\n\" .ip}}{{end}}'\n```\n\nValidate IPv4/IPv6 dual-stack | You can also validate Pod IPs using the Downward API via the status.podIPs fieldPath. The following snippet demonstrates how you can expose the Pod IPs via an environment variable called MY_POD_IPS wi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10297"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- set | grep MY_POD_IPS\n```\n\nValidate IPv4/IPv6 dual-stack | The Pod's IP addresses will also be written to /etc/hosts within a container. The following command executes a cat on /etc/hosts on a dual stack Pod. From the output you can verify both the IPv4 and I", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10298"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- cat /etc/hosts\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that does not explicitly define .spec.ipFamilyPolicy. Kubernetes will assign a cluster IP for the Service from the first configured service-cluster-ip-range and set the .s", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10299"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10300"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10301"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nValidate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv4 address from the first configured range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10302"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: default\nspec:\n  clusterIP: 10.0.217.164\n  clusterIPs:\n  - 10.0.217.164\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 9376\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines IPv6 as the first array element in .spec.ipFamilies. Kubernetes will assign a cluster IP for the Service from the IPv6 range configured service-clu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10303"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-ipfamilies-ipv6.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10304"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10305"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\nValidate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv6 address from the IPv6 range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10306"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 2001:db8:fd00::5118\n  clusterIPs:\n  - 2001:db8:fd00::5118\n  ipFamilies:\n  - IPv6\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\nValidate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines PreferDualStack in .spec.ipFamilyPolicy. Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and select th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10307"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10308"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10309"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\nValidate IPv4/IPv6 dual-stack | Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using kubectl describe. You may then validate access to the service via the IPs and ports.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10310"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc -l app.kubernetes.io/name=MyApp\n```\n\nValidate IPv4/IPv6 dual-stack | If the cloud provider supports the provisioning of IPv6 enabled external load balancers, create the following Service with PreferDualStack in .spec.ipFamilyPolicy, IPv6 as the first element of the .sp", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10311"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-prefer-ipv6-lb-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10312"}
{"instruction": "Write a yaml example for validate ipv4/ipv6 dual-stack", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\nValidate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10313"}
{"instruction": "Write a bash example for validate ipv4/ipv6 dual-stack", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\nValidate IPv4/IPv6 dual-stack | Validate that the Service receives a CLUSTER-IP address from the IPv6 address block along with an EXTERNAL-IP. You may then validate access to the service via the IP and port.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/validate-dual-stack/", "id": "k8s_00656_code_10314"}
{"instruction": "What is the reference documentation for flow control?", "response": "Flow controlAPI Priority and Fairness controls the behavior of the Kubernetes API server in an overload situation. You can find more information about it in the API Priority and Fairness documentation.DiagnosticsEvery HTTP response from an API server with the priority and fairness feature enabled has two extra headers: X-Kubernetes-PF-FlowSchema-UID and X-Kubernetes-PF-PriorityLevel-UID, noting the flow schema that matched the request and the priority level to which it was assigned, respectively. The API objects' names are not included in these headers (to avoid revealing details in case the requesting user does not have permission to view them). When debugging, you can use a command such as:kubectl get flowschemas -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\" kubectl get prioritylevelconfigurations -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\" to get a mapping of UIDs to names for both FlowSchemas and PriorityLevelConfigurations.Debug endpointsWith the APIPriorityAndFairness feature enabled, the kube-apiserver serves the following additional paths at its HTTP(S) ports.You need to ensure you have permissions to access these endpoints. You don't have to do anything if you are using admin. Permissions can be granted if needed following the RBAC doc to access /debug/api_priority_and_fairness/ by specifying nonResourceURLs./debug/api_priority_and_fairness/dump_priority_levels - a listing of all the priority levels and the current state of each. You can fetch like this:kubectl get --raw /debug/api_priority_and_fairness/dump_priority_levels The output will be in CSV and similar to this:PriorityLevelName, ActiveQueues, IsIdle, IsQuiescing, WaitingRequests, ExecutingRequests, DispatchedRequests, RejectedRequests, TimedoutRequests, CancelledRequests catch-all, 0, true, false, 0, 0, 1, 0, 0, 0 exempt, 0, true, false, 0, 0, 0, 0, 0, 0 global-default, 0, true, false, 0, 0, 46, 0, 0, 0 leader-election, 0, true, false, 0, 0, 4, 0, 0, 0 node-high, 0, true, false, 0, 0, 34, 0, 0, 0 system, 0, true, false, 0, 0, 48, 0, 0, 0 workload-high, 0, true, false, 0, 0, 500, 0, 0, 0 workload-low, 0, true, false, 0, 0, 0, 0, 0, 0 Explanation for selected column names:IsQuiescing indicates if this priority level will be removed when its queues have been drained./debug/api_priority_and_fairness/dump_queues - a listing of all the queues and their current state. You can fetch like this:kubectl get --raw /debug/api_priority_and_fairness/dump_queues The output will be in CSV and similar to this:PriorityLevelName, Index, PendingRequests, ExecutingRequests, SeatsInUse, NextDispatchR, InitialSeatsSum, MaxSeatsSum, TotalWorkSum workload-low, 14, 27, 0, 0, 77.64342019ss, 270, 270, 0.81000000ss workload-low, 74, 26, 0, 0, 76.95387841ss, 260, 260, 0.78000000ss ... leader-election, 0, 0, 0, 0, 5088.87053833ss, 0, 0, 0.00000000ss leader-election, 1, 0, 0, 0, 0.00000000ss, 0, 0, 0.00000000ss ... workload-high, 0, 0, 0, 0, 0.00000000ss, 0, 0, 0.00000000ss workload-high, 1, 0, 0, 0, 1119.44936475ss, 0, 0, 0.00000000ss Explanation for selected column names:NextDispatchR: The R progress meter reading, in units of seat-seconds, at which the next request will be dispatched.InitialSeatsSum: The sum of InitialSeats associated with all requests in a given queue.MaxSeatsSum: The sum of MaxSeats associated with all requests in a given queue.TotalWorkSum: The sum of total work, in units of seat-seconds, of all waiting requests in a given queue.Note: seat-second (abbreviate as ss) is a measure of work, in units of seat-seconds, in the APF world./debug/api_priority_and_fairness/dump_requests - a listing of all the requests including requests waiting in a queue and requests being executing. You can fetch like this:kubectl get --raw /debug/api_priority_and_fairness/dump_requests The output will be in CSV and similar to this:PriorityLevelName, FlowSchemaName, QueueIndex, RequestIndexInQueue, FlowDistingsher, ArriveTime, InitialSeats, FinalSeats, AdditionalLat", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get flowschemas -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\nkubectl get prioritylevelconfigurations -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\n```\n\nFlow control | to get a mapping of UIDs to names for both FlowSchemas and PriorityLevelConfigurations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10316"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_priority_levels\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10317"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_queues\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10318"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_requests\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10319"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw '/debug/api_priority_and_fairness/dump_requests?includeRequestDetails=1'\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10320"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get flowschemas -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\nkubectl get prioritylevelconfigurations -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\n```\n\nFlow control | to get a mapping of UIDs to names for both FlowSchemas and PriorityLevelConfigurations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10321"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_priority_levels\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10322"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_queues\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10323"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_requests\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10324"}
{"instruction": "Write a bash example for flow control", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw '/debug/api_priority_and_fairness/dump_requests?includeRequestDetails=1'\n```\n\nFlow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/debug-cluster/flow-control/", "id": "k8s_00657_code_10325"}
{"instruction": "Explain the Kubernetes concept: Workloads", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.WorkloadsUnderstand Pods, the smallest deployable compute object in Kubernetes, and the higher-level abstractions that help you to run them.1: Pods1.1: Pod Lifecycle1.2: Init Containers1.3: Sidecar Containers1.4: Ephemeral Containers1.5: Disruptions1.6: Pod Hostname1.7: Pod Quality of Service Classes1.8: User Namespaces1.9: Downward API2: Workload Management2.1: Deployments2.2: ReplicaSet2.3: StatefulSets2.4: DaemonSet2.5: Jobs2.6: Automatic Cleanup for Finished Jobs2.7: CronJob2.8: ReplicationController3: Autoscaling Workloads4: Managing WorkloadsA workload is an application running on Kubernetes. Whether your workload is a single component or several that work together, on Kubernetes you run it inside a set of pods. In Kubernetes, a Pod represents a set of running containers on your cluster.Kubernetes pods have a defined lifecycle. For example, once a pod is running in your cluster then a critical fault on the node where that pod is running means that all the pods on that node fail. Kubernetes treats that level of failure as final: you would need to create a new Pod to recover, even if the node later becomes healthy.However, to make life considerably easier, you don't need to manage each Pod directly. Instead, you can use workload resources that manage a set of pods on your behalf. These resources configure controllers that make sure the right number of the right kind of pod are running, to match the state you specified.Kubernetes provides several built-in workload resources:Deployment and ReplicaSet (replacing the legacy resource ReplicationController). Deployment is a good fit for managing a stateless application workload on your cluster, where any Pod in the Deployment is interchangeable and can be replaced if needed.StatefulSet lets you run one or more related Pods that do track state somehow. For example, if your workload records data persistently, you can run a StatefulSet that matches each Pod with a PersistentVolume. Your code, running in the Pods for that StatefulSet, can replicate data to other Pods in the same StatefulSet to improve overall resilience.DaemonSet defines Pods that provide facilities that are local to nodes. Every time you add a node to your cluster that matches the specification in a DaemonSet, the control plane schedules a Pod for that DaemonSet onto the new node. Each pod in a DaemonSet performs a job similar to a system daemon on a classic Unix / POSIX server. A DaemonSet might be fundamental to the operation of your cluster, such as a plugin to run cluster networking, it might help you to manage the node, or it could provide optional behavior that enhances the container platform you are running.Job and CronJob provide different ways to define tasks that run to completion and then stop. You can use a Job to define a task that runs to completion, just once. You can use a CronJob to run the same Job multiple times according a schedule.In the wider Kubernetes ecosystem, you can find third-party workload resources that provide additional behaviors. Using a custom resource definition, you can add in a third-party workload resource if you want a specific behavior that's not part of Kubernetes' core. For example, if you wanted to run a group of Pods for your application but stop work unless all the Pods are available (perhaps for some high-throughput distributed task), then you can implement or install an extension that does provide that feature.What's", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10327"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml\n```\n\n1 - Pods | Pods are generally not created directly and are created using workload resources. See Working with Pods for more information on how Pods are used with workload resources.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10328"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\n1 - Pods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10329"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\n1.1 - Pod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10330"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\n1.1 - Pod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10331"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\n1.1 - Pod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10332"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\n1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10333"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\n1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10334"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\n1.1 - Pod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10335"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\n1.2 - Init Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10336"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10337"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10338"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10339"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl logs myapp-pod -c init-myservice # Inspect the first init container\nkubectl logs myapp-pod -c init-mydb      # Inspect the second init container\n```\n\n1.2 - Init Containers | At this point, those init containers will be waiting to discover Services named mydb and myservice.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10340"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\n1.2 - Init Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10341"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f services.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10342"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10343"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10344"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10345"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n1.6 - Pod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10346"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n1.6 - Pod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10347"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\n1.8 - User Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10348"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10349"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml\n```\n\n2.1 - Deployments | Run kubectl get deployments to check if the Deployment was created.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10350"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1\n```\n\n2.1 - Deployments | or use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10351"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n2.1 - Deployments | where deployment/nginx-deployment indicates the Deployment, nginx indicates the Container the update will take place and nginx:1.16.1 indicates the new image and its tag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10352"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10353"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10354"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10355"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.161\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10356"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10357"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10358"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10359"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment --revision=2\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10360"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10361"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment --to-revision=2\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10362"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10363"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10364"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=10\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10365"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment/nginx-deployment --min=10 --max=15 --cpu-percent=80\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10366"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:sometag\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10367"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10368"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10369"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10370"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10371"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10372"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --watch\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10373"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10374"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment/nginx-deployment -p '{\"spec\":{\"progressDeadlineSeconds\":600}}'\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10375"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10376"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10377"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\n2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10378"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\n2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10379"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\n2.1 - Deployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10380"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10381"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n2.2 - ReplicaSet | You can then get the current ReplicaSets deployed:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10382"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe rs/frontend\n```\n\n2.2 - ReplicaSet | And you will see output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10383"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get pods frontend-gbgfx -o yaml\n```\n\n2.2 - ReplicaSet | The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10384"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\n2.2 - ReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10385"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10386"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n2.2 - ReplicaSet | The new Pods will be acquired by the ReplicaSet, and then immediately terminated as the ReplicaSet would be over its desired count.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10387"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n2.2 - ReplicaSet | And then create the ReplicaSet however:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10388"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n2.2 - ReplicaSet | You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the number of its new Pods and the original matches its desired count. As fetching the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10389"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Foreground\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n2.2 - ReplicaSet | You can delete a ReplicaSet without affecting any of its Pods using kubectl delete with the --cascade=orphan option. When using the REST API or the client-go library, you must set propagationPolicy to", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10390"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Orphan\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n2.2 - ReplicaSet | Once the original is deleted, you can create a new ReplicaSet to replace it. As long as the old and new .spec.selector are the same, then the new one will adopt the old Pods. However, it will not make", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10391"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10392"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/hpa-rs.yaml\n```\n\n2.2 - ReplicaSet | Alternatively, you can use the kubectl autoscale command to accomplish the same (and it's easier!)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10393"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50\n```\n\n2.2 - ReplicaSet | Deployment is an object which can own ReplicaSets and update them and their Pods via declarative, server-side rolling updates. While ReplicaSets can be used independently, today they're mainly used by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10394"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n2.3 - StatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10395"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\n2.3 - StatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10396"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\n2.3 - StatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10397"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\n2.3 - StatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10398"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10399"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\n2.4 - DaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10400"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10401"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/job.yaml\n```\n\n2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10402"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\n2.5 - Jobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10403"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10404"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get -o yaml job job-backoff-limit-per-index-example\n```\n\n2.5 - Jobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10405"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10406"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10407"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n2.5 - Jobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10408"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n2.5 - Jobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10409"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get job myjob -o yaml\n```\n\n2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10410"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\n2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10411"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":true}}'\n```\n\n2.5 - Jobs | Resume a suspended Job:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10412"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":false}}'\n```\n\n2.5 - Jobs | The Job's status can be used to determine if a Job is suspended or has been suspended in the past:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10413"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10414"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\n2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10415"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/myjob\n```\n\n2.5 - Jobs | The last four events, particularly the \"Suspended\" and \"Resumed\" events, are directly a result of toggling the .spec.suspend field. In the time between these two events, we see that no Pods were creat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10416"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get job old -o yaml\n```\n\n2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10417"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n2.5 - Jobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10418"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n2.5 - Jobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10419"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\n2.5 - Jobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10420"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10421"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\n2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10422"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10423"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10424"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/replication.yaml\n```\n\n2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10425"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe replicationcontrollers/nginx\n```\n\n2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10426"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10427"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4 - Managing Workloads | The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10428"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \\\n  -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4 - Managing Workloads | It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same direct", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10429"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4 - Managing Workloads | If you need to define more manifests, such as adding a ConfigMap, you can do that too.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10430"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4 - Managing Workloads | In the case of two resources, you can specify both resources on the command line using the resource/name syntax:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10431"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/my-nginx services/my-nginx-svc\n```\n\n4 - Managing Workloads | For larger numbers of resources, you'll find it easier to specify the selector (label query) specified using -l or --selector, to filter resources by their labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10432"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,services -l app=nginx\n```\n\n4 - Managing Workloads | Because kubectl outputs resource names in the same syntax it accepts, you can chain operations using $() or xargs:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10433"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ )\nkubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ | xargs -i kubectl get '{}'\n```\n\n4 - Managing Workloads | The output might be similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10434"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development\n```\n\n4 - Managing Workloads | Instead, specify the --recursive or -R command line argument along with the --filename/-f argument:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10435"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development --recursive\n```\n\n4 - Managing Workloads | The --recursive argument works with any operation that accepts the --filename/-f argument such as: kubectl create, kubectl get, kubectl delete, kubectl describe, or even kubectl rollout.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10436"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/namespaces -f project/k8s/development --recursive\n```\n\n4 - Managing Workloads | If you're interested in learning more about kubectl, go ahead and read Command line tool (kubectl).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10437"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-nginx --image=nginx:1.14.2\n```\n\n4 - Managing Workloads | Ensure that there is 1 replica:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10438"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas 1 deployments/my-nginx --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\": 1}}'\n```\n\n4 - Managing Workloads | and allow Kubernetes to add more temporary replicas during a rollout, by setting a surge maximum of 100%:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10439"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch --type='merge' -p '{\"spec\":{\"strategy\":{\"rollingUpdate\":{\"maxSurge\": \"100%\" }}}}'\n```\n\n4 - Managing Workloads | To update to version 1.16.1, change .spec.template.spec.containers[0].image from nginx:1.14.2 to nginx:1.16.1 using kubectl edit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10440"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n# Change the manifest to use the newer container image, then save your changes\n```\n\n4 - Managing Workloads | That's it! The Deployment will declaratively update the deployed nginx application progressively behind the scene. It ensures that only a certain number of old replicas may be down while they are bein", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10441"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-deployment.yaml\n\n# wait for rollout to finish\nkubectl rollout status deployment/my-deployment --timeout 10m # 10 minute timeout\n```\n\n4 - Managing Workloads | or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10442"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f backing-stateful-component.yaml\n\n# don't wait for rollout to finish, just check the status\nkubectl rollout status statefulsets/backing-stateful-component --watch=false\n```\n\n4 - Managing Workloads | You can also pause, resume or cancel a rollout. Visit kubectl rollout to learn more.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10443"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods my-nginx-v4-9gw19 description='my frontend running nginx'\nkubectl get pods my-nginx-v4-9gw19 -o yaml\n```\n\n4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10444"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: pod\nmetadata:\n  annotations:\n    description: my frontend running nginx\n...\n```\n\n4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10445"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/my-nginx --replicas=1\n```\n\n4 - Managing Workloads | Now you only have one pod managed by the deployment.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10446"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n4 - Managing Workloads | To have the system automatically choose the number of nginx replicas as needed, ranging from 1 to 3, do:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10447"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4 - Managing Workloads | To learn more about the underlying mechanism, read server-side apply.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10448"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n```\n\n4 - Managing Workloads | This is equivalent to first get the resource, edit it in text editor, and then apply the resource with the updated version:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10449"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment my-nginx -o yaml > /tmp/nginx.yaml\nvi /tmp/nginx.yaml\n# do some edit, and then save the file\n\nkubectl apply -f /tmp/nginx.yaml\ndeployment.apps/my-nginx configured\n\nrm /tmp/nginx.yaml\n```\n\n4 - Managing Workloads | This allows you to do more significant changes more easily. Note that you can specify the editor with your EDITOR or KUBE_EDITOR environment variables.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10450"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force\n```\n\n4 - Managing Workloads | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10451"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10452"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\n1 - Pods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10453"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <name-of-pod>\n```\n\n1.1 - Pod Lifecycle | Each state has a specific meaning:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10454"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl logs <name-of-pod>\n```\n\n1.1 - Pod Lifecycle | When a container in your Pod stops, or experiences failure, Kubernetes can restart it. A restart isn't always appropriate; for example, init containers run only once, during Pod startup.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10455"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <name-of-pod>\n```\n\n1.1 - Pod Lifecycle | When a container in your Pod stops, or experiences failure, Kubernetes can restart it. A restart isn't always appropriate; for example, init containers run only once, during Pod startup.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10456"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\n1.1 - Pod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10457"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\n1.1 - Pod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10458"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\n1.1 - Pod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10459"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\n1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10460"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\n1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10461"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\n1.1 - Pod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10462"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  os:\n    name: linux\n  containers:\n    - name: my-container\n      image: container-image:latest\n      lifecycle:\n        stopSignal: SIGUSR1\n```\n\n1.1 - Pod Lifecycle | If a stop signal is defined in the lifecycle, this will override the signal defined in the container image. If no stop signal is defined in the container spec, the container would fall back to the def", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10463"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\n1.2 - Init Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10464"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\n1.2 - Init Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10465"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10466"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10467"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n1.6 - Pod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10468"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n1.6 - Pod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10469"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\n1.8 - User Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10470"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10471"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.1 - Deployments | If the Deployment is still being created, the output is similar to the following:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10472"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10473"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.1 - Deployments | Notice that the Deployment has created all three replicas, and all replicas are up-to-date (they contain the latest Pod template) and available.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10474"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --show-labels\n```\n\n2.1 - Deployments | The created ReplicaSet ensures that there are three nginx Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10475"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.1 - Deployments | Run kubectl get rs to see that the Deployment updated the Pods by creating a new ReplicaSet and scaling it up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10476"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl annotate deployment/nginx-deployment kubernetes.io/change-cause=\"image updated to 1.16.1\"\n```\n\n2.1 - Deployments | To see the details of each revision, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10477"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n2.1 - Deployments | Kubernetes marks a Deployment as complete when it has the following characteristics:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10478"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10479"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10480"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n2.1 - Deployments | Eventually, once the Deployment progress deadline is exceeded, Kubernetes updates the status and the reason for the Progressing condition:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10481"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10482"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10483"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment deployment --replicas=X\n```\n\n2.1 - Deployments | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Deployment, don't set .spec.replicas.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10484"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f deployment.yaml\n```\n\n2.1 - Deployments | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Deployment, don't set .spec.replicas.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10485"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\n2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10486"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\n2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10487"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\n2.1 - Deployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10488"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10489"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\n2.2 - ReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10490"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10491"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nmatchLabels:\n  tier: frontend\n```\n\n2.2 - ReplicaSet | In the ReplicaSet, .spec.template.metadata.labels must match spec.selector, or it will be rejected by the API.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10492"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10493"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n2.3 - StatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10494"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\n2.3 - StatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10495"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\n# View revision history\nkubectl rollout history statefulset/webapp\n\n# Rollback to a specific revision\nkubectl rollout undo statefulset/webapp --to-revision=3\n```\n\n2.3 - StatefulSets | This will:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10496"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\n# List all revisions for the StatefulSet\nkubectl get controllerrevisions -l app.kubernetes.io/name=webapp\n\n# View detailed configuration of a specific revision\nkubectl get controllerrevision/webapp-3 -o yaml\n```\n\n2.3 - StatefulSets | Regularly check revisions with:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10497"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\n2.3 - StatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10498"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\n2.3 - StatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10499"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset statefulset --replicas=X\n```\n\n2.3 - StatefulSets | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Statefulset, don't set .spec.replicas. Instead, allow the Kubernetes control plane to manage the .spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10500"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f statefulset.yaml\n```\n\n2.3 - StatefulSets | If a HorizontalPodAutoscaler (or any similar API for horizontal scaling) is managing scaling for a Statefulset, don't set .spec.replicas. Instead, allow the Kubernetes control plane to manage the .spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10501"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10502"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/daemonset.yaml\n```\n\n2.4 - DaemonSet | As with all other Kubernetes config, a DaemonSet needs apiVersion, kind, and metadata fields. For general information about working with config files, see running stateless applications and object man", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10503"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nnodeAffinity:\n  requiredDuringSchedulingIgnoredDuringExecution:\n    nodeSelectorTerms:\n    - matchFields:\n      - key: metadata.name\n        operator: In\n        values:\n        - target-host-name\n```\n\n2.4 - DaemonSet | The DaemonSet controller automatically adds a set of tolerations to DaemonSet Pods:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10504"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10505"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nName:           pi\nNamespace:      default\nSelector:       batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\nLabels:         batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\n                batch.kubernetes.io/job-name=pi\n                ...\nAnnotations:    batch.kubernetes.io/job-tracking: \"\"\nParallelism:    1\nCompletions:    1\nStart Time:     Mon, 02 Dec 2019 15:20:11 +0200\nCompleted At:   Mon, 02 Dec 2019 15:21:16 +0200\nDuration:       65s\nPods Statuses:  0 Running / 1 Succeeded / 0 Failed\nPod Template:\n  Labels:  batch.kubernetes.io/controller-uid=c9948307-e56d-4b5d-8302-ae2d7b7da67c\n           batch.kubernetes.io/job-name=pi\n  Containers:\n   pi:\n    Image:      perl:5.34.0\n    Port:       <none>\n    Host Port:  <none>\n    Command:\n      perl\n      -Mbignum=bpi\n      -wle\n      print bpi(2000)\n    Environment:  <none>\n    Mounts:       <none>\n  Volumes:        <none>\nEvents:\n  Type    Reason            Age   From            Message\n  ----    ------            ----  ----            -------\n  Normal  SuccessfulCreate  21s   job-controller  Created pod: pi-xf9p4\n  Normal  Completed         18s   job-controller  Job completed\n```\n\n2.5 - Jobs | apiVersion: batch/v1 kind: Job metadata: annotations: batch.kubernetes.io/job-tracking: \"\" ... creationTimestamp: \"2022-11-10T17:53:53Z\" generation: 1 labels: batch.kubernet", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10506"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\n2.5 - Jobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10507"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10508"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n    completedIndexes: 1,3,5,7,9\n    failedIndexes: 0,2,4,6,8\n    succeeded: 5          # 1 succeeded pod for each of 5 succeeded indexes\n    failed: 10            # 2 failed pods (1 retry) for each of 5 failed indexes\n    conditions:\n    - message: Job has failed indexes\n      reason: FailedIndexes\n      status: \"True\"\n      type: FailureTarget\n    - message: Job has failed indexes\n      reason: FailedIndexes\n      status: \"True\"\n      type: Failed\n```\n\n2.5 - Jobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10509"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10510"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10511"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/pi\n```\n\n2.5 - Jobs | By default, a Job will run uninterrupted unless a Pod fails (restartPolicy=Never) or a Container exits in error (restartPolicy=OnFailure), at which point the Job defers to the .spec.backoffLimit descr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10512"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./job.yaml\n```\n\n2.5 - Jobs | By default, a Job will run uninterrupted unless a Pod fails (restartPolicy=Never) or a Container exits in error (restartPolicy=OnFailure), at which point the Job defers to the .spec.backoffLimit descr", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10513"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n2.5 - Jobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10514"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n2.5 - Jobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10515"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\n2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10516"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\n2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10517"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/old --cascade=orphan\n```\n\n2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10518"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n2.5 - Jobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10519"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n2.5 - Jobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10520"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\n2.5 - Jobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10521"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\n2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10522"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10523"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10524"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10525"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nselector:\n   app: guestbook\n   tier: frontend\n```\n\n4 - Managing Workloads | You can tweak the number of replicas of the stable and canary releases to determine the ratio of each release that will receive live production traffic (in this case, 3:1). Once you're confident, you", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10526"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\npods/simple-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10527"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\n1 - Pods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10528"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml\n```\n\n1 - Pods | Pods are generally not created directly and are created using workload resources. See Working with Pods for more information on how Pods are used with workload resources.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10529"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\n1 - Pods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10530"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: on-failure-pod\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: try-once-container    # This container will run only once because the restartPolicy is Never.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Only running once\" && sleep 10 && exit 1']\n    restartPolicy: Never     \n  - name: on-failure-container  # This container will be restarted on failure.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Keep restarting\" && sleep 1800 && exit 1']\n```\n\n1.1 - Pod Lifecycle | A Pod with Always restart policy with an init container that only execute once. If the init container fails, the Pod fails. This allows the Pod to fail if the initialization failed, but also keep runn", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10531"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fail-pod-if-init-fails\nspec:\n  restartPolicy: Always\n  initContainers:\n  - name: init-once      # This init container will only try once. If it fails, the pod will fail.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'echo \"Failing initialization\" && sleep 10 && exit 1']\n    restartPolicy: Never\n  containers:\n  - name: main-container # This container will always be restarted once initialization succeeds.\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 1800 && exit 0']\n```\n\n1.1 - Pod Lifecycle | A Pod with Never restart policy with a container that ignores and restarts on specific exit codes. This is useful to differentiate between restartable errors and non-restartable errors:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10532"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: restart-on-exit-codes\nspec:\n  restartPolicy: Never\n  containers:\n  - name: restart-on-exit-codes\n    image: docker.io/library/busybox:1.28\n    command: ['sh', '-c', 'sleep 60 && exit 0']\n    restartPolicy: Never     # Container restart policy must be specified if rules are specified\n    restartPolicyRules:      # Only restart the container if it exits with code 42\n    - action: Restart\n      exitCodes:\n        operator: In\n        values: [42]\n```\n\n1.1 - Pod Lifecycle | Restart rules can be used for many more advanced lifecycle management scenarios. Note, restart rules are affected by the same inconsistencies as the regular restart policy. Kubelet restarts, container", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10533"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n# container restart delays will start at 10s, increasing\n# 2x each time they are restarted, to a maximum of 100s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"100s\"\n```\n\n1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10534"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n# delays between container restarts will always be 2s\nkind: KubeletConfiguration\ncrashLoopBackOff:\n    maxContainerRestartPeriod: \"2s\"\n```\n\n1.1 - Pod Lifecycle | If you use this feature along with the alpha feature ReduceDefaultCrashLoopBackOffDecay (described above), your cluster defaults for initial backoff and maximum backoff will no longer be 10s and 300s,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10535"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\n...\nspec:\n  readinessGates:\n    - conditionType: \"www.example.com/feature-1\"\nstatus:\n  conditions:\n    - type: Ready                              # a built-in PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n    - type: \"www.example.com/feature-1\"        # an extra PodCondition\n      status: \"False\"\n      lastProbeTime: null\n      lastTransitionTime: 2018-01-01T00:00:00Z\n  containerStatuses:\n    - containerID: docker://abcd...\n      ready: true\n...\n```\n\n1.1 - Pod Lifecycle | The Pod conditions you add must have names that meet the Kubernetes label key format.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10536"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp-pod\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  containers:\n  - name: myapp-container\n    image: busybox:1.28\n    command: ['sh', '-c', 'echo The app is running! && sleep 3600']\n  initContainers:\n  - name: init-myservice\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done\"]\n  - name: init-mydb\n    image: busybox:1.28\n    command: ['sh', '-c', \"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done\"]\n```\n\n1.2 - Init Containers | You can start this Pod by running:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10537"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10538"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10539"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10540"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl logs myapp-pod -c init-myservice # Inspect the first init container\nkubectl logs myapp-pod -c init-mydb      # Inspect the second init container\n```\n\n1.2 - Init Containers | At this point, those init containers will be waiting to discover Services named mydb and myservice.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10541"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myservice\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: mydb\nspec:\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9377\n```\n\n1.2 - Init Containers | To create the mydb and myservice services:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10542"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f services.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10543"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get -f myapp.yaml\n```\n\n1.2 - Init Containers | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10544"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-sidecar.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10545"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp\n  labels:\n    app: myapp\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: myapp\n  template:\n    metadata:\n      labels:\n        app: myapp\n    spec:\n      containers:\n        - name: myapp\n          image: alpine:latest\n          command: ['sh', '-c', 'while true; do echo \"logging\" >> /opt/logs.txt; sleep 1; done']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod. This can be helpful for running supporting services separated", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10546"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napplication/job/job-sidecar.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10547"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  template:\n    spec:\n      containers:\n        - name: myjob\n          image: alpine:latest\n          command: ['sh', '-c', 'echo \"logging\" > /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      initContainers:\n        - name: logshipper\n          image: alpine:latest\n          restartPolicy: Always\n          command: ['sh', '-c', 'tail -F /opt/logs.txt']\n          volumeMounts:\n            - name: data\n              mountPath: /opt\n      restartPolicy: Never\n      volumes:\n        - name: data\n          emptyDir: {}\n```\n\n1.3 - Sidecar Containers | Sidecar containers run alongside app containers in the same pod. However, they do not execute the primary application logic; instead, they provide supporting functionality to the main application.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10548"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-1\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n1.6 - Pod Hostname | The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10549"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-2-busybox-example-domain\nspec:\n  hostnameOverride: busybox-2.busybox.example.domain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\n1.6 - Pod Hostname | If hostnameOverride is set alongside hostname and subdomain fields:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10550"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nuserNamespaces:\n  idsPerPod: 1048576\n```\n\n1.8 - User Namespaces | The value of idsPerPod (uint32) must be a multiple of 65536. The default value is 65536. This value only applies to containers created after the kubelet was started with this KubeletConfiguration. Run", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10551"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/nginx-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10552"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n2.1 - Deployments | In this example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10553"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml\n```\n\n2.1 - Deployments | Run kubectl get deployments to check if the Deployment was created.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10554"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1\n```\n\n2.1 - Deployments | or use the following command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10555"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n2.1 - Deployments | where deployment/nginx-deployment indicates the Deployment, nginx indicates the Container the update will take place and nginx:1.16.1 indicates the new image and its tag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10556"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10557"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10558"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10559"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.161\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10560"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10561"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10562"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10563"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment --revision=2\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10564"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10565"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployment/nginx-deployment --to-revision=2\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10566"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10567"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10568"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=10\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10569"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment/nginx-deployment --min=10 --max=15 --cpu-percent=80\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10570"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:sometag\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10571"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10572"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/nginx-deployment nginx=nginx:1.16.1\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10573"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10574"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl set resources deployment/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10575"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10576"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --watch\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10577"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10578"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment/nginx-deployment -p '{\"spec\":{\"progressDeadlineSeconds\":600}}'\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10579"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10580"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployment/nginx-deployment\n```\n\n2.1 - Deployments | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10581"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxUnavailable: 1\n```\n\n2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10582"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n```\n\n2.1 - Deployments | apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10583"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n labels:\n   app: nginx\nspec:\n replicas: 3\n selector:\n   matchLabels:\n     app: nginx\n template:\n   metadata:\n     labels:\n       app: nginx\n   spec:\n     containers:\n     - name: nginx\n       image: nginx:1.14.2\n       ports:\n       - containerPort: 80\n strategy:\n   type: RollingUpdate\n   rollingUpdate:\n     maxSurge: 1\n     maxUnavailable: 1\n```\n\n2.1 - Deployments | .spec.progressDeadlineSeconds is an optional field that specifies the number of seconds you want to wait for your Deployment to progress before the system reports back that the Deployment has failed p", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10584"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/frontend.yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10585"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # modify replicas according to your case\n  replicas: 3\n  selector:\n    matchLabels:\n      tier: frontend\n  template:\n    metadata:\n      labels:\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n```\n\n2.2 - ReplicaSet | Saving this manifest into frontend.yaml and submitting it to a Kubernetes cluster will create the defined ReplicaSet and the Pods that it manages.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10586"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n2.2 - ReplicaSet | You can then get the current ReplicaSets deployed:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10587"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe rs/frontend\n```\n\n2.2 - ReplicaSet | And you will see output similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10588"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get pods frontend-gbgfx -o yaml\n```\n\n2.2 - ReplicaSet | The output will look similar to this, with the frontend ReplicaSet's info set in the metadata's ownerReferences field:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10589"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2024-02-28T22:30:44Z\"\n  generateName: frontend-\n  labels:\n    tier: frontend\n  name: frontend-gbgfx\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: frontend\n    uid: e129deca-f864-481b-bb16-b27abfd92292\n...\n```\n\n2.2 - ReplicaSet | While you can create bare Pods with no problems, it is strongly recommended to make sure that the bare Pods do not have labels which match the selector of one of your ReplicaSets. The reason for this", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10590"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\npods/pod-rs.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10591"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod1\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello1\n    image: gcr.io/google-samples/hello-app:2.0\n\n---\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod2\n  labels:\n    tier: frontend\nspec:\n  containers:\n  - name: hello2\n    image: gcr.io/google-samples/hello-app:1.0\n```\n\n2.2 - ReplicaSet | As those Pods do not have a Controller (or any object) as their owner reference and match the selector of the frontend ReplicaSet, they will immediately be acquired by it.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10592"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n2.2 - ReplicaSet | The new Pods will be acquired by the ReplicaSet, and then immediately terminated as the ReplicaSet would be over its desired count.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10593"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/pods/pod-rs.yaml\n```\n\n2.2 - ReplicaSet | And then create the ReplicaSet however:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10594"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/frontend.yaml\n```\n\n2.2 - ReplicaSet | You shall see that the ReplicaSet has acquired the Pods and has only created new ones according to its spec until the number of its new Pods and the original matches its desired count. As fetching the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10595"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Foreground\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n2.2 - ReplicaSet | You can delete a ReplicaSet without affecting any of its Pods using kubectl delete with the --cascade=orphan option. When using the REST API or the client-go library, you must set propagationPolicy to", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10596"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\ncurl -X DELETE  'localhost:8080/apis/apps/v1/namespaces/default/replicasets/frontend' \\\n  -d '{\"kind\":\"DeleteOptions\",\"apiVersion\":\"v1\",\"propagationPolicy\":\"Orphan\"}' \\\n  -H \"Content-Type: application/json\"\n```\n\n2.2 - ReplicaSet | Once the original is deleted, you can create a new ReplicaSet to replace it. As long as the old and new .spec.selector are the same, then the new one will adopt the old Pods. However, it will not make", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10597"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/hpa-rs.yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10598"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: frontend-scaler\nspec:\n  scaleTargetRef:\n    kind: ReplicaSet\n    name: frontend\n  minReplicas: 3\n  maxReplicas: 10\n  targetCPUUtilizationPercentage: 50\n```\n\n2.2 - ReplicaSet | Saving this manifest into hpa-rs.yaml and submitting it to a Kubernetes cluster should create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage of the replicated Pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10599"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/hpa-rs.yaml\n```\n\n2.2 - ReplicaSet | Alternatively, you can use the kubectl autoscale command to accomplish the same (and it's easier!)", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10600"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50\n```\n\n2.2 - ReplicaSet | Deployment is an object which can own ReplicaSets and update them and their Pods via declarative, server-side rolling updates. While ReplicaSets can be used independently, today they're mainly used by", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10601"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  selector:\n    matchLabels:\n      app: nginx # has to match .spec.template.metadata.labels\n  serviceName: \"nginx\"\n  replicas: 3 # by default is 1\n  minReadySeconds: 10 # by default is 0\n  template:\n    metadata:\n      labels:\n        app: nginx # has to match .spec.selector.matchLabels\n    spec:\n      terminationGracePeriodSeconds: 10\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: \"my-storage-class\"\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n2.3 - StatefulSets | In the above example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10602"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: webapp\nspec:\n  revisionHistoryLimit: 5  # Keep last 5 revisions\n  # ... other spec fields ...\n```\n\n2.3 - StatefulSets | You can revert to a previous configuration using:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10603"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevisions\n```\n\n2.3 - StatefulSets | Alert on rapid revision count growth", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10604"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\n...\nspec:\n  persistentVolumeClaimRetentionPolicy:\n    whenDeleted: Retain\n    whenScaled: Delete\n...\n```\n\n2.3 - StatefulSets | The StatefulSet controller adds owner references to its PVCs, which are then deleted by the garbage collector after the Pod is terminated. This enables the Pod to cleanly unmount all volumes before th", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10605"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10606"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n      # it may be desirable to set a high priority class to ensure that a DaemonSet Pod\n      # preempts running Pods\n      # priorityClassName: important\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n```\n\n2.4 - DaemonSet | Create a DaemonSet based on the YAML file:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10607"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10608"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi\nspec:\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n  backoffLimit: 4\n```\n\n2.5 - Jobs | You can run the example with this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10609"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://kubernetes.io/examples/controllers/job.yaml\n```\n\n2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10610"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  annotations: batch.kubernetes.io/job-tracking: \"\"\n             ...  \n  creationTimestamp: \"2022-11-10T17:53:53Z\"\n  generation: 1\n  labels:\n    batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n    batch.kubernetes.io/job-name: pi\n  name: pi\n  namespace: default\n  resourceVersion: \"4751\"\n  uid: 204fb678-040b-497f-9266-35ffa8716d14\nspec:\n  backoffLimit: 4\n  completionMode: NonIndexed\n  completions: 1\n  parallelism: 1\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n  suspend: false\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        batch.kubernetes.io/controller-uid: 863452e6-270d-420e-9b94-53a54146c223\n        batch.kubernetes.io/job-name: pi\n    spec:\n      containers:\n      - command:\n        - perl\n        - -Mbignum=bpi\n        - -wle\n        - print bpi(2000)\n        image: perl:5.34.0\n        imagePullPolicy: IfNotPresent\n        name: pi\n        resources: {}\n        terminationMessagePath: /dev/termination-log\n        terminationMessagePolicy: File\n      dnsPolicy: ClusterFirst\n      restartPolicy: Never\n      schedulerName: default-scheduler\n      securityContext: {}\n      terminationGracePeriodSeconds: 30\nstatus:\n  active: 1\n  ready: 0\n  startTime: \"2022-11-10T17:53:57Z\"\n  uncountedTerminatedPods: {}\n```\n\n2.5 - Jobs | To view completed Pods of a Job, use kubectl get pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10611"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-backoff-limit-per-index-example.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10612"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-example\nspec:\n  completions: 10\n  parallelism: 3\n  completionMode: Indexed  # required for the feature\n  backoffLimitPerIndex: 1  # maximal number of failures per index\n  maxFailedIndexes: 5      # maximal number of failed indexes before terminating the Job execution\n  template:\n    spec:\n      restartPolicy: Never # required for the feature\n      containers:\n      - name: example\n        image: python\n        command:           # The jobs fails as there is at least one failed index\n                           # (all even indexes fail in here), yet all indexes\n                           # are executed as maxFailedIndexes is not exceeded.\n        - python3\n        - -c\n        - |\n          import os, sys\n          print(\"Hello world\")\n          if int(os.environ.get(\"JOB_COMPLETION_INDEX\")) % 2 == 0:\n            sys.exit(1)\n```\n\n2.5 - Jobs | In the example above, the Job controller allows for one restart for each of the indexes. When the total number of failed indexes exceeds 5, then the entire Job is terminated.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10613"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get -o yaml job job-backoff-limit-per-index-example\n```\n\n2.5 - Jobs | The Job controller adds the FailureTarget Job condition to trigger Job termination and cleanup. When all of the Job Pods are terminated, the Job controller adds the Failed condition with the same valu", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10614"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-example.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10615"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-example\nspec:\n  completions: 12\n  parallelism: 3\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]        # example command simulating a bug which triggers the FailJob action\n        args:\n        - -c\n        - echo \"Hello world!\" && sleep 5 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main      # optional\n        operator: In             # one of: In, NotIn\n        values: [42]\n    - action: Ignore             # one of: Ignore, FailJob, Count\n      onPodConditions:\n      - type: DisruptionTarget   # indicates Pod disruption\n```\n\n2.5 - Jobs | In the example above, the first rule of the Pod failure policy specifies that the Job should be marked failed if the main container fails with the 42 exit code. The following are the rules for the mai", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10616"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-success-policy.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10617"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-success\nspec:\n  parallelism: 10\n  completions: 10\n  completionMode: Indexed # Required for the success policy\n  successPolicy:\n    rules:\n      - succeededIndexes: 0,2-3\n        succeededCount: 1\n  template:\n    spec:\n      containers:\n      - name: main\n        image: python\n        command:          # Provided that at least one of the Pods with 0, 2, and 3 indexes has succeeded,\n                          # the overall Job is a success.\n          - python3\n          - -c\n          - |\n            import os, sys\n            if os.environ.get(\"JOB_COMPLETION_INDEX\") == \"2\":\n              sys.exit(0)\n            else:\n              sys.exit(1)            \n      restartPolicy: Never\n```\n\n2.5 - Jobs | In the example above, both succeededIndexes and succeededCount have been specified. Therefore, the job controller will mark the Job as succeeded and terminate the lingering Pods when either of the spe", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10618"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-timeout\nspec:\n  backoffLimit: 5\n  activeDeadlineSeconds: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n2.5 - Jobs | Note that both the Job spec and the Pod template spec within the Job have an activeDeadlineSeconds field. Ensure that you set this field at the proper level.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10619"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: pi-with-ttl\nspec:\n  ttlSecondsAfterFinished: 100\n  template:\n    spec:\n      containers:\n      - name: pi\n        image: perl:5.34.0\n        command: [\"perl\", \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n```\n\n2.5 - Jobs | The Job pi-with-ttl will be eligible to be automatically deleted, 100 seconds after it finishes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10620"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get job myjob -o yaml\n```\n\n2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10621"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: myjob\nspec:\n  suspend: true\n  parallelism: 1\n  completions: 5\n  template:\n    spec:\n      ...\n```\n\n2.5 - Jobs | You can also toggle Job suspension by patching the Job using the command line.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10622"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":true}}'\n```\n\n2.5 - Jobs | Resume a suspended Job:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10623"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch job/myjob --type=strategic --patch '{\"spec\":{\"suspend\":false}}'\n```\n\n2.5 - Jobs | The Job's status can be used to determine if a Job is suspended or has been suspended in the past:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10624"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10625"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  conditions:\n  - lastProbeTime: \"2021-02-05T13:14:33Z\"\n    lastTransitionTime: \"2021-02-05T13:14:33Z\"\n    status: \"True\"\n    type: Suspended\n  startTime: \"2021-02-05T13:13:48Z\"\n```\n\n2.5 - Jobs | The Job condition of type \"Suspended\" with status \"True\" means the Job is suspended; the lastTransitionTime field can be used to determine how long the Job has been suspended for. If the status of tha", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10626"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/myjob\n```\n\n2.5 - Jobs | The last four events, particularly the \"Suspended\" and \"Resumed\" events, are directly a result of toggling the .spec.suspend field. In the time between these two events, we see that no Pods were creat", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10627"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get job old -o yaml\n```\n\n2.5 - Jobs | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10628"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: old\n  ...\nspec:\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n2.5 - Jobs | Then you create a new Job with name new and you explicitly specify the same selector. Since the existing Pods have label batch.kubernetes.io/controller-uid=a8f3d00d-c6d2-11e5-9f87-42010af00002, they a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10629"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  manualSelector: true\n  selector:\n    matchLabels:\n      batch.kubernetes.io/controller-uid: a8f3d00d-c6d2-11e5-9f87-42010af00002\n  ...\n```\n\n2.5 - Jobs | The new Job itself will have a different uid from a8f3d00d-c6d2-11e5-9f87-42010af00002. Setting manualSelector: true tells the system that you know what you are doing and to allow this mismatch.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10630"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\nkind: Job\nmetadata:\n  name: new\n  ...\nspec:\n  podReplacementPolicy: Failed\n  ...\n```\n\n2.5 - Jobs | Provided your cluster has the feature gate enabled, you can inspect the .status.terminating field of a Job. The value of the field is the number of Pods owned by the Job that are currently terminating", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10631"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs/myjob -o yaml\n```\n\n2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10632"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\n# .metadata and .spec omitted\nstatus:\n  terminating: 3 # three Pods are terminating and have not yet reached the Failed phase\n```\n\n2.5 - Jobs | This feature allows you to disable the built-in Job controller, for a specific Job, and delegate reconciliation of the Job to an external controller.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10633"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napplication/job/cronjob.yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10634"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n2.7 - CronJob | (Running Automated Tasks with a CronJob takes you through this example in more detail).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10635"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/replication.yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10636"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n2.8 - ReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10637"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/replication.yaml\n```\n\n2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10638"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl describe replicationcontrollers/nginx\n```\n\n2.8 - ReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10639"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napplication/nginx-app.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10640"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx-svc\n  labels:\n    app: nginx\nspec:\n  type: LoadBalancer\n  ports:\n  - port: 80\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n4 - Managing Workloads | Multiple resources can be created the same way as a single resource:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10641"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4 - Managing Workloads | The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10642"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \\\n  -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4 - Managing Workloads | It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same direct", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10643"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4 - Managing Workloads | If you need to define more manifests, such as adding a ConfigMap, you can do that too.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10644"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/application/nginx-app.yaml\n```\n\n4 - Managing Workloads | In the case of two resources, you can specify both resources on the command line using the resource/name syntax:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10645"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/my-nginx services/my-nginx-svc\n```\n\n4 - Managing Workloads | For larger numbers of resources, you'll find it easier to specify the selector (label query) specified using -l or --selector, to filter resources by their labels:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10646"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,services -l app=nginx\n```\n\n4 - Managing Workloads | Because kubectl outputs resource names in the same syntax it accepts, you can chain operations using $() or xargs:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10647"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ )\nkubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service/ | xargs -i kubectl get '{}'\n```\n\n4 - Managing Workloads | The output might be similar to:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10648"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development\n```\n\n4 - Managing Workloads | Instead, specify the --recursive or -R command line argument along with the --filename/-f argument:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10649"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/development --recursive\n```\n\n4 - Managing Workloads | The --recursive argument works with any operation that accepts the --filename/-f argument such as: kubectl create, kubectl get, kubectl delete, kubectl describe, or even kubectl rollout.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10650"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f project/k8s/namespaces -f project/k8s/development --recursive\n```\n\n4 - Managing Workloads | If you're interested in learning more about kubectl, go ahead and read Command line tool (kubectl).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10651"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment my-nginx --image=nginx:1.14.2\n```\n\n4 - Managing Workloads | Ensure that there is 1 replica:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10652"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas 1 deployments/my-nginx --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\": 1}}'\n```\n\n4 - Managing Workloads | and allow Kubernetes to add more temporary replicas during a rollout, by setting a surge maximum of 100%:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10653"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl patch --type='merge' -p '{\"spec\":{\"strategy\":{\"rollingUpdate\":{\"maxSurge\": \"100%\" }}}}'\n```\n\n4 - Managing Workloads | To update to version 1.16.1, change .spec.template.spec.containers[0].image from nginx:1.14.2 to nginx:1.16.1 using kubectl edit:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10654"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n# Change the manifest to use the newer container image, then save your changes\n```\n\n4 - Managing Workloads | That's it! The Deployment will declaratively update the deployed nginx application progressively behind the scene. It ensures that only a certain number of old replicas may be down while they are bein", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10655"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-deployment.yaml\n\n# wait for rollout to finish\nkubectl rollout status deployment/my-deployment --timeout 10m # 10 minute timeout\n```\n\n4 - Managing Workloads | or", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10656"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f backing-stateful-component.yaml\n\n# don't wait for rollout to finish, just check the status\nkubectl rollout status statefulsets/backing-stateful-component --watch=false\n```\n\n4 - Managing Workloads | You can also pause, resume or cancel a rollout. Visit kubectl rollout to learn more.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10657"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl annotate pods my-nginx-v4-9gw19 description='my frontend running nginx'\nkubectl get pods my-nginx-v4-9gw19 -o yaml\n```\n\n4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10658"}
{"instruction": "Write a yaml example for workloads", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: pod\nmetadata:\n  annotations:\n    description: my frontend running nginx\n...\n```\n\n4 - Managing Workloads | For more information, see annotations and kubectl annotate.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10659"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/my-nginx --replicas=1\n```\n\n4 - Managing Workloads | Now you only have one pod managed by the deployment.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10660"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n4 - Managing Workloads | To have the system automatically choose the number of nginx replicas as needed, ranging from 1 to 3, do:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10661"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml\n```\n\n4 - Managing Workloads | To learn more about the underlying mechanism, read server-side apply.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10662"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment/my-nginx\n```\n\n4 - Managing Workloads | This is equivalent to first get the resource, edit it in text editor, and then apply the resource with the updated version:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10663"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment my-nginx -o yaml > /tmp/nginx.yaml\nvi /tmp/nginx.yaml\n# do some edit, and then save the file\n\nkubectl apply -f /tmp/nginx.yaml\ndeployment.apps/my-nginx configured\n\nrm /tmp/nginx.yaml\n```\n\n4 - Managing Workloads | This allows you to do more significant changes more easily. Note that you can specify the editor with your EDITOR or KUBE_EDITOR environment variables.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10664"}
{"instruction": "Write a bash example for workloads", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml --force\n```\n\n4 - Managing Workloads | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/_print/", "id": "k8s_00658_code_10665"}
{"instruction": "What is the reference documentation for kubectl config get-users?", "response": "kubectl config get-usersSynopsisDisplay users defined in the kubeconfig.kubectl config get-users [flags] Examples # List the users that kubectl knows about kubectl config get-users Options-h, --helphelp for get-usersParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-users/", "id": "k8s_00659"}
{"instruction": "Write a bash example for kubectl config get-users", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users [flags]\n```\n\nkubectl config get-users | help for get-users", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-users/", "id": "k8s_00659_code_10667"}
{"instruction": "Write a bash example for kubectl config get-users", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users [flags]\n```\n\nkubectl config get-users | help for get-users", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_get-users/", "id": "k8s_00659_code_10668"}
{"instruction": "What is the reference documentation for kubectl describe?", "response": "kubectl describeSynopsisShow details of a specific resource or group of resources.Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a name prefix, or label selector. For example: $ kubectl describe TYPE NAME_PREFIX will first check for an exact match on TYPE and NAME_PREFIX. If no such resource exists, it will output details for every resource that has a name prefixed with NAME_PREFIX.Use \"kubectl api-resources\" for a complete list of supported resources.kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME) Examples # Describe a node kubectl describe nodes kubernetes-node-emt8.c.myproject.internal # Describe a pod kubectl describe pods/nginx # Describe a pod identified by type and name in \"pod.json\" kubectl describe -f pod.json # Describe all pods kubectl describe pods # Describe pods by label name=myLabel kubectl describe pods -l name=myLabel # Describe all pods managed by the 'frontend' replication controller # (rc-created pods get the name of the rc as a prefix in the pod name) kubectl describe pods frontend Options-A, --all-namespacesIf present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.--chunk-size int Default: 500Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future.-f, --filename stringsFilename, directory, or URL to files containing the resource to describe-h, --helphelp for describe-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-events Default: trueIf true, display events related to the described object.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, -", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_describe/", "id": "k8s_00660"}
{"instruction": "Write a bash example for kubectl describe", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)\n```\n\nkubectl describe | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_describe/", "id": "k8s_00660_code_10670"}
{"instruction": "Write a bash example for kubectl describe", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)\n```\n\nkubectl describe | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_describe/", "id": "k8s_00660_code_10671"}
{"instruction": "What is the reference documentation for mapping podsecuritypolicies to pod security standards?", "response": "Mapping PodSecurityPolicies to Pod Security StandardsThe tables below enumerate the configuration parameters on PodSecurityPolicy objects, whether the field mutates and/or validates pods, and how the configuration values map to the Pod Security Standards.For each applicable parameter, the allowed values for the Baseline and Restricted profiles are listed. Anything outside the allowed values for those profiles would fall under the Privileged profile. \"No opinion\" means all values are allowed under all Pod Security Standards.For a step-by-step migration guide, see Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller.PodSecurityPolicy SpecThe fields enumerated in this table are part of the PodSecurityPolicySpec, which is specified under the .spec field path.Mapping PodSecurityPolicySpec fields to Pod Security StandardsPodSecurityPolicySpecTypePod Security Standards EquivalentprivilegedValidatingBaseline & Restricted: false / undefined / nildefaultAddCapabilitiesMutating & ValidatingRequirements match allowedCapabilities below.allowedCapabilitiesValidatingBaseline: subset ofAUDIT_WRITECHOWNDAC_OVERRIDEFOWNERFSETIDKILLMKNODNET_BIND_SERVICESETFCAPSETGIDSETPCAPSETUIDSYS_CHROOTRestricted: empty / undefined / nil OR a list containing only NET_BIND_SERVICErequiredDropCapabilitiesMutating & ValidatingBaseline: no opinionRestricted: must include ALLvolumesValidatingBaseline: anything excepthostPath*Restricted: subset ofconfigMapcsidownwardAPIemptyDirephemeralpersistentVolumeClaimprojectedsecrethostNetworkValidatingBaseline & Restricted: false / undefined / nilhostPortsValidatingBaseline & Restricted: undefined / nil / emptyhostPIDValidatingBaseline & Restricted: false / undefined / nilhostIPCValidatingBaseline & Restricted: false / undefined / nilseLinuxMutating & ValidatingBaseline & Restricted: seLinux.rule is MustRunAs, with the following optionsuser is unset (\"\" / undefined / nil)role is unset (\"\" / undefined / nil)type is unset or one of: container_t, container_init_t, container_kvm_t, container_engine_tlevel is anythingrunAsUserMutating & ValidatingBaseline: AnythingRestricted: rule is MustRunAsNonRootrunAsGroupMutating (MustRunAs) & ValidatingNo opinionsupplementalGroupsMutating & ValidatingNo opinionfsGroupMutating & ValidatingNo opinionreadOnlyRootFilesystemMutating & ValidatingNo opiniondefaultAllowPrivilegeEscalationMutatingNo opinion (non-validating)allowPrivilegeEscalationMutating & ValidatingOnly mutating if set to falseBaseline: No opinionRestricted: falseallowedHostPathsValidatingNo opinion (volumes takes precedence)allowedFlexVolumesValidatingNo opinion (volumes takes precedence)allowedCSIDriversValidatingNo opinion (volumes takes precedence)allowedUnsafeSysctlsValidatingBaseline & Restricted: undefined / nil / emptyforbiddenSysctlsValidatingNo opinionallowedProcMountTypes(alpha feature)ValidatingBaseline & Restricted: [\"Default\"] OR undefined / nil / emptyruntimeClass .defaultRuntimeClassNameMutatingNo opinionruntimeClass .allowedRuntimeClassNamesValidatingNo opinionPodSecurityPolicy annotationsThe annotations enumerated in this table can be specified under .metadata.annotations on the PodSecurityPolicy object.Mapping PodSecurityPolicy annotations to Pod Security StandardsPSP AnnotationTypePod Security Standards Equivalentseccomp.security.alpha.kubernetes.io/defaultProfileNameMutatingNo opinionseccomp.security.alpha.kubernetes.io/allowedProfileNamesValidatingBaseline: \"runtime/default,\" (Trailing comma to allow unset)Restricted: \"runtime/default\" (No trailing comma)localhost/* values are also permitted for both Baseline & Restricted.apparmor.security.beta.kubernetes.io/defaultProfileNameMutatingNo opinionapparmor.security.beta.kubernetes.io/allowedProfileNamesValidatingBaseline: \"runtime/default,\" (Trailing comma to allow unset)Restricted: \"runtime/default\" (No trailing comma)localhost/* values are also permitted for both Baseline & Restricted.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/psp-to-pod-security-standards/", "id": "k8s_00661"}
{"instruction": "What is the reference documentation for api access control?", "response": "API Access ControlFor an introduction to how Kubernetes implements and controls API access, read Controlling Access to the Kubernetes API.Reference documentation:AuthenticatingAuthenticating with Bootstrap TokensAdmission ControllersDynamic Admission ControlAuthorizationRole Based Access ControlAttribute Based Access ControlNode AuthorizationWebhook AuthorizationCertificate Signing Requestsincluding CSR approval and certificate signingService accountsDeveloper guideAdministrationKubelet Authentication & Authorizationincluding kubelet TLS bootstrapping", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/", "id": "k8s_00662"}
{"instruction": "What is the reference documentation for apiservice?", "response": "APIServiceAPIService represents a server for a particular GroupVersion.apiVersion: apiregistration.k8s.io/v1import \"k8s.io/kube-aggregator/pkg/apis/apiregistration/v1\"APIServiceAPIService represents a server for a particular GroupVersion. Name must be \"version.group\".apiVersion: apiregistration.k8s.io/v1kind: APIServicemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (APIServiceSpec)Spec contains information for locating and communicating with a serverstatus (APIServiceStatus)Status contains derived information about an API serverAPIServiceSpecAPIServiceSpec contains information for locating and communicating with a server. Only https is supported, though you are able to disable certificate verification.groupPriorityMinimum (int32), requiredGroupPriorityMinimum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMinimum values such that the whole group gets a higher priority. The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) We'd recommend something like: *.k8s.io (except extensions) at 18000 and PaaSes (OpenShift, Deis) are recommended to be in the 2000sversionPriority (int32), requiredVersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). Since it's inside of a group, the number can be small, probably in the 10s. In case of equal version priorities, the version string will be used to compute the order inside a group. If the version string is \"kube-like\", it will sort above non \"kube-like\" version strings, which are ordered lexicographically. \"Kube-like\" versions start with a \"v\", then are followed by a number (the major version), then optionally the string \"alpha\" or \"beta\" and another number (the minor version). These are sorted first by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.caBundle ([]byte)Atomic: will be replaced during a mergeCABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. If unspecified, system trust roots on the apiserver are used.group (string)Group is the API group name this server hostsinsecureSkipTLSVerify (boolean)InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead.service (ServiceReference)Service is a reference to the service for this API server. It must communicate on port 443. If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be fulfilled.ServiceReference holds a reference to Service.legacy.k8s.ioservice.name (string)Name is the name of the serviceservice.namespace (string)Namespace is the namespace of the serviceservice.port (int32)If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. port should be a valid port number (1-65535, inclusive).version (string)Version is the API version this server hosts. For example, \"v1\"APIServiceStatusAPIServiceStatus contains derived information about an API serverconditions ([]APIServiceCondition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeCurrent service state of apiService.APIServiceCondition describes the state of an APIService at a p", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/api-service-v1/", "id": "k8s_00663"}
{"instruction": "Write a yaml example for apiservice", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\n```\n\nAPIService | import \"k8s.io/kube-aggregator/pkg/apis/apiregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/api-service-v1/", "id": "k8s_00663_code_10675"}
{"instruction": "Explain production environment in Kubernetes", "response": "Production environmentCreate a production-quality Kubernetes clusterA production-quality Kubernetes cluster requires planning and preparation. If your Kubernetes cluster is to run critical workloads, it must be configured to be resilient. This page explains steps you can take to set up a production-ready cluster, or to promote an existing cluster for production use. If you're already familiar with production setup and want the links, skip to What's next.Production considerationsTypically, a production Kubernetes cluster environment has more requirements than a personal learning, development, or test environment Kubernetes. A production environment may require secure access by many users, consistent availability, and the resources to adapt to changing demands.As you decide where you want your production Kubernetes environment to live (on premises or in a cloud) and the amount of management you want to take on or hand to others, consider how your requirements for a Kubernetes cluster are influenced by the following issues:Availability: A single-machine Kubernetes learning environment has a single point of failure. Creating a highly available cluster means considering:Separating the control plane from the worker nodes.Replicating the control plane components on multiple nodes.Load balancing traffic to the cluster’s API server.Having enough worker nodes available, or able to quickly become available, as changing workloads warrant it.Scale: If you expect your production Kubernetes environment to receive a stable amount of demand, you might be able to set up for the capacity you need and be done. However, if you expect demand to grow over time or change dramatically based on things like season or special events, you need to plan how to scale to relieve increased pressure from more requests to the control plane and worker nodes or scale down to reduce unused resources.Security and access management: You have full admin privileges on your own Kubernetes learning cluster. But shared clusters with important workloads, and more than one or two users, require a more refined approach to who and what can access cluster resources. You can use role-based access control (RBAC) and other security mechanisms to make sure that users and workloads can get access to the resources they need, while keeping workloads, and the cluster itself, secure. You can set limits on the resources that users and workloads can access by managing policies and container resources.Before building a Kubernetes production environment on your own, consider handing off some or all of this job to Turnkey Cloud Solutions providers or other Kubernetes Partners. Options include:Serverless: Just run workloads on third-party equipment without managing a cluster at all. You will be charged for things like CPU usage, memory, and disk requests.Managed control plane: Let the provider manage the scale and availability of the cluster's control plane, as well as handle patches and upgrades.Managed worker nodes: Configure pools of nodes to meet your needs, then the provider makes sure those nodes are available and ready to implement upgrades when needed.Integration: There are providers that integrate Kubernetes with other services you may need, such as storage, container registries, authentication methods, and development tools.Whether you build a production Kubernetes cluster yourself or work with partners, review the following sections to evaluate your needs as they relate to your cluster’s control plane, worker nodes, user access, and workload resources.Production cluster setupIn a production-quality Kubernetes cluster, the control plane manages the cluster from services that can be spread across multiple computers in different ways. Each worker node, however, represents a single entity that is configured to run Kubernetes pods.Production control planeThe simplest Kubernetes cluster has the entire control plane and worker node services running on the same machine. You can grow that ", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/", "id": "k8s_00664"}
{"instruction": "Explain kubernetes documentation in Kubernetes", "response": "Kubernetes is an open source container orchestration engine for automating deployment, scaling, and management of containerized applications. The open source project is hosted by the Cloud Native Computing Foundation (CNCF).Understand KubernetesLearn about Kubernetes and its fundamental concepts.Why Kubernetes?Components of a clusterThe Kubernetes APIObjects In KubernetesContainersWorkloads and PodsView ConceptsTry KubernetesFollow tutorials to learn how to deploy applications in Kubernetes.Hello MinikubeWalkthrough the basicsStateless Example: PHP Guestbook with RedisStateful Example: Wordpress with Persistent VolumesView TutorialsSet up a K8s clusterGet Kubernetes running based on your resources and needs.Learning environmentProduction environmentInstall the kubeadm setup toolSecuring a clusterkubeadm command referenceSet up KubernetesLearn how to use KubernetesLook up common tasks and how to perform them using a short sequence of steps.kubectl Quick ReferenceInstall kubectlConfigure access to clustersUse the Web UI DashboardConfigure a Pod to Use a ConfigMapGetting helpView TasksLook up reference informationBrowse terminology, command line syntax, API resource types, and setup tool documentation.Glossarykubectl command line toolLabels, annotations and taintsKubernetes API referenceOverview of APIFeature GatesView ReferenceContribute to KubernetesFind out how you can help make Kubernetes better.Contribute to KubernetesContribute to documentationSuggest content improvementsOpening a pull requestDocumenting a feature for a releaseLocalizing the docsParticipating in SIG DocsViewing Site AnalyticsSee Ways to ContributeTrainingGet certified in Kubernetes and make your cloud native projects successful!View trainingDownload KubernetesInstall Kubernetes or upgrade to the newest version.Download KubernetesAbout the documentationThis website contains documentation for the current and previous 4 versions of Kubernetes.See available versions", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/home/", "id": "k8s_00665"}
{"instruction": "What is the reference documentation for kube-apiserver?", "response": "kube-apiserverSynopsisThe Kubernetes API server validates and configures data for the api objects which include pods, services, replicationcontrollers, and others. The API Server services REST operations and provides the frontend to the cluster's shared state through which all other components interact.kube-apiserver [flags] Options--admission-control-config-file stringFile with admission control configuration.--advertise-address stringThe IP address on which to advertise the apiserver to members of the cluster. This address must be reachable by the rest of the cluster. If blank, the --bind-address will be used. If --bind-address is unspecified, the host's default interface will be used.--aggregator-reject-forwarding-redirect Default: trueAggregator reject forwarding redirect response back to client.--allow-metric-labels stringToString Default: []The map from metric-label to value allow-list of this label. The key's format is <MetricName>,<LabelName>. The value's format is <allowed_value>,<allowed_value>...e.g. metric1,label1='v1,v2,v3', metric1,label2='v1,v2,v3' metric2,label1='v1,v2,v3'.--allow-metric-labels-manifest stringThe path to the manifest file that contains the allow-list mapping. The format of the file is the same as the flag --allow-metric-labels. Note that the flag --allow-metric-labels will override the manifest file.--allow-privilegedIf true, allow privileged containers. [default=false]--anonymous-auth Default: trueEnables anonymous requests to the secure port of the API server. Requests that are not rejected by another authentication method are treated as anonymous requests. Anonymous requests have a username of system:anonymous, and a group name of system:unauthenticated.--api-audiences stringsIdentifiers of the API. The service account token authenticator will validate that tokens used against the API are bound to at least one of these audiences. If the --service-account-issuer flag is configured and this flag is not, this field defaults to a single element list containing the issuer URL.--audit-log-batch-buffer-size int Default: 10000The size of the buffer to store events before batching and writing. Only used in batch mode.--audit-log-batch-max-size int Default: 1The maximum size of a batch. Only used in batch mode.--audit-log-batch-max-wait durationThe amount of time to wait before force writing the batch that hadn't reached the max size. Only used in batch mode.--audit-log-batch-throttle-burst intMaximum number of requests sent at the same moment if ThrottleQPS was not utilized before. Only used in batch mode.--audit-log-batch-throttle-enableWhether batching throttling is enabled. Only used in batch mode.--audit-log-batch-throttle-qps floatMaximum average number of batches per second. Only used in batch mode.--audit-log-compressIf set, the rotated log files will be compressed using gzip.--audit-log-format string Default: \"json\"Format of saved audits. \"legacy\" indicates 1-line text format for each event. \"json\" indicates structured json format. Known formats are legacy,json.--audit-log-maxage intThe maximum number of days to retain old audit log files based on the timestamp encoded in their filename.--audit-log-maxbackup intThe maximum number of old audit log files to retain. Setting a value of 0 will mean there's no restriction on the number of files.--audit-log-maxsize intThe maximum size in megabytes of the audit log file before it gets rotated.--audit-log-mode string Default: \"blocking\"Strategy for sending audit events. Blocking indicates sending events should block server responses. Batch causes the backend to buffer and write events asynchronously. Known modes are batch,blocking,blocking-strict.--audit-log-path stringIf set, all requests coming to the apiserver will be logged to this file. '-' means standard out.--audit-log-truncate-enabledWhether event and batch truncating is enabled.--audit-log-truncate-max-batch-size int Default: 10485760Maximum size of the batch sent to the underlying backend. A", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/", "id": "k8s_00666"}
{"instruction": "Explain the Kubernetes concept: Automatic Cleanup for Finished Jobs", "response": "Automatic Cleanup for Finished JobsA time-to-live mechanism to clean up old Jobs that have finished execution.FEATURE STATE: Kubernetes v1.23 [stable]When your Job has finished, it's useful to keep that Job in the API (and not immediately delete the Job) so that you can tell whether the Job succeeded or failed.Kubernetes' TTL-after-finished controller provides a TTL (time to live) mechanism to limit the lifetime of Job objects that have finished execution.Cleanup for finished JobsThe TTL-after-finished controller is only supported for Jobs. You can use this mechanism to clean up finished Jobs (either Complete or Failed) automatically by specifying the .spec.ttlSecondsAfterFinished field of a Job, as in this example.The TTL-after-finished controller assumes that a Job is eligible to be cleaned up TTL seconds after the Job has finished. The timer starts once the status condition of the Job changes to show that the Job is either Complete or Failed; once the TTL has expired, that Job becomes eligible for cascading removal. When the TTL-after-finished controller cleans up a job, it will delete it cascadingly, that is to say it will delete its dependent objects together with it.Kubernetes honors object lifecycle guarantees on the Job, such as waiting for finalizers.You can set the TTL seconds at any time. Here are some examples for setting the .spec.ttlSecondsAfterFinished field of a Job:Specify this field in the Job manifest, so that a Job can be cleaned up automatically some time after it finishes.Manually set this field of existing, already finished Jobs, so that they become eligible for cleanup.Use a mutating admission webhook to set this field dynamically at Job creation time. Cluster administrators can use this to enforce a TTL policy for finished jobs.Use a mutating admission webhook to set this field dynamically after the Job has finished, and choose different TTL values based on job status, labels. For this case, the webhook needs to detect changes to the .status of the Job and only set a TTL when the Job is being marked as completed.Write your own controller to manage the cleanup TTL for Jobs that match a particular selector.CaveatsUpdating TTL for finished JobsYou can modify the TTL period, e.g. .spec.ttlSecondsAfterFinished field of Jobs, after the job is created or has finished. If you extend the TTL period after the existing ttlSecondsAfterFinished period has expired, Kubernetes doesn't guarantee to retain that Job, even if an update to extend the TTL returns a successful API response.Time skewBecause the TTL-after-finished controller uses timestamps stored in the Kubernetes jobs to determine whether the TTL has expired or not, this feature is sensitive to time skew in your cluster, which may cause the control plane to clean up Job objects at the wrong time.Clocks aren't always correct, but the difference should be very small. Please be aware of this risk when setting a non-zero TTL.What's nextRead Clean up Jobs automaticallyRefer to the Kubernetes Enhancement Proposal (KEP) for adding this mechanism.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/", "id": "k8s_00667"}
{"instruction": "What is the reference documentation for kubeadm config?", "response": "kubeadm configDuring kubeadm init, kubeadm uploads the ClusterConfiguration object to your cluster in a ConfigMap called kubeadm-config in the kube-system namespace. This configuration is then read during kubeadm join, kubeadm reset and kubeadm upgrade.You can use kubeadm config print to print the default static configuration that kubeadm uses for kubeadm init and kubeadm join.Note:The output of the command is meant to serve as an example. You must manually edit the output of this command to adapt to your setup. Remove the fields that you are not certain about and kubeadm will try to default them on runtime by examining the host.For more information on init and join navigate to Using kubeadm init with a configuration file or Using kubeadm join with a configuration file.For more information on using the kubeadm configuration API navigate to Customizing components with the kubeadm API.You can use kubeadm config migrate to convert your old configuration files that contain a deprecated API version to a newer, supported API version.kubeadm config validate can be used for validating a configuration file.kubeadm config images list and kubeadm config images pull can be used to list and pull the images that kubeadm requires.kubeadm config printPrint configurationSynopsisThis command prints configurations for subcommands provided. For details, see: https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm#section-directorieskubeadm config print [flags] Options-h, --helphelp for printOptions inherited from parent commands--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm config print init-defaultsPrint default init configuration, that can be used for 'kubeadm init'SynopsisThis command prints objects such as the default init configuration that is used for 'kubeadm init'.Note that sensitive values like the Bootstrap Token fields are replaced with placeholder values like \"abcdef.0123456789abcdef\" in order to pass validation but not perform the real computation for creating a token.kubeadm config print init-defaults [flags] Options--component-configs stringsA comma-separated list for component config API objects to print the default values for. Available values: [KubeProxyConfiguration KubeletConfiguration]. If this flag is not set, no component configs will be printed.-h, --helphelp for init-defaultsOptions inherited from parent commands--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm config print join-defaultsPrint default join configuration, that can be used for 'kubeadm join'SynopsisThis command prints objects such as the default join configuration that is used for 'kubeadm join'.Note that sensitive values like the Bootstrap Token fields are replaced with placeholder values like \"abcdef.0123456789abcdef\" in order to pass validation but not perform the real computation for creating a token.kubeadm config print join-defaults [flags] Options-h, --helphelp for join-defaultsOptions inherited from parent commands--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.kubeadm config migrateRead an older version of the kubeadm configuration API types from a file, and output the similar config object for ", "category": "reference", "subcategory": "config-file-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-config/", "id": "k8s_00668"}
{"instruction": "What is the reference documentation for kubeadm?", "response": "KubeadmKubeadm is a tool built to provide kubeadm init and kubeadm join as best-practice \"fast paths\" for creating Kubernetes clusters.kubeadm performs the actions necessary to get a minimum viable cluster up and running. By design, it cares only about bootstrapping, not about provisioning machines. Likewise, installing various nice-to-have addons, like the Kubernetes Dashboard, monitoring solutions, and cloud-specific addons, is not in scope.Instead, we expect higher-level and more tailored tooling to be built on top of kubeadm, and ideally, using kubeadm as the basis of all deployments will make it easier to create conformant clusters.How to installTo install kubeadm, see the installation guide.What's nextkubeadm init to bootstrap a Kubernetes control-plane nodekubeadm join to bootstrap a Kubernetes worker node and join it to the clusterkubeadm upgrade to upgrade a Kubernetes cluster to a newer versionkubeadm config if you initialized your cluster using kubeadm v1.7.x or lower, to configure your cluster for kubeadm upgradekubeadm token to manage tokens for kubeadm joinkubeadm reset to revert any changes made to this host by kubeadm init or kubeadm joinkubeadm certs to manage Kubernetes certificateskubeadm kubeconfig to manage kubeconfig fileskubeadm version to print the kubeadm versionkubeadm alpha to preview a set of features made available for gathering", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/", "id": "k8s_00669"}
{"instruction": "What is the reference documentation for implementation details?", "response": "Implementation detailsFEATURE STATE: Kubernetes v1.10 [stable]kubeadm init and kubeadm join together provide a nice user experience for creating a bare Kubernetes cluster from scratch, that aligns with the best-practices. However, it might not be obvious how kubeadm does that.This document provides additional details on what happens under the hood, with the aim of sharing knowledge on the best practices for a Kubernetes cluster.Core design principlesThe cluster that kubeadm init and kubeadm join set up should be:Secure: It should adopt latest best-practices like:enforcing RBACusing the Node Authorizerusing secure communication between the control plane componentsusing secure communication between the API server and the kubeletslock-down the kubelet APIlocking down access to the API for system components like the kube-proxy and CoreDNSlocking down what a Bootstrap Token can accessUser-friendly: The user should not have to run anything more than a couple of commands:kubeadm initexport KUBECONFIG=/etc/kubernetes/admin.confkubectl apply -f <network-plugin-of-choice.yaml>kubeadm join --token <token> <endpoint>:<port>Extendable:It should not favor any particular network provider. Configuring the cluster network is out-of-scopeIt should provide the possibility to use a config file for customizing various parametersConstants and well-known values and pathsIn order to reduce complexity and to simplify development of higher level tools that build on top of kubeadm, it uses a limited set of constant values for well-known paths and file names.The Kubernetes directory /etc/kubernetes is a constant in the application, since it is clearly the given path in a majority of cases, and the most intuitive location; other constant paths and file names are:/etc/kubernetes/manifests as the path where the kubelet should look for static Pod manifests. Names of static Pod manifests are:etcd.yamlkube-apiserver.yamlkube-controller-manager.yamlkube-scheduler.yaml/etc/kubernetes/ as the path where kubeconfig files with identities for control plane components are stored. Names of kubeconfig files are:kubelet.conf (bootstrap-kubelet.conf during TLS bootstrap)controller-manager.confscheduler.confadmin.conf for the cluster admin and kubeadm itselfsuper-admin.conf for the cluster super-admin that can bypass RBACNames of certificates and key files:ca.crt, ca.key for the Kubernetes certificate authorityapiserver.crt, apiserver.key for the API server certificateapiserver-kubelet-client.crt, apiserver-kubelet-client.key for the client certificate used by the API server to connect to the kubelets securelysa.pub, sa.key for the key used by the controller manager when signing ServiceAccountfront-proxy-ca.crt, front-proxy-ca.key for the front proxy certificate authorityfront-proxy-client.crt, front-proxy-client.key for the front proxy clientThe kubeadm configuration file formatMost kubeadm commands support a --config flag which allows passing a configuration file from disk. The configuration file format follows the common Kubernetes API apiVersion / kind scheme, but is considered a component configuration format. Several Kubernetes components, such as the kubelet, also support file-based configuration.Different kubeadm subcommands require a different kind of configuration file. For example, InitConfiguration for kubeadm init, JoinConfiguration for kubeadm join, UpgradeConfiguration for kubeadm upgrade and ResetConfiguration for kubeadm reset.The command kubeadm config migrate can be used to migrate an older format configuration file to a newer (current) configuration format. The kubeadm tool only supports migrating from deprecated configuration formats to the current format.See the kubeadm configuration reference page for more details.kubeadm init workflow internal designThe kubeadm init consists of a sequence of atomic work tasks to perform, as described in the kubeadm init internal workflow.The kubeadm init phase command allows users to invoke each task individually, ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/implementation-details/", "id": "k8s_00670"}
{"instruction": "Write a bash example for implementation details", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <network-plugin-of-choice.yaml>\n```\n\nImplementation details | In order to reduce complexity and to simplify development of higher level tools that build on top of kubeadm, it uses a limited set of constant values for well-known paths and file names.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/implementation-details/", "id": "k8s_00670_code_10683"}
{"instruction": "Explain the Kubernetes concept: Controllers", "response": "ControllersIn robotics and automation, a control loop is a non-terminating loop that regulates the state of a system.Here is one example of a control loop: a thermostat in a room.When you set the temperature, that's telling the thermostat about your desired state. The actual room temperature is the current state. The thermostat acts to bring the current state closer to the desired state, by turning equipment on or off.In Kubernetes, controllers are control loops that watch the state of your cluster, then make or request changes where needed. Each controller tries to move the current cluster state closer to the desired state.Controller patternA controller tracks at least one Kubernetes resource type. These objects have a spec field that represents the desired state. The controller(s) for that resource are responsible for making the current state come closer to that desired state.The controller might carry the action out itself; more commonly, in Kubernetes, a controller will send messages to the API server that have useful side effects. You'll see examples of this below.Control via API serverThe Job controller is an example of a Kubernetes built-in controller. Built-in controllers manage state by interacting with the cluster API server.Job is a Kubernetes resource that runs a Pod, or perhaps several Pods, to carry out a task and then stop.(Once scheduled, Pod objects become part of the desired state for a kubelet).When the Job controller sees a new task it makes sure that, somewhere in your cluster, the kubelets on a set of Nodes are running the right number of Pods to get the work done. The Job controller does not run any Pods or containers itself. Instead, the Job controller tells the API server to create or remove Pods. Other components in the control plane act on the new information (there are new Pods to schedule and run), and eventually the work is done.After you create a new Job, the desired state is for that Job to be completed. The Job controller makes the current state for that Job be nearer to your desired state: creating Pods that do the work you wanted for that Job, so that the Job is closer to completion.Controllers also update the objects that configure them. For example: once the work is done for a Job, the Job controller updates that Job object to mark it Finished.(This is a bit like how some thermostats turn a light off to indicate that your room is now at the temperature you set).Direct controlIn contrast with Job, some controllers need to make changes to things outside of your cluster.For example, if you use a control loop to make sure there are enough Nodes in your cluster, then that controller needs something outside the current cluster to set up new Nodes when needed.Controllers that interact with external state find their desired state from the API server, then communicate directly with an external system to bring the current state closer in line.(There actually is a controller that horizontally scales the nodes in your cluster.)The important point here is that the controller makes some changes to bring about your desired state, and then reports the current state back to your cluster's API server. Other control loops can observe that reported data and take their own actions.In the thermostat example, if the room is very cold then a different controller might also turn on a frost protection heater. With Kubernetes clusters, the control plane indirectly works with IP address management tools, storage services, cloud provider APIs, and other services by extending Kubernetes to implement that.Desired versus current stateKubernetes takes a cloud-native view of systems, and is able to handle constant change.Your cluster could be changing at any point as work happens and control loops automatically fix failures. This means that, potentially, your cluster never reaches a stable state.As long as the controllers for your cluster are running and able to make useful changes, it doesn't matter if the overall state is", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/architecture/controller/", "id": "k8s_00671"}
{"instruction": "Explain the Kubernetes concept: Namespaces", "response": "NamespacesIn Kubernetes, namespaces provide a mechanism for isolating groups of resources within a single cluster. Names of resources need to be unique within a namespace, but not across namespaces. Namespace-based scoping is applicable only for namespaced objects (e.g. Deployments, Services, etc.) and not for cluster-wide objects (e.g. StorageClass, Nodes, PersistentVolumes, etc.).When to Use Multiple NamespacesNamespaces are intended for use in environments with many users spread across multiple teams, or projects. For clusters with a few to tens of users, you should not need to create or think about namespaces at all. Start using namespaces when you need the features they provide.Namespaces provide a scope for names. Names of resources need to be unique within a namespace, but not across namespaces. Namespaces cannot be nested inside one another and each Kubernetes resource can only be in one namespace.Namespaces are a way to divide cluster resources between multiple users (via resource quota).It is not necessary to use multiple namespaces to separate slightly different resources, such as different versions of the same software: use labels to distinguish resources within the same namespace.Note:For a production cluster, consider not using the default namespace. Instead, make other namespaces and use those.Initial namespacesKubernetes starts with four initial namespaces:defaultKubernetes includes this namespace so that you can start using your new cluster without first creating a namespace.kube-node-leaseThis namespace holds Lease objects associated with each node. Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.kube-publicThis namespace is readable by all clients (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.kube-systemThe namespace for objects created by the Kubernetes system.Working with NamespacesCreation and deletion of namespaces are described in the Admin Guide documentation for namespaces.Note:Avoid creating namespaces with the prefix kube-, since it is reserved for Kubernetes system namespaces.Viewing namespacesYou can list the current namespaces in a cluster using:kubectl get namespace NAME STATUS AGE default Active 1d kube-node-lease Active 1d kube-public Active 1d kube-system Active 1d Setting the namespace for a requestTo set the namespace for a current request, use the --namespace flag.For example:kubectl run nginx --image=nginx --namespace=<insert-namespace-name-here> kubectl get pods --namespace=<insert-namespace-name-here> Setting the namespace preferenceYou can permanently save the namespace for all subsequent kubectl commands in that context.kubectl config set-context --current --namespace=<insert-namespace-name-here> # Validate it kubectl config view --minify | grep namespace: Namespaces and DNSWhen you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>, it will resolve to the service which is local to a namespace. This is useful for using the same configuration across multiple namespaces such as Development, Staging and Production. If you want to reach across namespaces, you need to use the fully qualified domain name (FQDN).As a result, all namespace names must be valid RFC 1123 DNS labels.Warning:By creating namespaces with the same name as public top-level domains, Services in these namespaces can have short DNS names that overlap with public DNS records. Workloads from any namespace performing a DNS lookup without a trailing dot will be redirected to those services, taking precedence over public DNS.To mitigate this, limit privileges for creating namespaces to trusted users. If required, you could ad", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", "id": "k8s_00672"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\nNamespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", "id": "k8s_00672_code_10686"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\nNamespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", "id": "k8s_00672_code_10687"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\nNamespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", "id": "k8s_00672_code_10688"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace\n```\n\nNamespaces | To set the namespace for a current request, use the --namespace flag.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", "id": "k8s_00672_code_10689"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>\nkubectl get pods --namespace=<insert-namespace-name-here>\n```\n\nNamespaces | You can permanently save the namespace for all subsequent kubectl commands in that context.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", "id": "k8s_00672_code_10690"}
{"instruction": "Write a bash example for namespaces", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<insert-namespace-name-here>\n# Validate it\nkubectl config view --minify | grep namespace:\n```\n\nNamespaces | When you create a Service, it creates a corresponding DNS entry. This entry is of the form <service-name>.<namespace-name>.svc.cluster.local, which means that if a container only uses <service-name>,", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", "id": "k8s_00672_code_10691"}
{"instruction": "How do you configure a pod to use a volume for storage in Kubernetes?", "response": "Configure a Pod to Use a Volume for StorageThis page shows how to configure a Pod to use a Volume for storage.A Container's file system lives only as long as the Container does. So when a Container terminates and restarts, filesystem changes are lost. For more consistent storage that is independent of the Container, you can use a Volume. This is especially important for stateful applications, such as key-value stores (such as Redis) and databases.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Configure a volume for a PodIn this exercise, you create a Pod that runs one Container. This Pod has a Volume of type emptyDir that lasts for the life of the Pod, even if the Container terminates and restarts. Here is the configuration file for the Pod:pods/storage/redis.yaml apiVersion: v1 kind: Pod metadata: name: redis spec: containers: - name: redis image: redis volumeMounts: - name: redis-storage mountPath: /data/redis volumes: - name: redis-storage emptyDir: {} Create the Pod:kubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml Verify that the Pod's Container is running, and then watch for changes to the Pod:kubectl get pod redis --watch The output looks like this:NAME READY STATUS RESTARTS AGE redis 1/1 Running 0 13s In another terminal, get a shell to the running Container:kubectl exec -it redis -- /bin/bash In your shell, go to /data/redis, and then create a file:root@redis:/data# cd /data/redis/ root@redis:/data/redis# echo Hello > test-file In your shell, list the running processes:root@redis:/data/redis# apt-get update root@redis:/data/redis# apt-get install procps root@redis:/data/redis# ps aux The output is similar to this:USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND redis 1 0.1 0.1 33308 3828 ? Ssl 00:46 0:00 redis-server *:6379 root 12 0.0 0.0 20228 3020 ? Ss 00:47 0:00 /bin/bash root 15 0.0 0.0 17500 2072 ? R+ 00:48 0:00 ps aux In your shell, kill the Redis process:root@redis:/data/redis# kill <pid> where <pid> is the Redis process ID (PID).In your original terminal, watch for changes to the Redis Pod. Eventually, you will see something like this:NAME READY STATUS RESTARTS AGE redis 1/1 Running 0 13s redis 0/1 Completed 0 6m redis 1/1 Running 1 6m At this point, the Container has terminated and restarted. This is because the Redis Pod has a restartPolicy of Always.Get a shell into the restarted Container:kubectl exec -it redis -- /bin/bash In your shell, go to /data/redis, and verify that test-file is still there.root@redis:/data/redis# cd /data/redis/ root@redis:/data/redis# ls test-file Delete the Pod that you created for this exercise:kubectl delete pod redis What's nextSee Volume.See Pod.In addition to the local disk storage provided by emptyDir, Kubernetes supports many different network-attached storage solutions, including PD on GCE and EBS on EC2, which are preferred for critical data and will handle details such as mounting and unmounting the devices on the nodes. See Volumes for more details.", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673"}
{"instruction": "Write a yaml example for configure a pod to use a volume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\nConfigure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10693"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml\n```\n\nConfigure a Pod to Use a Volume for Storage | Verify that the Pod's Container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10694"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pod redis --watch\n```\n\nConfigure a Pod to Use a Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10695"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\nConfigure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and then create a file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10696"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\nConfigure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and verify that test-file is still there.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10697"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\n```\n\nConfigure a Pod to Use a Volume for Storage | See Volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10698"}
{"instruction": "Write a yaml example for configure a pod to use a volume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\nConfigure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10699"}
{"instruction": "Write a yaml example for configure a pod to use a volume for storage", "response": "Here's a yaml example:\n\n```yaml\npods/storage/redis.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\nConfigure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10700"}
{"instruction": "Write a yaml example for configure a pod to use a volume for storage", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\nConfigure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10701"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml\n```\n\nConfigure a Pod to Use a Volume for Storage | Verify that the Pod's Container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10702"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl get pod redis --watch\n```\n\nConfigure a Pod to Use a Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10703"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\nConfigure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and then create a file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10704"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\nConfigure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and verify that test-file is still there.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10705"}
{"instruction": "Write a bash example for configure a pod to use a volume for storage", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\n```\n\nConfigure a Pod to Use a Volume for Storage | See Volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/", "id": "k8s_00673_code_10706"}
{"instruction": "How do you developing and debugging services locally using telepresence in Kubernetes?", "response": "Developing and debugging services locally using telepresenceNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Kubernetes applications usually consist of multiple, separate services, each running in its own container. Developing and debugging these services on a remote Kubernetes cluster can be cumbersome, requiring you to get a shell on a running container in order to run debugging tools.telepresence is a tool to ease the process of developing and debugging services locally while proxying the service to a remote Kubernetes cluster. Using telepresence allows you to use custom tools, such as a debugger and IDE, for a local service and provides the service full access to ConfigMap, secrets, and the services running on the remote cluster.This document describes using telepresence to develop and debug services running on a remote cluster locally.Before you beginKubernetes cluster is installedkubectl is configured to communicate with the clusterTelepresence is installedConnecting your local machine to a remote Kubernetes clusterAfter installing telepresence, run telepresence connect to launch its Daemon and connect your local workstation to the cluster.$ telepresence connect Launching Telepresence Daemon ... Connected to context default (https://<cluster public IP>) You can curl services using the Kubernetes syntax e.g. curl -ik https://kubernetes.defaultDeveloping or debugging an existing serviceWhen developing an application on Kubernetes, you typically program or debug a single service. The service might require access to other services for testing and debugging. One option is to use the continuous deployment pipeline, but even the fastest deployment pipeline introduces a delay in the program or debug cycle.Use the telepresence intercept $SERVICE_NAME --port $LOCAL_PORT:$REMOTE_PORT command to create an \"intercept\" for rerouting remote service traffic.Where:$SERVICE_NAME is the name of your local service$LOCAL_PORT is the port that your service is running on your local workstationAnd $REMOTE_PORT is the port your service listens to in the clusterRunning this command tells Telepresence to send remote traffic to your local service instead of the service in the remote Kubernetes cluster. Make edits to your service source code locally, save, and see the corresponding changes when accessing your remote application take effect immediately. You can also run your local service using a debugger or any other local development tool.How does Telepresence work?Telepresence installs a traffic-agent sidecar next to your existing application's container running in the remote cluster. It then captures all traffic requests going into the Pod, and instead of forwarding this to the application in the remote cluster, it routes all traffic (when you create a global intercept or a subset of the traffic (when you create a personal intercept) to your local development environment.What's nextIf you're interested in a hands-on tutorial, check out this tutorial that walks through locally developing the Guestbook application on Google Kubernetes Engine.For further reading, visit the Telepresence website.Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/debug/debug-cluster/local-debugging/", "id": "k8s_00674"}
{"instruction": "What is the reference documentation for objectmeta?", "response": "ObjectMetaObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.import \"k8s.io/apimachinery/pkg/apis/meta/v1\"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.name (string)Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#namesgenerateName (string)GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.If this field is specified and the generated name exists, the server will return a 409.Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotencynamespace (string)Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaceslabels (map[string]string)Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labelsannotations (map[string]string)Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotationsSystemfinalizers ([]string)Set: unique values will be kept during a mergeMust be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.managedFields ([]ManagedFieldsEntry)Atomic: will be replaced during a mergeManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.managedFields.apiVersion (string", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/", "id": "k8s_00675"}
{"instruction": "What is the reference documentation for kubeadm upgrade phases?", "response": "kubeadm upgrade phaseskubeadm upgrade apply phaseUsing the phases of kubeadm upgrade apply, you can choose to execute the separate steps of the initial upgrade of a control plane node.SynopsisUse this command to invoke single phase of the \"apply\" workflowkubeadm upgrade apply phase [flags] Options-h, --helphelp for phaseOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisRun preflight checks before upgradekubeadm upgrade apply phase preflight [flags] Options--allow-experimental-upgradesShow unstable versions of Kubernetes as an upgrade alternative and allow upgrading to an alpha/beta/release candidate versions of Kubernetes.--allow-release-candidate-upgradesShow release candidate versions of Kubernetes as an upgrade alternative and allow upgrading to a release candidate versions of Kubernetes.--config stringPath to a kubeadm configuration file.--dry-runDo not change any state, just output what actions would be performed.-f, --forceForce upgrading although some requirements might not be met. This also implies non-interactive mode.-h, --helphelp for preflight--ignore-preflight-errors stringsA list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.-y, --yesPerform the upgrade and do not prompt for confirmation (non-interactive mode).Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisUpgrade the control planekubeadm upgrade apply phase control-plane [flags] Options--certificate-renewal Default: truePerform the renewal of certificates used by component changed during upgrades.--config stringPath to a kubeadm configuration file.--dry-runDo not change any state, just output what actions would be performed.--etcd-upgrade Default: truePerform the upgrade of etcd.-h, --helphelp for control-plane--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations can be searched for an existing kubeconfig file.--patches stringPath to a directory that contains files named \"target[suffix][+patchtype].extension\". For example, \"kube-apiserver0+merge.yaml\" or just \"etcd.json\". \"target\" can be one of \"kube-apiserver\", \"kube-controller-manager\", \"kube-scheduler\", \"etcd\", \"kubeletconfiguration\", \"corednsdeployment\". \"patchtype\" can be one of \"strategic\", \"merge\" or \"json\" and they match the patch formats supported by kubectl. The default \"patchtype\" is \"strategic\". \"extension\" must be either \"json\" or \"yaml\". \"suffix\" is an optional string that can be used to determine which patches are applied first alpha-numerically.Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisUpload the kubeadm and kubelet configurations to ConfigMapskubeadm upgrade apply phase upload-config [flags] Options-h, --helphelp for upload-configOptions inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.SynopsisUpgrade the kubelet configuration for this node by downloading it from the kubelet-config ConfigMap stored in the clusterkubeadm upgrade apply phase kubelet-config [flags] Options--config stringPath to a kubeadm configuration file.--dry-runDo not change any state, just output what actions would be performed.-h, --helphelp for kubelet-config--kubeconfig string Default: \"/etc/kubernetes/admin.conf\"The kubeconfig file to use when talking to the cluster. If the flag is not ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-upgrade-phase/", "id": "k8s_00676"}
{"instruction": "How do you certificate management with kubeadm in Kubernetes?", "response": "Certificate Management with kubeadmFEATURE STATE: Kubernetes v1.15 [stable]Client certificates generated by kubeadm expire after 1 year. This page explains how to manage certificate renewals with kubeadm. It also covers other tasks related to kubeadm certificate management.The Kubernetes project recommends upgrading to the latest patch releases promptly, and to ensure that you are running a supported minor release of Kubernetes. Following this recommendation helps you to stay secure.Before you beginYou should be familiar with PKI certificates and requirements in Kubernetes.You should be familiar with how to pass a configuration file to the kubeadm commands.This guide covers the usage of the openssl command (used for manual certificate signing, if you choose that approach), but you can use your preferred tools.Some of the steps here use sudo for administrator access. You can use any equivalent tool.Using custom certificatesBy default, kubeadm generates all the certificates needed for a cluster to run. You can override this behavior by providing your own certificates.To do so, you must place them in whatever directory is specified by the --cert-dir flag or the certificatesDir field of kubeadm's ClusterConfiguration. By default this is /etc/kubernetes/pki.If a given certificate and private key pair exists before running kubeadm init, kubeadm does not overwrite them. This means you can, for example, copy an existing CA into /etc/kubernetes/pki/ca.crt and /etc/kubernetes/pki/ca.key, and kubeadm will use this CA for signing the rest of the certificates.Choosing an encryption algorithmkubeadm allows you to choose an encryption algorithm that is used for creating public and private keys. That can be done by using the encryptionAlgorithm field of the kubeadm configuration:apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration encryptionAlgorithm: <ALGORITHM> <ALGORITHM> can be one of RSA-2048 (default), RSA-3072, RSA-4096 or ECDSA-P256.Choosing certificate validity periodkubeadm allows you to choose the validity period of CA and leaf certificates. That can be done by using the certificateValidityPeriod and caCertificateValidityPeriod fields of the kubeadm configuration:apiVersion: kubeadm.k8s.io/v1beta4 kind: ClusterConfiguration certificateValidityPeriod: 8760h # Default: 365 days × 24 hours = 1 year caCertificateValidityPeriod: 87600h # Default: 365 days × 24 hours * 10 = 10 years The values of the fields follow the accepted format for Go's time.Duration values, with the longest supported unit being h (hours).External CA modeIt is also possible to provide only the ca.crt file and not the ca.key file (this is only available for the root CA file, not other cert pairs). If all other certificates and kubeconfig files are in place, kubeadm recognizes this condition and activates the \"External CA\" mode. kubeadm will proceed without the CA key on disk.Instead, run the controller-manager standalone with --controllers=csrsigner and point to the CA certificate and key.There are various ways to prepare the component credentials when using external CA mode.Manual preparation of component credentialsPKI certificates and requirements includes information on how to prepare all the required by kubeadm component credentials manually.This guide covers the usage of the openssl command (used for manual certificate signing, if you choose that approach), but you can use your preferred tools.Preparation of credentials by signing CSRs generated by kubeadmkubeadm can generate CSR files that you can sign manually with tools like openssl and your external CA. These CSR files will include all the specification for credentials that components deployed by kubeadm require.Automated preparation of component credentials by using kubeadm phasesAlternatively, it is possible to use kubeadm phase commands to automate this process.Go to a host that you want to prepare as a kubeadm control plane node with external CA.Copy the external CA files ca.crt and ca.key tha", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nencryptionAlgorithm: <ALGORITHM>\n```\n\nCertificate Management with kubeadm | <ALGORITHM> can be one of RSA-2048 (default), RSA-3072, RSA-4096 or ECDSA-P256.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10711"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncertificateValidityPeriod: 8760h # Default: 365 days × 24 hours = 1 year\ncaCertificateValidityPeriod: 87600h # Default: 365 days × 24 hours * 10 = 10 years\n```\n\nCertificate Management with kubeadm | The values of the fields follow the accepted format for Go's time.Duration values, with the longest supported unit being h (hours).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10712"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-cert-file\"\n    value: \"/etc/kubernetes/pki/ca.crt\"\n  - name: \"cluster-signing-key-file\"\n    value: \"/etc/kubernetes/pki/ca.key\"\n```\n\nCertificate Management with kubeadm | See Create CertificateSigningRequest for creating CSRs with the Kubernetes API.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10713"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nserverTLSBootstrap: true\n```\n\nCertificate Management with kubeadm | If you have already created the cluster you must adapt it by doing the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10714"}
{"instruction": "Write a bash example for certificate management with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <CSR-name>\n```\n\nCertificate Management with kubeadm | By default, these serving certificate will expire after one year. Kubeadm sets the KubeletConfiguration field rotateCertificates to true, which means that close to expiration a new set of CSRs for the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10715"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n# example.yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n# Will be used as the target \"cluster\" in the kubeconfig\nclusterName: \"kubernetes\"\n# Will be used as the \"server\" (IP or DNS name) of this cluster in the kubeconfig\ncontrolPlaneEndpoint: \"some-dns-address:6443\"\n# The cluster CA key and certificate will be loaded from this local directory\ncertificatesDir: \"/etc/kubernetes/pki\"\n```\n\nCertificate Management with kubeadm | Make sure that these settings match the desired target cluster settings. To see the settings of an existing cluster use:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10716"}
{"instruction": "Write a bash example for certificate management with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl get cm kubeadm-config -n kube-system -o=jsonpath=\"{.data.ClusterConfiguration}\"\n```\n\nCertificate Management with kubeadm | The following example will generate a kubeconfig file with credentials valid for 24 hours for a new user johndoe that is part of the appdevs group:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10717"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nencryptionAlgorithm: <ALGORITHM>\n```\n\nCertificate Management with kubeadm | <ALGORITHM> can be one of RSA-2048 (default), RSA-3072, RSA-4096 or ECDSA-P256.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10718"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncertificateValidityPeriod: 8760h # Default: 365 days × 24 hours = 1 year\ncaCertificateValidityPeriod: 87600h # Default: 365 days × 24 hours * 10 = 10 years\n```\n\nCertificate Management with kubeadm | The values of the fields follow the accepted format for Go's time.Duration values, with the longest supported unit being h (hours).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10719"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\nclient-certificate: /var/lib/kubelet/pki/kubelet-client-current.pem\nclient-key: /var/lib/kubelet/pki/kubelet-client-current.pem\n```\n\nCertificate Management with kubeadm | kubeadm renews all the certificates during control plane upgrade.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10720"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-cert-file\"\n    value: \"/etc/kubernetes/pki/ca.crt\"\n  - name: \"cluster-signing-key-file\"\n    value: \"/etc/kubernetes/pki/ca.key\"\n```\n\nCertificate Management with kubeadm | See Create CertificateSigningRequest for creating CSRs with the Kubernetes API.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10721"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nserverTLSBootstrap: true\n```\n\nCertificate Management with kubeadm | If you have already created the cluster you must adapt it by doing the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10722"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n# example.yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n# Will be used as the target \"cluster\" in the kubeconfig\nclusterName: \"kubernetes\"\n# Will be used as the \"server\" (IP or DNS name) of this cluster in the kubeconfig\ncontrolPlaneEndpoint: \"some-dns-address:6443\"\n# The cluster CA key and certificate will be loaded from this local directory\ncertificatesDir: \"/etc/kubernetes/pki\"\n```\n\nCertificate Management with kubeadm | Make sure that these settings match the desired target cluster settings. To see the settings of an existing cluster use:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10723"}
{"instruction": "Write a bash example for certificate management with kubeadm", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\n# Set certificate expiration time in days\nDAYS=365\n\n# Process all CSR files except those for front-proxy and etcd\nfind ./ -name \"*.csr\" | grep -v \"pki/etcd\" | grep -v \"front-proxy\" | while read -r FILE;\ndo\n    echo \"* Processing ${FILE} ...\"\n    FILE=${FILE%.*} # Trim the extension\n    if [ -f \"./pki/ca.srl\" ]; then\n        SERIAL_FLAG=\"-CAserial ./pki/ca.srl\"\n    else\n        SERIAL_FLAG=\"-CAcreateserial\"\n    fi\n    openssl x509 -req -days \"${DAYS}\" -CA ./pki/ca.crt -CAkey ./pki/ca.key ${SERIAL_FLAG} \\\n        -in \"${FILE}.csr\" -out \"${FILE}.crt\"\n    sleep 2\ndone\n\n# Process all etcd CSRs\nfind ./pki/etcd -name \"*.csr\" | while read -r FILE;\ndo\n    echo \"* Processing ${FILE} ...\"\n    FILE=${FILE%.*} # Trim the extension\n    if [ -f \"./pki/etcd/ca.srl\" ]; then\n        SERIAL_FLAG=-CAserial ./pki/etcd/ca.srl\n    else\n        SERIAL_FLAG=-CAcreateserial\n    fi\n    openssl x509 -req -days \"${DAYS}\" -CA ./pki/etcd/ca.crt -CAkey ./pki/etcd/ca.key ${SERIAL_FLAG} \\\n        -in \"${FILE}.csr\" -out \"${FILE}.crt\"\ndone\n\n# Process front-proxy CSRs\necho \"* Processing ./pki/front-proxy-client.csr ...\"\nopenssl x509 -req -days \"${DAYS}\" -CA ./pki/front-proxy-ca.crt -CAkey ./pki/front-proxy-ca.key -CAcreateserial \\\n    -in ./pki/front-proxy-client.csr -out ./pki/front-proxy-client.crt\n```\n\nCertificate Management with kubeadm | Repeat this step for all nodes that have CSR files.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10724"}
{"instruction": "Write a bash example for certificate management with kubeadm", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\nCLUSTER=kubernetes\nfind ./ -name \"*.conf\" | while read -r FILE;\ndo\n    echo \"* Processing ${FILE} ...\"\n    KUBECONFIG=\"${FILE}\" kubectl config set-cluster \"${CLUSTER}\" --certificate-authority ./pki/ca.crt --embed-certs\n    USER=$(KUBECONFIG=\"${FILE}\" kubectl config view -o jsonpath='{.users[0].name}')\n    KUBECONFIG=\"${FILE}\" kubectl config set-credentials \"${USER}\" --client-certificate \"${FILE}.crt\" --embed-certs\ndone\n```\n\nCertificate Management with kubeadm | Perform this step on all nodes that have CSR files.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10725"}
{"instruction": "Write a bash example for certificate management with kubeadm", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\n# Cleanup CSR files\nrm -f ./*.csr ./pki/*.csr ./pki/etcd/*.csr # Clean all CSR files\n\n# Cleanup CRT files that were already embedded in kubeconfig files\nrm -f ./*.crt\n```\n\nCertificate Management with kubeadm | Optionally, move .srl files to the next node to be processed.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10726"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nencryptionAlgorithm: <ALGORITHM>\n```\n\nCertificate Management with kubeadm | <ALGORITHM> can be one of RSA-2048 (default), RSA-3072, RSA-4096 or ECDSA-P256.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10727"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncertificateValidityPeriod: 8760h # Default: 365 days × 24 hours = 1 year\ncaCertificateValidityPeriod: 87600h # Default: 365 days × 24 hours * 10 = 10 years\n```\n\nCertificate Management with kubeadm | The values of the fields follow the accepted format for Go's time.Duration values, with the longest supported unit being h (hours).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10728"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-cert-file\"\n    value: \"/etc/kubernetes/pki/ca.crt\"\n  - name: \"cluster-signing-key-file\"\n    value: \"/etc/kubernetes/pki/ca.key\"\n```\n\nCertificate Management with kubeadm | See Create CertificateSigningRequest for creating CSRs with the Kubernetes API.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10729"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nserverTLSBootstrap: true\n```\n\nCertificate Management with kubeadm | If you have already created the cluster you must adapt it by doing the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10730"}
{"instruction": "Write a bash example for certificate management with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <CSR-name>\n```\n\nCertificate Management with kubeadm | By default, these serving certificate will expire after one year. Kubeadm sets the KubeletConfiguration field rotateCertificates to true, which means that close to expiration a new set of CSRs for the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10731"}
{"instruction": "Write a yaml example for certificate management with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n# example.yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n# Will be used as the target \"cluster\" in the kubeconfig\nclusterName: \"kubernetes\"\n# Will be used as the \"server\" (IP or DNS name) of this cluster in the kubeconfig\ncontrolPlaneEndpoint: \"some-dns-address:6443\"\n# The cluster CA key and certificate will be loaded from this local directory\ncertificatesDir: \"/etc/kubernetes/pki\"\n```\n\nCertificate Management with kubeadm | Make sure that these settings match the desired target cluster settings. To see the settings of an existing cluster use:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10732"}
{"instruction": "Write a bash example for certificate management with kubeadm", "response": "Here's a bash example:\n\n```bash\nkubectl get cm kubeadm-config -n kube-system -o=jsonpath=\"{.data.ClusterConfiguration}\"\n```\n\nCertificate Management with kubeadm | The following example will generate a kubeconfig file with credentials valid for 24 hours for a new user johndoe that is part of the appdevs group:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/", "id": "k8s_00677_code_10733"}
{"instruction": "Explain set up a high availability etcd cluster with kubeadm in Kubernetes", "response": "Set up a High Availability etcd Cluster with kubeadmBy default, kubeadm runs a local etcd instance on each control plane node. It is also possible to treat the etcd cluster as external and provision etcd instances on separate hosts. The differences between the two approaches are covered in the Options for Highly Available topology page.This task walks through the process of creating a high availability external etcd cluster of three members that can be used by kubeadm during cluster creation.Before you beginThree hosts that can talk to each other over TCP ports 2379 and 2380. This document assumes these default ports. However, they are configurable through the kubeadm config file.Each host must have systemd and a bash compatible shell installed.Each host must have a container runtime, kubelet, and kubeadm installed.Each host should have access to the Kubernetes container image registry (registry.k8s.io) or list/pull the required etcd image using kubeadm config images list/pull. This guide will set up etcd instances as static pods managed by a kubelet.Some infrastructure to copy files between hosts. For example ssh and scp can satisfy this requirement.Setting up the clusterThe general approach is to generate all certs on one node and only distribute the necessary files to the other nodes.Note:kubeadm contains all the necessary cryptographic machinery to generate the certificates described below; no other cryptographic tooling is required for this example.Note:The examples below use IPv4 addresses but you can also configure kubeadm, the kubelet and etcd to use IPv6 addresses. Dual-stack is supported by some Kubernetes options, but not by etcd. For more details on Kubernetes dual-stack support see Dual-stack support with kubeadm.Configure the kubelet to be a service manager for etcd.Note:You must do this on every host where etcd should be running.Since etcd was created first, you must override the service priority by creating a new unit file that has higher precedence than the kubeadm-provided kubelet unit file.cat << EOF > /etc/systemd/system/kubelet.service.d/kubelet.conf # Replace \"systemd\" with the cgroup driver of your container runtime. The default value in the kubelet is \"cgroupfs\". # Replace the value of \"containerRuntimeEndpoint\" for a different container runtime if needed. # apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration authentication: anonymous: enabled: false webhook: enabled: false authorization: mode: AlwaysAllow cgroupDriver: systemd address: 127.0.0.1 containerRuntimeEndpoint: unix:///var/run/containerd/containerd.sock staticPodPath: /etc/kubernetes/manifests EOF cat << EOF > /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf [Service] ExecStart= ExecStart=/usr/bin/kubelet --config=/etc/systemd/system/kubelet.service.d/kubelet.conf Restart=always EOF systemctl daemon-reload systemctl restart kubelet Check the kubelet status to ensure it is running.systemctl status kubelet Create configuration files for kubeadm.Generate one kubeadm configuration file for each host that will have an etcd member running on it using the following script.# Update HOST0, HOST1 and HOST2 with the IPs of your hosts export HOST0=10.0.0.6 export HOST1=10.0.0.7 export HOST2=10.0.0.8 # Update NAME0, NAME1 and NAME2 with the hostnames of your hosts export NAME0=\"infra0\" export NAME1=\"infra1\" export NAME2=\"infra2\" # Create temp directories to store files that will end up on other hosts mkdir -p /tmp/${HOST0}/ /tmp/${HOST1}/ /tmp/${HOST2}/ HOSTS=(${HOST0} ${HOST1} ${HOST2}) NAMES=(${NAME0} ${NAME1} ${NAME2}) for i in \"${!HOSTS[@]}\"; do HOST=${HOSTS[$i]} NAME=${NAMES[$i]} cat << EOF > /tmp/${HOST}/kubeadmcfg.yaml --- apiVersion: \"kubeadm.k8s.io/v1beta4\" kind: InitConfiguration nodeRegistration: name: ${NAME} localAPIEndpoint: advertiseAddress: ${HOST} --- apiVersion: \"kubeadm.k8s.io/v1beta4\" kind: ClusterConfiguration etcd: local: serverCertSANs: - \"${HOST}\" peerCertSANs: - \"${HOST}\" extraArgs: - name: initi", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/", "id": "k8s_00678"}
{"instruction": "Write a yaml example for set up a high availability etcd cluster with kubeadm", "response": "Here's a yaml example:\n\n```yaml\ncat << EOF > /etc/systemd/system/kubelet.service.d/kubelet.conf\n# Replace \"systemd\" with the cgroup driver of your container runtime. The default value in the kubelet is \"cgroupfs\".\n# Replace the value of \"containerRuntimeEndpoint\" for a different container runtime if needed.\n#\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthentication:\n  anonymous:\n    enabled: false\n  webhook:\n    enabled: false\nauthorization:\n  mode: AlwaysAllow\ncgroupDriver: systemd\naddress: 127.0.0.1\ncontainerRuntimeEndpoint: unix:///var/run/containerd/containerd.sock\nstaticPodPath: /etc/kubernetes/manifests\nEOF\n\ncat << EOF > /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf\n[Service]\nExecStart=\nExecStart=/usr/bin/kubelet --config=/etc/systemd/system/kubelet.service.d/kubelet.conf\nRestart=always\nEOF\n\nsystemctl daemon-reload\nsystemctl restart kubelet\n```\n\nSet up a High Availability etcd Cluster with kubeadm | Check the kubelet status to ensure it is running.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/", "id": "k8s_00678_code_10735"}
{"instruction": "Write a yaml example for set up a high availability etcd cluster with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n# Update HOST0, HOST1 and HOST2 with the IPs of your hosts\nexport HOST0=10.0.0.6\nexport HOST1=10.0.0.7\nexport HOST2=10.0.0.8\n\n# Update NAME0, NAME1 and NAME2 with the hostnames of your hosts\nexport NAME0=\"infra0\"\nexport NAME1=\"infra1\"\nexport NAME2=\"infra2\"\n\n# Create temp directories to store files that will end up on other hosts\nmkdir -p /tmp/${HOST0}/ /tmp/${HOST1}/ /tmp/${HOST2}/\n\nHOSTS=(${HOST0} ${HOST1} ${HOST2})\nNAMES=(${NAME0} ${NAME1} ${NAME2})\n\nfor i in \"${!HOSTS[@]}\"; do\nHOST=${HOSTS[$i]}\nNAME=${NAMES[$i]}\ncat << EOF > /tmp/${HOST}/kubeadmcfg.yaml\n---\napiVersion: \"kubeadm.k8s.io/v1beta4\"\nkind: InitConfiguration\nnodeRegistration:\n    name: ${NAME}\nlocalAPIEndpoint:\n    advertiseAddress: ${HOST}\n---\napiVersion: \"kubeadm.k8s.io/v1beta4\"\nkind: ClusterConfiguration\netcd:\n    local:\n        serverCertSANs:\n        - \"${HOST}\"\n        peerCertSANs:\n        - \"${HOST}\"\n        extraArgs:\n        - name: initial-cluster\n          value: ${NAMES[0]}=https://${HOSTS[0]}:2380,${NAMES[1]}=https://${HOSTS[1]}:2380,${NAMES[2]}=https://${HOSTS[2]}:2380\n        - name: initial-cluster-state\n          value: new\n        - name: name\n          value: ${NAME}\n        - name: listen-peer-urls\n          value: https://${HOST}:2380\n        - name: listen-client-urls\n          value: https://${HOST}:2379\n        - name: advertise-client-urls\n          value: https://${HOST}:2379\n        - name: initial-advertise-peer-urls\n          value: https://${HOST}:2380\nEOF\ndone\n```\n\nSet up a High Availability etcd Cluster with kubeadm | Generate the certificate authority.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/", "id": "k8s_00678_code_10736"}
{"instruction": "Write a yaml example for set up a high availability etcd cluster with kubeadm", "response": "Here's a yaml example:\n\n```yaml\ncat << EOF > /etc/systemd/system/kubelet.service.d/kubelet.conf\n# Replace \"systemd\" with the cgroup driver of your container runtime. The default value in the kubelet is \"cgroupfs\".\n# Replace the value of \"containerRuntimeEndpoint\" for a different container runtime if needed.\n#\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthentication:\n  anonymous:\n    enabled: false\n  webhook:\n    enabled: false\nauthorization:\n  mode: AlwaysAllow\ncgroupDriver: systemd\naddress: 127.0.0.1\ncontainerRuntimeEndpoint: unix:///var/run/containerd/containerd.sock\nstaticPodPath: /etc/kubernetes/manifests\nEOF\n\ncat << EOF > /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf\n[Service]\nExecStart=\nExecStart=/usr/bin/kubelet --config=/etc/systemd/system/kubelet.service.d/kubelet.conf\nRestart=always\nEOF\n\nsystemctl daemon-reload\nsystemctl restart kubelet\n```\n\nSet up a High Availability etcd Cluster with kubeadm | Check the kubelet status to ensure it is running.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/", "id": "k8s_00678_code_10737"}
{"instruction": "Write a yaml example for set up a high availability etcd cluster with kubeadm", "response": "Here's a yaml example:\n\n```yaml\n# Update HOST0, HOST1 and HOST2 with the IPs of your hosts\nexport HOST0=10.0.0.6\nexport HOST1=10.0.0.7\nexport HOST2=10.0.0.8\n\n# Update NAME0, NAME1 and NAME2 with the hostnames of your hosts\nexport NAME0=\"infra0\"\nexport NAME1=\"infra1\"\nexport NAME2=\"infra2\"\n\n# Create temp directories to store files that will end up on other hosts\nmkdir -p /tmp/${HOST0}/ /tmp/${HOST1}/ /tmp/${HOST2}/\n\nHOSTS=(${HOST0} ${HOST1} ${HOST2})\nNAMES=(${NAME0} ${NAME1} ${NAME2})\n\nfor i in \"${!HOSTS[@]}\"; do\nHOST=${HOSTS[$i]}\nNAME=${NAMES[$i]}\ncat << EOF > /tmp/${HOST}/kubeadmcfg.yaml\n---\napiVersion: \"kubeadm.k8s.io/v1beta4\"\nkind: InitConfiguration\nnodeRegistration:\n    name: ${NAME}\nlocalAPIEndpoint:\n    advertiseAddress: ${HOST}\n---\napiVersion: \"kubeadm.k8s.io/v1beta4\"\nkind: ClusterConfiguration\netcd:\n    local:\n        serverCertSANs:\n        - \"${HOST}\"\n        peerCertSANs:\n        - \"${HOST}\"\n        extraArgs:\n        - name: initial-cluster\n          value: ${NAMES[0]}=https://${HOSTS[0]}:2380,${NAMES[1]}=https://${HOSTS[1]}:2380,${NAMES[2]}=https://${HOSTS[2]}:2380\n        - name: initial-cluster-state\n          value: new\n        - name: name\n          value: ${NAME}\n        - name: listen-peer-urls\n          value: https://${HOST}:2380\n        - name: listen-client-urls\n          value: https://${HOST}:2379\n        - name: advertise-client-urls\n          value: https://${HOST}:2379\n        - name: initial-advertise-peer-urls\n          value: https://${HOST}:2380\nEOF\ndone\n```\n\nSet up a High Availability etcd Cluster with kubeadm | Generate the certificate authority.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/", "id": "k8s_00678_code_10738"}
{"instruction": "What is the reference documentation for binding?", "response": "BindingBinding ties one object to another; for example, a pod is bound to a node by a scheduler.apiVersion: v1import \"k8s.io/api/core/v1\"BindingBinding ties one object to another; for example, a pod is bound to a node by a scheduler.apiVersion: v1kind: Bindingmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatatarget (ObjectReference), requiredThe target object that you want to bind to the standard object.Operationscreate create a BindingHTTP RequestPOST /api/v1/namespaces/{namespace}/bindingsParametersnamespace (in path): string, requirednamespacebody: Binding, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (Binding): OK201 (Binding): Created202 (Binding): Accepted401: Unauthorizedcreate create binding of a PodHTTP RequestPOST /api/v1/namespaces/{namespace}/pods/{name}/bindingParametersname (in path): string, requiredname of the Bindingnamespace (in path): string, requirednamespacebody: Binding, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (Binding): OK201 (Binding): Created202 (Binding): Accepted401: UnauthorizedThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/binding-v1/", "id": "k8s_00679"}
{"instruction": "Explain the Kubernetes concept: Configuration Best Practices", "response": "Configuration Best PracticesThis document highlights and consolidates configuration best practices that are introduced throughout the user guide, Getting Started documentation, and examples.This is a living document. If you think of something that is not on this list but might be useful to others, please don't hesitate to file an issue or submit a PR.General Configuration TipsWhen defining configurations, specify the latest stable API version.Configuration files should be stored in version control before being pushed to the cluster. This allows you to quickly roll back a configuration change if necessary. It also aids cluster re-creation and restoration.Write your configuration files using YAML rather than JSON. Though these formats can be used interchangeably in almost all scenarios, YAML tends to be more user-friendly.Group related objects into a single file whenever it makes sense. One file is often easier to manage than several. See the guestbook-all-in-one.yaml file as an example of this syntax.Note also that many kubectl commands can be called on a directory. For example, you can call kubectl apply on a directory of config files.Don't specify default values unnecessarily: simple, minimal configuration will make errors less likely.Put object descriptions in annotations, to allow better introspection.Note:There is a breaking change introduced in the YAML 1.2 boolean values specification with respect to YAML 1.1. This is a known issue in Kubernetes. YAML 1.2 only recognizes true and false as valid booleans, while YAML 1.1 also accepts yes, no, on, and off as booleans. However, Kubernetes uses YAML parsers that are mostly compatible with YAML 1.1, which means that using yes or no instead of true or false in a YAML manifest may cause unexpected errors or behaviors. To avoid this issue, it is recommended to always use true or false for boolean values in YAML manifests, and to quote any strings that may be confused with booleans, such as \"yes\" or \"no\".Besides booleans, there are additional specifications changes between YAML versions. Please refer to the YAML Specification Changes documentation for a comprehensive list.\"Naked\" Pods versus ReplicaSets, Deployments, and JobsDon't use naked Pods (that is, Pods not bound to a ReplicaSet or Deployment) if you can avoid it. Naked Pods will not be rescheduled in the event of a node failure.A Deployment, which both creates a ReplicaSet to ensure that the desired number of Pods is always available, and specifies a strategy to replace Pods (such as RollingUpdate), is almost always preferable to creating Pods directly, except for some explicit restartPolicy: Never scenarios. A Job may also be appropriate.ServicesCreate a Service before its corresponding backend workloads (Deployments or ReplicaSets), and before any workloads that need to access it. When Kubernetes starts a container, it provides environment variables pointing to all the Services which were running when the container was started. For example, if a Service named foo exists, all containers will get the following variables in their initial environment:FOO_SERVICE_HOST=<the host the Service is running on> FOO_SERVICE_PORT=<the port the Service is running on> This does imply an ordering requirement - any Service that a Pod wants to access must be created before the Pod itself, or else the environment variables will not be populated. DNS does not have this restriction.An optional (though strongly recommended) cluster add-on is a DNS server. The DNS server watches the Kubernetes API for new Services and creates a set of DNS records for each. If DNS has been enabled throughout the cluster then all Pods should be able to do name resolution of Services automatically.Don't specify a hostPort for a Pod unless it is absolutely necessary. When you bind a Pod to a hostPort, it limits the number of places the Pod can be scheduled, because each <hostIP, hostPort, protocol> combination must be unique. If you don't specify the hostIP and pro", "category": "concepts", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/overview/", "id": "k8s_00680"}
{"instruction": "Write a bash example for configuration best practices", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\nConfiguration Best Practices | Use label selectors for get and delete operations instead of specific object names. See the sections on label selectors and using labels effectively.", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/overview/", "id": "k8s_00680_code_10741"}
{"instruction": "Write a bash example for configuration best practices", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\nConfiguration Best Practices |", "category": "concepts_code", "subcategory": "configuration", "source": "https://kubernetes.io/docs/concepts/configuration/overview/", "id": "k8s_00680_code_10742"}
{"instruction": "How do you declarative management of kubernetes objects using configuration files in Kubernetes?", "response": "Declarative Management of Kubernetes Objects Using Configuration FilesKubernetes objects can be created, updated, and deleted by storing multiple object configuration files in a directory and using kubectl apply to recursively create and update those objects as needed. This method retains writes made to live objects without merging the changes back into the object configuration files. kubectl diff also gives you a preview of what changes apply will make.Before you beginInstall kubectl.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Trade-offsThe kubectl tool supports three kinds of object management:Imperative commandsImperative object configurationDeclarative object configurationSee Kubernetes Object Management for a discussion of the advantages and disadvantage of each kind of object management.OverviewDeclarative object configuration requires a firm understanding of the Kubernetes object definitions and configuration. Read and complete the following documents if you have not already:Managing Kubernetes Objects Using Imperative CommandsImperative Management of Kubernetes Objects Using Configuration FilesFollowing are definitions for terms used in this document:object configuration file / configuration file: A file that defines the configuration for a Kubernetes object. This topic shows how to pass configuration files to kubectl apply. Configuration files are typically stored in source control, such as Git.live object configuration / live configuration: The live configuration values of an object, as observed by the Kubernetes cluster. These are kept in the Kubernetes cluster storage, typically etcd.declarative configuration writer / declarative writer: A person or software component that makes updates to a live object. The live writers referred to in this topic make changes to object configuration files and run kubectl apply to write the changes.How to create objectsUse kubectl apply to create all objects, except those that already exist, defined by configuration files in a specified directory:kubectl apply -f <directory> This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the object.Note:Add the -R flag to recursively process directories.Here's an example of an object configuration file:application/simple_deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx minReadySeconds: 5 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Run kubectl diff to print the object that will be created:kubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml Note:diff uses server-side dry-run, which needs to be enabled on kube-apiserver.Since diff performs a server-side apply request in dry-run mode, it requires granting PATCH, CREATE, and UPDATE permissions. See Dry-Run Authorization for details.Create the object using kubectl apply:kubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml Print the live configuration using kubectl get:kubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:kind: Deployment metadata: annotations: # ... # This is the json representation of simple_deployment.yaml # It was written by kubectl apply when the", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the obj", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10744"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10745"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | diff uses server-side dry-run, which needs to be enabled on kube-apiserver.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10746"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10747"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10748"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10749"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f <directory>\nkubectl apply -f <directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Here's an example configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10750"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10751"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10752"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10753"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10754"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=2\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10755"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the replicas field has been set to 2, and the last-applied-configuration annotation does not contain a replicas field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10756"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10757"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10758"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/update_deployment.yaml\nkubectl apply -f https://k8s.io/examples/application/update_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10759"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/update_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows the following changes to the live configuration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10760"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10761"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10762"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune -l <labels> --prune-allowlist=<gvk-list>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10763"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | When kubectl apply updates the live configuration for an object, it does so by sending a patch request to the API server. The patch defines updates scoped to specific fields of the live object configu", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10764"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10765"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10766"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10767"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10768"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10769"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the API server set several fields to default values in the live configuration. These fields were not specified in the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10770"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10771"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10772"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10773"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10774"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration: '{...}'\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Here's an example of an object configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10775"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10776"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10777"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10778"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10779"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10780"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10781"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10782"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10783"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10784"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10785"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Manually deleting objects using the imperative command is the recommended approach, as it is more explicit about what is being deleted, and less likely to result in the user deleting something uninten", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10786"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10787"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10788"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune --applyset\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | To use ApplySet-based pruning, set the KUBECTL_APPLYSET=true environment variable, and add the following flags to your kubectl apply invocation:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10789"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Here's an example. Suppose this is the configuration file for a Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10790"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10791"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10792"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10793"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration value\n    args: [\"a\", \"b\"]\n\n# configuration file value\n    args: [\"a\", \"c\"]\n\n# live configuration\n    args: [\"a\", \"b\", \"d\"]\n\n# result after merge\n    args: [\"a\", \"c\"]\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Explanation: The merge used the configuration file value as the new list value.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10794"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration value\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-a # key: nginx-helper-a; will be deleted in result\n      image: helper:1.3\n    - name: nginx-helper-b # key: nginx-helper-b; will be retained\n      image: helper:1.3\n\n# configuration file value\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-b\n      image: helper:1.3\n    - name: nginx-helper-c # key: nginx-helper-c; will be added in result\n      image: helper:1.3\n\n# live configuration\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-a\n      image: helper:1.3\n    - name: nginx-helper-b\n      image: helper:1.3\n      args: [\"run\"] # Field will be retained\n    - name: nginx-helper-d # key: nginx-helper-d; will be retained\n      image: helper:1.3\n\n# result after merge\n    containers:\n    - name: nginx\n      image: nginx:1.16\n      # Element nginx-helper-a was deleted\n    - name: nginx-helper-b\n      image: helper:1.3\n      args: [\"run\"] # Field was retained\n    - name: nginx-helper-c # Element was added\n      image: helper:1.3\n    - name: nginx-helper-d # Element was ignored\n      image: helper:1.3\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Explanation:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10795"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10796"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10797"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration\nspec:\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# configuration file\nspec:\n  strategy:\n    type: Recreate # updated value\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# live configuration\nspec:\n  strategy:\n    type: RollingUpdate # defaulted value\n    rollingUpdate: # defaulted value derived from type\n      maxSurge : 1\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# result after merge - ERROR!\nspec:\n  strategy:\n    type: Recreate # updated value: incompatible with rollingUpdate\n    rollingUpdate: # defaulted value: incompatible with \"type: Recreate\"\n      maxSurge : 1\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Explanation:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10798"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Kubernetes objects should be managed using only one method at a time. Switching from one method to another is possible, but is a manual process.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10799"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10800"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10801"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n      controller-selector: \"apps/v1/deployment/nginx\"\ntemplate:\n  metadata:\n    labels:\n      controller-selector: \"apps/v1/deployment/nginx\"\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10802"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10803"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10804"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the obj", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10805"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10806"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10807"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | diff uses server-side dry-run, which needs to be enabled on kube-apiserver.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10808"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10809"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10810"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10811"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f <directory>\nkubectl apply -f <directory>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Here's an example configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10812"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10813"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10814"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10815"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10816"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10817"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=2\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10818"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the replicas field has been set to 2, and the last-applied-configuration annotation does not contain a replicas field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10819"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10820"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napplication/update_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10821"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10822"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/update_deployment.yaml\nkubectl apply -f https://k8s.io/examples/application/update_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10823"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/update_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows the following changes to the live configuration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10824"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10825"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10826"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune -l <labels> --prune-allowlist=<gvk-list>\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10827"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | When kubectl apply updates the live configuration for an object, it does so by sending a patch request to the API server. The patch defines updates scoped to specific fields of the live object configu", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10828"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napplication/update_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10829"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10830"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10831"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10832"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10833"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10834"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10835"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | The output shows that the API server set several fields to default values in the live configuration. These fields were not specified in the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10836"}
{"instruction": "Write a yaml example for declarative management of kubernetes objects using configuration files", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10837"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10838"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10839"}
{"instruction": "Write a bash example for declarative management of kubernetes objects using configuration files", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\nDeclarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/", "id": "k8s_00681_code_10840"}
{"instruction": "What is the reference documentation for deleteoptions?", "response": "DeleteOptionsDeleteOptions may be provided when deleting an API object.import \"k8s.io/apimachinery/pkg/apis/meta/v1\"DeleteOptions may be provided when deleting an API object.apiVersion (string)APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resourcesdryRun ([]string)Atomic: will be replaced during a mergeWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processedgracePeriodSeconds (int64)The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.ignoreStoreReadErrorWithClusterBreakingPotential (boolean)if set to true, it will trigger an unsafe deletion of the resource in case the normal deletion flow fails with a corrupt object error. A resource is considered corrupt if it can not be retrieved from the underlying storage successfully because of a) its data can not be transformed e.g. decryption failure, or b) it fails to decode into an object. NOTE: unsafe deletion ignores finalizer constraints, skips precondition checks, and removes the object from the storage. WARNING: This may potentially break the cluster if the workload associated with the resource being unsafe-deleted relies on normal deletion flow. Use only if you REALLY know what you are doing. The default value is false, and the user must opt in to enable itkind (string)Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsorphanDependents (boolean)Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.preconditions (Preconditions)Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.preconditions.resourceVersion (string)Specifies the target ResourceVersionpreconditions.uid (string)Specifies the target UID.propagationPolicy (string)Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/delete-options/", "id": "k8s_00682"}
{"instruction": "Explain pki certificates and requirements in Kubernetes", "response": "PKI certificates and requirementsKubernetes requires PKI certificates for authentication over TLS. If you install Kubernetes with kubeadm, the certificates that your cluster requires are automatically generated. You can also generate your own certificates -- for example, to keep your private keys more secure by not storing them on the API server. This page explains the certificates that your cluster requires.How certificates are used by your clusterKubernetes requires PKI for the following operations:Server certificatesServer certificate for the API server endpointServer certificate for the etcd serverServer certificates for each kubelet (every node runs a kubelet)Optional server certificate for the front-proxyClient certificatesClient certificates for each kubelet, used to authenticate to the API server as a client of the Kubernetes APIClient certificate for each API server, used to authenticate to etcdClient certificate for the controller manager to securely communicate with the API serverClient certificate for the scheduler to securely communicate with the API serverClient certificates, one for each node, for kube-proxy to authenticate to the API serverOptional client certificates for administrators of the cluster to authenticate to the API serverOptional client certificate for the front-proxyKubelet's server and client certificatesTo establish a secure connection and authenticate itself to the kubelet, the API Server requires a client certificate and key pair.In this scenario, there are two approaches for certificate usage:Shared Certificates: The kube-apiserver can utilize the same certificate and key pair it uses to authenticate its clients. This means that the existing certificates, such as apiserver.crt and apiserver.key, can be used for communicating with the kubelet servers.Separate Certificates: Alternatively, the kube-apiserver can generate a new client certificate and key pair to authenticate its communication with the kubelet servers. In this case, a distinct certificate named kubelet-client.crt and its corresponding private key, kubelet-client.key are created.Note:front-proxy certificates are required only if you run kube-proxy to support an extension API server.etcd also implements mutual TLS to authenticate clients and peers.Where certificates are storedIf you install Kubernetes with kubeadm, most certificates are stored in /etc/kubernetes/pki. All paths in this documentation are relative to that directory, with the exception of user account certificates which kubeadm places in /etc/kubernetes.Configure certificates manuallyIf you don't want kubeadm to generate the required certificates, you can create them using a single root CA or by providing all certificates. See Certificates for details on creating your own certificate authority. See Certificate Management with kubeadm for more on managing certificates.Single root CAYou can create a single root CA, controlled by an administrator. This root CA can then create multiple intermediate CAs, and delegate all further creation to Kubernetes itself.Required CAs:PathDefault CNDescriptionca.crt,keykubernetes-caKubernetes general CAetcd/ca.crt,keyetcd-caFor all etcd-related functionsfront-proxy-ca.crt,keykubernetes-front-proxy-caFor the front-end proxyOn top of the above CAs, it is also necessary to get a public/private key pair for service account management, sa.key and sa.pub. The following example illustrates the CA key and certificate files shown in the previous table:/etc/kubernetes/pki/ca.crt /etc/kubernetes/pki/ca.key /etc/kubernetes/pki/etcd/ca.crt /etc/kubernetes/pki/etcd/ca.key /etc/kubernetes/pki/front-proxy-ca.crt /etc/kubernetes/pki/front-proxy-ca.key All certificatesIf you don't wish to copy the CA private keys to your cluster, you can generate all certificates yourself.Required certificates:Default CNParent CAO (in Subject)kindhosts (SAN)kube-etcdetcd-caserver, client<hostname>, <Host_IP>, localhost, 127.0.0.1kube-etcd-peeretcd-caserver, client<hostname", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/best-practices/certificates/", "id": "k8s_00683"}
{"instruction": "Provide a tutorial on running kubelet in standalone mode", "response": "Running Kubelet in Standalone ModeThis tutorial shows you how to run a standalone kubelet instance.You may have different motivations for running a standalone kubelet. This tutorial is aimed at introducing you to Kubernetes, even if you don't have much experience with it. You can follow this tutorial and learn about node setup, basic (static) Pods, and how Kubernetes manages containers.Once you have followed this tutorial, you could try using a cluster that has a control plane to manage pods and nodes, and other types of objects. For example, Hello, minikube.You can also run the kubelet in standalone mode to suit production use cases, such as to run the control plane for a highly available, resiliently deployed cluster. This tutorial does not cover the details you need for running a resilient control plane.ObjectivesInstall cri-o, and kubelet on a Linux system and run them as systemd services.Launch a Pod running nginx that listens to requests on TCP port 80 on the Pod's IP address.Learn how the different components of the solution interact among themselves.Caution:The kubelet configuration used for this tutorial is insecure by design and should not be used in a production environment.Before you beginAdmin (root) access to a Linux system that uses systemd and iptables (or nftables with iptables emulation).Access to the Internet to download the components needed for the tutorial, such as:A container runtime that implements the Kubernetes (CRI).Network plugins (these are often known as Container Networking Interface (CNI))Required CLI tools: curl, tar, jq.Prepare the systemSwap configurationBy default, kubelet fails to start if swap memory is detected on a node. This means that swap should either be disabled or tolerated by kubelet.Note:If you configure the kubelet to tolerate swap, the kubelet still configures Pods (and the containers in those Pods) not to use swap space. To find out how Pods can actually use the available swap, you can read more about swap memory management on Linux nodes.If you have swap memory enabled, either disable it or add failSwapOn: false to the kubelet configuration file.To check if swap is enabled:sudo swapon --show If there is no output from the command, then swap memory is already disabled.To disable swap temporarily:sudo swapoff -a To make this change persistent across reboots:Make sure swap is disabled in either /etc/fstab or systemd.swap, depending on how it was configured on your system.Enable IPv4 packet forwardingTo check if IPv4 packet forwarding is enabled:cat /proc/sys/net/ipv4/ip_forward If the output is 1, it is already enabled. If the output is 0, then follow next steps.To enable IPv4 packet forwarding, create a configuration file that sets the net.ipv4.ip_forward parameter to 1:sudo tee /etc/sysctl.d/k8s.conf <<EOF net.ipv4.ip_forward = 1 EOF Apply the changes to the system:sudo sysctl --system The output is similar to:... * Applying /etc/sysctl.d/k8s.conf ... net.ipv4.ip_forward = 1 * Applying /etc/sysctl.conf ... Download, install, and configure the componentsNote: This section links to third party projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for these projects, which are listed alphabetically. To add a project to this list, read the content guide before submitting a change. More information.Install a container runtimeDownload the latest available versions of the required packages (recommended).This tutorial suggests installing the CRI-O container runtime (external link).There are several ways to install the CRI-O container runtime, depending on your particular Linux distribution. Although CRI-O recommends using either deb or rpm packages, this tutorial uses the static binary bundle script of the CRI-O Packaging project, both to streamline the overall process, and to remain distribution agnostic.The script installs and configures additional required software, such as cni-plugins, for container networking, and crun and r", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/kubelet-standalone/", "id": "k8s_00684"}
{"instruction": "Write a yaml example for running kubelet in standalone mode", "response": "Here's a yaml example:\n\n```yaml\nsudo tee /etc/kubernetes/kubelet.yaml <<EOF\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthentication:\n  webhook:\n    enabled: false # Do NOT use in production clusters!\nauthorization:\n  mode: AlwaysAllow # Do NOT use in production clusters!\nenableServer: false\nlogging:\n  format: text\naddress: 127.0.0.1 # Restrict access to localhost\nreadOnlyPort: 10255 # Do NOT use in production clusters!\nstaticPodPath: /etc/kubernetes/manifests\ncontainerRuntimeEndpoint: unix:///var/run/crio/crio.sock\nEOF\n```\n\nRunning Kubelet in Standalone Mode | Because you are not setting up a production cluster, you are using plain HTTP (readOnlyPort: 10255) for unauthenticated queries to the kubelet's API.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/kubelet-standalone/", "id": "k8s_00684_code_10844"}
{"instruction": "Write a yaml example for running kubelet in standalone mode", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\nRunning Kubelet in Standalone Mode | Copy the static-web.yaml manifest file to the /etc/kubernetes/manifests directory.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/kubelet-standalone/", "id": "k8s_00684_code_10845"}
{"instruction": "Write a bash example for running kubelet in standalone mode", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubelet\"\n```\n\nRunning Kubelet in Standalone Mode | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubelet\"", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/kubelet-standalone/", "id": "k8s_00684_code_10846"}
{"instruction": "Write a bash example for running kubelet in standalone mode", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubelet\"\n```\n\nRunning Kubelet in Standalone Mode | Configure:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/kubelet-standalone/", "id": "k8s_00684_code_10847"}
{"instruction": "Write a yaml example for running kubelet in standalone mode", "response": "Here's a yaml example:\n\n```yaml\nsudo tee /etc/kubernetes/kubelet.yaml <<EOF\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthentication:\n  webhook:\n    enabled: false # Do NOT use in production clusters!\nauthorization:\n  mode: AlwaysAllow # Do NOT use in production clusters!\nenableServer: false\nlogging:\n  format: text\naddress: 127.0.0.1 # Restrict access to localhost\nreadOnlyPort: 10255 # Do NOT use in production clusters!\nstaticPodPath: /etc/kubernetes/manifests\ncontainerRuntimeEndpoint: unix:///var/run/crio/crio.sock\nEOF\n```\n\nRunning Kubelet in Standalone Mode | Because you are not setting up a production cluster, you are using plain HTTP (readOnlyPort: 10255) for unauthenticated queries to the kubelet's API.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/kubelet-standalone/", "id": "k8s_00684_code_10848"}
{"instruction": "Write a yaml example for running kubelet in standalone mode", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\nRunning Kubelet in Standalone Mode | Copy the static-web.yaml manifest file to the /etc/kubernetes/manifests directory.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/kubelet-standalone/", "id": "k8s_00684_code_10849"}
{"instruction": "What is the reference documentation for policy resources?", "response": "Policy ResourcesFlowSchemaFlowSchema defines the schema of a group of flows.LimitRangeLimitRange sets resource usage limits for each kind of resource in a Namespace.ResourceQuotaResourceQuota sets aggregate quota restrictions enforced per namespace.NetworkPolicyNetworkPolicy describes what network traffic is allowed for a set of Pods.PodDisruptionBudgetPodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods.PriorityLevelConfigurationPriorityLevelConfiguration represents the configuration of a priority level.ValidatingAdmissionPolicyValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.ValidatingAdmissionPolicyBindingValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources.MutatingAdmissionPolicy v1beta1MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain.MutatingAdmissionPolicyBinding v1alpha1MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/", "id": "k8s_00685"}
{"instruction": "What is the reference documentation for leasecandidate v1beta1?", "response": "LeaseCandidate v1beta1LeaseCandidate defines a candidate for a Lease object.apiVersion: coordination.k8s.io/v1beta1import \"k8s.io/api/coordination/v1beta1\"LeaseCandidateLeaseCandidate defines a candidate for a Lease object. Candidates are created such that coordinated leader election will pick the best leader from the list of candidates.apiVersion: coordination.k8s.io/v1beta1kind: LeaseCandidatemetadata (ObjectMeta)More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (LeaseCandidateSpec)spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusLeaseCandidateSpecLeaseCandidateSpec is a specification of a Lease.binaryVersion (string), requiredBinaryVersion is the binary version. It must be in a semver format without leading v. This field is required.leaseName (string), requiredLeaseName is the name of the lease for which this candidate is contending. The limits on this field are the same as on Lease.name. Multiple lease candidates may reference the same Lease.name. This field is immutable.strategy (string), requiredStrategy is the strategy that coordinated leader election will use for picking the leader. If multiple candidates for the same Lease return different strategies, the strategy provided by the candidate with the latest BinaryVersion will be used. If there is still conflict, this is a user error and coordinated leader election will not operate the Lease until resolved.emulationVersion (string)EmulationVersion is the emulation version. It must be in a semver format without leading v. EmulationVersion must be less than or equal to BinaryVersion. This field is required when strategy is \"OldestEmulationVersion\"pingTime (MicroTime)PingTime is the last time that the server has requested the LeaseCandidate to renew. It is only done during leader election to check if any LeaseCandidates have become ineligible. When PingTime is updated, the LeaseCandidate will respond by updating RenewTime.MicroTime is version of Time with microsecond level precision.renewTime (MicroTime)RenewTime is the time that the LeaseCandidate was last updated. Any time a Lease needs to do leader election, the PingTime field is updated to signal to the LeaseCandidate that they should update the RenewTime. Old LeaseCandidate objects are also garbage collected if it has been hours since the last renew. The PingTime field is updated regularly to prevent garbage collection for still active LeaseCandidates.MicroTime is version of Time with microsecond level precision.LeaseCandidateListLeaseCandidateList is a list of Lease objects.apiVersion: coordination.k8s.io/v1beta1kind: LeaseCandidateListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]LeaseCandidate), requireditems is a list of schema objects.Operationsget read the specified LeaseCandidateHTTP RequestGET /apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leasecandidates/{name}Parametersname (in path): string, requiredname of the LeaseCandidatenamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (LeaseCandidate): OK401: Unauthorizedlist list or watch objects of kind LeaseCandidateHTTP RequestGET /apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leasecandidatesParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (Leas", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/lease-candidate-v1beta1/", "id": "k8s_00686"}
{"instruction": "Write a yaml example for leasecandidate v1beta1", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1beta1\n```\n\nLeaseCandidate v1beta1 | import \"k8s.io/api/coordination/v1beta1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/lease-candidate-v1beta1/", "id": "k8s_00686_code_10852"}
{"instruction": "Explain contributing to the upstream kubernetes code in Kubernetes", "response": "Contributing to the Upstream Kubernetes CodeThis page shows how to contribute to the upstream kubernetes/kubernetes project. You can fix bugs found in the Kubernetes API documentation or the content of the Kubernetes components such as kubeadm, kube-apiserver, and kube-controller-manager.If you instead want to regenerate the reference documentation for the Kubernetes API or the kube-* components from the upstream code, see the following instructions:Generating Reference Documentation for the Kubernetes APIGenerating Reference Documentation for the Kubernetes Components and ToolsBefore you beginYou need to have these tools installed:GitGolang version 1.13+Dockeretcdmakegcc compiler/linkerYour GOPATH environment variable must be set, and the location of etcd must be in your PATH environment variable.You need to know how to create a pull request to a GitHub repository. Typically, this involves creating a fork of the repository. For more information, see Creating a Pull Request and GitHub Standard Fork & Pull Request Workflow.The big pictureThe reference documentation for the Kubernetes API and the kube-* components such as kube-apiserver, kube-controller-manager are automatically generated from the source code in the upstream Kubernetes.When you see bugs in the generated documentation, you may want to consider creating a patch to fix it in the upstream project.Clone the Kubernetes repositoryIf you don't already have the kubernetes/kubernetes repository, get it now:mkdir $GOPATH/src cd $GOPATH/src go get github.com/kubernetes/kubernetes Determine the base directory of your clone of the kubernetes/kubernetes repository. For example, if you followed the preceding step to get the repository, your base directory is $GOPATH/src/github.com/kubernetes/kubernetes. The remaining steps refer to your base directory as <k8s-base>.Determine the base directory of your clone of the kubernetes-sigs/reference-docs repository. For example, if you followed the preceding step to get the repository, your base directory is $GOPATH/src/github.com/kubernetes-sigs/reference-docs. The remaining steps refer to your base directory as <rdocs-base>.Edit the Kubernetes source codeThe Kubernetes API reference documentation is automatically generated from an OpenAPI spec, which is generated from the Kubernetes source code. If you want to change the API reference documentation, the first step is to change one or more comments in the Kubernetes source code.The documentation for the kube-* components is also generated from the upstream source code. You must change the code related to the component you want to fix in order to fix the generated documentation.Make changes to the upstream source codeNote:The following steps are an example, not a general procedure. Details will be different in your situation.Here's an example of editing a comment in the Kubernetes source code.In your local kubernetes/kubernetes repository, check out the default branch, and make sure it is up to date:cd <k8s-base> git checkout master git pull https://github.com/kubernetes/kubernetes master Suppose this source file in that default branch has the typo \"atmost\":kubernetes/kubernetes/staging/src/k8s.io/api/apps/v1/types.goIn your local environment, open types.go, and change \"atmost\" to \"at most\".Verify that you have changed the file:git status The output shows that you are on the master branch, and that the types.go source file has been modified:On branch master ... modified: staging/src/k8s.io/api/apps/v1/types.go Commit your edited fileRun git add and git commit to commit the changes you have made so far. In the next step, you will do a second commit. It is important to keep your changes separated into two commits.Generate the OpenAPI spec and related filesGo to <k8s-base> and run these scripts:./hack/update-codegen.sh ./hack/update-openapi-spec.sh Run git status to see what was generated.On branch master ... modified: api/openapi-spec/swagger.json modified: api/openapi-spec/v3/apis__apps__", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/contribute-upstream/", "id": "k8s_00687"}
{"instruction": "What is the reference documentation for kube-apiserver?", "response": "kube-apiserverSynopsisThe Kubernetes API server validates and configures data for the api objects which include pods, services, replicationcontrollers, and others. The API Server services REST operations and provides the frontend to the cluster's shared state through which all other components interact.kube-apiserver [flags] Options--admission-control-config-file stringFile with admission control configuration.--advertise-address stringThe IP address on which to advertise the apiserver to members of the cluster. This address must be reachable by the rest of the cluster. If blank, the --bind-address will be used. If --bind-address is unspecified, the host's default interface will be used.--aggregator-reject-forwarding-redirect Default: trueAggregator reject forwarding redirect response back to client.--allow-metric-labels stringToString Default: []The map from metric-label to value allow-list of this label. The key's format is <MetricName>,<LabelName>. The value's format is <allowed_value>,<allowed_value>...e.g. metric1,label1='v1,v2,v3', metric1,label2='v1,v2,v3' metric2,label1='v1,v2,v3'.--allow-metric-labels-manifest stringThe path to the manifest file that contains the allow-list mapping. The format of the file is the same as the flag --allow-metric-labels. Note that the flag --allow-metric-labels will override the manifest file.--allow-privilegedIf true, allow privileged containers. [default=false]--anonymous-auth Default: trueEnables anonymous requests to the secure port of the API server. Requests that are not rejected by another authentication method are treated as anonymous requests. Anonymous requests have a username of system:anonymous, and a group name of system:unauthenticated.--api-audiences stringsIdentifiers of the API. The service account token authenticator will validate that tokens used against the API are bound to at least one of these audiences. If the --service-account-issuer flag is configured and this flag is not, this field defaults to a single element list containing the issuer URL.--audit-log-batch-buffer-size int Default: 10000The size of the buffer to store events before batching and writing. Only used in batch mode.--audit-log-batch-max-size int Default: 1The maximum size of a batch. Only used in batch mode.--audit-log-batch-max-wait durationThe amount of time to wait before force writing the batch that hadn't reached the max size. Only used in batch mode.--audit-log-batch-throttle-burst intMaximum number of requests sent at the same moment if ThrottleQPS was not utilized before. Only used in batch mode.--audit-log-batch-throttle-enableWhether batching throttling is enabled. Only used in batch mode.--audit-log-batch-throttle-qps floatMaximum average number of batches per second. Only used in batch mode.--audit-log-compressIf set, the rotated log files will be compressed using gzip.--audit-log-format string Default: \"json\"Format of saved audits. \"legacy\" indicates 1-line text format for each event. \"json\" indicates structured json format. Known formats are legacy,json.--audit-log-maxage intThe maximum number of days to retain old audit log files based on the timestamp encoded in their filename.--audit-log-maxbackup intThe maximum number of old audit log files to retain. Setting a value of 0 will mean there's no restriction on the number of files.--audit-log-maxsize intThe maximum size in megabytes of the audit log file before it gets rotated.--audit-log-mode string Default: \"blocking\"Strategy for sending audit events. Blocking indicates sending events should block server responses. Batch causes the backend to buffer and write events asynchronously. Known modes are batch,blocking,blocking-strict.--audit-log-path stringIf set, all requests coming to the apiserver will be logged to this file. '-' means standard out.--audit-log-truncate-enabledWhether event and batch truncating is enabled.--audit-log-truncate-max-batch-size int Default: 10485760Maximum size of the batch sent to the underlying backend. A", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kube-apiserver/", "id": "k8s_00688"}
{"instruction": "How do you scale a statefulset in Kubernetes?", "response": "Scale a StatefulSetThis task shows how to scale a StatefulSet. Scaling a StatefulSet refers to increasing or decreasing the number of replicas.Before you beginStatefulSets are only available in Kubernetes version 1.5 or later. To check your version of Kubernetes, run kubectl version.Not all stateful applications scale nicely. If you are unsure about whether to scale your StatefulSets, see StatefulSet concepts or StatefulSet tutorial for further information.You should perform scaling only when you are confident that your stateful application cluster is completely healthy.Scaling StatefulSetsUse kubectl to scale StatefulSetsFirst, find the StatefulSet you want to scale.kubectl get statefulsets <stateful-set-name> Change the number of replicas of your StatefulSet:kubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas> Make in-place updates on your StatefulSetsAlternatively, you can do in-place updates on your StatefulSets.If your StatefulSet was initially created with kubectl apply, update .spec.replicas of the StatefulSet manifests, and then do a kubectl apply:kubectl apply -f <stateful-set-file-updated> Otherwise, edit that field with kubectl edit:kubectl edit statefulsets <stateful-set-name> Or use kubectl patch:kubectl patch statefulsets <stateful-set-name> -p '{\"spec\":{\"replicas\":<new-replicas>}}' TroubleshootingScaling down does not work rightYou cannot scale down a StatefulSet when any of the stateful Pods it manages is unhealthy. Scaling down only takes place after those stateful Pods become running and ready.If spec.replicas > 1, Kubernetes cannot determine the reason for an unhealthy Pod. It might be the result of a permanent fault or of a transient fault. A transient fault can be caused by a restart required by upgrading or maintenance.If the Pod is unhealthy due to a permanent fault, scaling without correcting the fault may lead to a state where the StatefulSet membership drops below a certain minimum number of replicas that are needed to function correctly. This may cause your StatefulSet to become unavailable.If the Pod is unhealthy due to a transient fault and the Pod might become available again, the transient error may interfere with your scale-up or scale-down operation. Some distributed databases have issues when nodes join and leave at the same time. It is better to reason about scaling operations at the application level in these cases, and perform scaling only when you are sure that your stateful application cluster is completely healthy.What's nextLearn more about deleting a StatefulSet.", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets <stateful-set-name>\n```\n\nScale a StatefulSet | Change the number of replicas of your StatefulSet:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10856"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>\n```\n\nScale a StatefulSet | Alternatively, you can do in-place updates on your StatefulSets.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10857"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <stateful-set-file-updated>\n```\n\nScale a StatefulSet | Otherwise, edit that field with kubectl edit:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10858"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulsets <stateful-set-name>\n```\n\nScale a StatefulSet | Or use kubectl patch:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10859"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulsets <stateful-set-name> -p '{\"spec\":{\"replicas\":<new-replicas>}}'\n```\n\nScale a StatefulSet | You cannot scale down a StatefulSet when any of the stateful Pods it manages is unhealthy. Scaling down only takes place after those stateful Pods become running and ready.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10860"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets <stateful-set-name>\n```\n\nScale a StatefulSet | Change the number of replicas of your StatefulSet:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10861"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>\n```\n\nScale a StatefulSet | Alternatively, you can do in-place updates on your StatefulSets.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10862"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <stateful-set-file-updated>\n```\n\nScale a StatefulSet | Otherwise, edit that field with kubectl edit:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10863"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulsets <stateful-set-name>\n```\n\nScale a StatefulSet | Or use kubectl patch:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10864"}
{"instruction": "Write a bash example for scale a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulsets <stateful-set-name> -p '{\"spec\":{\"replicas\":<new-replicas>}}'\n```\n\nScale a StatefulSet | You cannot scale down a StatefulSet when any of the stateful Pods it manages is unhealthy. Scaling down only takes place after those stateful Pods become running and ready.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/scale-stateful-set/", "id": "k8s_00689_code_10865"}
{"instruction": "What is the reference documentation for kubectl apply set-last-applied?", "response": "kubectl apply set-last-appliedSynopsisSet the latest last-applied-configuration annotations by setting it to match the contents of a file. This results in the last-applied-configuration being updated as though 'kubectl apply -f<file> ' was run, without updating any other parts of the object.kubectl apply set-last-applied -f FILENAME Examples # Set the last-applied-configuration of a resource to match the contents of a file kubectl apply set-last-applied -f deploy.yaml # Execute set-last-applied against each configuration file in a directory kubectl apply set-last-applied -f path/ # Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist kubectl apply set-last-applied -f deploy.yaml --create-annotation=true Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--create-annotationWill create 'last-applied-configuration' annotations if current objects doesn't have one--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.-f, --filename stringsFilename, directory, or URL to files that contains the last-applied-configuration annotations-h, --helphelp for set-last-applied-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single tra", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_set-last-applied/", "id": "k8s_00690"}
{"instruction": "Write a bash example for kubectl apply set-last-applied", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f FILENAME\n```\n\nkubectl apply set-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_set-last-applied/", "id": "k8s_00690_code_10867"}
{"instruction": "Write a bash example for kubectl apply set-last-applied", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f FILENAME\n```\n\nkubectl apply set-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/kubectl_apply_set-last-applied/", "id": "k8s_00690_code_10868"}
{"instruction": "What is the reference documentation for priorityclass?", "response": "PriorityClassPriorityClass defines mapping from a priority class name to the priority integer value.apiVersion: scheduling.k8s.io/v1import \"k8s.io/api/scheduling/v1\"PriorityClassPriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer.apiVersion: scheduling.k8s.io/v1kind: PriorityClassmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatavalue (int32), requiredvalue represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.description (string)description is an arbitrary string that usually provides guidelines on when this priority class should be used.globalDefault (boolean)globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as globalDefault. However, if more than one PriorityClasses exists with their globalDefault field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.preemptionPolicy (string)preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.PriorityClassListPriorityClassList is a collection of priority classes.apiVersion: scheduling.k8s.io/v1kind: PriorityClassListmetadata (ListMeta)Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]PriorityClass), requireditems is the list of PriorityClassesOperationsget read the specified PriorityClassHTTP RequestGET /apis/scheduling.k8s.io/v1/priorityclasses/{name}Parametersname (in path): string, requiredname of the PriorityClasspretty (in query): stringprettyResponse200 (PriorityClass): OK401: Unauthorizedlist list or watch objects of kind PriorityClassHTTP RequestGET /apis/scheduling.k8s.io/v1/priorityclassesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (PriorityClassList): OK401: Unauthorizedcreate create a PriorityClassHTTP RequestPOST /apis/scheduling.k8s.io/v1/priorityclassesParametersbody: PriorityClass, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (PriorityClass): OK201 (PriorityClass): Created202 (PriorityClass): Accepted401: Unauthorizedupdate replace the specified PriorityClassHTTP RequestPUT /apis/scheduling.k8s.io/v1/priorityclasses/{name}Parametersname (in path): string, requiredname of the PriorityClassbody: PriorityClass, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (PriorityClass): OK201 (PriorityClass): Created401: Unauthorizedpatch partially update the specified PriorityClassHTTP RequestPATCH /apis/scheduling.k8s.io/v1/priorityclasses/{name}Parametersname (in path): string, requiredname of the PriorityClassbody: Patch, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationforce (in query): booleanforcepretty (in query): stringprettyResponse200 (PriorityClass): OK201 (PriorityClass): Created401: Unauthorizeddelete delete a PriorityClassHTTP RequestDELETE /apis/scheduling.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/priority-class-v1/", "id": "k8s_00691"}
{"instruction": "Write a yaml example for priorityclass", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\n```\n\nPriorityClass | import \"k8s.io/api/scheduling/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/priority-class-v1/", "id": "k8s_00691_code_10870"}
{"instruction": "What is the reference documentation for kubeadm version?", "response": "kubeadm versionThis command prints the version of kubeadm.SynopsisPrint the version of kubeadmkubeadm version [flags] Options-h, --helphelp for version-o, --output stringOutput format; available options are 'yaml', 'json' and 'short'Options inherited from parent commands--rootfs stringThe path to the 'real' host root filesystem. This will cause kubeadm to chroot into the provided path.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-version/", "id": "k8s_00692"}
{"instruction": "Explain the Kubernetes concept: Cluster Networking", "response": "Cluster NetworkingNetworking is a central part of Kubernetes, but it can be challenging to understand exactly how it is expected to work. There are 4 distinct networking problems to address:Highly-coupled container-to-container communications: this is solved by Pods and localhost communications.Pod-to-Pod communications: this is the primary focus of this document.Pod-to-Service communications: this is covered by Services.External-to-Service communications: this is also covered by Services.Kubernetes is all about sharing machines among applications. Typically, sharing machines requires ensuring that two applications do not try to use the same ports. Coordinating ports across multiple developers is very difficult to do at scale and exposes users to cluster-level issues outside of their control.Dynamic port allocation brings a lot of complications to the system - every application has to take ports as flags, the API servers have to know how to insert dynamic port numbers into configuration blocks, services have to know how to find each other, etc. Rather than deal with this, Kubernetes takes a different approach.To learn about the Kubernetes networking model, see here.Kubernetes IP address rangesKubernetes clusters require to allocate non-overlapping IP addresses for Pods, Services and Nodes, from a range of available addresses configured in the following components:The network plugin is configured to assign IP addresses to Pods.The kube-apiserver is configured to assign IP addresses to Services.The kubelet or the cloud-controller-manager is configured to assign IP addresses to Nodes.Cluster networking typesKubernetes clusters, attending to the IP families configured, can be categorized into:IPv4 only: The network plugin, kube-apiserver and kubelet/cloud-controller-manager are configured to assign only IPv4 addresses.IPv6 only: The network plugin, kube-apiserver and kubelet/cloud-controller-manager are configured to assign only IPv6 addresses.IPv4/IPv6 or IPv6/IPv4 dual-stack:The network plugin is configured to assign IPv4 and IPv6 addresses.The kube-apiserver is configured to assign IPv4 and IPv6 addresses.The kubelet or cloud-controller-manager is configured to assign IPv4 and IPv6 address.All components must agree on the configured primary IP family.Kubernetes clusters only consider the IP families present on the Pods, Services and Nodes objects, independently of the existing IPs of the represented objects. Per example, a server or a pod can have multiple IP addresses on its interfaces, but only the IP addresses in node.status.addresses or pod.status.ips are considered for implementing the Kubernetes network model and defining the type of the cluster.How to implement the Kubernetes network modelThe network model is implemented by the container runtime on each node. The most common container runtimes use Container Network Interface (CNI) plugins to manage their network and security capabilities. Many different CNI plugins exist from many different vendors. Some of these provide only basic features of adding and removing network interfaces, while others provide more sophisticated solutions, such as integration with other container orchestration systems, running multiple CNI plugins, advanced IPAM features etc.See this page for a non-exhaustive list of networking addons supported by Kubernetes.What's nextThe early design of the networking model and its rationale are described in more detail in the networking design document. For future plans and some on-going efforts that aim to improve Kubernetes networking, please refer to the SIG-Network KEPs.", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/cluster-administration/networking/", "id": "k8s_00693"}
{"instruction": "Explain the Kubernetes concept: Pods", "response": "PodsPods are the smallest deployable units of computing that you can create and manage in Kubernetes.A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific \"logical host\": it contains one or more application containers which are relatively tightly coupled. In non-cloud contexts, applications executed on the same physical or virtual machine are analogous to cloud applications executed on the same logical host.As well as application containers, a Pod can contain init containers that run during Pod startup. You can also inject ephemeral containers for debugging a running Pod.What is a Pod?Note:You need to install a container runtime into each node in the cluster so that Pods can run there.The shared context of a Pod is a set of Linux namespaces, cgroups, and potentially other facets of isolation - the same things that isolate a container. Within a Pod's context, the individual applications may have further sub-isolations applied.A Pod is similar to a set of containers with shared namespaces and shared filesystem volumes.Pods in a Kubernetes cluster are used in two main ways:Pods that run a single container. The \"one-container-per-Pod\" model is the most common Kubernetes use case; in this case, you can think of a Pod as a wrapper around a single container; Kubernetes manages Pods rather than managing the containers directly.Pods that run multiple containers that need to work together. A Pod can encapsulate an application composed of multiple co-located containers that are tightly coupled and need to share resources. These co-located containers form a single cohesive unit.Grouping multiple co-located and co-managed containers in a single Pod is a relatively advanced use case. You should use this pattern only in specific instances in which your containers are tightly coupled.You don't need to run multiple containers to provide replication (for resilience or capacity); if you need multiple replicas, see Workload management.Using PodsThe following is an example of a Pod which consists of a container running the image nginx:1.14.2.pods/simple-pod.yaml apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 To create the Pod shown above, run the following command:kubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml Pods are generally not created directly and are created using workload resources. See Working with Pods for more information on how Pods are used with workload resources.Workload resources for managing podsUsually you don't need to create Pods directly, even singleton Pods. Instead, create them using workload resources such as Deployment or Job. If your Pods need to track state, consider the StatefulSet resource.Each Pod is meant to run a single instance of a given application. If you want to scale your application horizontally (to provide more overall resources by running more instances), you should use multiple Pods, one for each instance. In Kubernetes, this is typically referred to as replication. Replicated Pods are usually created and managed as a group by a workload resource and its controller.See Pods and controllers for more information on how Kubernetes uses workload resources, and their controllers, to implement application scaling and auto-healing.Pods natively provide two kinds of shared resources for their constituent containers: networking and storage.Working with PodsYou'll rarely create individual Pods directly in Kubernetes—even singleton Pods. This is because Pods are designed as relatively ephemeral, disposable entities. When a Pod gets created (directly by you, or indirectly by a controller), the new Pod is scheduled to run on a Node in your cluster. The Pod remains on that node until the Po", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694"}
{"instruction": "Write a yaml example for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nPods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10874"}
{"instruction": "Write a bash example for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml\n```\n\nPods | Pods are generally not created directly and are created using workload resources. See Working with Pods for more information on how Pods are used with workload resources.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10875"}
{"instruction": "Write a yaml example for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\nPods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10876"}
{"instruction": "Write a yaml example for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nPods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10877"}
{"instruction": "Write a yaml example for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\nPods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10878"}
{"instruction": "Write a yaml example for pods", "response": "Here's a yaml example:\n\n```yaml\npods/simple-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nPods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10879"}
{"instruction": "Write a yaml example for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nPods | To create the Pod shown above, run the following command:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10880"}
{"instruction": "Write a bash example for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml\n```\n\nPods | Pods are generally not created directly and are created using workload resources. See Working with Pods for more information on how Pods are used with workload resources.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10881"}
{"instruction": "Write a yaml example for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: hello\nspec:\n  template:\n    # This is the pod template\n    spec:\n      containers:\n      - name: hello\n        image: busybox:1.28\n        command: ['sh', '-c', 'echo \"Hello, Kubernetes!\" && sleep 3600']\n      restartPolicy: OnFailure\n    # The pod template ends here\n```\n\nPods | Modifying the pod template or switching to a new pod template has no direct effect on the Pods that already exist. If you change the pod template for a workload resource, that resource needs to create", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/workloads/pods/", "id": "k8s_00694_code_10882"}
{"instruction": "Explain the Kubernetes concept: ReplicationController", "response": "ReplicationControllerLegacy API for managing workloads that can scale horizontally. Superseded by the Deployment and ReplicaSet APIs.Note:A Deployment that configures a ReplicaSet is now the recommended way to set up replication.A ReplicationController ensures that a specified number of pod replicas are running at any one time. In other words, a ReplicationController makes sure that a pod or a homogeneous set of pods is always up and available.How a ReplicationController worksIf there are too many pods, the ReplicationController terminates the extra pods. If there are too few, the ReplicationController starts more pods. Unlike manually created pods, the pods maintained by a ReplicationController are automatically replaced if they fail, are deleted, or are terminated. For example, your pods are re-created on a node after disruptive maintenance such as a kernel upgrade. For this reason, you should use a ReplicationController even if your application requires only a single pod. A ReplicationController is similar to a process supervisor, but instead of supervising individual processes on a single node, the ReplicationController supervises multiple pods across multiple nodes.ReplicationController is often abbreviated to \"rc\" in discussion, and as a shortcut in kubectl commands.A simple case is to create one ReplicationController object to reliably run one instance of a Pod indefinitely. A more complex use case is to run several identical replicas of a replicated service, such as web servers.Running an example ReplicationControllerThis example ReplicationController config runs three copies of the nginx web server.controllers/replication.yaml apiVersion: v1 kind: ReplicationController metadata: name: nginx spec: replicas: 3 selector: app: nginx template: metadata: name: nginx labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80 Run the example job by downloading the example file and then running this command:kubectl apply -f https://k8s.io/examples/controllers/replication.yaml The output is similar to this:replicationcontroller/nginx created Check on the status of the ReplicationController using this command:kubectl describe replicationcontrollers/nginx The output is similar to this:Name: nginx Namespace: default Selector: app=nginx Labels: app=nginx Annotations: <none> Replicas: 3 current / 3 desired Pods Status: 0 Running / 3 Waiting / 0 Succeeded / 0 Failed Pod Template: Labels: app=nginx Containers: nginx: Image: nginx Port: 80/TCP Environment: <none> Mounts: <none> Volumes: <none> Events: FirstSeen LastSeen Count From SubobjectPath Type Reason Message --------- -------- ----- ---- ------------- ---- ------ ------- 20s 20s 1 {replication-controller } Normal SuccessfulCreate Created pod: nginx-qrm3m 20s 20s 1 {replication-controller } Normal SuccessfulCreate Created pod: nginx-3ntk0 20s 20s 1 {replication-controller } Normal SuccessfulCreate Created pod: nginx-4ok8v Here, three pods are created, but none is running yet, perhaps because the image is being pulled. A little later, the same command may show:Pods Status: 3 Running / 0 Waiting / 0 Succeeded / 0 Failed To list all the pods that belong to the ReplicationController in a machine readable form, you can use a command like this:pods=$(kubectl get pods --selector=app=nginx --output=jsonpath={.items..metadata.name}) echo $pods The output is similar to this:nginx-3ntk0 nginx-4ok8v nginx-qrm3m Here, the selector is the same as the selector for the ReplicationController (seen in the kubectl describe output), and in a different form in replication.yaml. The --output=jsonpath option specifies an expression with the name from each pod in the returned list.Writing a ReplicationController ManifestAs with all other Kubernetes config, a ReplicationController needs apiVersion, kind, and metadata fields.When the control plane creates new Pods for a ReplicationController, the .metadata.name of the ReplicationController is part of the basis for naming tho", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695"}
{"instruction": "Write a yaml example for replicationcontroller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10884"}
{"instruction": "Write a bash example for replicationcontroller", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/replication.yaml\n```\n\nReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10885"}
{"instruction": "Write a bash example for replicationcontroller", "response": "Here's a bash example:\n\n```bash\nkubectl describe replicationcontrollers/nginx\n```\n\nReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10886"}
{"instruction": "Write a yaml example for replicationcontroller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10887"}
{"instruction": "Write a yaml example for replicationcontroller", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/replication.yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10888"}
{"instruction": "Write a yaml example for replicationcontroller", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  name: nginx\nspec:\n  replicas: 3\n  selector:\n    app: nginx\n  template:\n    metadata:\n      name: nginx\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\nReplicationController | Run the example job by downloading the example file and then running this command:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10889"}
{"instruction": "Write a bash example for replicationcontroller", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/replication.yaml\n```\n\nReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10890"}
{"instruction": "Write a bash example for replicationcontroller", "response": "Here's a bash example:\n\n```bash\nkubectl describe replicationcontrollers/nginx\n```\n\nReplicationController | The output is similar to this:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/", "id": "k8s_00695_code_10891"}
{"instruction": "What is the reference documentation for componentstatus?", "response": "ComponentStatusComponentStatus (and ComponentStatusList) holds the cluster validation info.apiVersion: v1import \"k8s.io/api/core/v1\"ComponentStatusComponentStatus (and ComponentStatusList) holds the cluster validation info. Deprecated: This API is deprecated in v1.19+apiVersion: v1kind: ComponentStatusmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataconditions ([]ComponentCondition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeList of component conditions observedInformation about the condition of a component.conditions.status (string), requiredStatus of the condition for a component. Valid values for \"Healthy\": \"True\", \"False\", or \"Unknown\".conditions.type (string), requiredType of condition for a component. Valid value: \"Healthy\"conditions.error (string)Condition error code for a component. For example, a health check error code.conditions.message (string)Message about the condition for a component. For example, information about a health check.ComponentStatusListStatus of all the conditions for the component as a list of ComponentStatus objects. Deprecated: This API is deprecated in v1.19+apiVersion: v1kind: ComponentStatusListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems ([]ComponentStatus), requiredList of ComponentStatus objects.Operationsget read the specified ComponentStatusHTTP RequestGET /api/v1/componentstatuses/{name}Parametersname (in path): string, requiredname of the ComponentStatuspretty (in query): stringprettyResponse200 (ComponentStatus): OK401: Unauthorizedlist list objects of kind ComponentStatusHTTP RequestGET /api/v1/componentstatusesParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ComponentStatusList): OK401: UnauthorizedThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/component-status-v1/", "id": "k8s_00696"}
{"instruction": "How do you configure quality of service for pods in Kubernetes?", "response": "Configure Quality of Service for PodsThis page shows how to configure Pods so that they will be assigned particular Quality of Service (QoS) classes. Kubernetes uses QoS classes to make decisions about evicting Pods when Node resources are exceeded.When Kubernetes creates a Pod it assigns one of these QoS classes to the Pod:GuaranteedBurstableBestEffortBefore you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou also need to be able to create and delete namespaces.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace qos-example Create a Pod that gets assigned a QoS class of GuaranteedFor a Pod to be given a QoS class of Guaranteed:Every Container in the Pod must have a memory limit and a memory request.For every Container in the Pod, the memory limit must equal the memory request.Every Container in the Pod must have a CPU limit and a CPU request.For every Container in the Pod, the CPU limit must equal the CPU request.These restrictions apply to init containers and app containers equally. Ephemeral containers cannot define resources so these restrictions do not apply.Here is a manifest for a Pod that has one Container. The Container has a memory limit and a memory request, both equal to 200 MiB. The Container has a CPU limit and a CPU request, both equal to 700 milliCPU:pods/qos/qos-pod.yaml apiVersion: v1 kind: Pod metadata: name: qos-demo namespace: qos-example spec: containers: - name: qos-demo-ctr image: nginx resources: limits: memory: \"200Mi\" cpu: \"700m\" requests: memory: \"200Mi\" cpu: \"700m\" Create the Pod:kubectl apply -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example View detailed information about the Pod:kubectl get pod qos-demo --namespace=qos-example --output=yaml The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also verifies that the Pod Container has a memory request that matches its memory limit, and it has a CPU request that matches its CPU limit.spec: containers: ... resources: limits: cpu: 700m memory: 200Mi requests: cpu: 700m memory: 200Mi ... status: qosClass: Guaranteed Note:If a Container specifies its own memory limit, but does not specify a memory request, Kubernetes automatically assigns a memory request that matches the limit. Similarly, if a Container specifies its own CPU limit, but does not specify a CPU request, Kubernetes automatically assigns a CPU request that matches the limit.Clean upDelete your Pod:kubectl delete pod qos-demo --namespace=qos-example Create a Pod that gets assigned a QoS class of BurstableA Pod is given a QoS class of Burstable if:The Pod does not meet the criteria for QoS class Guaranteed.At least one Container in the Pod has a memory or CPU request or limit.Here is a manifest for a Pod that has one Container. The Container has a memory limit of 200 MiB and a memory request of 100 MiB.pods/qos/qos-pod-2.yaml apiVersion: v1 kind: Pod metadata: name: qos-demo-2 namespace: qos-example spec: containers: - name: qos-demo-2-ctr image: nginx resources: limits: memory: \"200Mi\" requests: memory: \"100Mi\" Create the Pod:kubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example View detailed information about the Pod:kubectl get pod qos-demo-2 --namespace=qos-example --output=yaml The output shows that Kubernetes gave the Pod a QoS class of Burstable:spec: containers: - image: nginx imagePullPolicy: Always name: qos-demo-2-ctr resources: limits: memory: 200Mi requests: memory: 100Mi ... status: qosClass: Burstable Clean upDe", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace qos-example\n```\n\nConfigure Quality of Service for Pods | For a Pod to be given a QoS class of Guaranteed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10894"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10895"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10896"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also verifies that the Pod Container has a memory request that matches its memory limit, and it has a CPU request th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10897"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | A Pod is given a QoS class of Burstable if:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10898"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10899"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10900"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-2 --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10901"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-2 --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not have any memory or CPU limits or requests.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10902"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10903"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10904"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-3 --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of BestEffort:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10905"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-3 --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | Here is a manifest for a Pod that has two Containers. One container specifies a memory request of 200 MiB. The other Container does not specify any requests or limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10906"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\nConfigure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10907"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10908"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-4 --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10909"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\nConfigure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10910"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace qos-example\n```\n\nConfigure Quality of Service for Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10911"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10912"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    resources:\n      limits:\n        cpu: 700m\n        memory: 200Mi\n      requests:\n        cpu: 700m\n        memory: 200Mi\n    ...\nstatus:\n  qosClass: Guaranteed\n```\n\nConfigure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10913"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10914"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: qos-demo-2-ctr\n    resources:\n      limits:\n        memory: 200Mi\n      requests:\n        memory: 100Mi\n  ...\nstatus:\n  qosClass: Burstable\n```\n\nConfigure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10915"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10916"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    resources: {}\n  ...\nstatus:\n  qosClass: BestEffort\n```\n\nConfigure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10917"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\nConfigure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10918"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    name: qos-demo-4-ctr-1\n    resources:\n      requests:\n        memory: 200Mi\n    ...\n    name: qos-demo-4-ctr-2\n    resources: {}\n    ...\nstatus:\n  qosClass: Burstable\n```\n\nConfigure Quality of Service for Pods | Rather than see all the fields, you can view just the field you need:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10919"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\nConfigure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10920"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace qos-example\n```\n\nConfigure Quality of Service for Pods | For a Pod to be given a QoS class of Guaranteed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10921"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10922"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10923"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10924"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also verifies that the Pod Container has a memory request that matches its memory limit, and it has a CPU request th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10925"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | A Pod is given a QoS class of Burstable if:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10926"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10927"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10928"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10929"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-2 --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10930"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-2 --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not have any memory or CPU limits or requests.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10931"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10932"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\nConfigure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10933"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10934"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-3 --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of BestEffort:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10935"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-3 --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | Here is a manifest for a Pod that has two Containers. One container specifies a memory request of 200 MiB. The other Container does not specify any requests or limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10936"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\nConfigure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10937"}
{"instruction": "Write a yaml example for configure quality of service for pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\nConfigure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10938"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example\n```\n\nConfigure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10939"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-4 --namespace=qos-example --output=yaml\n```\n\nConfigure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10940"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\nConfigure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10941"}
{"instruction": "Write a bash example for configure quality of service for pods", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace qos-example\n```\n\nConfigure Quality of Service for Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/", "id": "k8s_00697_code_10942"}
{"instruction": "How do you deploy and access the kubernetes dashboard in Kubernetes?", "response": "Deploy and Access the Kubernetes DashboardDeploy the web UI (Kubernetes Dashboard) and access it.Dashboard is a web-based Kubernetes user interface. You can use Dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster resources. You can use Dashboard to get an overview of applications running on your cluster, as well as for creating or modifying individual Kubernetes resources (such as Deployments, Jobs, DaemonSets, etc). For example, you can scale a Deployment, initiate a rolling update, restart a pod or deploy new applications using a deploy wizard.Dashboard also provides information on the state of Kubernetes resources in your cluster and on any errors that may have occurred.Deploying the Dashboard UINote:Kubernetes Dashboard supports only Helm-based installation currently as it is faster and gives us better control over all dependencies required by Dashboard to run.The Dashboard UI is not deployed by default. To deploy it, run the following command:# Add kubernetes-dashboard repository helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ # Deploy a Helm Release named \"kubernetes-dashboard\" using the kubernetes-dashboard chart helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard Accessing the Dashboard UITo protect your cluster data, Dashboard deploys with a minimal RBAC configuration by default. Currently, Dashboard only supports logging in with a Bearer Token. To create a token for this demo, you can follow our guide on creating a sample user.Warning:The sample user created in the tutorial will have administrative privileges and is for educational purposes only.Command line proxyYou can enable access to the Dashboard using the kubectl command-line tool, by running the following command:kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443 Kubectl will make Dashboard available at https://localhost:8443.The UI can only be accessed from the machine where the command is executed. See kubectl port-forward --help for more options.Note:The kubeconfig authentication method does not support external identity providers or X.509 certificate-based authentication.Welcome viewWhen you access Dashboard on an empty cluster, you'll see the welcome page. This page contains a link to this document as well as a button to deploy your first application. In addition, you can view which system applications are running by default in the kube-system namespace of your cluster, for example the Dashboard itself.Deploying containerized applicationsDashboard lets you create and deploy a containerized application as a Deployment and optional Service with a simple wizard. You can either manually specify application details, or upload a YAML or JSON manifest file containing application configuration.Click the CREATE button in the upper right corner of any page to begin.Specifying application detailsThe deploy wizard expects that you provide the following information:App name (mandatory): Name for your application. A label with the name will be added to the Deployment and Service, if any, that will be deployed.The application name must be unique within the selected Kubernetes namespace. It must start with a lowercase character, and end with a lowercase character or a number, and contain only lowercase letters, numbers and dashes (-). It is limited to 24 characters. Leading and trailing spaces are ignored.Container image (mandatory): The URL of a public Docker container image on any registry, or a private image (commonly hosted on the Google Container Registry or Docker Hub). The container image specification must end with a colon.Number of pods (mandatory): The target number of Pods you want your application to be deployed in. The value must be a positive integer.A Deployment will be created to maintain the desired number of Pods acro", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/", "id": "k8s_00698"}
{"instruction": "Write a bash example for deploy and access the kubernetes dashboard", "response": "Here's a bash example:\n\n```bash\nkubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443\n```\n\nDeploy and Access the Kubernetes Dashboard | Kubectl will make Dashboard available at https://localhost:8443.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/", "id": "k8s_00698_code_10944"}
{"instruction": "Write a bash example for deploy and access the kubernetes dashboard", "response": "Here's a bash example:\n\n```bash\nkubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443\n```\n\nDeploy and Access the Kubernetes Dashboard | Kubectl will make Dashboard available at https://localhost:8443.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/", "id": "k8s_00698_code_10945"}
{"instruction": "Write a bash example for deploy and access the kubernetes dashboard", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --help\n```\n\nDeploy and Access the Kubernetes Dashboard | When you access Dashboard on an empty cluster, you'll see the welcome page. This page contains a link to this document as well as a button to deploy your first application. In addition, you can view w", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/", "id": "k8s_00698_code_10946"}
{"instruction": "Explain the Kubernetes concept: DNS for Services and Pods", "response": "DNS for Services and PodsYour workload can discover Services within your cluster using DNS; this page explains how that works.Kubernetes creates DNS records for Services and Pods. You can contact Services with consistent DNS names instead of IP addresses.Kubernetes publishes information about Pods and Services which is used to program DNS. kubelet configures Pods' DNS so that running containers can look up Services by name rather than IP.Services defined in the cluster are assigned DNS names. By default, a client Pod's DNS search list includes the Pod's own namespace and the cluster's default domain.Namespaces of ServicesA DNS query may return different results based on the namespace of the Pod making it. DNS queries that don't specify a namespace are limited to the Pod's namespace. Access Services in other namespaces by specifying it in the DNS query.For example, consider a Pod in a test namespace. A data Service is in the prod namespace.A query for data returns no results, because it uses the Pod's test namespace.A query for data.prod returns the intended result, because it specifies the namespace.DNS queries may be expanded using the Pod's /etc/resolv.conf. kubelet configures this file for each Pod. For example, a query for just data may be expanded to data.test.svc.cluster.local. The values of the search option are used to expand queries. To learn more about DNS queries, see the resolv.conf manual page.nameserver 10.32.0.10 search <namespace>.svc.cluster.local svc.cluster.local cluster.local options ndots:5 In summary, a Pod in the test namespace can successfully resolve either data.prod or data.prod.svc.cluster.local.DNS RecordsWhat objects get DNS records?ServicesPodsThe following sections detail the supported DNS record types and layout that is supported. Any other layout or names or queries that happen to work are considered implementation details and are subject to change without warning. For more up-to-date specification, see Kubernetes DNS-Based Service Discovery.ServicesA/AAAA records\"Normal\" (not headless) Services are assigned DNS A and/or AAAA records, depending on the IP family or families of the Service, with a name of the form my-svc.my-namespace.svc.cluster-domain.example. This resolves to the cluster IP of the Service.Headless Services (without a cluster IP) are also assigned DNS A and/or AAAA records, with a name of the form my-svc.my-namespace.svc.cluster-domain.example. Unlike normal Services, this resolves to the set of IPs of all of the Pods selected by the Service. Clients are expected to consume the set or else use standard round-robin selection from the set.SRV recordsSRV Records are created for named ports that are part of normal or headless services.For each named port, the SRV record has the form _port-name._port-protocol.my-svc.my-namespace.svc.cluster-domain.example.For a regular Service, this resolves to the port number and the domain name: my-svc.my-namespace.svc.cluster-domain.example.For a headless Service, this resolves to multiple answers, one for each Pod that is backing the Service, and contains the port number and the domain name of the Pod of the form hostname.my-svc.my-namespace.svc.cluster-domain.example.PodsA/AAAA recordsKube-DNS versions, prior to the implementation of the DNS specification, had the following DNS resolution:<pod-IPv4-address>.<namespace>.pod.<cluster-domain> For example, if a Pod in the default namespace has the IP address 172.17.0.3, and the domain name for your cluster is cluster.local, then the Pod has a DNS name:172-17-0-3.default.pod.cluster.local Some cluster DNS mechanisms, like CoreDNS, also provide A records for:<pod-ipv4-address>.<service-name>.<my-namespace>.svc.<cluster-domain.example> For example, if a Pod in the cafe namespace has the IP address 172.17.0.3, is an endpoint of a Service named barista, and the domain name for your cluster is cluster.local, then the Pod would have this service-scoped DNS A record.172-17-0-3.barista.cafe.svc.cluster.local", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nDNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10948"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\nDNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10949"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\nDNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10950"}
{"instruction": "Write a bash example for dns for services and pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dns-example -- cat /etc/resolv.conf\n```\n\nDNS for Services and Pods | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10951"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nDNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10952"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\nDNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10953"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\nDNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10954"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: busybox-subdomain\nspec:\n  selector:\n    name: busybox\n  clusterIP: None\n  ports:\n  - name: foo # name is not required for single-port Services\n    port: 1234\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox1\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-1\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox2\n  labels:\n    name: busybox\nspec:\n  hostname: busybox-2\n  subdomain: busybox-subdomain\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    name: busybox\n```\n\nDNS for Services and Pods | Given the above Service \"busybox-subdomain\" and the Pods which set spec.subdomain to \"busybox-subdomain\", the first Pod will see its own FQDN as \"busybox-1.busybox-subdomain.my-namespace.svc.cluster-d", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10955"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox\n  namespace: default\nspec:\n  containers:\n  - image: busybox:1.28\n    command:\n      - sleep\n      - \"3600\"\n    imagePullPolicy: IfNotPresent\n    name: busybox\n  restartPolicy: Always\n  hostNetwork: true\n  dnsPolicy: ClusterFirstWithHostNet\n```\n\nDNS for Services and Pods | Pod's DNS Config allows users more control on the DNS settings for a Pod.", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10956"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/custom-dns.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\nDNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10957"}
{"instruction": "Write a yaml example for dns for services and pods", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  namespace: default\n  name: dns-example\nspec:\n  containers:\n    - name: test\n      image: nginx\n  dnsPolicy: \"None\"\n  dnsConfig:\n    nameservers:\n      - 192.0.2.1 # this is an example\n    searches:\n      - ns1.svc.cluster-domain.example\n      - my.dns.search.suffix\n    options:\n      - name: ndots\n        value: \"2\"\n      - name: edns0\n```\n\nDNS for Services and Pods | When the Pod above is created, the container test gets the following contents in its /etc/resolv.conf file:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10958"}
{"instruction": "Write a bash example for dns for services and pods", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dns-example -- cat /etc/resolv.conf\n```\n\nDNS for Services and Pods | The output is similar to this:", "category": "concepts_code", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/", "id": "k8s_00699_code_10959"}
{"instruction": "Provide a tutorial on adopting sidecar containers", "response": "Adopting Sidecar ContainersThis section is relevant for people adopting a new built-in sidecar containers feature for their workloads.Sidecar container is not a new concept as posted in the blog post. Kubernetes allows running multiple containers in a Pod to implement this concept. However, running a sidecar container as a regular container has a lot of limitations being fixed with the new built-in sidecar containers support.FEATURE STATE: Kubernetes v1.33 [stable] (enabled by default: true)ObjectivesUnderstand the need for sidecar containersBe able to troubleshoot issues with the sidecar containersUnderstand options to universally \"inject\" sidecar containers to any workloadBefore you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.29.To check the version, enter kubectl version.Sidecar containers overviewSidecar containers are secondary containers that run along with the main application container within the same Pod. These containers are used to enhance or to extend the functionality of the primary app container by providing additional services, or functionalities such as logging, monitoring, security, or data synchronization, without directly altering the primary application code. You can read more in the Sidecar containers concept page.The concept of sidecar containers is not new and there are multiple implementations of this concept. As well as sidecar containers that you, the person defining the Pod, want to run, you can also find that some addons modify Pods - before the Pods start running - so that there are extra sidecar containers. The mechanisms to inject those extra sidecars are often mutating webhooks. For example, a service mesh addon might inject a sidecar that configures mutual TLS and encryption in transit between different Pods.While the concept of sidecar containers is not new, the native implementation of this feature in Kubernetes, however, is new. And as with every new feature, adopting this feature may present certain challenges.This tutorial explores challenges and solutions that can be experienced by end users as well as by authors of sidecar containers.Benefits of a built-in sidecar containerUsing Kubernetes' native support for sidecar containers provides several benefits:You can configure a native sidecar container to start ahead of init containers.The built-in sidecar containers can be authored to guarantee that they are terminated last. Sidecar containers are terminated with a SIGTERM signal once all the regular containers are completed and terminated. If the sidecar container isn’t gracefully shut down, a SIGKILL signal will be used to terminate it.With Jobs, when Pod's restartPolicy: OnFailure or restartPolicy: Never, native sidecar containers do not block Pod completion. With legacy sidecar containers, special care is needed to handle this situation.Also, with Jobs, built-in sidecar containers would keep being restarted once they are done, even if regular containers would not with Pod's restartPolicy: Never.See differences from init containers to learn more about it.Adopting built-in sidecar containersThe SidecarContainers feature gate is in beta state starting from Kubernetes version 1.29 and is enabled by default. Some clusters may have this feature disabled or have software installed that is incompatible with the feature.When this happens, the Pod may be rejected or the sidecar containers may block Pod startup, rendering the Pod useless. This condition is easy to detect as the Pod simply gets stuck on initialization. However, it is often unclear what caused the pr", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/pod-sidecar-containers/", "id": "k8s_00700"}
{"instruction": "Write a bash example for adopting sidecar containers", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\nAdopting Sidecar Containers | For the individual node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/pod-sidecar-containers/", "id": "k8s_00700_code_10961"}
{"instruction": "Write a bash example for adopting sidecar containers", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\nAdopting Sidecar Containers | If you see something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/pod-sidecar-containers/", "id": "k8s_00700_code_10962"}
{"instruction": "Write a bash example for adopting sidecar containers", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\nAdopting Sidecar Containers | For the individual node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/pod-sidecar-containers/", "id": "k8s_00700_code_10963"}
{"instruction": "Write a bash example for adopting sidecar containers", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\nAdopting Sidecar Containers | If you see something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/configuration/pod-sidecar-containers/", "id": "k8s_00700_code_10964"}
{"instruction": "What is the reference documentation for statefulset?", "response": "StatefulSetStatefulSet represents a set of pods with consistent identities.apiVersion: apps/v1import \"k8s.io/api/apps/v1\"StatefulSetStatefulSet represents a set of pods with consistent identities. Identities are defined as:Network: A single stable DNS and hostname.Storage: As many VolumeClaims as requested.The StatefulSet guarantees that a given network identity will always map to the same storage identity.apiVersion: apps/v1kind: StatefulSetmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (StatefulSetSpec)Spec defines the desired identities of pods in this set.status (StatefulSetStatus)Status is the current status of Pods in this StatefulSet. This data may be out of date by some window of time.StatefulSetSpecA StatefulSetSpec is the specification of a StatefulSet.serviceName (string)serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.selector (LabelSelector), requiredselector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectorstemplate (PodTemplateSpec), requiredtemplate is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet. Each pod will be named with the format <statefulsetname>-<podindex>. For example, a pod in a StatefulSet named \"web\" with index number \"3\" would be named \"web-3\". The only allowed template.spec.restartPolicy value is \"Always\".replicas (int32)replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.updateStrategy (StatefulSetUpdateStrategy)updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy.updateStrategy.type (string)Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate.updateStrategy.rollingUpdate (RollingUpdateStatefulSetStrategy)RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.updateStrategy.rollingUpdate.maxUnavailable (IntOrString)The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0. Defaults to 1. This field is alpha-level and is only honored by servers that enable the MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable.IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.updateStrategy.rollingUpdate.partition (int32)Partition indicates the ordinal at which the StatefulSet should be partitioned for updates. During a r", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/stateful-set-v1/", "id": "k8s_00701"}
{"instruction": "Provide a tutorial on explore termination behavior for pods and their endpoints", "response": "Explore Termination Behavior for Pods And Their EndpointsOnce you connected your Application with Service following steps like those outlined in Connecting Applications with Services, you have a continuously running, replicated application, that is exposed on a network. This tutorial helps you look at the termination flow for Pods and to explore ways to implement graceful connection draining.Termination process for Pods and their endpointsThere are often cases when you need to terminate a Pod - be it to upgrade or scale down. In order to improve application availability, it may be important to implement a proper active connections draining.This tutorial explains the flow of Pod termination in connection with the corresponding endpoint state and removal by using a simple nginx web server to demonstrate the concept.Example flow with endpoint terminationThe following is the example flow described in the Termination of Pods document.Let's say you have a Deployment containing a single nginx replica (say just for the sake of demonstration purposes) and a Service:service/pod-with-graceful-termination.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: terminationGracePeriodSeconds: 120 # extra long grace period containers: - name: nginx image: nginx:latest ports: - containerPort: 80 lifecycle: preStop: exec: # Real life termination may take any time up to terminationGracePeriodSeconds. # In this example - just hang around for at least the duration of terminationGracePeriodSeconds, # at 120 seconds container will be forcibly terminated. # Note, all this time nginx will keep processing requests. command: [ \"/bin/sh\", \"-c\", \"sleep 180\" ] service/explore-graceful-termination-nginx.yaml apiVersion: v1 kind: Service metadata: name: nginx-service spec: selector: app: nginx ports: - protocol: TCP port: 80 targetPort: 80Now create the Deployment Pod and Service using the above files:kubectl apply -f pod-with-graceful-termination.yaml kubectl apply -f explore-graceful-termination-nginx.yaml Once the Pod and Service are running, you can get the name of any associated EndpointSlices:kubectl get endpointslice The output is similar to this:NAME ADDRESSTYPE PORTS ENDPOINTS AGE nginx-service-6tjbr IPv4 80 10.12.1.199,10.12.1.201 22m You can see its status, and validate that there is one endpoint registered:kubectl get endpointslices -o json -l kubernetes.io/service-name=nginx-service The output is similar to this:{ \"addressType\": \"IPv4\", \"apiVersion\": \"discovery.k8s.io/v1\", \"endpoints\": [ { \"addresses\": [ \"10.12.1.201\" ], \"conditions\": { \"ready\": true, \"serving\": true, \"terminating\": false Now let's terminate the Pod and validate that the Pod is being terminated respecting the graceful termination period configuration:kubectl delete pod nginx-deployment-7768647bf9-b4b9s All pods:kubectl get pods The output is similar to this:NAME READY STATUS RESTARTS AGE nginx-deployment-7768647bf9-b4b9s 1/1 Terminating 0 4m1s nginx-deployment-7768647bf9-rkxlw 1/1 Running 0 8s You can see that the new pod got scheduled.While the new endpoint is being created for the new Pod, the old endpoint is still around in the terminating state:kubectl get endpointslice -o json nginx-service-6tjbr The output is similar to this:{ \"addressType\": \"IPv4\", \"apiVersion\": \"discovery.k8s.io/v1\", \"endpoints\": [ { \"addresses\": [ \"10.12.1.201\" ], \"conditions\": { \"ready\": false, \"serving\": true, \"terminating\": true }, \"nodeName\": \"gke-main-default-pool-dca1511c-d17b\", \"targetRef\": { \"kind\": \"Pod\", \"name\": \"nginx-deployment-7768647bf9-b4b9s\", \"namespace\": \"default\", \"uid\": \"66fa831c-7eb2-407f-bd2c-f96dfe841478\" }, \"zone\": \"us-central1-c\" }, { \"addresses\": [ \"10.12.1.202\" ], \"conditions\": { \"ready\": true, \"serving\": true, \"terminating\": false }, \"nodeName\": \"gke-main-default-pool-dca1511c-d17b\", \"targetRef\": { \"kind\": \"Pod\", \"name\": \"nginx-deployment-7768", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10967"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10968"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f pod-with-graceful-termination.yaml\nkubectl apply -f explore-graceful-termination-nginx.yaml\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Once the Pod and Service are running, you can get the name of any associated EndpointSlices:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10969"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10970"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -o json -l kubernetes.io/service-name=nginx-service\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10971"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod nginx-deployment-7768647bf9-b4b9s\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | All pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10972"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice -o json nginx-service-6tjbr\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10973"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10974"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10975"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\nservice/pod-with-graceful-termination.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10976"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10977"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\nservice/explore-graceful-termination-nginx.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10978"}
{"instruction": "Write a yaml example for explore termination behavior for pods and their endpoints", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10979"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f pod-with-graceful-termination.yaml\nkubectl apply -f explore-graceful-termination-nginx.yaml\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | Once the Pod and Service are running, you can get the name of any associated EndpointSlices:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10980"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10981"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -o json -l kubernetes.io/service-name=nginx-service\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10982"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod nginx-deployment-7768647bf9-b4b9s\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | All pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10983"}
{"instruction": "Write a bash example for explore termination behavior for pods and their endpoints", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice -o json nginx-service-6tjbr\n```\n\nExplore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/services/pods-and-endpoint-termination-flow/", "id": "k8s_00702_code_10984"}
{"instruction": "What is the reference documentation for command line tool (kubectl)?", "response": "Command line tool (kubectl)Kubernetes provides a command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.This tool is named kubectl.For configuration, kubectl looks for a file named config in the $HOME/.kube directory. You can specify other kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.This overview covers kubectl syntax, describes the command operations, and provides common examples. For details about each command, including all the supported flags and subcommands, see the kubectl reference documentation.For installation instructions, see Installing kubectl; for a quick guide, see the cheat sheet. If you're used to using the docker command-line tool, kubectl for Docker Users explains some equivalent commands for Kubernetes.SyntaxUse the following syntax to run kubectl commands from your terminal window:kubectl [command] [TYPE] [NAME] [flags] where command, TYPE, NAME, and flags are:command: Specifies the operation that you want to perform on one or more resources, for example create, get, describe, delete.TYPE: Specifies the resource type. Resource types are case-insensitive and you can specify the singular, plural, or abbreviated forms. For example, the following commands produce the same output:kubectl get pod pod1 kubectl get pods pod1 kubectl get po pod1 NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, for example kubectl get pods.When performing an operation on multiple resources, you can specify each resource by type and name or specify one or more files:To specify resources by type and name:To group resources if they are all the same type: TYPE1 name1 name2 name<#>.Example: kubectl get pod example-pod1 example-pod2To specify multiple resource types individually: TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>.Example: kubectl get pod/example-pod1 replicationcontroller/example-rc1To specify resources with one or more files: -f file1 -f file2 -f file<#>Use YAML rather than JSON since YAML tends to be more user-friendly, especially for configuration files.Example: kubectl get -f ./pod.yamlflags: Specifies optional flags. For example, you can use the -s or --server flags to specify the address and port of the Kubernetes API server.Caution:Flags that you specify from the command line override default values and any corresponding environment variables.If you need help, run kubectl help from the terminal window.In-cluster authentication and namespace overridesBy default kubectl will first determine if it is running within a pod, and thus in a cluster. It starts by checking for the KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT environment variables and the existence of a service account token file at /var/run/secrets/kubernetes.io/serviceaccount/token. If all three are found in-cluster authentication is assumed.To maintain backwards compatibility, if the POD_NAMESPACE environment variable is set during in-cluster authentication it will override the default namespace from the service account token. Any manifests or tools relying on namespace defaulting will be affected by this.POD_NAMESPACE environment variableIf the POD_NAMESPACE environment variable is set, cli operations on namespaced resources will default to the variable value. For example, if the variable is set to seattle, kubectl get pods would return pods in the seattle namespace. This is because pods are a namespaced resource, and no namespace was provided in the command. Review the output of kubectl api-resources to determine if a resource is namespaced.Explicit use of --namespace <value> overrides this behavior.How kubectl handles ServiceAccount tokensIf:there is Kubernetes service account token file mounted at /var/run/secrets/kubernetes.io/serviceaccount/token, andthe KUBERNETES_SERVICE_HOST environment variable is set, andthe KUBERNETES_SERVICE_PORT environment variable ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] [flags]\n```\n\nCommand line tool (kubectl) | where command, TYPE, NAME, and flags are:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10986"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod1\nkubectl get pods pod1\nkubectl get po pod1\n```\n\nCommand line tool (kubectl) | NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, for example kubectl get pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10987"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<namespace-name>\n```\n\nCommand line tool (kubectl) | The following table includes short descriptions and the general syntax for all of the kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10988"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] -o <output_format>\n```\n\nCommand line tool (kubectl) | Depending on the kubectl operation, the following output formats are supported:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10989"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-pod-13je7 -o yaml\n```\n\nCommand line tool (kubectl) | Remember: See the kubectl reference documentation for details about which output format is supported by each command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10990"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion\n```\n\nCommand line tool (kubectl) | Template file:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10991"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns-file=template.txt\n```\n\nCommand line tool (kubectl) | where the template.txt file contains:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10992"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> --server-print=false\n```\n\nCommand line tool (kubectl) | The output is similar to:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10993"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>\n```\n\nCommand line tool (kubectl) | To print a list of pods sorted by name, you run:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10994"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --sort-by=.metadata.name\n```\n\nCommand line tool (kubectl) | Use the following set of examples to help you familiarize yourself with running the commonly used kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10995"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod example-pod1 example-pod2\n```\n\nCommand line tool (kubectl) | To specify multiple resource types individually: TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>.Example: kubectl get pod/example-pod1 replicationcontroller/example-rc1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10996"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/example-pod1 replicationcontroller/example-rc1\n```\n\nCommand line tool (kubectl) | To specify resources with one or more files: -f file1 -f file2 -f file<#>", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10997"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get -f ./pod.yaml\n```\n\nCommand line tool (kubectl) | flags: Specifies optional flags. For example, you can use the -s or --server flags to specify the address and port of the Kubernetes API server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10998"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\nCommand line tool (kubectl) | Explicit use of --namespace <value> overrides this behavior.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_10999"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl alpha SUBCOMMAND [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11000"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11001"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11002"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-versions [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11003"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f FILENAME [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11004"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl attach POD -c CONTAINER [-i] [-t] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11005"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl auth [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11006"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11007"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11008"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11009"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11010"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11011"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f FILENAME [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11012"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cordon NODE [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11013"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest> [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11014"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11015"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11016"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11017"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11018"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl drain NODE [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11019"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11020"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11021"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=false] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11022"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11023"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11024"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <dir> [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11025"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11026"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs POD [-c CONTAINER] [--follow] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11027"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11028"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11029"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11030"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11031"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11032"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11033"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client|none] [--overrides=inline-json] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11034"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11035"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11036"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11037"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl top (POD | NODE) [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11038"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11039"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl version [--client] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11040"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11041"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\nCommand line tool (kubectl) | Use the following sections for information about how you can format or sort the output of certain commands. For details about which commands support the various output options, see the kubectl referen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11042"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl describe node\n```\n\nCommand line tool (kubectl) | kubectl delete - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11043"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nchmod a+x ./kubectl-hello\n\n# and move it to a location in our PATH\nsudo mv ./kubectl-hello /usr/local/bin\nsudo chown root:root /usr/local/bin\n\n# You have now created and \"installed\" a kubectl plugin.\n# You can begin using this plugin by invoking it from kubectl as if it were a regular command\nkubectl hello\n```\n\nCommand line tool (kubectl) | In order to view all of the plugins that are available to kubectl, use the kubectl plugin list subcommand:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11044"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] [flags]\n```\n\nCommand line tool (kubectl) | where command, TYPE, NAME, and flags are:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11045"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod1\nkubectl get pods pod1\nkubectl get po pod1\n```\n\nCommand line tool (kubectl) | NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, for example kubectl get pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11046"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<namespace-name>\n```\n\nCommand line tool (kubectl) | The following table includes short descriptions and the general syntax for all of the kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11047"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] -o <output_format>\n```\n\nCommand line tool (kubectl) | Depending on the kubectl operation, the following output formats are supported:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11048"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-pod-13je7 -o yaml\n```\n\nCommand line tool (kubectl) | Remember: See the kubectl reference documentation for details about which output format is supported by each command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11049"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion\n```\n\nCommand line tool (kubectl) | Template file:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11050"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns-file=template.txt\n```\n\nCommand line tool (kubectl) | where the template.txt file contains:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11051"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> --server-print=false\n```\n\nCommand line tool (kubectl) | The output is similar to:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11052"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>\n```\n\nCommand line tool (kubectl) | To print a list of pods sorted by name, you run:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11053"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --sort-by=.metadata.name\n```\n\nCommand line tool (kubectl) | Use the following set of examples to help you familiarize yourself with running the commonly used kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/", "id": "k8s_00703_code_11054"}
{"instruction": "What is the reference documentation for storageversionmigration v1alpha1?", "response": "StorageVersionMigration v1alpha1StorageVersionMigration represents a migration of stored data to the latest storage version.apiVersion: storagemigration.k8s.io/v1alpha1import \"k8s.io/api/storagemigration/v1alpha1\"StorageVersionMigrationStorageVersionMigration represents a migration of stored data to the latest storage version.apiVersion: storagemigration.k8s.io/v1alpha1kind: StorageVersionMigrationmetadata (ObjectMeta)Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (StorageVersionMigrationSpec)Specification of the migration.status (StorageVersionMigrationStatus)Status of the migration.StorageVersionMigrationSpecSpec of the storage version migration.continueToken (string)The token used in the list options to get the next chunk of objects to migrate. When the .status.conditions indicates the migration is \"Running\", users can use this token to check the progress of the migration.resource (GroupVersionResource), requiredThe resource that is being migrated. The migrator sends requests to the endpoint serving the resource. Immutable.The names of the group, the version, and the resource.resource.group (string)The name of the group.resource.resource (string)The name of the resource.resource.version (string)The name of the version.StorageVersionMigrationStatusStatus of the storage version migration.conditions ([]MigrationCondition)Patch strategy: merge on key typeMap: unique values on key type will be kept during a mergeThe latest available observations of the migration's current state.Describes the state of a migration at a certain point.conditions.status (string), requiredStatus of the condition, one of True, False, Unknown.conditions.type (string), requiredType of the condition.conditions.lastUpdateTime (Time)The last time this condition was updated.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.conditions.message (string)A human readable message indicating details about the transition.conditions.reason (string)The reason for the condition's last transition.resourceVersion (string)ResourceVersion to compare with the GC cache for performing the migration. This is the current resource version of given group, version and resource when kube-controller-manager first observes this StorageVersionMigration resource.StorageVersionMigrationListStorageVersionMigrationList is a collection of storage version migrations.apiVersion: storagemigration.k8s.io/v1alpha1kind: StorageVersionMigrationListmetadata (ListMeta)Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]StorageVersionMigration), requiredPatch strategy: merge on key typeMap: unique values on key type will be kept during a mergeItems is the list of StorageVersionMigrationOperationsget read the specified StorageVersionMigrationHTTP RequestGET /apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}Parametersname (in path): string, requiredname of the StorageVersionMigrationpretty (in query): stringprettyResponse200 (StorageVersionMigration): OK401: Unauthorizedget read status of the specified StorageVersionMigrationHTTP RequestGET /apis/storagemigration.k8s.io/v1alpha1/storageversionmigrations/{name}/statusParametersname (in path): string, requiredname of the StorageVersionMigrationpretty (in query): stringprettyResponse200 (StorageVersionMigration): OK401: Unauthorizedlist list or watch objects of kind StorageVersionMigrationHTTP RequestGET /apis/storagemigration.k8s.io/v1alpha1/storageversionmigrationsParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringr", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/storage-version-migration-v1alpha1/", "id": "k8s_00704"}
{"instruction": "Write a yaml example for storageversionmigration v1alpha1", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storagemigration.k8s.io/v1alpha1\n```\n\nStorageVersionMigration v1alpha1 | import \"k8s.io/api/storagemigration/v1alpha1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/storage-version-migration-v1alpha1/", "id": "k8s_00704_code_11056"}
{"instruction": "What is the reference documentation for seccomp and kubernetes?", "response": "Seccomp and KubernetesSeccomp stands for secure computing mode and has been a feature of the Linux kernel since version 2.6.12. It can be used to sandbox the privileges of a process, restricting the calls it is able to make from userspace into the kernel. Kubernetes lets you automatically apply seccomp profiles loaded onto a node to your Pods and containers.Seccomp fieldsFEATURE STATE: Kubernetes v1.19 [stable]There are four ways to specify a seccomp profile for a pod:for the whole Pod using spec.securityContext.seccompProfilefor a single container using spec.containers[*].securityContext.seccompProfilefor an (restartable / sidecar) init container using spec.initContainers[*].securityContext.seccompProfilefor an ephemeral container using spec.ephemeralContainers[*].securityContext.seccompProfilepods/security/seccomp/fields.yaml apiVersion: v1 kind: Pod metadata: name: pod spec: securityContext: seccompProfile: type: Unconfined ephemeralContainers: - name: ephemeral-container image: debian securityContext: seccompProfile: type: RuntimeDefault initContainers: - name: init-container image: debian securityContext: seccompProfile: type: RuntimeDefault containers: - name: container image: docker.io/library/debian:stable securityContext: seccompProfile: type: Localhost localhostProfile: my-profile.json The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securityContext.seccompProfile field explicitly, then the value would be inherited from the Pod. The same applies to the container, which runs a Localhost profile my-profile.json.Generally speaking, fields from (ephemeral) containers have a higher priority than the Pod level value, while containers which do not set the seccomp field inherit the profile from the Pod.Note:It is not possible to apply a seccomp profile to a Pod or container running with privileged: true set in the container's securityContext. Privileged containers always run as Unconfined.The following values are possible for the seccompProfile.type:UnconfinedThe workload runs without any seccomp restrictions.RuntimeDefaultA default seccomp profile defined by the container runtime is applied. The default profiles aim to provide a strong set of security defaults while preserving the functionality of the workload. It is possible that the default profiles differ between container runtimes and their release versions, for example when comparing those from CRI-O and containerd.LocalhostThe localhostProfile will be applied, which has to be available on the node disk (on Linux it's /var/lib/kubelet/seccomp). The availability of the seccomp profile is verified by the container runtime on container creation. If the profile does not exist, then the container creation will fail with a CreateContainerError.Localhost profilesSeccomp profiles are JSON files following the scheme defined by the OCI runtime specification. A profile basically defines actions based on matched syscalls, but also allows to pass specific values as arguments to syscalls. For example:{ \"defaultAction\": \"SCMP_ACT_ERRNO\", \"defaultErrnoRet\": 38, \"syscalls\": [ { \"names\": [ \"adjtimex\", \"alarm\", \"bind\", \"waitid\", \"waitpid\", \"write\", \"writev\" ], \"action\": \"SCMP_ACT_ALLOW\" } ] } The defaultAction in the profile above is defined as SCMP_ACT_ERRNO and will return as fallback to the actions defined in syscalls. The error is defined as code 38 via the defaultErrnoRet field.The following actions are generally possible:SCMP_ACT_ERRNOReturn the specified error code.SCMP_ACT_ALLOWAllow the syscall to be executed.SCMP_ACT_KILL_PROCESSKill the process.SCMP_ACT_KILL_THREAD and SCMP_ACT_KILLKill only the thread.SCMP_ACT_TRAPThrow a SIGSYS signal.SCMP_ACT_NOTIFY and SECCOMP_RET_USER_NOTIF.Notify the user space.SCMP_ACT_TRACENotify a tracing process with the specified value.SCMP_ACT_LOGAllow the syscall to be executed after the action has been lo", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/seccomp/", "id": "k8s_00705"}
{"instruction": "Write a yaml example for seccomp and kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\nSeccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/seccomp/", "id": "k8s_00705_code_11058"}
{"instruction": "Write a yaml example for seccomp and kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\nSeccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/seccomp/", "id": "k8s_00705_code_11059"}
{"instruction": "Write a yaml example for seccomp and kubernetes", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/fields.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\nSeccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/seccomp/", "id": "k8s_00705_code_11060"}
{"instruction": "Write a yaml example for seccomp and kubernetes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\nSeccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/node/seccomp/", "id": "k8s_00705_code_11061"}
{"instruction": "What is the reference documentation for kubernetes api concepts?", "response": "Kubernetes API ConceptsThe Kubernetes API is a resource-based (RESTful) programmatic interface provided via HTTP. It supports retrieving, creating, updating, and deleting primary resources via the standard HTTP verbs (POST, PUT, PATCH, DELETE, GET).For some resources, the API includes additional subresources that allow fine-grained authorization (such as separate views for Pod details and log retrievals), and can accept and serve those resources in different representations for convenience or efficiency.Kubernetes supports efficient change notifications on resources via watches:in the Kubernetes API, watch is a verb that is used to track changes to an object in Kubernetes as a stream. It is used for the efficient detection of changes.Kubernetes also provides consistent list operations so that API clients can effectively cache, track, and synchronize the state of resources.You can view the API reference online, or read on to learn about the API in general.Kubernetes API terminologyKubernetes generally leverages common RESTful terminology to describe the API concepts:A resource type is the name used in the URL (pods, namespaces, services)All resource types have a concrete representation (their object schema) which is called a kindA list of instances of a resource type is known as a collectionA single instance of a resource type is called a resource, and also usually represents an objectFor some resource types, the API includes one or more sub-resources, which are represented as URI paths below the resourceMost Kubernetes API resource types are objects – they represent a concrete instance of a concept on the cluster, like a pod or namespace. A smaller number of API resource types are virtual in that they often represent operations on objects, rather than objects, such as a permission check (use a POST with a JSON-encoded body of SubjectAccessReview to the subjectaccessreviews resource), or the eviction sub-resource of a Pod (used to trigger API-initiated eviction).Object namesAll objects you can create via the API have a unique object name to allow idempotent creation and retrieval, except that virtual resource types may not have unique names if they are not retrievable, or do not rely on idempotency. Within a namespace, only one object of a given kind can have a given name at a time. However, if you delete the object, you can make a new object with the same name. Some objects are not namespaced (for example: Nodes), and so their names must be unique across the whole cluster.API verbsAlmost all object resource types support the standard HTTP verbs - GET, POST, PUT, PATCH, and DELETE. Kubernetes also uses its own verbs, which are often written in lowercase to distinguish them from HTTP verbs.Kubernetes uses the term list to describe the action of returning a collection of resources, to distinguish it from retrieving a single resource which is usually called a get. If you sent an HTTP GET request with the ?watch query parameter, Kubernetes calls this a watch and not a get (see Efficient detection of changes for more details).For PUT requests, Kubernetes internally classifies these as either create or update based on the state of the existing object. An update is different from a patch; the HTTP verb for a patch is PATCH.Resource URIsAll resource types are either scoped by the cluster (/apis/GROUP/VERSION/*) or to a namespace (/apis/GROUP/VERSION/namespaces/NAMESPACE/*). A namespace-scoped resource type will be deleted when its namespace is deleted and access to that resource type is controlled by authorization checks on the namespace scope.Note: core resources use /api instead of /apis and omit the GROUP path segment.Examples:/api/v1/namespaces/api/v1/pods/api/v1/namespaces/my-namespace/pods/apis/apps/v1/deployments/apis/apps/v1/namespaces/my-namespace/deployments/apis/apps/v1/namespaces/my-namespace/deployments/my-deploymentYou can also access collections of resources (for example: listing all Nodes). The following paths are used ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\n200 OK\nContent-Type: application/yaml\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\n  …\n```\n\nKubernetes API Concepts | Kubernetes uses an envelope wrapper to encode Protobuf responses. That wrapper starts with a 4 byte magic number to help identify content in disk or in etcd as Protobuf (as opposed to JSON). The 4 byt", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11063"}
{"instruction": "Write a bash example for kubernetes api concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get services -A -o yaml\n```\n\nKubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11064"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\nitems:\n- apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: \"2021-06-03T14:54:12Z\"\n    labels:\n      component: apiserver\n      provider: kubernetes\n    name: kubernetes\n    namespace: default\n...\n- apiVersion: v1\n  kind: Service\n  metadata:\n    annotations:\n      prometheus.io/port: \"9153\"\n      prometheus.io/scrape: \"true\"\n    creationTimestamp: \"2021-06-03T14:54:14Z\"\n    labels:\n      k8s-app: kube-dns\n      kubernetes.io/cluster-service: \"true\"\n      kubernetes.io/name: CoreDNS\n    name: kube-dns\n    namespace: kube-system\n```\n\nKubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11065"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\n200 OK\nContent-Type: application/yaml\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\n  …\n```\n\nKubernetes API Concepts | Kubernetes uses an envelope wrapper to encode Protobuf responses. That wrapper starts with a 4 byte magic number to help identify content in disk or in etcd as Protobuf (as opposed to JSON). The 4 byt", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11066"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"kind\": \"ServiceList\",\n  \"apiVersion\": \"v1\",\n  \"metadata\": {\n    \"resourceVersion\": \"2947301\"\n  },\n  \"items\": [\n    {\n      \"metadata\": {\n        \"name\": \"kubernetes\",\n        \"namespace\": \"default\",\n...\n      \"metadata\": {\n        \"name\": \"kube-dns\",\n        \"namespace\": \"kube-system\",\n...\n```\n\nKubernetes API Concepts | There are dozens of collection types (such as PodList, ServiceList, and NodeList) defined in the Kubernetes API. You can get more information about each collection type from the Kubernetes API documen", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11067"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\nitems:\n- apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: \"2021-06-03T14:54:12Z\"\n    labels:\n      component: apiserver\n      provider: kubernetes\n    name: kubernetes\n    namespace: default\n...\n- apiVersion: v1\n  kind: Service\n  metadata:\n    annotations:\n      prometheus.io/port: \"9153\"\n      prometheus.io/scrape: \"true\"\n    creationTimestamp: \"2021-06-03T14:54:14Z\"\n    labels:\n      k8s-app: kube-dns\n      kubernetes.io/cluster-service: \"true\"\n      kubernetes.io/name: CoreDNS\n    name: kube-dns\n    namespace: kube-system\n```\n\nKubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11068"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"kind\": \"ConfigMap\",\n  \"apiVersion\": \"v1\",\n  \"metadata\": {\n    \"finalizers\": [\"url.io/neat-finalization\", \"other-url.io/my-finalizer\"],\n    \"deletionTimestamp\": nil,\n  }\n}\n```\n\nKubernetes API Concepts | When a client first sends a delete to request the removal of a resource, the .metadata.deletionTimestamp is set to the current time. Once the .metadata.deletionTimestamp is set, external controllers t", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11069"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"apps\"]\n  resources: [\"deployments\"]\n  verbs: [\"patch\"]\n```\n\nKubernetes API Concepts | See Authorization Overview.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11070"}
{"instruction": "Write a bash example for kubernetes api concepts", "response": "Here's a bash example:\n\n```bash\nkubectl get services -A -o yaml\n```\n\nKubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11071"}
{"instruction": "Write a yaml example for kubernetes api concepts", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\nitems:\n- apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: \"2021-06-03T14:54:12Z\"\n    labels:\n      component: apiserver\n      provider: kubernetes\n    name: kubernetes\n    namespace: default\n...\n- apiVersion: v1\n  kind: Service\n  metadata:\n    annotations:\n      prometheus.io/port: \"9153\"\n      prometheus.io/scrape: \"true\"\n    creationTimestamp: \"2021-06-03T14:54:14Z\"\n    labels:\n      k8s-app: kube-dns\n      kubernetes.io/cluster-service: \"true\"\n      kubernetes.io/name: CoreDNS\n    name: kube-dns\n    namespace: kube-system\n```\n\nKubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/api-concepts/", "id": "k8s_00706_code_11072"}
{"instruction": "What is the reference documentation for secret?", "response": "SecretSecret holds secret data of a certain type.apiVersion: v1import \"k8s.io/api/core/v1\"SecretSecret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.apiVersion: v1kind: Secretmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatadata (map[string][]byte)Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4immutable (boolean)Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.stringData (map[string]string)stringData allows specifying non-binary secret data in string form. It is provided as a write-only input field for convenience. All keys and values are merged into the data field on write, overwriting any existing values. The stringData field is never output when reading from the API.type (string)Used to facilitate programmatic handling of secret data. More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-typesSecretListSecretList is a list of Secret.apiVersion: v1kind: SecretListmetadata (ListMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kindsitems ([]Secret), requiredItems is a list of secret objects. More info: https://kubernetes.io/docs/concepts/configuration/secretOperationsget read the specified SecretHTTP RequestGET /api/v1/namespaces/{namespace}/secrets/{name}Parametersname (in path): string, requiredname of the Secretnamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (Secret): OK401: Unauthorizedlist list or watch objects of kind SecretHTTP RequestGET /api/v1/namespaces/{namespace}/secretsParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (SecretList): OK401: Unauthorizedlist list or watch objects of kind SecretHTTP RequestGET /api/v1/secretsParametersallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (SecretList): OK401: Unauthorizedcreate create a SecretHTTP RequestPOST /api/v1/namespaces/{namespace}/secretsParametersnamespace (in path): string, requirednamespacebody: Secret, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (Secret): OK201 (Secret): Created202 (Secret): Accepted401: Unauthorizedupdate replace the specified SecretHTTP RequestPUT /api/v1/namespaces/{namespace}/secrets/{name}Parametersname (in path): string, requiredname of the Secretnamespace (in path): string, requirednamespacebody: Secret, requireddryRun (in query): stringdryRunfieldManager (in query): stringfi", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/secret-v1/", "id": "k8s_00707"}
{"instruction": "How do you managing kubernetes objects using imperative commands in Kubernetes?", "response": "Managing Kubernetes Objects Using Imperative CommandsKubernetes objects can quickly be created, updated, and deleted directly using imperative commands built into the kubectl command-line tool. This document explains how those commands are organized and how to use them to manage live objects.Before you beginInstall kubectl.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Trade-offsThe kubectl tool supports three kinds of object management:Imperative commandsImperative object configurationDeclarative object configurationSee Kubernetes Object Management for a discussion of the advantages and disadvantage of each kind of object management.How to create objectsThe kubectl tool supports verb-driven commands for creating some of the most common object types. The commands are named to be recognizable to users unfamiliar with the Kubernetes object types.run: Create a new Pod to run a Container.expose: Create a new Service object to load balance traffic across Pods.autoscale: Create a new Autoscaler object to automatically horizontally scale a controller, such as a Deployment.The kubectl tool also supports creation commands driven by object type. These commands support more object types and are more explicit about their intent, but require users to know the type of objects they intend to create.create <objecttype> [<subtype>] <instancename>Some objects types have subtypes that you can specify in the create command. For example, the Service object has several subtypes including ClusterIP, LoadBalancer, and NodePort. Here's an example that creates a Service with subtype NodePort:kubectl create service nodeport <myservicename> In the preceding example, the create service nodeport command is called a subcommand of the create service command.You can use the -h flag to find the arguments and flags supported by a subcommand:kubectl create service nodeport -h How to update objectsThe kubectl command supports verb-driven commands for some common update operations. These commands are named to enable users unfamiliar with Kubernetes objects to perform updates without knowing the specific fields that must be set:scale: Horizontally scale a controller to add or remove Pods by updating the replica count of the controller.annotate: Add or remove an annotation from an object.label: Add or remove a label from an object.The kubectl command also supports update commands driven by an aspect of the object. Setting this aspect may set different fields for different object types:set <field>: Set an aspect of an object.Note:In Kubernetes version 1.5, not every verb-driven command has an associated aspect-driven command.The kubectl tool supports these additional ways to update a live object directly, however they require a better understanding of the Kubernetes object schema.edit: Directly edit the raw configuration of a live object by opening its configuration in an editor.patch: Directly modify specific fields of a live object by using a patch string. For more details on patch strings, see the patch section in API Conventions.How to delete objectsYou can use the delete command to delete an object from a cluster:delete <type>/<name>Note:You can use kubectl delete for both imperative commands and imperative object configuration. The difference is in the arguments passed to the command. To use kubectl delete as an imperative command, pass the object to be deleted as an argument. Here's an example that passes a Deployment object named nginx:kubectl delete deployment/nginx How to view an objectThere are several commands for printing information about an", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport <myservicename>\n```\n\nManaging Kubernetes Objects Using Imperative Commands | In the preceding example, the create service nodeport command is called a subcommand of the create service command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11075"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport -h\n```\n\nManaging Kubernetes Objects Using Imperative Commands | The kubectl command supports verb-driven commands for some common update operations. These commands are named to enable users unfamiliar with Kubernetes objects to perform updates without knowing the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11076"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment/nginx\n```\n\nManaging Kubernetes Objects Using Imperative Commands | There are several commands for printing information about an object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11077"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\n```\n\nManaging Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11078"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client > /tmp/srv.yaml\nkubectl create --edit -f /tmp/srv.yaml\n```\n\nManaging Kubernetes Objects Using Imperative Commands |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11079"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service -o yaml --dry-run=client\n```\n\nManaging Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11080"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl set selector --local -f - -o yaml\n```\n\nManaging Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11081"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\nManaging Kubernetes Objects Using Imperative Commands |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11082"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service\n```\n\nManaging Kubernetes Objects Using Imperative Commands |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11083"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\nManaging Kubernetes Objects Using Imperative Commands |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11084"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport <myservicename>\n```\n\nManaging Kubernetes Objects Using Imperative Commands | In the preceding example, the create service nodeport command is called a subcommand of the create service command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11085"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport -h\n```\n\nManaging Kubernetes Objects Using Imperative Commands | The kubectl command supports verb-driven commands for some common update operations. These commands are named to enable users unfamiliar with Kubernetes objects to perform updates without knowing the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11086"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment/nginx\n```\n\nManaging Kubernetes Objects Using Imperative Commands | There are several commands for printing information about an object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11087"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\n```\n\nManaging Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11088"}
{"instruction": "Write a bash example for managing kubernetes objects using imperative commands", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client > /tmp/srv.yaml\nkubectl create --edit -f /tmp/srv.yaml\n```\n\nManaging Kubernetes Objects Using Imperative Commands |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/imperative-command/", "id": "k8s_00708_code_11089"}
{"instruction": "What is the reference documentation for kubectl config view?", "response": "kubectl config viewSynopsisDisplay merged kubeconfig settings or a specified kubeconfig file.You can use --output jsonpath={...} to extract specific values using a jsonpath expression.kubectl config view [flags] Examples # Show merged kubeconfig settings kubectl config view # Show merged kubeconfig settings, raw certificate data, and exposed secrets kubectl config view --raw # Get the password for the e2e user kubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}' Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--flattenFlatten the resulting kubeconfig file into self-contained output (useful for creating portable kubeconfig files)-h, --helphelp for view--merge tristate[=true] Default: trueMerge the full hierarchy of kubeconfig files--minifyRemove all information not used by current-context from the output-o, --output string Default: \"yaml\"Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--rawDisplay raw byte data and sensitive data--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_view/", "id": "k8s_00709"}
{"instruction": "Write a bash example for kubectl config view", "response": "Here's a bash example:\n\n```bash\nkubectl config view [flags]\n```\n\nkubectl config view | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_view/", "id": "k8s_00709_code_11091"}
{"instruction": "Write a bash example for kubectl config view", "response": "Here's a bash example:\n\n```bash\nkubectl config view [flags]\n```\n\nkubectl config view | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_view/", "id": "k8s_00709_code_11092"}
{"instruction": "How do you developing cloud controller manager in Kubernetes?", "response": "Developing Cloud Controller ManagerFEATURE STATE: Kubernetes v1.11 [beta]The cloud-controller-manager is a Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.By decoupling the interoperability logic between Kubernetes and the underlying cloud infrastructure, the cloud-controller-manager component enables cloud providers to release features at a different pace compared to the main Kubernetes project.BackgroundSince cloud providers develop and release at a different pace compared to the Kubernetes project, abstracting the provider-specific code to the cloud-controller-manager binary allows cloud vendors to evolve independently from the core Kubernetes code.The Kubernetes project provides skeleton cloud-controller-manager code with Go interfaces to allow you (or your cloud provider) to plug in your own implementations. This means that a cloud provider can implement a cloud-controller-manager by importing packages from Kubernetes core; each cloudprovider will register their own code by calling cloudprovider.RegisterCloudProvider to update a global variable of available cloud providers.DevelopingOut of treeTo build an out-of-tree cloud-controller-manager for your cloud:Create a go package with an implementation that satisfies cloudprovider.Interface.Use main.go in cloud-controller-manager from Kubernetes core as a template for your main.go. As mentioned above, the only difference should be the cloud package that will be imported.Import your cloud package in main.go, ensure your package has an init block to run cloudprovider.RegisterCloudProvider.Many cloud providers publish their controller manager code as open source. If you are creating a new cloud-controller-manager from scratch, you could take an existing out-of-tree cloud controller manager as your starting point.In treeFor in-tree cloud providers, you can run the in-tree cloud controller manager as a DaemonSet in your cluster. See Cloud Controller Manager Administration for more details.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/developing-cloud-controller-manager/", "id": "k8s_00710"}
{"instruction": "What is the reference documentation for kubectl cluster-info dump?", "response": "kubectl cluster-info dumpSynopsisDump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you specify a directory, Kubernetes will build a set of files in that directory. By default, only dumps things in the current namespace and 'kube-system' namespace, but you can switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces.The command also dumps the logs of all of the pods in the cluster; these logs are dumped into different directories based on namespace and pod name.kubectl cluster-info dump [flags] Examples # Dump current cluster state to stdout kubectl cluster-info dump # Dump current cluster state to /path/to/cluster-state kubectl cluster-info dump --output-directory=/path/to/cluster-state # Dump all namespaces to stdout kubectl cluster-info dump --all-namespaces # Dump a set of namespaces to /path/to/cluster-state kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state Options-A, --all-namespacesIf true, dump all namespaces. If true, --namespaces is ignored.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.-h, --helphelp for dump--namespaces stringsA comma separated list of namespaces to dump.-o, --output string Default: \"json\"Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--output-directory stringWhere to output the files. If empty or '-' uses stdout, otherwise creates a directory hierarchy in that directory--pod-running-timeout duration Default: 20sThe length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cluster-info/kubectl_cluster-info_dump/", "id": "k8s_00711"}
{"instruction": "Write a bash example for kubectl cluster-info dump", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump [flags]\n```\n\nkubectl cluster-info dump | If true, dump all namespaces. If true, --namespaces is ignored.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cluster-info/kubectl_cluster-info_dump/", "id": "k8s_00711_code_11095"}
{"instruction": "Write a bash example for kubectl cluster-info dump", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump [flags]\n```\n\nkubectl cluster-info dump | If true, dump all namespaces. If true, --namespaces is ignored.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cluster-info/kubectl_cluster-info_dump/", "id": "k8s_00711_code_11096"}
{"instruction": "What is the reference documentation for kubectl run?", "response": "kubectl runSynopsisCreate and run a particular image in a pod.kubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...] Examples # Start a nginx pod kubectl run nginx --image=nginx # Start a hazelcast pod and let the container expose port 5701 kubectl run hazelcast --image=hazelcast/hazelcast --port=5701 # Start a hazelcast pod and set environment variables \"DNS_DOMAIN=cluster\" and \"POD_NAMESPACE=default\" in the container kubectl run hazelcast --image=hazelcast/hazelcast --env=\"DNS_DOMAIN=cluster\" --env=\"POD_NAMESPACE=default\" # Start a hazelcast pod and set labels \"app=hazelcast\" and \"env=prod\" in the container kubectl run hazelcast --image=hazelcast/hazelcast --labels=\"app=hazelcast,env=prod\" # Dry run; print the corresponding API objects without creating them kubectl run nginx --image=nginx --dry-run=client # Start a nginx pod, but overload the spec with a partial set of values parsed from JSON kubectl run nginx --image=nginx --overrides='{ \"apiVersion\": \"v1\", \"spec\": { ... } }' # Start a busybox pod and keep it in the foreground, don't restart it if it exits kubectl run -i -t busybox --image=busybox --restart=Never # Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN> # Start the nginx pod using a different command and custom arguments kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN> Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--annotations stringsAnnotations to apply to the pod.--attachIf true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--stdin' is set, in which case the default is true. With '--restart=Never' the exit code of the container process is returned.--cascade string[=\"background\"] Default: \"background\"Must be \"background\", \"orphan\", or \"foreground\". Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background.--commandIf true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--env stringsEnvironment variables to set in the container.--expose --portIf true, create a ClusterIP service associated with the pod. Requires --port.--field-manager string Default: \"kubectl-run\"Name of the manager used to track field ownership.-f, --filename stringsto use to replace the resource.--forceIf true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation.--grace-period int Default: -1Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion).-h, --helphelp for run--image stringThe image for the container to run.--image-pull-policy stringThe image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server.-k, --kustomize stringProcess a kustomization directory. This flag can't be used together with -f or -R.-l, --labels stringComma separated labels to apply to the pod. Will override previous values.--leave-stdin-openIf the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_run/", "id": "k8s_00712"}
{"instruction": "Write a bash example for kubectl run", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]\n```\n\nkubectl run | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_run/", "id": "k8s_00712_code_11098"}
{"instruction": "Write a bash example for kubectl run", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]\n```\n\nkubectl run | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_run/", "id": "k8s_00712_code_11099"}
{"instruction": "What is the reference documentation for glossary?", "response": "GlossaryThis glossary is intended to be a comprehensive, standardized list of Kubernetes terminology. It includes technical terms that are specific to Kubernetes, as well as more general terms that provide useful context.Filter terms according to their tags.The inner components of Kubernetes.Related to Kubernetes open-source development.A resource type that Kubernetes supports by default.Supported customizations of Kubernetes.Relevant for a first-time user of Kubernetes.How Kubernetes components talk to each other (and to programs outside the cluster).Starting and maintaining Kubernetes.Keeping Kubernetes applications safe and secure.How Kubernetes applications handle persistent data.Software that makes Kubernetes easier or better to use.Represents a common type of Kubernetes user.Applications running on Kubernetes.Architecture Community Core Object Extension Fundamental Networking Operation Security Storage Tool User Type Workload Select all Deselect allClick on the [+] indicators below to get a longer explanation for any particular term.Add-onsResources that extend the functionality of Kubernetes.[+]Installing addons explains more about using add-ons with your cluster, and lists some popular add-ons.Admission ControllerA piece of code that intercepts requests to the Kubernetes API server prior to persistence of the object.[+]Admission controllers are configurable for the Kubernetes API server and may be \"validating\", \"mutating\", or both. Any admission controller may reject the request. Mutating controllers may modify the objects they admit; validating controllers may not.Admission controllers in the Kubernetes documentationAffinityIn Kubernetes, affinity is a set of rules that give hints to the scheduler about where to place pods.[+]There are two kinds of affinity:node affinitypod-to-pod affinityThe rules are defined using the Kubernetes labels, and selectors specified in pods, and they can be either required or preferred, depending on how strictly you want the scheduler to enforce them.Aggregation LayerThe aggregation layer lets you install additional Kubernetes-style APIs in your cluster.[+]When you've configured the Kubernetes API Server to support additional APIs, you can add APIService objects to \"claim\" a URL path in the Kubernetes API.AnnotationA key-value pair that is used to attach arbitrary non-identifying metadata to objects.[+]The metadata in an annotation can be small or large, structured or unstructured, and can include characters not permitted by labels. Clients such as tools and libraries can retrieve this metadata.API GroupA set of related paths in Kubernetes API.[+]You can enable or disable each API group by changing the configuration of your API server. You can also disable or enable paths to specific resources. An API group makes it easier to extend the Kubernetes API. The API group is specified in a REST path and in the apiVersion field of a serialized object.Read API Group for more information.API resourceAlso known as: ResourceAn entity in the Kubernetes type system, corresponding to an endpoint on the Kubernetes API. A resource typically represents an object. Some resources represent an operation on other objects, such as a permission check.[+]Each resource represents an HTTP endpoint (URI) on the Kubernetes API server, defining the schema for the objects or operations on that resource.API serverAlso known as: kube-apiserverThe API server is a component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.[+]The main implementation of a Kubernetes API server is kube-apiserver. kube-apiserver is designed to scale horizontally—that is, it scales by deploying more instances. You can run several instances of kube-apiserver and balance traffic between those instances.API-initiated evictionAPI-initiated eviction is the process by which you use the Eviction API to create an Eviction object that triggers graceful pod termination.[+]Y", "category": "reference", "subcategory": "glossary", "source": "https://kubernetes.io/docs/reference/glossary/", "id": "k8s_00713"}
{"instruction": "Explain the Kubernetes concept: Ephemeral Volumes", "response": "Ephemeral VolumesThis document describes ephemeral volumes in Kubernetes. Familiarity with volumes is suggested, in particular PersistentVolumeClaim and PersistentVolume.Some applications need additional storage but don't care whether that data is stored persistently across restarts. For example, caching services are often limited by memory size and can move infrequently used data into storage that is slower than memory with little impact on overall performance.Other applications expect some read-only input data to be present in files, like configuration data or secret keys.Ephemeral volumes are designed for these use cases. Because volumes follow the Pod's lifetime and get created and deleted along with the Pod, Pods can be stopped and restarted without being limited to where some persistent volume is available.Ephemeral volumes are specified inline in the Pod spec, which simplifies application deployment and management.Types of ephemeral volumesKubernetes supports several different kinds of ephemeral volumes for different purposes:emptyDir: empty at Pod startup, with storage coming locally from the kubelet base directory (usually the root disk) or RAMconfigMap, downwardAPI, secret: inject different kinds of Kubernetes data into a Podimage: allows mounting container image files or artifacts, directly to a Pod.CSI ephemeral volumes: similar to the previous volume kinds, but provided by special CSI drivers which specifically support this featuregeneric ephemeral volumes, which can be provided by all storage drivers that also support persistent volumesemptyDir, configMap, downwardAPI, secret are provided as local ephemeral storage. They are managed by kubelet on each node.CSI ephemeral volumes must be provided by third-party CSI storage drivers.Generic ephemeral volumes can be provided by third-party CSI storage drivers, but also by any other storage driver that supports dynamic provisioning. Some CSI drivers are written specifically for CSI ephemeral volumes and do not support dynamic provisioning: those then cannot be used for generic ephemeral volumes.The advantage of using third-party drivers is that they can offer functionality that Kubernetes itself does not support, for example storage with different performance characteristics than the disk that is managed by kubelet, or injecting different data.CSI ephemeral volumesFEATURE STATE: Kubernetes v1.25 [stable]Note:CSI ephemeral volumes are only supported by a subset of CSI drivers. The Kubernetes CSI Drivers list shows which drivers support ephemeral volumes.Conceptually, CSI ephemeral volumes are similar to configMap, downwardAPI and secret volume types: the storage is managed locally on each node and is created together with other local resources after a Pod has been scheduled onto a node. Kubernetes has no concept of rescheduling Pods anymore at this stage. Volume creation has to be unlikely to fail, otherwise Pod startup gets stuck. In particular, storage capacity aware Pod scheduling is not supported for these volumes. They are currently also not covered by the storage resource usage limits of a Pod, because that is something that kubelet can only enforce for storage that it manages itself.Here's an example manifest for a Pod that uses CSI ephemeral storage:kind: Pod apiVersion: v1 metadata: name: my-csi-app spec: containers: - name: my-frontend image: busybox:1.28 volumeMounts: - mountPath: \"/data\" name: my-csi-inline-vol command: [ \"sleep\", \"1000000\" ] volumes: - name: my-csi-inline-vol csi: driver: inline.storage.kubernetes.io volumeAttributes: foo: bar The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructions.CSI driver restrictionsCSI ephemeral volumes allow users to provide volumeAttributes directly to the CSI driver as part of the Pod spec. A CSI driver allowing volumeAttributes that are typically restricted to administr", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/", "id": "k8s_00714"}
{"instruction": "Write a yaml example for ephemeral volumes", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\nEphemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/", "id": "k8s_00714_code_11102"}
{"instruction": "Write a yaml example for ephemeral volumes", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\nEphemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/", "id": "k8s_00714_code_11103"}
{"instruction": "Write a yaml example for ephemeral volumes", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\nEphemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/", "id": "k8s_00714_code_11104"}
{"instruction": "Write a yaml example for ephemeral volumes", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\nEphemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/", "id": "k8s_00714_code_11105"}
{"instruction": "Write a yaml example for ephemeral volumes", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-csi-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/data\"\n        name: my-csi-inline-vol\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: my-csi-inline-vol\n      csi:\n        driver: inline.storage.kubernetes.io\n        volumeAttributes:\n          foo: bar\n```\n\nEphemeral Volumes | The volumeAttributes determine what volume is prepared by the driver. These attributes are specific to each driver and not standardized. See the documentation of each CSI driver for further instructio", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/", "id": "k8s_00714_code_11106"}
{"instruction": "Write a yaml example for ephemeral volumes", "response": "Here's a yaml example:\n\n```yaml\nkind: Pod\napiVersion: v1\nmetadata:\n  name: my-app\nspec:\n  containers:\n    - name: my-frontend\n      image: busybox:1.28\n      volumeMounts:\n      - mountPath: \"/scratch\"\n        name: scratch-volume\n      command: [ \"sleep\", \"1000000\" ]\n  volumes:\n    - name: scratch-volume\n      ephemeral:\n        volumeClaimTemplate:\n          metadata:\n            labels:\n              type: my-frontend-volume\n          spec:\n            accessModes: [ \"ReadWriteOnce\" ]\n            storageClassName: \"scratch-storage-class\"\n            resources:\n              requests:\n                storage: 1Gi\n```\n\nEphemeral Volumes | The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. Labels, annotations and the whole set of fields for a PersistentVolumeClaim are supported.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/", "id": "k8s_00714_code_11107"}
{"instruction": "What is the reference documentation for kubeadm configuration (v1beta3)?", "response": "kubeadm Configuration (v1beta3)OverviewPackage v1beta3 defines the v1beta3 version of the kubeadm configuration file format. This version improves on the v1beta2 format by fixing some minor issues and adding a few new fields.A list of changes since v1beta2:The deprecated \"ClusterConfiguration.useHyperKubeImage\" field has been removed. Kubeadm no longer supports the hyperkube image.The \"ClusterConfiguration.dns.type\" field has been removed since CoreDNS is the only supported DNS server type by kubeadm.Include \"datapolicy\" tags on the fields that hold secrets. This would result in the field values to be omitted when API structures are printed with klog.Add \"InitConfiguration.skipPhases\", \"JoinConfiguration.skipPhases\" to allow skipping a list of phases during kubeadm init/join command execution.Add \"InitConfiguration.nodeRegistration.imagePullPolicy\" and \"JoinConfiguration.nodeRegistration.imagePullPolicy\" to allow specifying the images pull policy during kubeadm \"init\" and \"join\". The value must be one of \"Always\", \"Never\" or \"IfNotPresent\". \"IfNotPresent\" is the default, which has been the existing behavior prior to this addition.Add \"InitConfiguration.patches.directory\", \"JoinConfiguration.patches.directory\" to allow the user to configure a directory from which to take patches for components deployed by kubeadm.Move the BootstrapToken* API and related utilities out of the \"kubeadm\" API group to a new group \"bootstraptoken\". The kubeadm API version v1beta3 no longer contains the BootstrapToken* structures.Migration from old kubeadm config versionskubeadm v1.15.x and newer can be used to migrate from v1beta1 to v1beta2.kubeadm v1.22.x and newer no longer support v1beta1 and older APIs, but can be used to migrate v1beta2 to v1beta3.kubeadm v1.27.x and newer no longer support v1beta2 and older APIs,BasicsThe preferred way to configure kubeadm is to pass an YAML configuration file with the --config option. Some of the configuration options defined in the kubeadm config file are also available as command line flags, but only the most common/simple use case are supported with this approach.A kubeadm config file could contain multiple configuration types separated using three dashes (---).kubeadm supports the following configuration types:apiVersion: kubeadm.k8s.io/v1beta3 kind: InitConfiguration apiVersion: kubeadm.k8s.io/v1beta3 kind: ClusterConfiguration apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration apiVersion: kubeadm.k8s.io/v1beta3 kind: JoinConfiguration To print the defaults for \"init\" and \"join\" actions use the following commands:kubeadm config print init-defaults kubeadm config print join-defaults The list of configuration types that must be included in a configuration file depends by the action you are performing (init or join) and by the configuration options you are going to use (defaults or advanced customization).If some configuration types are not provided, or provided only partially, kubeadm will use default values; defaults provided by kubeadm includes also enforcing consistency of values across components when required (e.g. --cluster-cidr flag on controller manager and clusterCIDR on kube-proxy).Users are always allowed to override default values, with the only exception of a small subset of setting with relevance for security (e.g. enforce authorization-mode Node and RBAC on api server).If the user provides a configuration types that is not expected for the action you are performing, kubeadm will ignore those types and print a warning.Kubeadm init configuration typesWhen executing kubeadm init with the --config option, the following configuration types could be used: InitConfiguration, ClusterConfiguration, KubeProxyConfiguration, KubeletConfiguration, but only one between InitConfiguration and ClusterConfiguration is mandatory.apiVersion: kubeadm.k8s.io/v1beta3 kind: InitConfiguration bootstrapTokens: ... nodeRegistra", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta3)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: InitConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta3\nkind: ClusterConfiguration\n\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta3\nkind: JoinConfiguration\n```\n\nkubeadm Configuration (v1beta3) | To print the defaults for \"init\" and \"join\" actions use the following commands:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715_code_11109"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta3)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: InitConfiguration\nbootstrapTokens:\n  ...\nnodeRegistration:\n  ...\n```\n\nkubeadm Configuration (v1beta3) | The InitConfiguration type should be used to configure runtime settings, that in case of kubeadm init are the configuration of the bootstrap token and all the setting which are specific to the node wh", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715_code_11110"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta3)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: ClusterConfiguration\nnetworking:\n  ...\netcd:\n  ...\napiServer:\n  extraArgs:\n    ...\n  extraVolumes:\n    ...\n...\n```\n\nkubeadm Configuration (v1beta3) | The ClusterConfiguration type should be used to configure cluster-wide settings, including settings for:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715_code_11111"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta3)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n  ...\n```\n\nkubeadm Configuration (v1beta3) | The KubeProxyConfiguration type should be used to change the configuration passed to kube-proxy instances deployed in the cluster. If this object is not provided or provided only partially, kubeadm ap", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715_code_11112"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta3)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n  ...\n```\n\nkubeadm Configuration (v1beta3) | The KubeletConfiguration type should be used to change the configurations that will be passed to all kubelet instances deployed in the cluster. If this object is not provided or provided only partiall", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715_code_11113"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta3)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: InitConfiguration\nbootstrapTokens:\n  - token: \"9a08jv.c0izixklcxtmnze7\"\n    description: \"kubeadm bootstrap token\"\n    ttl: \"24h\"\n  - token: \"783bde.3f89s0fje9f38fhf\"\n    description: \"another bootstrap token\"\n    usages:\n      - authentication\n      - signing\n    groups:\n      - system:bootstrappers:kubeadm:default-node-token\nnodeRegistration:\n  name: \"ec2-10-100-0-1\"\n  criSocket: \"/var/run/dockershim.sock\"\n  taints:\n    - key: \"kubeadmNode\"\n      value: \"someValue\"\n      effect: \"NoSchedule\"\n  kubeletExtraArgs:\n    v: 4\n  ignorePreflightErrors:\n    - IsPrivilegedUser\n  imagePullPolicy: \"IfNotPresent\"\nlocalAPIEndpoint:\n  advertiseAddress: \"10.100.0.1\"\n  bindPort: 6443\ncertificateKey: \"e6a2eb8581237ab72a4f494f30285ec12a9694d750b9785706a83bfcbbbd2204\"\nskipPhases:\n  - addon/kube-proxy\n---\napiVersion: kubeadm.k8s.io/v1beta3\nkind: ClusterConfiguration\netcd:\n  # one of local or external\n  local:\n    imageRepository: \"registry.k8s.io\"\n    imageTag: \"3.2.24\"\n    dataDir: \"/var/lib/etcd\"\n    extraArgs:\n      listen-client-urls: \"http://10.100.0.1:2379\"\n    serverCertSANs:\n      -  \"ec2-10-100-0-1.compute-1.amazonaws.com\"\n    peerCertSANs:\n      - \"10.100.0.1\"\n  # external:\n    # endpoints:\n    # - \"10.100.0.1:2379\"\n    # - \"10.100.0.2:2379\"\n    # caFile: \"/etcd/kubernetes/pki/etcd/etcd-ca.crt\"\n    # certFile: \"/etcd/kubernetes/pki/etcd/etcd.crt\"\n    # keyFile: \"/etcd/kubernetes/pki/etcd/etcd.key\"\nnetworking:\n  serviceSubnet: \"10.96.0.0/16\"\n  podSubnet: \"10.244.0.0/24\"\n  dnsDomain: \"cluster.local\"\nkubernetesVersion: \"v1.21.0\"\ncontrolPlaneEndpoint: \"10.100.0.1:6443\"\napiServer:\n  extraArgs:\n    authorization-mode: \"Node,RBAC\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n  certSANs:\n    - \"10.100.1.1\"\n    - \"ec2-10-100-0-1.compute-1.amazonaws.com\"\n  timeoutForControlPlane: 4m0s\ncontrollerManager:\n  extraArgs:\n    \"node-cidr-mask-size\": \"20\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\nscheduler:\n  extraArgs:\n    bind-address: \"10.100.0.1\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\ncertificatesDir: \"/etc/kubernetes/pki\"\nimageRepository: \"registry.k8s.io\"\nclusterName: \"example-cluster\"\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n# kubelet specific options here\n---\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n# kube-proxy specific options here\n```\n\nkubeadm Configuration (v1beta3) | When executing kubeadm join with the --config option, the JoinConfiguration type should be provided.", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715_code_11114"}
{"instruction": "Write a yaml example for kubeadm configuration (v1beta3)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: JoinConfiguration\n  ...\n```\n\nkubeadm Configuration (v1beta3) | The JoinConfiguration type should be used to configure runtime settings, that in case of kubeadm join are the discovery method used for accessing the cluster info and all the setting which are specifi", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/", "id": "k8s_00715_code_11115"}
{"instruction": "Provide a tutorial on apply pod security standards at the cluster level", "response": "Apply Pod Security Standards at the Cluster LevelNoteThis tutorial applies only for new clusters.Pod Security is an admission controller that carries out checks against the Kubernetes Pod Security Standards when new pods are created. It is a feature GA'ed in v1.25. This tutorial shows you how to enforce the baseline Pod Security Standard at the cluster level which applies a standard configuration to all namespaces in a cluster.To apply Pod Security Standards to specific namespaces, refer to Apply Pod Security Standards at the namespace level.If you are running a version of Kubernetes other than v1.34, check the documentation for that version.Before you beginInstall the following on your workstation:kindkubectlThis tutorial demonstrates what you can configure for a Kubernetes cluster that you fully control. If you are learning how to configure Pod Security Admission for a managed cluster where you are not able to configure the control plane, read Apply Pod Security Standards at the namespace level.Choose the right Pod Security Standard to applyPod Security Admission lets you apply built-in Pod Security Standards with the following modes: enforce, audit, and warn.To gather information that helps you to choose the Pod Security Standards that are most appropriate for your configuration, do the following:Create a cluster with no Pod Security Standards applied:kind create cluster --name psa-wo-cluster-pss The output is similar to:Creating cluster \"psa-wo-cluster-pss\" ... ✓ Ensuring node image (kindest/node:v1.34.0) 🖼 ✓ Preparing nodes 📦 ✓ Writing configuration 📜 ✓ Starting control-plane 🕹️ ✓ Installing CNI 🔌 ✓ Installing StorageClass 💾 Set kubectl context to \"kind-psa-wo-cluster-pss\" You can now use your cluster with: kubectl cluster-info --context kind-psa-wo-cluster-pss Thanks for using kind! 😊 Set the kubectl context to the new cluster:kubectl cluster-info --context kind-psa-wo-cluster-pss The output is similar to this:Kubernetes control plane is running at https://127.0.0.1:61350 CoreDNS is running at https://127.0.0.1:61350/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. Get a list of namespaces in the cluster:kubectl get ns The output is similar to this:NAME STATUS AGE default Active 9m30s kube-node-lease Active 9m32s kube-public Active 9m32s kube-system Active 9m32s local-path-storage Active 9m26s Use --dry-run=server to understand what happens when different Pod Security Standards are applied:Privilegedkubectl label --dry-run=server --overwrite ns --all \\ pod-security.kubernetes.io/enforce=privileged The output is similar to:namespace/default labeled namespace/kube-node-lease labeled namespace/kube-public labeled namespace/kube-system labeled namespace/local-path-storage labeled Baselinekubectl label --dry-run=server --overwrite ns --all \\ pod-security.kubernetes.io/enforce=baseline The output is similar to:namespace/default labeled namespace/kube-node-lease labeled namespace/kube-public labeled Warning: existing pods in namespace \"kube-system\" violate the new PodSecurity enforce level \"baseline:latest\" Warning: etcd-psa-wo-cluster-pss-control-plane (and 3 other pods): host namespaces, hostPath volumes Warning: kindnet-vzj42: non-default capabilities, host namespaces, hostPath volumes Warning: kube-proxy-m6hwf: host namespaces, hostPath volumes, privileged namespace/kube-system labeled namespace/local-path-storage labeled Restrictedkubectl label --dry-run=server --overwrite ns --all \\ pod-security.kubernetes.io/enforce=restricted The output is similar to:namespace/default labeled namespace/kube-node-lease labeled namespace/kube-public labeled Warning: existing pods in namespace \"kube-system\" violate the new PodSecurity enforce level \"restricted:latest\" Warning: coredns-7bb9c7b568-hsptc (and 1 other pod): unrestricted capabilities, runAsNonRoot != true, seccompProfile Warning: etcd-psa-wo-cluster-pss-control-plane (and 3 other pods): ho", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-wo-cluster-pss\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11117"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=privileged\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11118"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=baseline\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11119"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=restricted\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11120"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\nmkdir -p /tmp/pss\ncat <<EOF > /tmp/pss/cluster-level-pss.yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1\n    kind: PodSecurityConfiguration\n    defaults:\n      enforce: \"baseline\"\n      enforce-version: \"latest\"\n      audit: \"restricted\"\n      audit-version: \"latest\"\n      warn: \"restricted\"\n      warn-version: \"latest\"\n    exemptions:\n      usernames: []\n      runtimeClasses: []\n      namespaces: [kube-system]\nEOF\n```\n\nApply Pod Security Standards at the Cluster Level | Configure the API server to consume this file during cluster creation:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11121"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > /tmp/pss/cluster-config.yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n- role: control-plane\n  kubeadmConfigPatches:\n  - |\n    kind: ClusterConfiguration\n    apiServer:\n        extraArgs:\n          admission-control-config-file: /etc/config/cluster-level-pss.yaml\n        extraVolumes:\n          - name: accf\n            hostPath: /etc/config\n            mountPath: /etc/config\n            readOnly: false\n            pathType: \"DirectoryOrCreate\"\n  extraMounts:\n  - hostPath: /tmp/pss\n    containerPath: /etc/config\n    # optional: if set, the mount is read-only.\n    # default false\n    readOnly: false\n    # optional: if set, the mount needs SELinux relabeling.\n    # default false\n    selinuxRelabel: false\n    # optional: set propagation mode (None, HostToContainer or Bidirectional)\n    # see https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation\n    # default None\n    propagation: None\nEOF\n```\n\nApply Pod Security Standards at the Cluster Level | Create a cluster that uses Pod Security Admission to apply these Pod Security Standards:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11122"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-with-cluster-pss\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11123"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\nApply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11124"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\nApply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11125"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\nmkdir -p /tmp/pss\ncat <<EOF > /tmp/pss/cluster-level-pss.yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1\n    kind: PodSecurityConfiguration\n    defaults:\n      enforce: \"baseline\"\n      enforce-version: \"latest\"\n      audit: \"restricted\"\n      audit-version: \"latest\"\n      warn: \"restricted\"\n      warn-version: \"latest\"\n    exemptions:\n      usernames: []\n      runtimeClasses: []\n      namespaces: [kube-system]\nEOF\n```\n\nApply Pod Security Standards at the Cluster Level | Configure the API server to consume this file during cluster creation:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11126"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > /tmp/pss/cluster-config.yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n- role: control-plane\n  kubeadmConfigPatches:\n  - |\n    kind: ClusterConfiguration\n    apiServer:\n        extraArgs:\n          admission-control-config-file: /etc/config/cluster-level-pss.yaml\n        extraVolumes:\n          - name: accf\n            hostPath: /etc/config\n            mountPath: /etc/config\n            readOnly: false\n            pathType: \"DirectoryOrCreate\"\n  extraMounts:\n  - hostPath: /tmp/pss\n    containerPath: /etc/config\n    # optional: if set, the mount is read-only.\n    # default false\n    readOnly: false\n    # optional: if set, the mount needs SELinux relabeling.\n    # default false\n    selinuxRelabel: false\n    # optional: set propagation mode (None, HostToContainer or Bidirectional)\n    # see https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation\n    # default None\n    propagation: None\nEOF\n```\n\nApply Pod Security Standards at the Cluster Level | Create a cluster that uses Pod Security Admission to apply these Pod Security Standards:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11127"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\nApply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11128"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-wo-cluster-pss\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11129"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=privileged\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11130"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=baseline\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11131"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=restricted\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11132"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-with-cluster-pss\n```\n\nApply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11133"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\nsecurity/example-baseline-pod.yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\nApply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11134"}
{"instruction": "Write a yaml example for apply pod security standards at the cluster level", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\nApply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11135"}
{"instruction": "Write a bash example for apply pod security standards at the cluster level", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\nApply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/security/cluster-level-pss/", "id": "k8s_00716_code_11136"}
{"instruction": "How do you migrating from dockershim in Kubernetes?", "response": "Migrating from dockershimThis section presents information you need to know when migrating from dockershim to other container runtimes.Since the announcement of dockershim deprecation in Kubernetes 1.20, there were questions on how this will affect various workloads and Kubernetes installations. Our Dockershim Removal FAQ is there to help you to understand the problem better.Dockershim was removed from Kubernetes with the release of v1.24. If you use Docker Engine via dockershim as your container runtime and wish to upgrade to v1.24, it is recommended that you either migrate to another runtime or find an alternative means to obtain Docker Engine support. Check out the container runtimes section to know your options.The version of Kubernetes with dockershim (1.23) is out of support and the v1.24 will run out of support soon. Make sure to report issues you encountered with the migration so the issues can be fixed in a timely manner and your cluster would be ready for dockershim removal. After v1.24 running out of support, you will need to contact your Kubernetes provider for support or upgrade multiple versions at a time if there are critical issues affecting your cluster.Your cluster might have more than one kind of node, although this is not a common configuration.These tasks will help you to migrate:Check whether Dockershim removal affects youMigrating telemetry and security agents from dockershimWhat's nextCheck out container runtimes to understand your options for an alternative.If you find a defect or other technical concern relating to migrating away from dockershim, you can report an issue to the Kubernetes project.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/", "id": "k8s_00717"}
{"instruction": "What is the reference documentation for controllerrevision?", "response": "ControllerRevisionControllerRevision implements an immutable snapshot of state data.apiVersion: apps/v1import \"k8s.io/api/apps/v1\"ControllerRevisionControllerRevision implements an immutable snapshot of state data. Clients are responsible for serializing and deserializing the objects that contain their internal state. Once a ControllerRevision has been successfully created, it can not be updated. The API Server will fail validation of all requests that attempt to mutate the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, it may be subject to name and representation changes in future releases, and clients should not depend on its stability. It is primarily for internal use by controllers.apiVersion: apps/v1kind: ControllerRevisionmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadatarevision (int64), requiredRevision indicates the revision of the state represented by Data.data (RawExtension)Data is the serialized representation of the state.*RawExtension is used to hold extensions in external versions.To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.// Internal package:type MyAPIObject struct { runtime.TypeMeta json:\",inline\" MyPlugin runtime.Object json:\"myPlugin\" }type PluginA struct { AOption string json:\"aOption\" }// External package:type MyAPIObject struct { runtime.TypeMeta json:\",inline\" MyPlugin runtime.RawExtension json:\"myPlugin\" }type PluginA struct { AOption string json:\"aOption\" }// On the wire, the JSON will look something like this:{ \"kind\":\"MyAPIObject\", \"apiVersion\":\"v1\", \"myPlugin\": { \"kind\":\"PluginA\", \"aOption\":\"foo\", }, }So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)*ControllerRevisionListControllerRevisionList is a resource containing a list of ControllerRevision objects.apiVersion: apps/v1kind: ControllerRevisionListmetadata (ListMeta)More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]ControllerRevision), requiredItems is the list of ControllerRevisionsOperationsget read the specified ControllerRevisionHTTP RequestGET /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}Parametersname (in path): string, requiredname of the ControllerRevisionnamespace (in path): string, requirednamespacepretty (in query): stringprettyResponse200 (ControllerRevision): OK401: Unauthorizedlist list or watch objects of kind ControllerRevisionHTTP RequestGET /apis/apps/v1/namespaces/{namespace}/controllerrevisionsParametersnamespace (in path): string, requirednamespaceallowWatchBookmarks (in query): booleanallowWatchBookmarkscontinue (in query): stringcontinuefieldSelector (in query): stringfieldSelectorlabelSelector (in query): stringlabelSelectorlimit (in query): integerlimitpretty (in query): stringprettyresourceVersion (in query): stringresourceVersionresourceVersionMatch (in query): stringresourceVersionMatchsendInitialEvents (in query): booleansendInitialEventstimeoutSeconds (in query): integertimeoutSecondswatch (in query): booleanwatchResponse200 (ControllerRevisionList): OK401: Unauthorizedlist list or watch objects of kind ControllerRevisionHTTP RequestGET /apis/apps/v1/controllerrevision", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/controller-revision-v1/", "id": "k8s_00718"}
{"instruction": "Explain reference documentation quickstart in Kubernetes", "response": "Reference Documentation QuickstartThis page shows how to use the update-imported-docs.py script to generate the Kubernetes reference documentation. The script automates the build setup and generates the reference documentation for a release.Before you beginRequirements:You need a machine that is running Linux or macOS.You need to have these tools installed:Python v3.7.x+GitGolang version 1.13+Pip used to install PyYAMLPyYAML v5.1.2makegcc compiler/linkerDocker (Required only for kubectl command reference)Your PATH environment variable must include the required build tools, such as the Go binary and python.You need to know how to create a pull request to a GitHub repository. This involves creating your own fork of the repository. For more information, see Work from a local clone.Getting the docs repositoryMake sure your website fork is up-to-date with the kubernetes/website remote on GitHub (main branch), and clone your website fork.mkdir github.com cd github.com git clone git@github.com:<your_github_username>/website.git Determine the base directory of your clone. For example, if you followed the preceding step to get the repository, your base directory is github.com/website. The remaining steps refer to your base directory as <web-base>.Note:If you want to change the content of the component tools and API reference, see the contributing upstream guide.Overview of update-imported-docsThe update-imported-docs.py script is located in the <web-base>/update-imported-docs/ directory.The script builds the following references:Component and tool reference pagesThe kubectl command referenceThe Kubernetes API referenceNote:The kubelet reference page is not generated by this script and is maintained manually. To update the kubelet reference, follow the standard contribution process described in Opening a pull request.The update-imported-docs.py script generates the Kubernetes reference documentation from the Kubernetes source code. The script creates a temporary directory under /tmp on your machine and clones the required repositories: kubernetes/kubernetes and kubernetes-sigs/reference-docs into this directory. The script sets your GOPATH to this temporary directory. Three additional environment variables are set:K8S_RELEASEK8S_ROOTK8S_WEBROOTThe script requires two arguments to run successfully:A YAML configuration file (reference.yml)A release version, for example:1.17The configuration file contains a generate-command field. The generate-command field defines a series of build instructions from kubernetes-sigs/reference-docs/Makefile. The K8S_RELEASE variable determines the version of the release.The update-imported-docs.py script performs the following steps:Clones the related repositories specified in a configuration file. For the purpose of generating reference docs, the repository that is cloned by default is kubernetes-sigs/reference-docs.Runs commands under the cloned repositories to prepare the docs generator and then generates the HTML and Markdown files.Copies the generated HTML and Markdown files to a local clone of the <web-base> repository under locations specified in the configuration file.Updates kubectl command links from kubectl.md to the refer to the sections in the kubectl command reference.When the generated files are in your local clone of the <web-base> repository, you can submit them in a pull request to <web-base>.Configuration file formatEach configuration file may contain multiple repos that will be imported together. When necessary, you can customize the configuration file by manually editing it. You may create new config files for importing other groups of documents. The following is an example of the YAML configuration file:repos: - name: community remote: https://github.com/kubernetes/community.git branch: master files: - src: contributors/devel/README.md dst: docs/imported/community/devel.md - src: contributors/guide/README.md dst: docs/imported/community/guide.md Single page Markdown documents, imported", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/quickstart/", "id": "k8s_00719"}
{"instruction": "Write a yaml example for reference documentation quickstart", "response": "Here's a yaml example:\n\n```yaml\nrepos:\n- name: community\n  remote: https://github.com/kubernetes/community.git\n  branch: master\n  files:\n  - src: contributors/devel/README.md\n    dst: docs/imported/community/devel.md\n  - src: contributors/guide/README.md\n    dst: docs/imported/community/guide.md\n```\n\nReference Documentation Quickstart | Single page Markdown documents, imported by the tool, must adhere to the Documentation Style Guide.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/quickstart/", "id": "k8s_00719_code_11140"}
{"instruction": "Write a yaml example for reference documentation quickstart", "response": "Here's a yaml example:\n\n```yaml\nrepos:\n- name: reference-docs\n  remote: https://github.com/kubernetes-sigs/reference-docs.git\n  files:\n  - src: gen-compdocs/build/kube-apiserver.md\n    dst: content/en/docs/reference/command-line-tools-reference/kube-apiserver.md\n  ...\n```\n\nReference Documentation Quickstart | Note that when there are many files to be copied from the same source directory to the same destination directory, you can use wildcards in the value given to src. You must provide the directory name", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/quickstart/", "id": "k8s_00719_code_11141"}
{"instruction": "Write a yaml example for reference documentation quickstart", "response": "Here's a yaml example:\n\n```yaml\nfiles:\n  - src: gen-compdocs/build/kubeadm*.md\n    dst: content/en/docs/reference/setup-tools/kubeadm/generated/\n```\n\nReference Documentation Quickstart | You can run the update-imported-docs.py tool as follows:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/generate-ref-docs/quickstart/", "id": "k8s_00719_code_11142"}
{"instruction": "How do you assign extended resources to a container in Kubernetes?", "response": "Assign Extended Resources to a ContainerFEATURE STATE: Kubernetes v1.34 [stable]This page shows how to assign extended resources to a Container.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Before you do this exercise, do the exercise in Advertise Extended Resources for a Node. That will configure one of your Nodes to advertise a dongle resource.Assign an extended resource to a PodTo request an extended resource, include the resources:requests field in your Container manifest. Extended resources are fully qualified with any domain outside of *.kubernetes.io/. Valid extended resource names have the form example.com/foo where example.com is replaced with your organization's domain and foo is a descriptive resource name.Here is the configuration file for a Pod that has one Container:pods/resource/extended-resource-pod.yaml apiVersion: v1 kind: Pod metadata: name: extended-resource-demo spec: containers: - name: extended-resource-demo-ctr image: nginx resources: requests: example.com/dongle: 3 limits: example.com/dongle: 3 In the configuration file, you can see that the Container requests 3 dongles.Create a Pod:kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml Verify that the Pod is running:kubectl get pod extended-resource-demo Describe the Pod:kubectl describe pod extended-resource-demo The output shows dongle requests:Limits: example.com/dongle: 3 Requests: example.com/dongle: 3 Attempt to create a second PodHere is the configuration file for a Pod that has one Container. The Container requests two dongles.pods/resource/extended-resource-pod-2.yaml apiVersion: v1 kind: Pod metadata: name: extended-resource-demo-2 spec: containers: - name: extended-resource-demo-2-ctr image: nginx resources: requests: example.com/dongle: 2 limits: example.com/dongle: 2 Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.Attempt to create a Pod:kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml Describe the Podkubectl describe pod extended-resource-demo-2 The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:Conditions: Type Status PodScheduled False ... Events: ... ... Warning FailedScheduling pod (extended-resource-demo-2) failed to fit in any node fit failure summary on nodes : Insufficient example.com/dongle (1) View the Pod status:kubectl get pod extended-resource-demo-2 The output shows that the Pod was created, but not scheduled to run on a Node. It has a status of Pending:NAME READY STATUS RESTARTS AGE extended-resource-demo-2 0/1 Pending 0 6m Clean upDelete the Pods that you created for this exercise:kubectl delete pod extended-resource-demo kubectl delete pod extended-resource-demo-2 What's nextFor application developersAssign Memory Resources to Containers and PodsAssign CPU Resources to Containers and PodsFor cluster administratorsAdvertise Extended Resources for a Node", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\nAssign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11144"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml\n```\n\nAssign Extended Resources to a Container | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11145"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo\n```\n\nAssign Extended Resources to a Container | Describe the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11146"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo\n```\n\nAssign Extended Resources to a Container | The output shows dongle requests:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11147"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\nAssign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11148"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml\n```\n\nAssign Extended Resources to a Container | Describe the Pod", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11149"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo-2\n```\n\nAssign Extended Resources to a Container | The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11150"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo-2\n```\n\nAssign Extended Resources to a Container | The output shows that the Pod was created, but not scheduled to run on a Node. It has a status of Pending:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11151"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod extended-resource-demo\nkubectl delete pod extended-resource-demo-2\n```\n\nAssign Extended Resources to a Container |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11152"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\nAssign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11153"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\nLimits:\n  example.com/dongle: 3\nRequests:\n  example.com/dongle: 3\n```\n\nAssign Extended Resources to a Container | Here is the configuration file for a Pod that has one Container. The Container requests two dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11154"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\nAssign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11155"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\nNAME                       READY     STATUS    RESTARTS   AGE\nextended-resource-demo-2   0/1       Pending   0          6m\n```\n\nAssign Extended Resources to a Container | Delete the Pods that you created for this exercise:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11156"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\npods/resource/extended-resource-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\nAssign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11157"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\nAssign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11158"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml\n```\n\nAssign Extended Resources to a Container | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11159"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo\n```\n\nAssign Extended Resources to a Container | Describe the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11160"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo\n```\n\nAssign Extended Resources to a Container | The output shows dongle requests:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11161"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\npods/resource/extended-resource-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\nAssign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11162"}
{"instruction": "Write a yaml example for assign extended resources to a container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\nAssign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11163"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml\n```\n\nAssign Extended Resources to a Container | Describe the Pod", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11164"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo-2\n```\n\nAssign Extended Resources to a Container | The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11165"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo-2\n```\n\nAssign Extended Resources to a Container | The output shows that the Pod was created, but not scheduled to run on a Node. It has a status of Pending:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11166"}
{"instruction": "Write a bash example for assign extended resources to a container", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod extended-resource-demo\nkubectl delete pod extended-resource-demo-2\n```\n\nAssign Extended Resources to a Container |", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/", "id": "k8s_00720_code_11167"}
{"instruction": "How do you extend the kubernetes api with customresourcedefinitions in Kubernetes?", "response": "Extend the Kubernetes API with CustomResourceDefinitionsThis page shows how to install a custom resource into the Kubernetes API by creating a CustomResourceDefinition.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version 1.16.To check the version, enter kubectl version.If you are using an older version of Kubernetes that is still supported, switch to the documentation for that version to see advice that is relevant for your cluster.Create a CustomResourceDefinitionWhen you create a new CustomResourceDefinition (CRD), the Kubernetes API Server creates a new RESTful resource path for each version you specify. The custom resource created from a CRD object can be either namespaced or cluster-scoped, as specified in the CRD's spec.scope field. As with existing built-in objects, deleting a namespace deletes all custom objects in that namespace. CustomResourceDefinitions themselves are non-namespaced and are available to all namespaces.For example, if you save the following CustomResourceDefinition to resourcedefinition.yaml:apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the form: <plural>.<group> name: crontabs.stable.example.com spec: # group name to use for REST API: /apis/<group>/<version> group: stable.example.com # list of versions supported by this CustomResourceDefinition versions: - name: v1 # Each version can be enabled/disabled by Served flag. served: true # One and only one version must be marked as the storage version. storage: true schema: openAPIV3Schema: type: object properties: spec: type: object properties: cronSpec: type: string image: type: string replicas: type: integer # either Namespaced or Cluster scope: Namespaced names: # plural name to be used in the URL: /apis/<group>/<version>/<plural> plural: crontabs # singular name to be used as an alias on the CLI and for display singular: crontab # kind is normally the CamelCased singular type. Your resource manifests use this. kind: CronTab # shortNames allow shorter string to match your resource on the CLI shortNames: - ct and create it:kubectl apply -f resourcedefinition.yaml Then a new namespaced RESTful API endpoint is created at:/apis/stable.example.com/v1/namespaces/*/crontabs/... This endpoint URL can then be used to create and manage custom objects. The kind of these objects will be CronTab from the spec of the CustomResourceDefinition object you created above.It might take a few seconds for the endpoint to be created. You can watch the Established condition of your CustomResourceDefinition to be true or watch the discovery information of the API server for your resource to show up.Create custom objectsAfter the CustomResourceDefinition object has been created, you can create custom objects. Custom objects can contain custom fields. These fields can contain arbitrary JSON. In the following example, the cronSpec and image custom fields are set in a custom object of kind CronTab. The kind CronTab comes from the spec of the CustomResourceDefinition object you created above.If you save the following YAML to my-crontab.yaml:apiVersion: \"stable.example.com/v1\" kind: CronTab metadata: name: my-new-cron-object spec: cronSpec: \"* * * * */5\" image: my-awesome-cron-image and create it:kubectl apply -f my-crontab.yaml You can then manage your CronTab objects using kubectl. For example:kubectl get crontab Should print a list like this:NAME AGE my-new-cron-object 6s Resource names are not case-sensitive when using kubectl, and you can use either the singular ", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.stable.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: stable.example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n    - name: v1\n      # Each version can be enabled/disabled by Served flag.\n      served: true\n      # One and only one version must be marked as the storage version.\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11169"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Then a new namespaced RESTful API endpoint is created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11170"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11171"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You can then manage your CronTab objects using kubectl. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11172"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get ct -o yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You should see that it contains the custom cronSpec and image fields from the YAML you used to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11173"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nitems:\n- apiVersion: stable.example.com/v1\n  kind: CronTab\n  metadata:\n    annotations:\n      kubectl.kubernetes.io/last-applied-configuration: |\n        {\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"CronTab\",\"metadata\":{\"annotations\":{},\"name\":\"my-new-cron-object\",\"namespace\":\"default\"},\"spec\":{\"cronSpec\":\"* * * * */5\",\"image\":\"my-awesome-cron-image\"}}        \n    creationTimestamp: \"2021-06-20T07:35:27Z\"\n    generation: 1\n    name: my-new-cron-object\n    namespace: default\n    resourceVersion: \"1326\"\n    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9\n  spec:\n    cronSpec: '* * * * */5'\n    image: my-awesome-cron-image\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11174"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f resourcedefinition.yaml\nkubectl get crontabs\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11175"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  someRandomField: 42\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11176"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl create --validate=false -f my-crontab.yaml -o yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11177"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: CronTab\nmetadata:\n  creationTimestamp: 2017-05-31T12:56:35Z\n  generation: 1\n  name: my-new-cron-object\n  namespace: default\n  resourceVersion: \"285\"\n  uid: 9423255b-4600-11e7-af6a-28d2447dc82b\nspec:\n  cronSpec: '* * * * */5'\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11178"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nfoo:\n  apiVersion: v1\n  kind: Pod\n  spec:\n    # ...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11179"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  finalizers:\n  - stable.example.com/finalizer\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11180"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11181"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | A request to create a custom object of kind CronTab is rejected if there are invalid values in its fields. In the following example, the custom object contains fields with invalid values:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11182"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * *\"\n  image: my-awesome-cron-image\n  replicas: 15\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11183"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | then you get an error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11184"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 5\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11185"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\ncrontab \"my-new-cron-object\" created\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11186"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  minReplicas: 0\n  replicas: 20\n  maxReplicas: 10\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | with the response:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11187"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                  default: \"5 0 * * *\"\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n                  default: 1\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11188"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11189"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"5 0 * * *\"\n  image: my-awesome-cron-image\n  replicas: 1\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11190"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              cronSpec:\n                type: string\n              image:\n                type: string\n              replicas:\n                type: integer\n    additionalPrinterColumns:\n    - name: Spec\n      type: string\n      description: The cron spec defining the interval a CronJob is run\n      jsonPath: .spec.cronSpec\n    - name: Replicas\n      type: integer\n      description: The number of jobs launched by the CronJob\n      jsonPath: .spec.replicas\n    - name: Age\n      type: date\n      jsonPath: .metadata.creationTimestamp\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11191"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create an instance using the my-crontab.yaml from the previous section.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11192"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get crontab my-new-cron-object\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Notice the NAME, SPEC, REPLICAS, and AGE columns in the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11193"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11194"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resource-definition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Define some Shirts by editing shirt-resources.yaml; for example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11195"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11196"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resources.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Get all the resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11197"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11198"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11199"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=green,spec.size=M\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11200"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n            status:\n              type: object\n              properties:\n                replicas:\n                  type: integer\n                labelSelector:\n                  type: string\n      # subresources describes the subresources for custom resources.\n      subresources:\n        # status enables the status subresource.\n        status: {}\n        # scale enables the scale subresource.\n        scale:\n          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.\n          specReplicasPath: .spec.replicas\n          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.\n          statusReplicasPath: .status.replicas\n          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.\n          labelSelectorPath: .status.labelSelector\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11201"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11202"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 3\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11203"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Then new namespaced RESTful API endpoints are created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11204"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 crontabs/my-new-cron-object\ncrontabs \"my-new-cron-object\" scaled\n\nkubectl get crontabs my-new-cron-object -o jsonpath='{.spec.replicas}'\n5\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You can use a PodDisruptionBudget to protect custom resources that have the scale subresource enabled.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11205"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n    # categories is a list of grouped resources the custom resource belongs to.\n    categories:\n    - all\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11206"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11207"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11208"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You can specify the category when using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11209"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.stable.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: stable.example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n    - name: v1\n      # Each version can be enabled/disabled by Served flag.\n      served: true\n      # One and only one version must be marked as the storage version.\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11210"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11211"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nitems:\n- apiVersion: stable.example.com/v1\n  kind: CronTab\n  metadata:\n    annotations:\n      kubectl.kubernetes.io/last-applied-configuration: |\n        {\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"CronTab\",\"metadata\":{\"annotations\":{},\"name\":\"my-new-cron-object\",\"namespace\":\"default\"},\"spec\":{\"cronSpec\":\"* * * * */5\",\"image\":\"my-awesome-cron-image\"}}        \n    creationTimestamp: \"2021-06-20T07:35:27Z\"\n    generation: 1\n    name: my-new-cron-object\n    namespace: default\n    resourceVersion: \"1326\"\n    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9\n  spec:\n    cronSpec: '* * * * */5'\n    image: my-awesome-cron-image\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11212"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nallOf:\n- properties:\n    foo:\n      # ...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11213"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nproperties:\n  foo:\n    # ...\nallOf:\n- properties:\n    foo:\n      # ...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Non-structural example 2:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11214"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nallOf:\n- items:\n    properties:\n      foo:\n        # ...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11215"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nitems:\n  properties:\n    foo:\n      # ...\nallOf:\n- items:\n    properties:\n      foo:\n        # ...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Non-structural example 3:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11216"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nproperties:\n  foo:\n    pattern: \"abc\"\n  metadata:\n    type: object\n    properties:\n      name:\n        type: string\n        pattern: \"^a\"\n      finalizers:\n        type: array\n        items:\n          type: string\n          pattern: \"my-finalizer\"\nanyOf:\n- properties:\n    bar:\n      type: integer\n      minimum: 42\n  required: [\"bar\"]\n  description: \"foo bar object\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | is not a structural schema because of the following violations:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11217"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: object\ndescription: \"foo bar object\"\nproperties:\n  foo:\n    type: string\n    pattern: \"abc\"\n  bar:\n    type: integer\n  metadata:\n    type: object\n    properties:\n      name:\n        type: string\n        pattern: \"^a\"\nanyOf:\n- properties:\n    bar:\n      minimum: 42\n  required: [\"bar\"]\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Violations of the structural schema rules are reported in the NonStructural condition in the CustomResourceDefinition.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11218"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  someRandomField: 42\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11219"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: CronTab\nmetadata:\n  creationTimestamp: 2017-05-31T12:56:35Z\n  generation: 1\n  name: my-new-cron-object\n  namespace: default\n  resourceVersion: \"285\"\n  uid: 9423255b-4600-11e7-af6a-28d2447dc82b\nspec:\n  cronSpec: '* * * * */5'\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11220"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  json:\n    x-kubernetes-preserve-unknown-fields: true\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | The field json can store any JSON value, without anything being pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11221"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  json:\n    x-kubernetes-preserve-unknown-fields: true\n    type: object\n    description: this is arbitrary JSON\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | With this, only object type values are allowed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11222"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  json:\n    x-kubernetes-preserve-unknown-fields: true\n    type: object\n    properties:\n      spec:\n        type: object\n        properties:\n          foo:\n            type: string\n          bar:\n            type: string\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | With this, the value:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11223"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\njson:\n  spec:\n    foo: abc\n    bar: def\n    something: x\n  status:\n    something: x\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | is pruned to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11224"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\njson:\n  spec:\n    foo: abc\n    bar: def\n  status:\n    something: x\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | This means that the something field in the specified spec object is pruned, but everything outside is not.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11225"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  foo:\n    x-kubernetes-int-or-string: true\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Also those nodes are partially excluded from rule 3 in the sense that the following two patterns are allowed (exactly those, without variations in order to additional fields):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11226"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-int-or-string: true\nanyOf:\n  - type: integer\n  - type: string\n...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11227"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-int-or-string: true\nallOf:\n  - anyOf:\n      - type: integer\n      - type: string\n  - # ... zero or more\n...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | With one of those specification, both an integer and a string validate.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11228"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  foo:\n    x-kubernetes-embedded-resource: true\n    x-kubernetes-preserve-unknown-fields: true\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Here, the field foo holds a complete object, e.g.:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11229"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nfoo:\n  apiVersion: v1\n  kind: Pod\n  spec:\n    # ...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11230"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  finalizers:\n  - stable.example.com/finalizer\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11231"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11232"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * *\"\n  image: my-awesome-cron-image\n  replicas: 15\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11233"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 5\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11234"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        x-kubernetes-validations:\n          - rule: \"self.minReplicas <= self.replicas\"\n            message: \"replicas should be greater than or equal to minReplicas.\"\n          - rule: \"self.replicas <= self.maxReplicas\"\n            message: \"replicas should be smaller than or equal to maxReplicas.\"\n        properties:\n          # ...\n          minReplicas:\n            type: integer\n          replicas:\n            type: integer\n          maxReplicas:\n            type: integer\n        required:\n          - minReplicas\n          - replicas\n          - maxReplicas\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | will reject a request to create this custom resource:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11235"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  minReplicas: 0\n  replicas: 20\n  maxReplicas: 10\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | with the response:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11236"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    x-kubernetes-validations:\n      - rule: \"self.status.availableReplicas >= self.spec.minReplicas\"\n    properties:\n        spec:\n          type: object\n          properties:\n            minReplicas:\n              type: integer\n            # ...\n        status:\n          type: object\n          properties:\n            availableReplicas:\n              type: integer\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable via self.field and field presence can be checked via has(self.field). Null valued field", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11237"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        x-kubernetes-validations:\n          - rule: \"has(self.foo)\"\n        properties:\n          # ...\n          foo:\n            type: integer\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map are accessible via self[mapKey], map containment can be checked via mapKey in self and all entries of the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11238"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        x-kubernetes-validations:\n          - rule: \"self['xyz'].foo > 0\"\n        additionalProperties:\n          # ...\n          type: object\n          properties:\n            foo:\n              type: integer\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an array, the elements of the array are accessible via self[i] and also by macros and functions.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11239"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      # ...\n      foo:\n        type: array\n        x-kubernetes-validations:\n          - rule: \"size(self) == 1\"\n        items:\n          type: string\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to a scalar, self is bound to the scalar value.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11240"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        properties:\n          # ...\n          foo:\n            type: integer\n            x-kubernetes-validations:\n            - rule: \"self > 0\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Examples:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11241"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-validations:\n- rule: \"self.x <= self.maxLimit\"\n  messageExpression: '\"x exceeded max limit of \" + string(self.maxLimit)'\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Keep in mind that CEL string concatenation (+ operator) does not auto-cast to string. If you have a non-string scalar, use the string(<value>) function to cast the scalar to a string like shown in the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11242"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-validations:\n- rule: \"self.x <= self.maxLimit\"\n  reason: \"FieldValueInvalid\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | The HTTP status code returned to the caller will match the reason of the first failed validation rule. The currently supported reasons are: \"FieldValueInvalid\", \"FieldValueForbidden\", \"FieldValueRequi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11243"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-validations:\n- rule: \"self.foo.test.x <= self.maxLimit\"\n  fieldPath: \".foo.test.x\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | In the example above, the validation checks the value of field x should be less than the value of maxLimit. If no fieldPath specified, when validation fails, the fieldPath would be default to wherever", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11244"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: string\nenum: [\"low\", \"medium\", \"high\"]\nx-kubernetes-validations:\n- rule: \"!(self == 'high' && oldSelf == 'low') && !(self == 'low' && oldSelf == 'high')\"\n  message: cannot transition directly between 'low' and 'high'\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Unlike other rules, transition rules apply only to operations meeting the following criteria:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11245"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      items:\n        type: string\n      x-kubernetes-validations:\n        - rule: \"self.all(x, x.contains('a string'))\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | then the API server rejects this rule on validation budget grounds with error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11246"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      maxItems: 25\n      items:\n        type: string\n        maxLength: 10\n      x-kubernetes-validations:\n        - rule: \"self.all(x, x.contains('a string'))\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | The cost estimation system takes into account how many times the rule will be executed in addition to the estimated cost of the rule itself. For instance, the following rule will have the same estimat", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11247"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      maxItems: 25\n      items:\n        type: string\n        x-kubernetes-validations:\n          - rule: \"self.contains('a string'))\"\n        maxLength: 10\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If a list inside of a list has a validation rule that uses self.all, that is significantly more expensive than a non-nested list with the same rule. A rule that would have been allowed on a non-nested", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11248"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      items:\n        type: integer\n    x-kubernetes-validations:\n      - rule: \"self.all(x, x == 5)\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | But the same rule on the following schema (with a nested array added) produces a validation error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11249"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      items:\n        type: array\n        items:\n          type: integer\n        x-kubernetes-validations:\n          - rule: \"self.all(x, x == 5)\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | This is because each item of foo is itself an array, and each subarray in turn calls self.all. Avoid nested lists and maps if possible where validation rules are used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11250"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                  default: \"5 0 * * *\"\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n                  default: 1\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11251"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11252"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"5 0 * * *\"\n  image: my-awesome-cron-image\n  replicas: 1\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11253"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  spec:\n    type: object\n    properties:\n      foo:\n        type: string\n        nullable: false\n        default: \"default\"\n      bar:\n        type: string\n        nullable: true\n      baz:\n        type: string\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | creating an object with null values for foo and bar and baz", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11254"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  foo: null\n  bar: null\n  baz: null\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11255"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  foo: \"default\"\n  bar: null\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | with foo pruned and defaulted because the field is non-nullable, bar maintaining the null value due to nullable: true, and baz pruned because the field is non-nullable and has no default.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11256"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              cronSpec:\n                type: string\n              image:\n                type: string\n              replicas:\n                type: integer\n    additionalPrinterColumns:\n    - name: Spec\n      type: string\n      description: The cron spec defining the interval a CronJob is run\n      jsonPath: .spec.cronSpec\n    - name: Replicas\n      type: integer\n      description: The number of jobs launched by the CronJob\n      jsonPath: .spec.replicas\n    - name: Age\n      type: date\n      jsonPath: .metadata.creationTimestamp\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11257"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11258"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11259"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n            status:\n              type: object\n              properties:\n                replicas:\n                  type: integer\n                labelSelector:\n                  type: string\n      # subresources describes the subresources for custom resources.\n      subresources:\n        # status enables the status subresource.\n        status: {}\n        # scale enables the scale subresource.\n        scale:\n          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.\n          specReplicasPath: .spec.replicas\n          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.\n          statusReplicasPath: .status.replicas\n          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.\n          labelSelectorPath: .status.labelSelector\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11260"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 3\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11261"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get <category-name>\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | The following example adds all in the list of categories in the CustomResourceDefinition and illustrates how to output the custom resource using kubectl get all.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11262"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n    # categories is a list of grouped resources the custom resource belongs to.\n    categories:\n    - all\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11263"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11264"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.stable.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: stable.example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n    - name: v1\n      # Each version can be enabled/disabled by Served flag.\n      served: true\n      # One and only one version must be marked as the storage version.\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11265"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Then a new namespaced RESTful API endpoint is created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11266"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11267"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You can then manage your CronTab objects using kubectl. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11268"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get ct -o yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You should see that it contains the custom cronSpec and image fields from the YAML you used to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11269"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nitems:\n- apiVersion: stable.example.com/v1\n  kind: CronTab\n  metadata:\n    annotations:\n      kubectl.kubernetes.io/last-applied-configuration: |\n        {\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"CronTab\",\"metadata\":{\"annotations\":{},\"name\":\"my-new-cron-object\",\"namespace\":\"default\"},\"spec\":{\"cronSpec\":\"* * * * */5\",\"image\":\"my-awesome-cron-image\"}}        \n    creationTimestamp: \"2021-06-20T07:35:27Z\"\n    generation: 1\n    name: my-new-cron-object\n    namespace: default\n    resourceVersion: \"1326\"\n    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9\n  spec:\n    cronSpec: '* * * * */5'\n    image: my-awesome-cron-image\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11270"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f resourcedefinition.yaml\nkubectl get crontabs\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11271"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  someRandomField: 42\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11272"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl create --validate=false -f my-crontab.yaml -o yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11273"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: CronTab\nmetadata:\n  creationTimestamp: 2017-05-31T12:56:35Z\n  generation: 1\n  name: my-new-cron-object\n  namespace: default\n  resourceVersion: \"285\"\n  uid: 9423255b-4600-11e7-af6a-28d2447dc82b\nspec:\n  cronSpec: '* * * * */5'\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11274"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\nfoo:\n  apiVersion: v1\n  kind: Pod\n  spec:\n    # ...\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11275"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  finalizers:\n  - stable.example.com/finalizer\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11276"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11277"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | A request to create a custom object of kind CronTab is rejected if there are invalid values in its fields. In the following example, the custom object contains fields with invalid values:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11278"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * *\"\n  image: my-awesome-cron-image\n  replicas: 15\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11279"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | then you get an error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11280"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 5\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11281"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\ncrontab \"my-new-cron-object\" created\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11282"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  minReplicas: 0\n  replicas: 20\n  maxReplicas: 10\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | with the response:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11283"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                  default: \"5 0 * * *\"\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n                  default: 1\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11284"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11285"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"5 0 * * *\"\n  image: my-awesome-cron-image\n  replicas: 1\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11286"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              cronSpec:\n                type: string\n              image:\n                type: string\n              replicas:\n                type: integer\n    additionalPrinterColumns:\n    - name: Spec\n      type: string\n      description: The cron spec defining the interval a CronJob is run\n      jsonPath: .spec.cronSpec\n    - name: Replicas\n      type: integer\n      description: The number of jobs launched by the CronJob\n      jsonPath: .spec.replicas\n    - name: Age\n      type: date\n      jsonPath: .metadata.creationTimestamp\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11287"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create an instance using the my-crontab.yaml from the previous section.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11288"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get crontab my-new-cron-object\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Notice the NAME, SPEC, REPLICAS, and AGE columns in the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11289"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ncustomresourcedefinition/shirt-resource-definition.yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11290"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11291"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resource-definition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Define some Shirts by editing shirt-resources.yaml; for example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11292"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\ncustomresourcedefinition/shirt-resources.yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11293"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11294"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resources.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Get all the resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11295"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11296"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11297"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=green,spec.size=M\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11298"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n            status:\n              type: object\n              properties:\n                replicas:\n                  type: integer\n                labelSelector:\n                  type: string\n      # subresources describes the subresources for custom resources.\n      subresources:\n        # status enables the status subresource.\n        status: {}\n        # scale enables the scale subresource.\n        scale:\n          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.\n          specReplicasPath: .spec.replicas\n          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.\n          statusReplicasPath: .status.replicas\n          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.\n          labelSelectorPath: .status.labelSelector\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11299"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11300"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 3\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11301"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | Then new namespaced RESTful API endpoints are created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11302"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 crontabs/my-new-cron-object\ncrontabs \"my-new-cron-object\" scaled\n\nkubectl get crontabs my-new-cron-object -o jsonpath='{.spec.replicas}'\n5\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You can use a PodDisruptionBudget to protect custom resources that have the scale subresource enabled.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11303"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n    # categories is a list of grouped resources the custom resource belongs to.\n    categories:\n    - all\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11304"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11305"}
{"instruction": "Write a yaml example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11306"}
{"instruction": "Write a bash example for extend the kubernetes api with customresourcedefinitions", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\nExtend the Kubernetes API with CustomResourceDefinitions | You can specify the category when using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/", "id": "k8s_00721_code_11307"}
{"instruction": "What is the reference documentation for resourceslice?", "response": "ResourceSliceResourceSlice represents one or more resources in a pool of similar resources, managed by a common driver.apiVersion: resource.k8s.io/v1import \"k8s.io/api/resource/v1\"ResourceSliceResourceSlice represents one or more resources in a pool of similar resources, managed by a common driver. A pool may span more than one ResourceSlice, and exactly how many ResourceSlices comprise a pool is determined by the driver.At the moment, the only supported resources are devices with attributes and capacities. Each device in a given pool, regardless of how many ResourceSlices, must have a unique name. The ResourceSlice in which a device gets published may change over time. The unique identifier for a device is the tuple <driver name>, <pool name>, <device name>.Whenever a driver needs to update a pool, it increments the pool.Spec.Pool.Generation number and updates all ResourceSlices with that new number and new resource definitions. A consumer must only use ResourceSlices with the highest generation number and ignore all others.When allocating all resources in a pool matching certain criteria or when looking for the best solution among several different alternatives, a consumer should check the number of ResourceSlices in a pool (included in each ResourceSlice) to determine whether its view of a pool is complete and if not, should wait until the driver has completed updating the pool.For resources that are not local to a node, the node name is not set. Instead, the driver may use a node selector to specify where the devices are available.This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.apiVersion: resource.k8s.io/v1kind: ResourceSlicemetadata (ObjectMeta)Standard object metadataspec (ResourceSliceSpec), requiredContains the information published by the driver.Changing the spec automatically increments the metadata.generation number.ResourceSliceSpecResourceSliceSpec contains the information published by the driver in one ResourceSlice.driver (string), requiredDriver identifies the DRA driver providing the capacity information. A field selector can be used to list only ResourceSlice objects with a certain driver name.Must be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver. This field is immutable.pool (ResourcePool), requiredPool describes the pool that this ResourceSlice belongs to.ResourcePool describes the pool that ResourceSlices belong to.pool.generation (int64), requiredGeneration tracks the change in a pool over time. Whenever a driver changes something about one or more of the resources in a pool, it must change the generation in all ResourceSlices which are part of that pool. Consumers of ResourceSlices should only consider resources from the pool with the highest generation number. The generation may be reset by drivers, which should be fine for consumers, assuming that all ResourceSlices in a pool are updated to match or deleted.Combined with ResourceSliceCount, this mechanism enables consumers to detect pools which are comprised of multiple ResourceSlices and are in an incomplete state.pool.name (string), requiredName is used to identify the pool. For node-local devices, this is often the node name, but this is not required.It must not be longer than 253 characters and must consist of one or more DNS sub-domains separated by slashes. This field is immutable.pool.resourceSliceCount (int64), requiredResourceSliceCount is the total number of ResourceSlices in the pool at this generation number. Must be greater than zero.Consumers can use this to check whether they have seen all ResourceSlices belonging to the same pool.allNodes (boolean)AllNodes indicates that all nodes have access to the resources in the pool.Exactly one of NodeName, NodeSelector, AllNodes, and PerDeviceNodeSelection must be set.devices ([]Device)Atomic: will be replaced during a mergeDevices lists some or all of the devices in this pool.Must not have more than 128 entries.Device re", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/resource-slice-v1/", "id": "k8s_00722"}
{"instruction": "Write a yaml example for resourceslice", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\nResourceSlice | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/resource-slice-v1/", "id": "k8s_00722_code_11309"}
{"instruction": "Explain the Kubernetes concept: Compute, Storage, and Networking Extensions", "response": "Compute, Storage, and Networking ExtensionsThis section covers extensions to your cluster that do not come as part as Kubernetes itself. You can use these extensions to enhance the nodes in your cluster, or to provide the network fabric that links Pods together.CSI and FlexVolume storage pluginsContainer Storage Interface (CSI) plugins provide a way to extend Kubernetes with supports for new kinds of volumes. The volumes can be backed by durable external storage, or provide ephemeral storage, or they might offer a read-only interface to information using a filesystem paradigm.Kubernetes also includes support for FlexVolume plugins, which are deprecated since Kubernetes v1.23 (in favour of CSI).FlexVolume plugins allow users to mount volume types that aren't natively supported by Kubernetes. When you run a Pod that relies on FlexVolume storage, the kubelet calls a binary plugin to mount the volume. The archived FlexVolume design proposal has more detail on this approach.The Kubernetes Volume Plugin FAQ for Storage Vendors includes general information on storage plugins.Device pluginsDevice plugins allow a node to discover new Node facilities (in addition to the built-in node resources such as cpu and memory), and provide these custom node-local facilities to Pods that request them.Network pluginsNetwork plugins allow Kubernetes to work with different networking topologies and technologies. Your Kubernetes cluster needs a network plugin in order to have a working Pod network and to support other aspects of the Kubernetes network model.Kubernetes 1.34 is compatible with CNI network plugins.", "category": "concepts", "subcategory": "services-networking", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/", "id": "k8s_00723"}
{"instruction": "How do you run a replicated stateful application in Kubernetes?", "response": "Run a Replicated Stateful ApplicationThis page shows how to run a replicated stateful application using a StatefulSet. This application is a replicated MySQL database. The example topology has a single primary server and multiple replicas, using asynchronous row-based replication.Note:This is not a production configuration. MySQL settings remain on insecure defaults to keep the focus on general patterns for running stateful applications in Kubernetes.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou need to either have a dynamic PersistentVolume provisioner with a default StorageClass, or statically provision PersistentVolumes yourself to satisfy the PersistentVolumeClaims used here.This tutorial assumes you are familiar with PersistentVolumes and StatefulSets, as well as other core concepts like Pods, Services, and ConfigMaps.Some familiarity with MySQL helps, but this tutorial aims to present general patterns that should be useful for other systems.You are using the default namespace or another namespace that does not contain any conflicting objects.You need to have a AMD64-compatible CPU.ObjectivesDeploy a replicated MySQL topology with a StatefulSet.Send MySQL client traffic.Observe resistance to downtime.Scale the StatefulSet up and down.Deploy MySQLThe example MySQL deployment consists of a ConfigMap, two Services, and a StatefulSet.Create a ConfigMapCreate the ConfigMap from the following YAML configuration file:application/mysql/mysql-configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: mysql labels: app: mysql app.kubernetes.io/name: mysql data: primary.cnf: | # Apply this config only on the primary. [mysqld] log-bin replica.cnf: | # Apply this config only on replicas. [mysqld] super-read-only kubectl apply -f https://k8s.io/examples/application/mysql/mysql-configmap.yaml This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve replication logs to replicas and you want replicas to reject any writes that don't come via replication.There's nothing special about the ConfigMap itself that causes different portions to apply to different Pods. Each Pod decides which portion to look at as it's initializing, based on information provided by the StatefulSet controller.Create ServicesCreate the Services from the following YAML configuration file:application/mysql/mysql-services.yaml # Headless service for stable DNS entries of StatefulSet members. apiVersion: v1 kind: Service metadata: name: mysql labels: app: mysql app.kubernetes.io/name: mysql spec: ports: - name: mysql port: 3306 clusterIP: None selector: app: mysql --- # Client service for connecting to any MySQL instance for reads. # For writes, you must instead connect to the primary: mysql-0.mysql. apiVersion: v1 kind: Service metadata: name: mysql-read labels: app: mysql app.kubernetes.io/name: mysql readonly: \"true\" spec: ports: - name: mysql port: 3306 selector: app: mysql kubectl apply -f https://k8s.io/examples/application/mysql/mysql-services.yaml The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessible by resolving <pod-name>.mysql from within any other Pod in the same Kubernetes cluster and namespace.The client Service, called mysql-read, is a normal Service with its own cluster IP that distributes connections across all MySQL Pods that report being Ready. The set of potential endpoints", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\nRun a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11312"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-configmap.yaml\n```\n\nRun a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11313"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\nRun a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11314"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-services.yaml\n```\n\nRun a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11315"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRun a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11316"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-statefulset.yaml\n```\n\nRun a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11317"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\nRun a Replicated Stateful Application | After a while, you should see all 3 Pods become Running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11318"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i --rm --restart=Never --\\\n  mysql -h mysql-0.mysql <<EOF\nCREATE DATABASE test;\nCREATE TABLE test.messages (message VARCHAR(250));\nINSERT INTO test.messages VALUES ('hello');\nEOF\n```\n\nRun a Replicated Stateful Application | Use the hostname mysql-read to send test queries to any server that reports being Ready:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11319"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-read -e \"SELECT * FROM test.messages\"\n```\n\nRun a Replicated Stateful Application | You should get output like this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11320"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client-loop --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  bash -ic \"while sleep 1; do mysql -h mysql-read -e 'SELECT @@server_id,NOW()'; done\"\n```\n\nRun a Replicated Stateful Application | You should see the reported @@server_id change randomly, because a different endpoint might be selected upon each connection attempt:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11321"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql /usr/bin/mysql.off\n```\n\nRun a Replicated Stateful Application | This reaches into the actual container's filesystem for Pod mysql-2 and renames the mysql command so the readiness probe can't find it. After a few seconds, the Pod should report one of its containers", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11322"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2\n```\n\nRun a Replicated Stateful Application | Look for 1/2 in the READY column:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11323"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql.off /usr/bin/mysql\n```\n\nRun a Replicated Stateful Application | The StatefulSet also recreates Pods if they're deleted, similar to what a ReplicaSet does for stateless Pods.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11324"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-2\n```\n\nRun a Replicated Stateful Application | The StatefulSet controller notices that no mysql-2 Pod exists anymore, and creates a new one with the same name and linked to the same PersistentVolumeClaim. You should see server ID 102 disappear fro", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11325"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide\n```\n\nRun a Replicated Stateful Application | The Node name should show up in the last column:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11326"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide --watch\n```\n\nRun a Replicated Stateful Application | It should look something like this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11327"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-name>\n```\n\nRun a Replicated Stateful Application | When you use MySQL replication, you can scale your read query capacity by adding replicas. For a StatefulSet, you can achieve this with a single command:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11328"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql  --replicas=5\n```\n\nRun a Replicated Stateful Application | Watch the new Pods come up by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11329"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\nRun a Replicated Stateful Application | Once they're up, you should see server IDs 103 and 104 start appearing in the SELECT @@server_id loop output.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11330"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-3.mysql -e \"SELECT * FROM test.messages\"\n```\n\nRun a Replicated Stateful Application | Scaling back down is also seamless:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11331"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql --replicas=3\n```\n\nRun a Replicated Stateful Application | Although scaling up creates new PersistentVolumeClaims automatically, scaling down does not automatically delete these PVCs.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11332"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=mysql\n```\n\nRun a Replicated Stateful Application | Which shows that all 5 PVCs still exist, despite having scaled the StatefulSet down to 3:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11333"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc data-mysql-3\nkubectl delete pvc data-mysql-4\n```\n\nRun a Replicated Stateful Application | Cancel the SELECT @@server_id loop by pressing Ctrl+C in its terminal, or running the following from another terminal:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11334"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-client-loop --now\n```\n\nRun a Replicated Stateful Application | Delete the StatefulSet. This also begins terminating the Pods.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11335"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset mysql\n```\n\nRun a Replicated Stateful Application | Verify that the Pods disappear. They might take some time to finish terminating.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11336"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\nRun a Replicated Stateful Application | You'll know the Pods have terminated when the above returns:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11337"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap,service,pvc -l app=mysql\n```\n\nRun a Replicated Stateful Application | If you manually provisioned PersistentVolumes, you also need to manually delete them, as well as release the underlying resources. If you used a dynamic provisioner, it automatically deletes the Persi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11338"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\nRun a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11339"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\nRun a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11340"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRun a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11341"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-configmap.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\nRun a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11342"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\nRun a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11343"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-configmap.yaml\n```\n\nRun a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11344"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-services.yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\nRun a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11345"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\nRun a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11346"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-services.yaml\n```\n\nRun a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11347"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-statefulset.yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRun a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11348"}
{"instruction": "Write a yaml example for run a replicated stateful application", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\nRun a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11349"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-statefulset.yaml\n```\n\nRun a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11350"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\nRun a Replicated Stateful Application | After a while, you should see all 3 Pods become Running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11351"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i --rm --restart=Never --\\\n  mysql -h mysql-0.mysql <<EOF\nCREATE DATABASE test;\nCREATE TABLE test.messages (message VARCHAR(250));\nINSERT INTO test.messages VALUES ('hello');\nEOF\n```\n\nRun a Replicated Stateful Application | Use the hostname mysql-read to send test queries to any server that reports being Ready:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11352"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-read -e \"SELECT * FROM test.messages\"\n```\n\nRun a Replicated Stateful Application | You should get output like this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11353"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client-loop --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  bash -ic \"while sleep 1; do mysql -h mysql-read -e 'SELECT @@server_id,NOW()'; done\"\n```\n\nRun a Replicated Stateful Application | You should see the reported @@server_id change randomly, because a different endpoint might be selected upon each connection attempt:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11354"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql /usr/bin/mysql.off\n```\n\nRun a Replicated Stateful Application | This reaches into the actual container's filesystem for Pod mysql-2 and renames the mysql command so the readiness probe can't find it. After a few seconds, the Pod should report one of its containers", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11355"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2\n```\n\nRun a Replicated Stateful Application | Look for 1/2 in the READY column:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11356"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql.off /usr/bin/mysql\n```\n\nRun a Replicated Stateful Application | The StatefulSet also recreates Pods if they're deleted, similar to what a ReplicaSet does for stateless Pods.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11357"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-2\n```\n\nRun a Replicated Stateful Application | The StatefulSet controller notices that no mysql-2 Pod exists anymore, and creates a new one with the same name and linked to the same PersistentVolumeClaim. You should see server ID 102 disappear fro", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11358"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide\n```\n\nRun a Replicated Stateful Application | The Node name should show up in the last column:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11359"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide --watch\n```\n\nRun a Replicated Stateful Application | It should look something like this:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11360"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-name>\n```\n\nRun a Replicated Stateful Application | When you use MySQL replication, you can scale your read query capacity by adding replicas. For a StatefulSet, you can achieve this with a single command:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11361"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql  --replicas=5\n```\n\nRun a Replicated Stateful Application | Watch the new Pods come up by running:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11362"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\nRun a Replicated Stateful Application | Once they're up, you should see server IDs 103 and 104 start appearing in the SELECT @@server_id loop output.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11363"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-3.mysql -e \"SELECT * FROM test.messages\"\n```\n\nRun a Replicated Stateful Application | Scaling back down is also seamless:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11364"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql --replicas=3\n```\n\nRun a Replicated Stateful Application | Although scaling up creates new PersistentVolumeClaims automatically, scaling down does not automatically delete these PVCs.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11365"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=mysql\n```\n\nRun a Replicated Stateful Application | Which shows that all 5 PVCs still exist, despite having scaled the StatefulSet down to 3:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11366"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc data-mysql-3\nkubectl delete pvc data-mysql-4\n```\n\nRun a Replicated Stateful Application | Cancel the SELECT @@server_id loop by pressing Ctrl+C in its terminal, or running the following from another terminal:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11367"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-client-loop --now\n```\n\nRun a Replicated Stateful Application | Delete the StatefulSet. This also begins terminating the Pods.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11368"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset mysql\n```\n\nRun a Replicated Stateful Application | Verify that the Pods disappear. They might take some time to finish terminating.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11369"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\nRun a Replicated Stateful Application | You'll know the Pods have terminated when the above returns:", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11370"}
{"instruction": "Write a bash example for run a replicated stateful application", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap,service,pvc -l app=mysql\n```\n\nRun a Replicated Stateful Application | If you manually provisioned PersistentVolumes, you also need to manually delete them, as well as release the underlying resources. If you used a dynamic provisioner, it automatically deletes the Persi", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/", "id": "k8s_00724_code_11371"}
{"instruction": "What is the reference documentation for kubectl user preferences (kuberc)?", "response": "Kubectl user preferences (kuberc)FEATURE STATE: Kubernetes 1.34 [beta]A Kubernetes kuberc configuration file allows you to define preferences for kubectl, such as default options and command aliases. Unlike the kubeconfig file, a kuberc configuration file does not contain cluster details, usernames or passwords.The default location of this configuration file is $HOME/.kube/kuberc. To provide kubectl with a path to a custom kuberc file, use the --kuberc command line option, or set the KUBERC environment variable.A kuberc using the kubectl.config.k8s.io/v1beta1 format allows you to define two types of user preferences:Aliases - allow you to create shorter versions of your favorite commands, optionally setting options and arguments.Defaults - allow you to configure default option values for your favorite commands.aliasesWithin a kuberc configuration, the aliases section allows you to define custom shortcuts for kubectl commands, optionally with preset command line arguments and flags.This", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11373"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11374"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11375"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11376"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11377"}
{"instruction": "Write a bash example for kubectl user preferences (kuberc)", "response": "Here's a bash example:\n\n```bash\nkubectl.config.k8s.io/v1beta1\n```\n\nKubectl user preferences (kuberc) | Within a kuberc configuration, the aliases section allows you to define custom shortcuts for kubectl commands, optionally with preset command line arguments and flags.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11378"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11379"}
{"instruction": "Write a bash example for kubectl user preferences (kuberc)", "response": "Here's a bash example:\n\n```bash\nkubectl getn pods -oyaml\n```\n\nKubectl user preferences (kuberc) | Full kuberc schema is available here.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11380"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11381"}
{"instruction": "Write a bash example for kubectl user preferences (kuberc)", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace test-ns --output json\n```\n\nKubectl user preferences (kuberc) | This next example, will introduce a mechanism similar to prepending arguments, this time, though, we will append arguments to the end of the kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11382"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11383"}
{"instruction": "Write a bash example for kubectl user preferences (kuberc)", "response": "Here's a bash example:\n\n```bash\nkubectl run test-pod --namespace test-ns --image busybox -- custom-arg\n```\n\nKubectl user preferences (kuberc) | Within a kuberc configuration, defaults section lets you specify default values for command line arguments.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11384"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11385"}
{"instruction": "Write a bash example for kubectl user preferences (kuberc)", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/test-pod\n```\n\nKubectl user preferences (kuberc) | The kubectl maintainers encourage you to adopt kuberc with the following defaults:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11386"}
{"instruction": "Write a bash example for kubectl user preferences (kuberc)", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/test-pod --interactive=false\n```\n\nKubectl user preferences (kuberc) | The kubectl maintainers encourage you to adopt kuberc with the following defaults:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11387"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11388"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11389"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11390"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11391"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11392"}
{"instruction": "Write a yaml example for kubectl user preferences (kuberc)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\nKubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/kuberc/", "id": "k8s_00725_code_11393"}
{"instruction": "What is the reference documentation for cri pod & container metrics?", "response": "CRI Pod & Container MetricsCollection of Pod & Container metrics via the CRI.FEATURE STATE: Kubernetes v1.23 [alpha]The kubelet collects pod and container metrics via cAdvisor. As an alpha feature, Kubernetes lets you configure the collection of pod and container metrics via the Container Runtime Interface (CRI). You must enable the PodAndContainerStatsFromCRI feature gate and use a compatible CRI implementation (containerd >= 1.6.0, CRI-O >= 1.23.0) to use the CRI based collection mechanism.CRI Pod & Container MetricsWith PodAndContainerStatsFromCRI enabled, the kubelet polls the underlying container runtime for pod and container stats instead of inspecting the host system directly using cAdvisor. The benefits of relying on the container runtime for this information as opposed to direct collection with cAdvisor include:Potential improved performance if the container runtime already collects this information during normal operations. In this case, the data can be re-used instead of being aggregated again by the kubelet.It further decouples the kubelet and the container runtime allowing collection of metrics for container runtimes that don't run processes directly on the host with kubelet where they are observable by cAdvisor (for example: container runtimes that use virtualization).", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/instrumentation/cri-pod-container-metrics/", "id": "k8s_00726"}
{"instruction": "What is the reference documentation for kubectl config unset?", "response": "kubectl config unsetSynopsisUnset an individual value in a kubeconfig file.PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.kubectl config unset PROPERTY_NAME Examples # Unset the current-context kubectl config unset current-context # Unset namespace in foo context kubectl config unset contexts.foo.namespace Options-h, --helphelp for unsetParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_unset/", "id": "k8s_00727"}
{"instruction": "Write a bash example for kubectl config unset", "response": "Here's a bash example:\n\n```bash\nkubectl config unset PROPERTY_NAME\n```\n\nkubectl config unset | help for unset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_unset/", "id": "k8s_00727_code_11396"}
{"instruction": "Write a bash example for kubectl config unset", "response": "Here's a bash example:\n\n```bash\nkubectl config unset PROPERTY_NAME\n```\n\nkubectl config unset | help for unset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_unset/", "id": "k8s_00727_code_11397"}
{"instruction": "Explain the Kubernetes concept: Object Names and IDs", "response": "Object Names and IDsEach object in your cluster has a Name that is unique for that type of resource. Every Kubernetes object also has a UID that is unique across your whole cluster.For example, you can only have one Pod named myapp-1234 within the same namespace, but you can have one Pod and one Deployment that are each named myapp-1234.For non-unique user-provided attributes, Kubernetes provides labels and annotations.NamesA client-provided string that refers to an object in a resource URL, such as /api/v1/pods/some-name.Only one object of a given kind can have a given name at a time. However, if you delete the object, you can make a new object with the same name.Names must be unique across all API versions of the same resource. API resources are distinguished by their API group, resource type, namespace (for namespaced resources), and name. In other words, API version is irrelevant in this context.Note:In cases when objects represent a physical entity, like a Node representing a physical host, when the host is re-created under the same name without deleting and re-creating the Node, Kubernetes treats the new host as the old one, which may lead to inconsistencies.The server may generate a name when generateName is provided instead of name in a resource create request. When generateName is used, the provided value is used as a name prefix, which server appends a generated suffix to. Even though the name is generated, it may conflict with existing names resulting in a HTTP 409 response. This became far less likely to happen in Kubernetes v1.31 and later, since the server will make up to 8 attempt to generate a unique name before returning a HTTP 409 response.Below are four types of commonly used name constraints for resources.DNS Subdomain NamesMost resource types require a name that can be used as a DNS subdomain name as defined in RFC 1123. This means the name must:contain no more than 253 characterscontain only lowercase alphanumeric characters, '-' or '.'start with an alphanumeric characterend with an alphanumeric characterRFC 1123 Label NamesSome resource types require their names to follow the DNS label standard as defined in RFC 1123. This means the name must:contain at most 63 characterscontain only lowercase alphanumeric characters or '-'start with an alphanumeric characterend with an alphanumeric characterRFC 1035 Label NamesSome resource types require their names to follow the DNS label standard as defined in RFC 1035. This means the name must:contain at most 63 characterscontain only lowercase alphanumeric characters or '-'start with an alphabetic characterend with an alphanumeric characterNote:The only difference between the RFC 1035 and RFC 1123 label standards is that RFC 1123 labels are allowed to start with a digit, whereas RFC 1035 labels can start with a lowercase alphabetic character only.Path Segment NamesSome resource types require their names to be able to be safely encoded as a path segment. In other words, the name may not be \".\" or \"..\" and the name may not contain \"/\" or \"%\".Here's an example manifest for a Pod named nginx-demo.apiVersion: v1 kind: Pod metadata: name: nginx-demo spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Note:Some resource types have additional restrictions on their names.UIDsA Kubernetes systems-generated string to uniquely identify objects.Every object created over the whole lifetime of a Kubernetes cluster has a distinct UID. It is intended to distinguish between historical occurrences of similar entities.Kubernetes UIDs are universally unique identifiers (also known as UUIDs). UUIDs are standardized as ISO/IEC 9834-8 and as ITU-T X.667.What's nextRead about labels and annotations in Kubernetes.See the Identifiers and Names in Kubernetes design document.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/names/", "id": "k8s_00728"}
{"instruction": "Write a yaml example for object names and ids", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nObject Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/names/", "id": "k8s_00728_code_11399"}
{"instruction": "Write a yaml example for object names and ids", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nObject Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/names/", "id": "k8s_00728_code_11400"}
{"instruction": "Write a yaml example for object names and ids", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nObject Names and IDs | A Kubernetes systems-generated string to uniquely identify objects.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/names/", "id": "k8s_00728_code_11401"}
{"instruction": "What is the reference documentation for kubectl config use-context?", "response": "kubectl config use-contextSynopsisSet the current-context in a kubeconfig file.kubectl config use-context CONTEXT_NAME Examples # Use the context for the minikube cluster kubectl config use-context minikube Options-h, --helphelp for use-contextParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_use-context/", "id": "k8s_00729"}
{"instruction": "Write a bash example for kubectl config use-context", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context CONTEXT_NAME\n```\n\nkubectl config use-context | help for use-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_use-context/", "id": "k8s_00729_code_11403"}
{"instruction": "Write a bash example for kubectl config use-context", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context CONTEXT_NAME\n```\n\nkubectl config use-context | help for use-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_use-context/", "id": "k8s_00729_code_11404"}
{"instruction": "How do you enable or disable a kubernetes api in Kubernetes?", "response": "Enable Or Disable A Kubernetes APIThis page shows how to enable or disable an API version from your cluster's control plane.Specific API versions can be turned on or off by passing --runtime-config=api/<version> as a command line argument to the API server. The values for this argument are a comma-separated list of API versions. Later values override earlier values.The runtime-config command line argument also supports 2 special keys:api/all, representing all known APIsapi/legacy, representing only legacy APIs. Legacy APIs are any APIs that have been explicitly deprecated.For example, to turn off all API versions except v1, pass --runtime-config=api/all=false,api/v1=true to the kube-apiserver.What's nextRead the full documentation for the kube-apiserver component.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/enable-disable-api/", "id": "k8s_00730"}
{"instruction": "What is the reference documentation for authenticating?", "response": "AuthenticatingThis page provides an overview of authentication in Kubernetes, with a focus on authentication to the Kubernetes API.Users in KubernetesAll Kubernetes clusters have two categories of users: service accounts managed by Kubernetes, and normal users.It is assumed that a cluster-independent service manages normal users in the following ways:an administrator distributing private keysa user store like Keystone or Google Accountsa file with a list of usernames and passwordsIn this regard, Kubernetes does not have objects which represent normal user accounts. Normal users cannot be added to a cluster through an API call.Even though a normal user cannot be added via an API call, any user that presents a valid certificate signed by the cluster's certificate authority (CA) is considered authenticated. In this configuration, Kubernetes determines the username from the common name field in the 'subject' of the cert (e.g., \"/CN=bob\"). From there, the role based access control (RBAC) sub-system would determine whether the user is authorized to perform a specific operation on a resource.In contrast, service accounts are users managed by the Kubernetes API. They are bound to specific namespaces, and created automatically by the API server or manually through API calls. Service accounts are tied to a set of credentials stored as Secrets, which are mounted into pods allowing in-cluster processes to talk to the Kubernetes API.API requests are tied to either a normal user or a service account, or are treated as anonymous requests. This means every process inside or outside the cluster, from a human user typing kubectl on a workstation, to kubelets on nodes, to members of the control plane, must authenticate when making requests to the API server, or be treated as an anonymous user.Authentication strategiesKubernetes uses client certificates, bearer tokens, or an authenticating proxy to authenticate API requests through authentication plugins. As HTTP requests are made to the API server, plugins attempt to associate the following attributes with the request:Username: a string which identifies the end user. Common values might be kube-admin or jane@example.com.UID: a string which identifies the end user and attempts to be more consistent and unique than username.Groups: a set of strings, each of which indicates the user's membership in a named logical collection of users. Common values might be system:masters or devops-team.Extra fields: a map of strings to list of strings which holds additional information authorizers may find useful.Note:All values are opaque to the authentication system and only hold significance when interpreted by an authorizer.Authentication methodsYou can enable multiple authentication methods at once. You should usually use at least two methods:service account tokens for service accountsat least one other method for user authentication.When multiple authenticator modules are enabled, the first module to successfully authenticate the request short-circuits evaluation. The API server does not guarantee the order authenticators run in.The system:authenticated group is included in the list of groups for all authenticated users.Integrations with other authentication protocols (LDAP, SAML, Kerberos, alternate x509 schemes, etc) are available; for example using an authenticating proxy or the authentication webhook.X.509 client certificatesClient certificate authentication is enabled by passing the --client-ca-file=SOMEFILE option to API server. The referenced file must contain one or more certificate authorities to use to validate client certificates presented to the API server. If a client certificate is presented and verified, the common name of the subject is used as the user name for the request. As of Kubernetes 1.4, client certificates can also indicate a user's group memberships using the certificate's organization fields. To include multiple group memberships for a user, include multiple organization fields in", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1 # this apiVersion is relevant as of Kubernetes 1.9\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  namespace: default\nspec:\n  replicas: 3\n  template:\n    metadata:\n    # ...\n    spec:\n      serviceAccountName: bob-the-bot\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nAuthenticating | Service account bearer tokens are perfectly valid to use outside the cluster and can be used to create identities for long standing jobs that wish to talk to the Kubernetes API. To manually create a s", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11407"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount jenkins\n```\n\nAuthenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11408"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl create token jenkins\n```\n\nAuthenticating | The created token is a signed JSON Web Token (JWT).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11409"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\n# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.\n# the maximum number of allowed authenticators is 64.\njwt:\n- issuer:\n    # url must be unique across all authenticators.\n    # url must not conflict with issuer configured in --service-account-issuer.\n    url: https://example.com # Same as --oidc-issuer-url.\n    # discoveryURL, if specified, overrides the URL used to fetch discovery\n    # information instead of using \"{url}/.well-known/openid-configuration\".\n    # The exact value specified is used, so \"/.well-known/openid-configuration\"\n    # must be included in discoveryURL if needed.\n    #\n    # The \"issuer\" field in the fetched discovery information must match the \"issuer.url\" field\n    # in the AuthenticationConfiguration and will be used to validate the \"iss\" claim in the presented JWT.\n    # This is for scenarios where the well-known and jwks endpoints are hosted at a different\n    # location than the issuer (such as locally in the cluster).\n    # discoveryURL must be different from url if specified and must be unique across all authenticators.\n    discoveryURL: https://discovery.example.com/.well-known/openid-configuration\n    # PEM encoded CA certificates used to validate the connection when fetching\n    # discovery information. If not set, the system verifier will be used.\n    # Same value as the content of the file referenced by the --oidc-ca-file command line argument.\n    certificateAuthority: <PEM encoded CA certificates>    \n    # audiences is the set of acceptable audiences the JWT must be issued to.\n    # At least one of the entries must match the \"aud\" claim in presented JWTs.\n    audiences:\n    - my-app # Same as --oidc-client-id.\n    - my-other-app\n    # this is required to be set to \"MatchAny\" when multiple audiences are specified.\n    audienceMatchPolicy: MatchAny\n    # egressSelectorType is an indicator of which egress selection should be used for sending all traffic related\n    # to this issuer (discovery, JWKS, distributed claims, etc).  If unspecified, no custom dialer is used.\n    # The StructuredAuthenticationConfigurationEgressSelector feature gate must be enabled\n    # before you can use the egressSelectorType field.\n    # When specified, the valid choices are \"controlplane\" and \"cluster\".  These correspond to the associated\n    # values in the --egress-selector-config-file.\n    # - controlplane: for traffic intended to go to the control plane.\n    # - cluster: for traffic intended to go to the system being managed by Kubernetes.\n    egressSelectorType: <egress-selector-type>\n  # rules applied to validate token claims to authenticate users.\n  claimValidationRules:\n    # Same as --oidc-required-claim key=value.\n  - claim: hd\n    requiredValue: example.com\n    # Instead of claim and requiredValue, you can use expression to validate the claim.\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for validation to succeed.\n  - expression: 'claims.hd == \"example.com\"'\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: the hd claim must be set to example.com\n  - expression: 'claims.exp - claims.nbf <= 86400'\n    message: total token lifetime must not exceed 24 hours\n  claimMappings:\n    # username represents an option for the username attribute.\n    # This is the only required attribute.\n    username:\n      # Same as --oidc-username-claim. Mutually exclusive with username.expression.\n      claim: \"sub\"\n      # Same as --oidc-username-prefix. Mutually exclusive with username.expression.\n      # if username.claim is set, username.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with username.claim and username.prefix.\n      # expression is a CEL expression that evaluates to a string.\n      #\n      # 1.  If username.expression uses 'claims.email', then 'claims.email_verified' must be used in\n      #     username.expression or extra[*].valueExpression or claimValidationRules[*].expression.\n      #     An example claim validation rule expression that matches the validation automatically\n      #     applied when username.claim is set to 'email' is 'claims.?email_verified.orValue(true) == true'.\n      #     By explicitly comparing the value to true, we let type-checking see the result will be a boolean, and\n      #     to make sure a non-boolean email_verified claim will be caught at runtime.\n      # 2.  If the username asserted based on username.expression is the empty string, the authentication\n      #     request will fail.\n      expression: 'claims.username + \":external-user\"'\n    # groups represents an option for the groups attribute.\n    groups:\n      # Same as --oidc-groups-claim. Mutually exclusive with groups.expression.\n      claim: \"sub\"\n      # Same as --oidc-groups-prefix. Mutually exclusive with groups.expression.\n      # if groups.claim is set, groups.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with groups.claim and groups.prefix.\n      # expression is a CEL expression that evaluates to a string or a list of strings.\n      expression: 'claims.roles.split(\",\")'\n    # uid represents an option for the uid attribute.\n    uid:\n      # Mutually exclusive with uid.expression.\n      claim: 'sub'\n      # Mutually exclusive with uid.claim\n      # expression is a CEL expression that evaluates to a string.\n      expression: 'claims.sub'\n    # extra attributes to be added to the UserInfo object. Keys must be domain-prefix path and must be unique.\n    extra:\n      # key is a string to use as the extra attribute key.\n      # key must be a domain-prefix path (e.g. example.org/foo). All characters before the first \"/\" must be a valid\n      # subdomain as defined by RFC 1123. All characters trailing the first \"/\" must\n      # be valid HTTP Path characters as defined by RFC 3986.\n      # k8s.io, kubernetes.io and their subdomains are reserved for Kubernetes use and cannot be used.\n      # key must be lowercase and unique across all extra attributes.\n    - key: 'example.com/tenant'\n      # valueExpression is a CEL expression that evaluates to a string or a list of strings.\n      valueExpression: 'claims.tenant'\n  # validation rules applied to the final user object.\n  userValidationRules:\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for the user to be valid.\n  - expression: \"!user.username.startsWith('system:')\"\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: 'username cannot used reserved system: prefix'\n  - expression: \"user.groups.all(group, !group.startsWith('system:'))\"\n    message: 'groups cannot used reserved system: prefix'\n```\n\nAuthenticating | Claim validation rule expression", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11410"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11411"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"' # the token below does not have this claim, so validation will fail.\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11412"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"'\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: '\"system:\" + claims.username' # this will prefix the username with \"system:\" and will fail user validation.\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the username will be system:foo and expression will evaluate to false, so validation will fail.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11413"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials USER_NAME \\\n   --auth-provider=oidc \\\n   --auth-provider-arg=idp-issuer-url=( issuer url ) \\\n   --auth-provider-arg=client-id=( your client id ) \\\n   --auth-provider-arg=client-secret=( your client secret ) \\\n   --auth-provider-arg=refresh-token=( your refresh token ) \\\n   --auth-provider-arg=idp-certificate-authority=( path to your ca certificate ) \\\n   --auth-provider-arg=id-token=( your id_token )\n```\n\nAuthenticating | As an example, running the below command after authenticating to your identity provider:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11414"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials mmosley  \\\n        --auth-provider=oidc  \\\n        --auth-provider-arg=idp-issuer-url=https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP  \\\n        --auth-provider-arg=client-id=kubernetes  \\\n        --auth-provider-arg=client-secret=1db158f6-177d-4d9c-8a8b-d36869918ec5  \\\n        --auth-provider-arg=refresh-token=q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXqHega4GAXlF+ma+vmYpFcHe5eZR+slBFpZKtQA= \\\n        --auth-provider-arg=idp-certificate-authority=/root/ca.pem \\\n        --auth-provider-arg=id-token=eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n```\n\nAuthenticating | Which would produce the below configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11415"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl --token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL21sYi50cmVtb2xvLmxhbjo4MDQzL2F1dGgvaWRwL29pZGMiLCJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNDc0NTk2NjY5LCJqdGkiOiI2RDUzNXoxUEpFNjJOR3QxaWVyYm9RIiwiaWF0IjoxNDc0NTk2MzY5LCJuYmYiOjE0NzQ1OTYyNDksInN1YiI6Im13aW5kdSIsInVzZXJfcm9sZSI6WyJ1c2VycyIsIm5ldy1uYW1lc3BhY2Utdmlld2VyIl0sImVtYWlsIjoibXdpbmR1QG5vbW9yZWplZGkuY29tIn0.f2As579n9VNoaKzoF-dOQGmXkFKf1FMyNV0-va_B63jn-_n9LGSCca_6IVMP8pO-Zb4KvRqGyTP0r3HkHxYy5c81AnIh8ijarruczl-TK_yF5akjSTHFZD-0gRzlevBDiH8Q79NAr-ky0P4iIXS8lY9Vnjch5MF74Zx0c3alKJHJUnnpjIACByfF2SCaYzbWFMUNat-K1PaUk5-ujMBG7yYnr95xD-63n8CO8teGUAAEMx6zRjzfhnhbzX-ajwZLGwGUBT4WqjMs70-6a7_8gZmLZb2az1cZynkFRj2BaCkVT3A2RrjeEwZEtGXlMqKJ1_I2ulrOVsYx01_yD35-rw get nodes\n```\n\nAuthenticating | Kubernetes webhook authentication is a mechanism to make an HTTP callout for verifying bearer tokens.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11416"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authn-service\n    cluster:\n      certificate-authority: /path/to/ca.pem         # CA for verifying the remote service.\n      server: https://authn.example.com/authenticate # URL of remote service to query. 'https' recommended for production.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authn-service\n    user: name-of-api-server\n  name: webhook\n```\n\nAuthenticating | When a client attempts to authenticate with the API server using a bearer token as discussed above, the authentication webhook POSTs a JSON-serialized TokenReview object containing the token to the re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11417"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\nanonymous:\n  enabled: true\n  conditions:\n  - path: /livez\n  - path: /readyz\n  - path: /healthz\n```\n\nAuthenticating | In the configuration above only the /livez, /readyz and /healthz endpoints are reachable by anonymous requests. Any other endpoints will not be reachable even if it is allowed by RBAC configuration.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11418"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl drain mynode --as=superman --as-group=system:masters\n```\n\nAuthenticating | To impersonate a user, group, user identifier (UID) or extra fields, the impersonating user must have the ability to perform the impersonate verb on the kind of attribute being impersonated (\"user\", \"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11419"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: impersonator\nrules:\n- apiGroups: [\"\"]\n  resources: [\"users\", \"groups\", \"serviceaccounts\"]\n  verbs: [\"impersonate\"]\n```\n\nAuthenticating | For impersonation, extra fields and impersonated UIDs are both under the \"authentication.k8s.io\" apiGroup. Extra fields are evaluated as sub-resources of the resource \"userextras\". To allow a user to", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11420"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: scopes-and-uid-impersonator\nrules:\n# Can set \"Impersonate-Extra-scopes\" header and the \"Impersonate-Uid\" header.\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\", \"uids\"]\n  verbs: [\"impersonate\"]\n```\n\nAuthenticating | The values of impersonation headers can also be restricted by limiting the set of resourceNames a resource can take.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11421"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: limited-impersonator\nrules:\n# Can impersonate the user \"jane.doe@example.com\"\n- apiGroups: [\"\"]\n  resources: [\"users\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"jane.doe@example.com\"]\n\n# Can impersonate the groups \"developers\" and \"admins\"\n- apiGroups: [\"\"]\n  resources: [\"groups\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"developers\",\"admins\"]\n\n# Can impersonate the extras field \"scopes\" with the values \"view\" and \"development\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"view\", \"development\"]\n\n# Can impersonate the uid \"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"uids\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"]\n```\n\nAuthenticating | k8s.io/client-go and tools using it such as kubectl and kubelet are able to execute an external command to receive user credentials.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11422"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1beta1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Required.\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\nAuthenticating | apiVersion: v1 kind: Config users: - name: my-user user: exec: # Command to execute. Required. command: \"example-client-go-exec-plugin\" # API version to use when decoding the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11423"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1beta1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Optional.\n      # Defaults to \"IfAvailable\".\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\nAuthenticating | Relative command paths are interpreted as relative to the directory of the config file. If KUBECONFIG is set to /home/jane/kubeconfig and the exec command is ./bin/example-client-go-exec-plugin, the b", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11424"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n- name: my-user\n  user:\n    exec:\n      # Path relative to the directory of the kubeconfig\n      command: \"./bin/example-client-go-exec-plugin\"\n      apiVersion: \"client.authentication.k8s.io/v1\"\n      interactiveMode: Never\n```\n\nAuthenticating | The executed command prints an ExecCredential object to stdout. k8s.io/client-go authenticates against the Kubernetes API using the returned credentials in the status. The executed command is passed a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11425"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: SelfSubjectReview\nstatus:\n  userInfo:\n    username: jane.doe\n    uid: b79dbf30-0c6a-11ed-861d-0242ac120002\n    groups:\n    - students\n    - teachers\n    - system:authenticated\n    extra:\n      skills:\n      - reading\n      - learning\n      subjects:\n      - math\n      - sports\n```\n\nAuthenticating | This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster, for example, if you use webhook token authentication or authenticating proxy.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11426"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nopenssl req -new -key jbeda.pem -out jbeda-csr.pem -subj \"/CN=jbeda/O=app1/O=app2\"\n```\n\nAuthenticating | This would create a CSR for the username \"jbeda\", belonging to two groups, \"app1\" and \"app2\".", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11427"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1 # this apiVersion is relevant as of Kubernetes 1.9\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  namespace: default\nspec:\n  replicas: 3\n  template:\n    metadata:\n    # ...\n    spec:\n      serviceAccountName: bob-the-bot\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nAuthenticating | Service account bearer tokens are perfectly valid to use outside the cluster and can be used to create identities for long standing jobs that wish to talk to the Kubernetes API. To manually create a s", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11428"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount (NAME)\n```\n\nAuthenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11429"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount jenkins\n```\n\nAuthenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11430"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl create token jenkins\n```\n\nAuthenticating | The created token is a signed JSON Web Token (JWT).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11431"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\n# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.\n# the maximum number of allowed authenticators is 64.\njwt:\n- issuer:\n    # url must be unique across all authenticators.\n    # url must not conflict with issuer configured in --service-account-issuer.\n    url: https://example.com # Same as --oidc-issuer-url.\n    # discoveryURL, if specified, overrides the URL used to fetch discovery\n    # information instead of using \"{url}/.well-known/openid-configuration\".\n    # The exact value specified is used, so \"/.well-known/openid-configuration\"\n    # must be included in discoveryURL if needed.\n    #\n    # The \"issuer\" field in the fetched discovery information must match the \"issuer.url\" field\n    # in the AuthenticationConfiguration and will be used to validate the \"iss\" claim in the presented JWT.\n    # This is for scenarios where the well-known and jwks endpoints are hosted at a different\n    # location than the issuer (such as locally in the cluster).\n    # discoveryURL must be different from url if specified and must be unique across all authenticators.\n    discoveryURL: https://discovery.example.com/.well-known/openid-configuration\n    # PEM encoded CA certificates used to validate the connection when fetching\n    # discovery information. If not set, the system verifier will be used.\n    # Same value as the content of the file referenced by the --oidc-ca-file command line argument.\n    certificateAuthority: <PEM encoded CA certificates>    \n    # audiences is the set of acceptable audiences the JWT must be issued to.\n    # At least one of the entries must match the \"aud\" claim in presented JWTs.\n    audiences:\n    - my-app # Same as --oidc-client-id.\n    - my-other-app\n    # this is required to be set to \"MatchAny\" when multiple audiences are specified.\n    audienceMatchPolicy: MatchAny\n    # egressSelectorType is an indicator of which egress selection should be used for sending all traffic related\n    # to this issuer (discovery, JWKS, distributed claims, etc).  If unspecified, no custom dialer is used.\n    # The StructuredAuthenticationConfigurationEgressSelector feature gate must be enabled\n    # before you can use the egressSelectorType field.\n    # When specified, the valid choices are \"controlplane\" and \"cluster\".  These correspond to the associated\n    # values in the --egress-selector-config-file.\n    # - controlplane: for traffic intended to go to the control plane.\n    # - cluster: for traffic intended to go to the system being managed by Kubernetes.\n    egressSelectorType: <egress-selector-type>\n  # rules applied to validate token claims to authenticate users.\n  claimValidationRules:\n    # Same as --oidc-required-claim key=value.\n  - claim: hd\n    requiredValue: example.com\n    # Instead of claim and requiredValue, you can use expression to validate the claim.\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for validation to succeed.\n  - expression: 'claims.hd == \"example.com\"'\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: the hd claim must be set to example.com\n  - expression: 'claims.exp - claims.nbf <= 86400'\n    message: total token lifetime must not exceed 24 hours\n  claimMappings:\n    # username represents an option for the username attribute.\n    # This is the only required attribute.\n    username:\n      # Same as --oidc-username-claim. Mutually exclusive with username.expression.\n      claim: \"sub\"\n      # Same as --oidc-username-prefix. Mutually exclusive with username.expression.\n      # if username.claim is set, username.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with username.claim and username.prefix.\n      # expression is a CEL expression that evaluates to a string.\n      #\n      # 1.  If username.expression uses 'claims.email', then 'claims.email_verified' must be used in\n      #     username.expression or extra[*].valueExpression or claimValidationRules[*].expression.\n      #     An example claim validation rule expression that matches the validation automatically\n      #     applied when username.claim is set to 'email' is 'claims.?email_verified.orValue(true) == true'.\n      #     By explicitly comparing the value to true, we let type-checking see the result will be a boolean, and\n      #     to make sure a non-boolean email_verified claim will be caught at runtime.\n      # 2.  If the username asserted based on username.expression is the empty string, the authentication\n      #     request will fail.\n      expression: 'claims.username + \":external-user\"'\n    # groups represents an option for the groups attribute.\n    groups:\n      # Same as --oidc-groups-claim. Mutually exclusive with groups.expression.\n      claim: \"sub\"\n      # Same as --oidc-groups-prefix. Mutually exclusive with groups.expression.\n      # if groups.claim is set, groups.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with groups.claim and groups.prefix.\n      # expression is a CEL expression that evaluates to a string or a list of strings.\n      expression: 'claims.roles.split(\",\")'\n    # uid represents an option for the uid attribute.\n    uid:\n      # Mutually exclusive with uid.expression.\n      claim: 'sub'\n      # Mutually exclusive with uid.claim\n      # expression is a CEL expression that evaluates to a string.\n      expression: 'claims.sub'\n    # extra attributes to be added to the UserInfo object. Keys must be domain-prefix path and must be unique.\n    extra:\n      # key is a string to use as the extra attribute key.\n      # key must be a domain-prefix path (e.g. example.org/foo). All characters before the first \"/\" must be a valid\n      # subdomain as defined by RFC 1123. All characters trailing the first \"/\" must\n      # be valid HTTP Path characters as defined by RFC 3986.\n      # k8s.io, kubernetes.io and their subdomains are reserved for Kubernetes use and cannot be used.\n      # key must be lowercase and unique across all extra attributes.\n    - key: 'example.com/tenant'\n      # valueExpression is a CEL expression that evaluates to a string or a list of strings.\n      valueExpression: 'claims.tenant'\n  # validation rules applied to the final user object.\n  userValidationRules:\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for the user to be valid.\n  - expression: \"!user.username.startsWith('system:')\"\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: 'username cannot used reserved system: prefix'\n  - expression: \"user.groups.all(group, !group.startsWith('system:'))\"\n    message: 'groups cannot used reserved system: prefix'\n```\n\nAuthenticating | Claim validation rule expression", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11432"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11433"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nTOKEN=eyJhbGciOiJSUzI1NiIsImtpZCI6ImY3dF9tOEROWmFTQk1oWGw5QXZTWGhBUC04Y0JmZ0JVbFVpTG5oQkgxdXMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNzAzMjMyOTQ5LCJpYXQiOjE3MDExMDcyMzMsImlzcyI6Imh0dHBzOi8vZXhhbXBsZS5jb20iLCJqdGkiOiI3YzMzNzk0MjgwN2U3M2NhYTJjMzBjODY4YWMwY2U5MTBiY2UwMmRkY2JmZWJlOGMyM2I4YjVmMjdhZDYyODczIiwibmJmIjoxNzAxMTA3MjMzLCJyb2xlcyI6InVzZXIsYWRtaW4iLCJzdWIiOiJhdXRoIiwidGVuYW50IjoiNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjRhIiwidXNlcm5hbWUiOiJmb28ifQ.TBWF2RkQHm4QQz85AYPcwLxSk-VLvQW-mNDHx7SEOSv9LVwcPYPuPajJpuQn9C_gKq1R94QKSQ5F6UgHMILz8OfmPKmX_00wpwwNVGeevJ79ieX2V-__W56iNR5gJ-i9nn6FYk5pwfVREB0l4HSlpTOmu80gbPWAXY5hLW0ZtcE1JTEEmefORHV2ge8e3jp1xGafNy6LdJWabYuKiw8d7Qga__HxtKB-t0kRMNzLRS7rka_SfQg0dSYektuxhLbiDkqhmRffGlQKXGVzUsuvFw7IGM5ZWnZgEMDzCI357obHeM3tRqpn5WRjtB8oM7JgnCymaJi-P3iCd88iu1xnzA\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11434"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"' # the token below does not have this claim, so validation will fail.\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11435"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nTOKEN=eyJhbGciOiJSUzI1NiIsImtpZCI6ImY3dF9tOEROWmFTQk1oWGw5QXZTWGhBUC04Y0JmZ0JVbFVpTG5oQkgxdXMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNzAzMjMyOTQ5LCJpYXQiOjE3MDExMDcyMzMsImlzcyI6Imh0dHBzOi8vZXhhbXBsZS5jb20iLCJqdGkiOiI3YzMzNzk0MjgwN2U3M2NhYTJjMzBjODY4YWMwY2U5MTBiY2UwMmRkY2JmZWJlOGMyM2I4YjVmMjdhZDYyODczIiwibmJmIjoxNzAxMTA3MjMzLCJyb2xlcyI6InVzZXIsYWRtaW4iLCJzdWIiOiJhdXRoIiwidGVuYW50IjoiNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjRhIiwidXNlcm5hbWUiOiJmb28ifQ.TBWF2RkQHm4QQz85AYPcwLxSk-VLvQW-mNDHx7SEOSv9LVwcPYPuPajJpuQn9C_gKq1R94QKSQ5F6UgHMILz8OfmPKmX_00wpwwNVGeevJ79ieX2V-__W56iNR5gJ-i9nn6FYk5pwfVREB0l4HSlpTOmu80gbPWAXY5hLW0ZtcE1JTEEmefORHV2ge8e3jp1xGafNy6LdJWabYuKiw8d7Qga__HxtKB-t0kRMNzLRS7rka_SfQg0dSYektuxhLbiDkqhmRffGlQKXGVzUsuvFw7IGM5ZWnZgEMDzCI357obHeM3tRqpn5WRjtB8oM7JgnCymaJi-P3iCd88iu1xnzA\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11436"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"'\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: '\"system:\" + claims.username' # this will prefix the username with \"system:\" and will fail user validation.\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the username will be system:foo and expression will evaluate to false, so validation will fail.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11437"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nTOKEN=eyJhbGciOiJSUzI1NiIsImtpZCI6ImY3dF9tOEROWmFTQk1oWGw5QXZTWGhBUC04Y0JmZ0JVbFVpTG5oQkgxdXMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNzAzMjMyOTQ5LCJoZCI6ImV4YW1wbGUuY29tIiwiaWF0IjoxNzAxMTEzMTAxLCJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwianRpIjoiYjViMDY1MjM3MmNkMjBlMzQ1YjZmZGZmY2RjMjE4MWY0YWZkNmYyNTlhYWI0YjdlMzU4ODEyMzdkMjkyMjBiYyIsIm5iZiI6MTcwMTExMzEwMSwicm9sZXMiOiJ1c2VyLGFkbWluIiwic3ViIjoiYXV0aCIsInRlbmFudCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0YSIsInVzZXJuYW1lIjoiZm9vIn0.FgPJBYLobo9jnbHreooBlvpgEcSPWnKfX6dc0IvdlRB-F0dCcgy91oCJeK_aBk-8zH5AKUXoFTlInfLCkPivMOJqMECA1YTrMUwt_IVqwb116AqihfByUYIIqzMjvUbthtbpIeHQm2fF0HbrUqa_Q0uaYwgy8mD807h7sBcUMjNd215ff_nFIHss-9zegH8GI1d9fiBf-g6zjkR1j987EP748khpQh9IxPjMJbSgG_uH5x80YFuqgEWwq-aYJPQxXX6FatP96a2EAn7wfPpGlPRt0HcBOvq5pCnudgCgfVgiOJiLr_7robQu4T1bis0W75VPEvwWtgFcLnvcQx0JWg\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11438"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials USER_NAME \\\n   --auth-provider=oidc \\\n   --auth-provider-arg=idp-issuer-url=( issuer url ) \\\n   --auth-provider-arg=client-id=( your client id ) \\\n   --auth-provider-arg=client-secret=( your client secret ) \\\n   --auth-provider-arg=refresh-token=( your refresh token ) \\\n   --auth-provider-arg=idp-certificate-authority=( path to your ca certificate ) \\\n   --auth-provider-arg=id-token=( your id_token )\n```\n\nAuthenticating | As an example, running the below command after authenticating to your identity provider:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11439"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials mmosley  \\\n        --auth-provider=oidc  \\\n        --auth-provider-arg=idp-issuer-url=https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP  \\\n        --auth-provider-arg=client-id=kubernetes  \\\n        --auth-provider-arg=client-secret=1db158f6-177d-4d9c-8a8b-d36869918ec5  \\\n        --auth-provider-arg=refresh-token=q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXqHega4GAXlF+ma+vmYpFcHe5eZR+slBFpZKtQA= \\\n        --auth-provider-arg=idp-certificate-authority=/root/ca.pem \\\n        --auth-provider-arg=id-token=eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n```\n\nAuthenticating | Which would produce the below configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11440"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\nusers:\n- name: mmosley\n  user:\n    auth-provider:\n      config:\n        client-id: kubernetes\n        client-secret: 1db158f6-177d-4d9c-8a8b-d36869918ec5\n        id-token: eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n        idp-certificate-authority: /root/ca.pem\n        idp-issuer-url: https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP\n        refresh-token: q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXq\n      name: oidc\n```\n\nAuthenticating | Once your id_token expires, kubectl will attempt to refresh your id_token using your refresh_token and client_secret storing the new values for the refresh_token and id_token in your .kube/config.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11441"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl --token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL21sYi50cmVtb2xvLmxhbjo4MDQzL2F1dGgvaWRwL29pZGMiLCJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNDc0NTk2NjY5LCJqdGkiOiI2RDUzNXoxUEpFNjJOR3QxaWVyYm9RIiwiaWF0IjoxNDc0NTk2MzY5LCJuYmYiOjE0NzQ1OTYyNDksInN1YiI6Im13aW5kdSIsInVzZXJfcm9sZSI6WyJ1c2VycyIsIm5ldy1uYW1lc3BhY2Utdmlld2VyIl0sImVtYWlsIjoibXdpbmR1QG5vbW9yZWplZGkuY29tIn0.f2As579n9VNoaKzoF-dOQGmXkFKf1FMyNV0-va_B63jn-_n9LGSCca_6IVMP8pO-Zb4KvRqGyTP0r3HkHxYy5c81AnIh8ijarruczl-TK_yF5akjSTHFZD-0gRzlevBDiH8Q79NAr-ky0P4iIXS8lY9Vnjch5MF74Zx0c3alKJHJUnnpjIACByfF2SCaYzbWFMUNat-K1PaUk5-ujMBG7yYnr95xD-63n8CO8teGUAAEMx6zRjzfhnhbzX-ajwZLGwGUBT4WqjMs70-6a7_8gZmLZb2az1cZynkFRj2BaCkVT3A2RrjeEwZEtGXlMqKJ1_I2ulrOVsYx01_yD35-rw get nodes\n```\n\nAuthenticating | Kubernetes webhook authentication is a mechanism to make an HTTP callout for verifying bearer tokens.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11442"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authn-service\n    cluster:\n      certificate-authority: /path/to/ca.pem         # CA for verifying the remote service.\n      server: https://authn.example.com/authenticate # URL of remote service to query. 'https' recommended for production.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authn-service\n    user: name-of-api-server\n  name: webhook\n```\n\nAuthenticating | When a client attempts to authenticate with the API server using a bearer token as discussed above, the authentication webhook POSTs a JSON-serialized TokenReview object containing the token to the re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11443"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1\",\n  \"kind\": \"TokenReview\",\n  \"spec\": {\n    # Opaque bearer token sent to the API server\n    \"token\": \"014fbff9a07c...\",\n\n    # Optional list of the audience identifiers for the server the token was presented to.\n    # Audience-aware token authenticators (for example, OIDC token authenticators)\n    # should verify the token was intended for at least one of the audiences in this list,\n    # and return the intersection of this list and the valid audiences for the token in the response status.\n    # This ensures the token is valid to authenticate to the server it was presented to.\n    # If no audiences are provided, the token should be validated to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\", \"https://myserver.internal.example.com\"]\n  }\n}\n```\n\nAuthenticating | { \"apiVersion\": \"authentication.k8s.io/v1beta1\", \"kind\": \"TokenReview\", \"spec\": { # Opaque bearer token sent to the API server \"token\": \"014fbff9a07c...\", # Optional list of the aud", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11444"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1beta1\",\n  \"kind\": \"TokenReview\",\n  \"spec\": {\n    # Opaque bearer token sent to the API server\n    \"token\": \"014fbff9a07c...\",\n\n    # Optional list of the audience identifiers for the server the token was presented to.\n    # Audience-aware token authenticators (for example, OIDC token authenticators)\n    # should verify the token was intended for at least one of the audiences in this list,\n    # and return the intersection of this list and the valid audiences for the token in the response status.\n    # This ensures the token is valid to authenticate to the server it was presented to.\n    # If no audiences are provided, the token should be validated to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\", \"https://myserver.internal.example.com\"]\n  }\n}\n```\n\nAuthenticating | The remote service is expected to fill the status field of the request to indicate the success of the login. The response body's spec field is ignored and may be omitted. The remote service must retur", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11445"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": true,\n    \"user\": {\n      # Required\n      \"username\": \"janedoe@example.com\",\n      # Optional\n      \"uid\": \"42\",\n      # Optional group memberships\n      \"groups\": [\"developers\", \"qa\"],\n      # Optional additional information provided by the authenticator.\n      # This should not contain confidential data, as it can be recorded in logs\n      # or API objects, and is made available to admission webhooks.\n      \"extra\": {\n        \"extrafield1\": [\n          \"extravalue1\",\n          \"extravalue2\"\n        ]\n      }\n    },\n    # Optional list audience-aware token authenticators can return,\n    # containing the audiences from the `spec.audiences` list for which the provided token was valid.\n    # If this is omitted, the token is considered to be valid to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\"]\n  }\n}\n```\n\nAuthenticating | { \"apiVersion\": \"authentication.k8s.io/v1beta1\", \"kind\": \"TokenReview\", \"status\": { \"authenticated\": true, \"user\": { # Required \"username\": \"janedoe@example.com\", # Opt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11446"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1beta1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": true,\n    \"user\": {\n      # Required\n      \"username\": \"janedoe@example.com\",\n      # Optional\n      \"uid\": \"42\",\n      # Optional group memberships\n      \"groups\": [\"developers\", \"qa\"],\n      # Optional additional information provided by the authenticator.\n      # This should not contain confidential data, as it can be recorded in logs\n      # or API objects, and is made available to admission webhooks.\n      \"extra\": {\n        \"extrafield1\": [\n          \"extravalue1\",\n          \"extravalue2\"\n        ]\n      }\n    },\n    # Optional list audience-aware token authenticators can return,\n    # containing the audiences from the `spec.audiences` list for which the provided token was valid.\n    # If this is omitted, the token is considered to be valid to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\"]\n  }\n}\n```\n\nAuthenticating | An unsuccessful request would return:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11447"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": false,\n    # Optionally include details about why authentication failed.\n    # If no error is provided, the API will return a generic Unauthorized message.\n    # The error field is ignored when authenticated=true.\n    \"error\": \"Credentials are expired\"\n  }\n}\n```\n\nAuthenticating | { \"apiVersion\": \"authentication.k8s.io/v1beta1\", \"kind\": \"TokenReview\", \"status\": { \"authenticated\": false, # Optionally include details about why authentication failed. # If no erro", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11448"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1beta1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": false,\n    # Optionally include details about why authentication failed.\n    # If no error is provided, the API will return a generic Unauthorized message.\n    # The error field is ignored when authenticated=true.\n    \"error\": \"Credentials are expired\"\n  }\n}\n```\n\nAuthenticating | The API server can be configured to identify users from request header values, such as X-Remote-User. It is designed for use in combination with an authenticating proxy that sets these headers.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11449"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\nname: fido\ngroups:\n- dogs\n- dachshunds\nextra:\n  acme.com/project:\n  - some-project\n  scopes:\n  - openid\n  - profile\n```\n\nAuthenticating | In order to prevent header spoofing, the authenticating proxy is required to present a valid client certificate to the API server for validation against the specified CA before the request headers are", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11450"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\nanonymous:\n  enabled: true\n  conditions:\n  - path: /livez\n  - path: /readyz\n  - path: /healthz\n```\n\nAuthenticating | In the configuration above only the /livez, /readyz and /healthz endpoints are reachable by anonymous requests. Any other endpoints will not be reachable even if it is allowed by RBAC configuration.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11451"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl drain mynode --as=superman --as-group=system:masters\n```\n\nAuthenticating | To impersonate a user, group, user identifier (UID) or extra fields, the impersonating user must have the ability to perform the impersonate verb on the kind of attribute being impersonated (\"user\", \"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11452"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: impersonator\nrules:\n- apiGroups: [\"\"]\n  resources: [\"users\", \"groups\", \"serviceaccounts\"]\n  verbs: [\"impersonate\"]\n```\n\nAuthenticating | For impersonation, extra fields and impersonated UIDs are both under the \"authentication.k8s.io\" apiGroup. Extra fields are evaluated as sub-resources of the resource \"userextras\". To allow a user to", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11453"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: scopes-and-uid-impersonator\nrules:\n# Can set \"Impersonate-Extra-scopes\" header and the \"Impersonate-Uid\" header.\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\", \"uids\"]\n  verbs: [\"impersonate\"]\n```\n\nAuthenticating | The values of impersonation headers can also be restricted by limiting the set of resourceNames a resource can take.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11454"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: limited-impersonator\nrules:\n# Can impersonate the user \"jane.doe@example.com\"\n- apiGroups: [\"\"]\n  resources: [\"users\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"jane.doe@example.com\"]\n\n# Can impersonate the groups \"developers\" and \"admins\"\n- apiGroups: [\"\"]\n  resources: [\"groups\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"developers\",\"admins\"]\n\n# Can impersonate the extras field \"scopes\" with the values \"view\" and \"development\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"view\", \"development\"]\n\n# Can impersonate the uid \"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"uids\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"]\n```\n\nAuthenticating | k8s.io/client-go and tools using it such as kubectl and kubelet are able to execute an external command to receive user credentials.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11455"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1beta1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Required.\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\nAuthenticating | apiVersion: v1 kind: Config users: - name: my-user user: exec: # Command to execute. Required. command: \"example-client-go-exec-plugin\" # API version to use when decoding the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11456"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1beta1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Optional.\n      # Defaults to \"IfAvailable\".\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\nAuthenticating | Relative command paths are interpreted as relative to the directory of the config file. If KUBECONFIG is set to /home/jane/kubeconfig and the exec command is ./bin/example-client-go-exec-plugin, the b", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11457"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n- name: my-user\n  user:\n    exec:\n      # Path relative to the directory of the kubeconfig\n      command: \"./bin/example-client-go-exec-plugin\"\n      apiVersion: \"client.authentication.k8s.io/v1\"\n      interactiveMode: Never\n```\n\nAuthenticating | The executed command prints an ExecCredential object to stdout. k8s.io/client-go authenticates against the Kubernetes API using the returned credentials in the status. The executed command is passed a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11458"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: SelfSubjectReview\nstatus:\n  userInfo:\n    username: jane.doe\n    uid: b79dbf30-0c6a-11ed-861d-0242ac120002\n    groups:\n    - students\n    - teachers\n    - system:authenticated\n    extra:\n      skills:\n      - reading\n      - learning\n      subjects:\n      - math\n      - sports\n```\n\nAuthenticating | This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster, for example, if you use webhook token authentication or authenticating proxy.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11459"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1 # this apiVersion is relevant as of Kubernetes 1.9\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  namespace: default\nspec:\n  replicas: 3\n  template:\n    metadata:\n    # ...\n    spec:\n      serviceAccountName: bob-the-bot\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\nAuthenticating | Service account bearer tokens are perfectly valid to use outside the cluster and can be used to create identities for long standing jobs that wish to talk to the Kubernetes API. To manually create a s", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11460"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount jenkins\n```\n\nAuthenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11461"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl create token jenkins\n```\n\nAuthenticating | The created token is a signed JSON Web Token (JWT).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11462"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\n# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.\n# the maximum number of allowed authenticators is 64.\njwt:\n- issuer:\n    # url must be unique across all authenticators.\n    # url must not conflict with issuer configured in --service-account-issuer.\n    url: https://example.com # Same as --oidc-issuer-url.\n    # discoveryURL, if specified, overrides the URL used to fetch discovery\n    # information instead of using \"{url}/.well-known/openid-configuration\".\n    # The exact value specified is used, so \"/.well-known/openid-configuration\"\n    # must be included in discoveryURL if needed.\n    #\n    # The \"issuer\" field in the fetched discovery information must match the \"issuer.url\" field\n    # in the AuthenticationConfiguration and will be used to validate the \"iss\" claim in the presented JWT.\n    # This is for scenarios where the well-known and jwks endpoints are hosted at a different\n    # location than the issuer (such as locally in the cluster).\n    # discoveryURL must be different from url if specified and must be unique across all authenticators.\n    discoveryURL: https://discovery.example.com/.well-known/openid-configuration\n    # PEM encoded CA certificates used to validate the connection when fetching\n    # discovery information. If not set, the system verifier will be used.\n    # Same value as the content of the file referenced by the --oidc-ca-file command line argument.\n    certificateAuthority: <PEM encoded CA certificates>    \n    # audiences is the set of acceptable audiences the JWT must be issued to.\n    # At least one of the entries must match the \"aud\" claim in presented JWTs.\n    audiences:\n    - my-app # Same as --oidc-client-id.\n    - my-other-app\n    # this is required to be set to \"MatchAny\" when multiple audiences are specified.\n    audienceMatchPolicy: MatchAny\n    # egressSelectorType is an indicator of which egress selection should be used for sending all traffic related\n    # to this issuer (discovery, JWKS, distributed claims, etc).  If unspecified, no custom dialer is used.\n    # The StructuredAuthenticationConfigurationEgressSelector feature gate must be enabled\n    # before you can use the egressSelectorType field.\n    # When specified, the valid choices are \"controlplane\" and \"cluster\".  These correspond to the associated\n    # values in the --egress-selector-config-file.\n    # - controlplane: for traffic intended to go to the control plane.\n    # - cluster: for traffic intended to go to the system being managed by Kubernetes.\n    egressSelectorType: <egress-selector-type>\n  # rules applied to validate token claims to authenticate users.\n  claimValidationRules:\n    # Same as --oidc-required-claim key=value.\n  - claim: hd\n    requiredValue: example.com\n    # Instead of claim and requiredValue, you can use expression to validate the claim.\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for validation to succeed.\n  - expression: 'claims.hd == \"example.com\"'\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: the hd claim must be set to example.com\n  - expression: 'claims.exp - claims.nbf <= 86400'\n    message: total token lifetime must not exceed 24 hours\n  claimMappings:\n    # username represents an option for the username attribute.\n    # This is the only required attribute.\n    username:\n      # Same as --oidc-username-claim. Mutually exclusive with username.expression.\n      claim: \"sub\"\n      # Same as --oidc-username-prefix. Mutually exclusive with username.expression.\n      # if username.claim is set, username.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with username.claim and username.prefix.\n      # expression is a CEL expression that evaluates to a string.\n      #\n      # 1.  If username.expression uses 'claims.email', then 'claims.email_verified' must be used in\n      #     username.expression or extra[*].valueExpression or claimValidationRules[*].expression.\n      #     An example claim validation rule expression that matches the validation automatically\n      #     applied when username.claim is set to 'email' is 'claims.?email_verified.orValue(true) == true'.\n      #     By explicitly comparing the value to true, we let type-checking see the result will be a boolean, and\n      #     to make sure a non-boolean email_verified claim will be caught at runtime.\n      # 2.  If the username asserted based on username.expression is the empty string, the authentication\n      #     request will fail.\n      expression: 'claims.username + \":external-user\"'\n    # groups represents an option for the groups attribute.\n    groups:\n      # Same as --oidc-groups-claim. Mutually exclusive with groups.expression.\n      claim: \"sub\"\n      # Same as --oidc-groups-prefix. Mutually exclusive with groups.expression.\n      # if groups.claim is set, groups.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with groups.claim and groups.prefix.\n      # expression is a CEL expression that evaluates to a string or a list of strings.\n      expression: 'claims.roles.split(\",\")'\n    # uid represents an option for the uid attribute.\n    uid:\n      # Mutually exclusive with uid.expression.\n      claim: 'sub'\n      # Mutually exclusive with uid.claim\n      # expression is a CEL expression that evaluates to a string.\n      expression: 'claims.sub'\n    # extra attributes to be added to the UserInfo object. Keys must be domain-prefix path and must be unique.\n    extra:\n      # key is a string to use as the extra attribute key.\n      # key must be a domain-prefix path (e.g. example.org/foo). All characters before the first \"/\" must be a valid\n      # subdomain as defined by RFC 1123. All characters trailing the first \"/\" must\n      # be valid HTTP Path characters as defined by RFC 3986.\n      # k8s.io, kubernetes.io and their subdomains are reserved for Kubernetes use and cannot be used.\n      # key must be lowercase and unique across all extra attributes.\n    - key: 'example.com/tenant'\n      # valueExpression is a CEL expression that evaluates to a string or a list of strings.\n      valueExpression: 'claims.tenant'\n  # validation rules applied to the final user object.\n  userValidationRules:\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for the user to be valid.\n  - expression: \"!user.username.startsWith('system:')\"\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: 'username cannot used reserved system: prefix'\n  - expression: \"user.groups.all(group, !group.startsWith('system:'))\"\n    message: 'groups cannot used reserved system: prefix'\n```\n\nAuthenticating | Claim validation rule expression", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11463"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11464"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"' # the token below does not have this claim, so validation will fail.\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11465"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"'\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: '\"system:\" + claims.username' # this will prefix the username with \"system:\" and will fail user validation.\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the username will be system:foo and expression will evaluate to false, so validation will fail.\n    message: 'username cannot used reserved system: prefix'\n```\n\nAuthenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11466"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials USER_NAME \\\n   --auth-provider=oidc \\\n   --auth-provider-arg=idp-issuer-url=( issuer url ) \\\n   --auth-provider-arg=client-id=( your client id ) \\\n   --auth-provider-arg=client-secret=( your client secret ) \\\n   --auth-provider-arg=refresh-token=( your refresh token ) \\\n   --auth-provider-arg=idp-certificate-authority=( path to your ca certificate ) \\\n   --auth-provider-arg=id-token=( your id_token )\n```\n\nAuthenticating | As an example, running the below command after authenticating to your identity provider:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11467"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials mmosley  \\\n        --auth-provider=oidc  \\\n        --auth-provider-arg=idp-issuer-url=https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP  \\\n        --auth-provider-arg=client-id=kubernetes  \\\n        --auth-provider-arg=client-secret=1db158f6-177d-4d9c-8a8b-d36869918ec5  \\\n        --auth-provider-arg=refresh-token=q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXqHega4GAXlF+ma+vmYpFcHe5eZR+slBFpZKtQA= \\\n        --auth-provider-arg=idp-certificate-authority=/root/ca.pem \\\n        --auth-provider-arg=id-token=eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n```\n\nAuthenticating | Which would produce the below configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11468"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl --token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL21sYi50cmVtb2xvLmxhbjo4MDQzL2F1dGgvaWRwL29pZGMiLCJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNDc0NTk2NjY5LCJqdGkiOiI2RDUzNXoxUEpFNjJOR3QxaWVyYm9RIiwiaWF0IjoxNDc0NTk2MzY5LCJuYmYiOjE0NzQ1OTYyNDksInN1YiI6Im13aW5kdSIsInVzZXJfcm9sZSI6WyJ1c2VycyIsIm5ldy1uYW1lc3BhY2Utdmlld2VyIl0sImVtYWlsIjoibXdpbmR1QG5vbW9yZWplZGkuY29tIn0.f2As579n9VNoaKzoF-dOQGmXkFKf1FMyNV0-va_B63jn-_n9LGSCca_6IVMP8pO-Zb4KvRqGyTP0r3HkHxYy5c81AnIh8ijarruczl-TK_yF5akjSTHFZD-0gRzlevBDiH8Q79NAr-ky0P4iIXS8lY9Vnjch5MF74Zx0c3alKJHJUnnpjIACByfF2SCaYzbWFMUNat-K1PaUk5-ujMBG7yYnr95xD-63n8CO8teGUAAEMx6zRjzfhnhbzX-ajwZLGwGUBT4WqjMs70-6a7_8gZmLZb2az1cZynkFRj2BaCkVT3A2RrjeEwZEtGXlMqKJ1_I2ulrOVsYx01_yD35-rw get nodes\n```\n\nAuthenticating | Kubernetes webhook authentication is a mechanism to make an HTTP callout for verifying bearer tokens.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11469"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authn-service\n    cluster:\n      certificate-authority: /path/to/ca.pem         # CA for verifying the remote service.\n      server: https://authn.example.com/authenticate # URL of remote service to query. 'https' recommended for production.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authn-service\n    user: name-of-api-server\n  name: webhook\n```\n\nAuthenticating | When a client attempts to authenticate with the API server using a bearer token as discussed above, the authentication webhook POSTs a JSON-serialized TokenReview object containing the token to the re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11470"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\nanonymous:\n  enabled: true\n  conditions:\n  - path: /livez\n  - path: /readyz\n  - path: /healthz\n```\n\nAuthenticating | In the configuration above only the /livez, /readyz and /healthz endpoints are reachable by anonymous requests. Any other endpoints will not be reachable even if it is allowed by RBAC configuration.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11471"}
{"instruction": "Write a bash example for authenticating", "response": "Here's a bash example:\n\n```bash\nkubectl drain mynode --as=superman --as-group=system:masters\n```\n\nAuthenticating | To impersonate a user, group, user identifier (UID) or extra fields, the impersonating user must have the ability to perform the impersonate verb on the kind of attribute being impersonated (\"user\", \"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11472"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: impersonator\nrules:\n- apiGroups: [\"\"]\n  resources: [\"users\", \"groups\", \"serviceaccounts\"]\n  verbs: [\"impersonate\"]\n```\n\nAuthenticating | For impersonation, extra fields and impersonated UIDs are both under the \"authentication.k8s.io\" apiGroup. Extra fields are evaluated as sub-resources of the resource \"userextras\". To allow a user to", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11473"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: scopes-and-uid-impersonator\nrules:\n# Can set \"Impersonate-Extra-scopes\" header and the \"Impersonate-Uid\" header.\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\", \"uids\"]\n  verbs: [\"impersonate\"]\n```\n\nAuthenticating | The values of impersonation headers can also be restricted by limiting the set of resourceNames a resource can take.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11474"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: limited-impersonator\nrules:\n# Can impersonate the user \"jane.doe@example.com\"\n- apiGroups: [\"\"]\n  resources: [\"users\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"jane.doe@example.com\"]\n\n# Can impersonate the groups \"developers\" and \"admins\"\n- apiGroups: [\"\"]\n  resources: [\"groups\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"developers\",\"admins\"]\n\n# Can impersonate the extras field \"scopes\" with the values \"view\" and \"development\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"view\", \"development\"]\n\n# Can impersonate the uid \"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"uids\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"]\n```\n\nAuthenticating | k8s.io/client-go and tools using it such as kubectl and kubelet are able to execute an external command to receive user credentials.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11475"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1beta1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Required.\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\nAuthenticating | apiVersion: v1 kind: Config users: - name: my-user user: exec: # Command to execute. Required. command: \"example-client-go-exec-plugin\" # API version to use when decoding the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11476"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1beta1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Optional.\n      # Defaults to \"IfAvailable\".\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\nAuthenticating | Relative command paths are interpreted as relative to the directory of the config file. If KUBECONFIG is set to /home/jane/kubeconfig and the exec command is ./bin/example-client-go-exec-plugin, the b", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11477"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\n- name: my-user\n  user:\n    exec:\n      # Path relative to the directory of the kubeconfig\n      command: \"./bin/example-client-go-exec-plugin\"\n      apiVersion: \"client.authentication.k8s.io/v1\"\n      interactiveMode: Never\n```\n\nAuthenticating | The executed command prints an ExecCredential object to stdout. k8s.io/client-go authenticates against the Kubernetes API using the returned credentials in the status. The executed command is passed a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11478"}
{"instruction": "Write a yaml example for authenticating", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: SelfSubjectReview\nstatus:\n  userInfo:\n    username: jane.doe\n    uid: b79dbf30-0c6a-11ed-861d-0242ac120002\n    groups:\n    - students\n    - teachers\n    - system:authenticated\n    extra:\n      skills:\n      - reading\n      - learning\n      subjects:\n      - math\n      - sports\n```\n\nAuthenticating | This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster, for example, if you use webhook token authentication or authenticating proxy.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authentication/", "id": "k8s_00731_code_11479"}
{"instruction": "How do you configure gmsa for windows pods and containers in Kubernetes?", "response": "Configure GMSA for Windows Pods and containersFEATURE STATE: Kubernetes v1.18 [stable]This page shows how to configure Group Managed Service Accounts (GMSA) for Pods and containers that will run on Windows nodes. Group Managed Service Accounts are a specific type of Active Directory account that provides automatic password management, simplified service principal name (SPN) management, and the ability to delegate the management to other administrators across multiple servers.In Kubernetes, GMSA credential specs are configured at a Kubernetes cluster-wide scope as Custom Resources. Windows Pods, as well as individual containers within a Pod, can be configured to use a GMSA for domain based functions (e.g. Kerberos authentication) when interacting with other Windows services.Before you beginYou need to have a Kubernetes cluster and the kubectl command-line tool must be configured to communicate with your cluster. The cluster is expected to have Windows worker nodes. This section covers a set of initial steps required once for each cluster:Install the GMSACredentialSpec CRDA CustomResourceDefinition(CRD) for GMSA credential spec resources needs to be configured on the cluster to define the custom resource type GMSACredentialSpec. Download the GMSA CRD YAML and save it as gmsa-crd.yaml. Next, install the CRD with kubectl apply -f gmsa-crd.yamlInstall webhooks to validate GMSA usersTwo webhooks need to be configured on the Kubernetes cluster to populate and validate GMSA credential spec references at the Pod or container level:A mutating webhook that expands references to GMSAs (by name from a Pod specification) into the full credential spec in JSON form within the Pod spec.A validating webhook ensures all references to GMSAs are authorized to be used by the Pod service account.Installing the above webhooks and associated objects require the steps below:Create a certificate key pair (that will be used to allow the webhook container to communicate to the cluster)Install a secret with the certificate from above.Create a deployment for the core webhook logic.Create the validating and mutating webhook configurations referring to the deployment.A script can be used to deploy and configure the GMSA webhooks and associated objects mentioned above. The script can be run with a --dry-run=server option to allow you to review the changes that would be made to your cluster.The YAML template used by the script may also be used to deploy the webhooks and associated objects manually (with appropriate substitutions for the parameters)Configure GMSAs and Windows nodes in Active DirectoryBefore Pods in Kubernetes can be configured to use GMSAs, the desired GMSAs need to be provisioned in Active Directory as described in the Windows GMSA documentation. Windows worker nodes (that are part of the Kubernetes cluster) need to be configured in Active Directory to access the secret credentials associated with the desired GMSA as described in the Windows GMSA documentation.Create GMSA credential spec resourcesWith the GMSACredentialSpec CRD installed (as described earlier), custom resources containing GMSA credential specs can be configured. The GMSA credential spec does not contain secret or sensitive data. It is information that a container runtime can use to describe the desired GMSA of a container to Windows. GMSA credential specs can be generated in YAML format with a utility PowerShell script.Following are the steps for generating a GMSA credential spec YAML manually in JSON format and then converting it:Import the CredentialSpec module: ipmo CredentialSpec.psm1Create a credential spec in JSON format using New-CredentialSpec. To create a GMSA credential spec named WebApp1, invoke New-CredentialSpec -Name WebApp1 -AccountName WebApp1 -Domain $(Get-ADDomain -Current LocalComputer)Use Get-CredentialSpec to show the path of the JSON file.Convert the credspec file from JSON to YAML format and apply the necessary header fields apiVersion, kind, metadata and", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\nConfigure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11481"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\nConfigure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11482"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\nConfigure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11483"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\nConfigure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11484"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\nConfigure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11485"}
{"instruction": "Write a bash example for configure gmsa for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it iis-auth-7776966999-n5nzr powershell.exe\n```\n\nConfigure GMSA for Windows Pods and containers | nltest.exe /parentdomain results in the following error:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11486"}
{"instruction": "Write a bash example for configure gmsa for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-crd.yaml\n```\n\nConfigure GMSA for Windows Pods and containers | Two webhooks need to be configured on the Kubernetes cluster to populate and validate GMSA credential spec references at the Pod or container level:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11487"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\nConfigure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11488"}
{"instruction": "Write a bash example for configure gmsa for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-Webapp1-credspec.yml\n```\n\nConfigure GMSA for Windows Pods and containers | A cluster role needs to be defined for each GMSA credential spec resource. This authorizes the use verb on a specific GMSA resource by a subject which is typically a service account. The following exa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11489"}
{"instruction": "Write a bash example for configure gmsa for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-webapp1-role.yaml\n```\n\nConfigure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11490"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\nConfigure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11491"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\nConfigure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11492"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\nConfigure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11493"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\nConfigure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11494"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\nimage: registry.domain.example/iis-auth:1809v1\n        lifecycle:\n          postStart:\n            exec:\n              command: [\"powershell.exe\",\"-command\",\"do { Restart-Service -Name netlogon } while ( $($Result = (nltest.exe /query); if ($Result -like '*0x0 NERR_Success*') {return $true} else {return $false}) -eq $false)\"]\n        imagePullPolicy: IfNotPresent\n```\n\nConfigure GMSA for Windows Pods and containers | If you add the lifecycle section show above to your Pod spec, the Pod will execute the commands listed to restart the netlogon service until the nltest.exe /query command exits without error.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11495"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\nConfigure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11496"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\nConfigure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11497"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\nConfigure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11498"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\nConfigure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11499"}
{"instruction": "Write a yaml example for configure gmsa for windows pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\nConfigure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11500"}
{"instruction": "Write a bash example for configure gmsa for windows pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it iis-auth-7776966999-n5nzr powershell.exe\n```\n\nConfigure GMSA for Windows Pods and containers | nltest.exe /parentdomain results in the following error:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/configure-gmsa/", "id": "k8s_00732_code_11501"}
{"instruction": "What is the reference documentation for kubernetes security and disclosure information?", "response": "Kubernetes Security and Disclosure InformationThis page describes Kubernetes security and disclosure information.Security AnnouncementsJoin the kubernetes-security-announce group for emails about security and major API announcements.Report a VulnerabilityWe're extremely grateful for security researchers and users that report vulnerabilities to the Kubernetes Open Source Community. All reports are thoroughly investigated by a set of community volunteers.To make a report, submit your vulnerability to the Kubernetes bug bounty program. This allows triage and handling of the vulnerability with standardized response times.You can also email the private security@kubernetes.io list with the security details and the details expected for all Kubernetes bug reports.You may encrypt your email to this list using the GPG keys of the Security Response Committee members. Encryption using GPG is NOT required to make a disclosure.When Should I Report a Vulnerability?You think you discovered a potential security vulnerability in KubernetesYou are unsure how a vulnerability affects KubernetesYou think you discovered a vulnerability in another project that Kubernetes depends onFor projects with their own vulnerability reporting and disclosure process, please report it directly thereWhen Should I NOT Report a Vulnerability?You need help tuning Kubernetes components for securityYou need help applying security related updatesYour issue is not security relatedSecurity Vulnerability ResponseEach report is acknowledged and analyzed by Security Response Committee members within 3 working days. This will set off the Security Release Process.Any vulnerability information shared with Security Response Committee stays within Kubernetes project and will not be disseminated to other projects unless it is necessary to get the issue fixed.As the security issue moves from triage, to identified fix, to release planning we will keep the reporter updated.Public Disclosure TimingA public disclosure date is negotiated by the Kubernetes Security Response Committee and the bug submitter. We prefer to fully disclose the bug as soon as possible once a user mitigation is available. It is reasonable to delay disclosure when the bug or the fix is not yet fully understood, the solution is not well-tested, or for vendor coordination. The timeframe for disclosure is from immediate (especially if it's already publicly known) to a few weeks. For a vulnerability with a straightforward mitigation, we expect report date to disclosure date to be on the order of 7 days. The Kubernetes Security Response Committee holds the final say when setting a disclosure date.", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/issues-security/security/", "id": "k8s_00733"}
{"instruction": "Explain the Kubernetes concept: Dynamic Resource Allocation", "response": "Dynamic Resource AllocationFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)This page describes dynamic resource allocation (DRA) in Kubernetes.About DRADRA is a Kubernetes feature that lets you request and share resources among Pods. These resources are often attached devices like hardware accelerators.With DRA, device drivers and cluster admins define device classes that are available to claim in workloads. Kubernetes allocates matching devices to specific claims and places the corresponding Pods on nodes that can access the allocated devices.Allocating resources with DRA is a similar experience to dynamic volume provisioning, in which you use PersistentVolumeClaims to claim storage capacity from storage classes and request the claimed capacity in your Pods.Benefits of DRADRA provides a flexible way to categorize, request, and use devices in your cluster. Using DRA provides benefits like the following:Flexible device filtering: use common expression language (CEL) to perform fine-grained filtering for specific device attributes.Device sharing: share the same resource with multiple containers or Pods by referencing the corresponding resource claim.Centralized device categorization: device drivers and cluster admins can use device classes to provide app operators with hardware categories that are optimized for various use cases. For example, you can create a cost-optimized device class for general-purpose workloads, and a high-performance device class for critical jobs.Simplified Pod requests: with DRA, app operators don't need to specify device quantities in Pod resource requests. Instead, the Pod references a resource claim, and the device configuration in that claim applies to the Pod.These benefits provide significant improvements in the device allocation workflow when compared to device plugins, which require per-container device requests, don't support device sharing, and don't support expression-based device filtering.Types of DRA usersThe workflow of using DRA to allocate devices involves the following types of users:Device owner: responsible for devices. Device owners might be commercial vendors, the cluster operator, or another entity. To use DRA, devices must have DRA-compatible drivers that do the following:Create ResourceSlices that provide Kubernetes with information about nodes and resources.Update ResourceSlices when resource capacity in the cluster changes.Optionally, create DeviceClasses that workload operators can use to claim devices.Cluster admin: responsible for configuring clusters and nodes, attaching devices, installing drivers, and similar tasks. To use DRA, cluster admins do the following:Attach devices to nodes.Install device drivers that support DRA.Optionally, create DeviceClasses that workload operators can use to claim devices.Workload operator: responsible for deploying and managing workloads in the cluster. To use DRA to allocate devices to Pods, workload operators do the following:Create ResourceClaims or ResourceClaimTemplates to request specific configurations within DeviceClasses.Deploy workloads that use specific ResourceClaims or ResourceClaimTemplates.DRA terminologyDRA uses the following Kubernetes API kinds to provide the core allocation functionality. All of these API kinds are included in the resource.k8s.io/v1 API group.DeviceClassDefines a category of devices that can be claimed and how to select specific device attributes in claims. The DeviceClass parameters can match zero or more devices in ResourceSlices. To claim devices from a DeviceClass, ResourceClaims select specific device attributes.ResourceClaimDescribes a request for access to attached resources, such as devices, in the cluster. ResourceClaims provide Pods with access to a specific resource. ResourceClaims can be created by workload operators or generated by Kubernetes based on a ResourceClaimTemplate.ResourceClaimTemplateDefines a template that Kubernetes uses to create per-Pod ResourceClaims for a ", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: prioritized-list-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        firstAvailable:\n        - name: large-black\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"black\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"large\"                \n        - name: small-white\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"white\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"small\"                \n          count: 2\n```\n\nDynamic Resource Allocation | The decision is made on a per-Pod basis, so if the Pod is a member of a ReplicaSet or similar grouping, you cannot rely on all the members of the group having the same subrequest chosen. Your workload", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11504"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: cat-slice\nspec:\n  driver: \"resource-driver.example.com\"\n  pool:\n    generation: 1\n    name: \"black-cat-pool\"\n    resourceSliceCount: 1\n  # The allNodes field defines whether any node in the cluster can access the device.\n  allNodes: true\n  devices:\n  - name: \"large-black-cat\"\n    attributes:\n      color:\n        string: \"black\"\n      size:\n        string: \"large\"\n      cat:\n        boolean: true\n```\n\nDynamic Resource Allocation | This ResourceSlice is managed by the resource-driver.example.com driver in the black-cat-pool pool. The allNodes: true field indicates that any node in the cluster can access the devices. There's one", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11505"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-cats\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: name-of-the-intended-node\n  ...\n```\n\nDynamic Resource Allocation | You may also be able to mutate the incoming Pod, at admission time, to unset the .spec.nodeName field and to use a node selector instead.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11506"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: large-black-cat-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n          deviceClassName: resource.example.com\n          allocationMode: All\n          adminAccess: true\n```\n\nDynamic Resource Allocation | If this feature is disabled, the adminAccess field will be removed automatically when creating such a ResourceClaim.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11507"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel:\n      expression: device.driver == 'gpu.example.com' && device.attributes['gpu.example.com'].type\n        == 'gpu'\n  extendedResourceName: example.com/gpu\n```\n\nDynamic Resource Allocation | In addition, users can use a special extended resource to allocate devices without having to explicitly create a ResourceClaim. Using the extended resource name prefix deviceclass.resource.kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11508"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  sharedCounters:\n  - name: gpu-1-counters\n    counters:\n      memory:\n        value: 8Gi\n  devices:\n  - name: device-1\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n  - name: device-2\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n```\n\nDynamic Resource Allocation | Partitionable devices is an alpha feature and only enabled when the DRAPartitionableDevices feature gate is enabled in the kube-apiserver and kube-scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11509"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  devices:\n  - name: eth1\n    allowMultipleAllocations: true\n    attributes:\n      name:\n        string: \"eth1\"\n    capacity:\n      bandwidth:\n        requestPolicy:\n          default: \"1M\"\n          validRange:\n            min: \"1M\"\n            step: \"8\"\n        value: \"10G\"\n```\n\nDynamic Resource Allocation | The consumable capacity can be requested as shown in the below example.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11510"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: bandwidth-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n        - deviceClassName: resource.example.com\n          capacity:\n            requests:\n              bandwidth: 1G\n```\n\nDynamic Resource Allocation | The allocation result will include the consumed capacity and the identifier of the share.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11511"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\n...\nstatus:\n  allocation:\n    devices:\n      results:\n      - consumedCapacity:\n          bandwidth: 1G\n        device: eth1\n        shareID: \"a671734a-e8e5-11e4-8fde-42010af09327\"\n```\n\nDynamic Resource Allocation | In this example, a multiply-allocatable device was chosen. However, any resource.example.com device with at least the requested 1G bandwidth could have met the requirement. If a non-multiply-allocatab", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11512"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\nkind: DeviceTaintRule\nmetadata:\n  name: example\nspec:\n  # The entire hardware installation for this\n  # particular driver is broken.\n  # Evict all pods and don't schedule new ones.\n  deviceSelector:\n    driver: dra.example.com\n  taint:\n    key: dra.example.com/unhealthy\n    value: Broken\n    effect: NoExecute\n```\n\nDynamic Resource Allocation | Device Binding Conditions allow the Kubernetes scheduler to delay Pod binding until external resources, such as fabric-attached GPUs or reprogrammable FPGAs, are confirmed to be ready.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11513"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: gpu-slice\nspec:\n  driver: dra.example.com\n  nodeSelector:\n    accelerator-type: high-performance\n  pool:\n    name: gpu-pool\n    generation: 1\n    resourceSliceCount: 1\n  devices:\n    - name: gpu-1\n      attributes:\n        vendor:\n          string: \"example\"\n        model:\n          string: \"example-gpu\"\n      bindsToNode: true\n      bindingConditions:\n        - dra.example.com/is-prepared\n      bindingFailureConditions:\n        - dra.example.com/preparing-failed\n```\n\nDynamic Resource Allocation | This example ResourceSlice has the following properties:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11514"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: prioritized-list-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        firstAvailable:\n        - name: large-black\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"black\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"large\"                \n        - name: small-white\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"white\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"small\"                \n          count: 2\n```\n\nDynamic Resource Allocation | The decision is made on a per-Pod basis, so if the Pod is a member of a ReplicaSet or similar grouping, you cannot rely on all the members of the group having the same subrequest chosen. Your workload", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11515"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: cat-slice\nspec:\n  driver: \"resource-driver.example.com\"\n  pool:\n    generation: 1\n    name: \"black-cat-pool\"\n    resourceSliceCount: 1\n  # The allNodes field defines whether any node in the cluster can access the device.\n  allNodes: true\n  devices:\n  - name: \"large-black-cat\"\n    attributes:\n      color:\n        string: \"black\"\n      size:\n        string: \"large\"\n      cat:\n        boolean: true\n```\n\nDynamic Resource Allocation | This ResourceSlice is managed by the resource-driver.example.com driver in the black-cat-pool pool. The allNodes: true field indicates that any node in the cluster can access the devices. There's one", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11516"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-cats\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: name-of-the-intended-node\n  ...\n```\n\nDynamic Resource Allocation | You may also be able to mutate the incoming Pod, at admission time, to unset the .spec.nodeName field and to use a node selector instead.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11517"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: large-black-cat-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n          deviceClassName: resource.example.com\n          allocationMode: All\n          adminAccess: true\n```\n\nDynamic Resource Allocation | If this feature is disabled, the adminAccess field will be removed automatically when creating such a ResourceClaim.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11518"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel:\n      expression: device.driver == 'gpu.example.com' && device.attributes['gpu.example.com'].type\n        == 'gpu'\n  extendedResourceName: example.com/gpu\n```\n\nDynamic Resource Allocation | In addition, users can use a special extended resource to allocate devices without having to explicitly create a ResourceClaim. Using the extended resource name prefix deviceclass.resource.kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11519"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  sharedCounters:\n  - name: gpu-1-counters\n    counters:\n      memory:\n        value: 8Gi\n  devices:\n  - name: device-1\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n  - name: device-2\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n```\n\nDynamic Resource Allocation | Partitionable devices is an alpha feature and only enabled when the DRAPartitionableDevices feature gate is enabled in the kube-apiserver and kube-scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11520"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  devices:\n  - name: eth1\n    allowMultipleAllocations: true\n    attributes:\n      name:\n        string: \"eth1\"\n    capacity:\n      bandwidth:\n        requestPolicy:\n          default: \"1M\"\n          validRange:\n            min: \"1M\"\n            step: \"8\"\n        value: \"10G\"\n```\n\nDynamic Resource Allocation | The consumable capacity can be requested as shown in the below example.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11521"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: bandwidth-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n        - deviceClassName: resource.example.com\n          capacity:\n            requests:\n              bandwidth: 1G\n```\n\nDynamic Resource Allocation | The allocation result will include the consumed capacity and the identifier of the share.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11522"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\n...\nstatus:\n  allocation:\n    devices:\n      results:\n      - consumedCapacity:\n          bandwidth: 1G\n        device: eth1\n        shareID: \"a671734a-e8e5-11e4-8fde-42010af09327\"\n```\n\nDynamic Resource Allocation | In this example, a multiply-allocatable device was chosen. However, any resource.example.com device with at least the requested 1G bandwidth could have met the requirement. If a non-multiply-allocatab", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11523"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\nkind: DeviceTaintRule\nmetadata:\n  name: example\nspec:\n  # The entire hardware installation for this\n  # particular driver is broken.\n  # Evict all pods and don't schedule new ones.\n  deviceSelector:\n    driver: dra.example.com\n  taint:\n    key: dra.example.com/unhealthy\n    value: Broken\n    effect: NoExecute\n```\n\nDynamic Resource Allocation | Device Binding Conditions allow the Kubernetes scheduler to delay Pod binding until external resources, such as fabric-attached GPUs or reprogrammable FPGAs, are confirmed to be ready.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11524"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: gpu-slice\nspec:\n  driver: dra.example.com\n  nodeSelector:\n    accelerator-type: high-performance\n  pool:\n    name: gpu-pool\n    generation: 1\n    resourceSliceCount: 1\n  devices:\n    - name: gpu-1\n      attributes:\n        vendor:\n          string: \"example\"\n        model:\n          string: \"example-gpu\"\n      bindsToNode: true\n      bindingConditions:\n        - dra.example.com/is-prepared\n      bindingFailureConditions:\n        - dra.example.com/preparing-failed\n```\n\nDynamic Resource Allocation | This example ResourceSlice has the following properties:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11525"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: prioritized-list-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        firstAvailable:\n        - name: large-black\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"black\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"large\"                \n        - name: small-white\n          deviceClassName: resource.example.com\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"resource-driver.example.com\"].color == \"white\" &&\n                device.attributes[\"resource-driver.example.com\"].size == \"small\"                \n          count: 2\n```\n\nDynamic Resource Allocation | The decision is made on a per-Pod basis, so if the Pod is a member of a ReplicaSet or similar grouping, you cannot rely on all the members of the group having the same subrequest chosen. Your workload", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11526"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: cat-slice\nspec:\n  driver: \"resource-driver.example.com\"\n  pool:\n    generation: 1\n    name: \"black-cat-pool\"\n    resourceSliceCount: 1\n  # The allNodes field defines whether any node in the cluster can access the device.\n  allNodes: true\n  devices:\n  - name: \"large-black-cat\"\n    attributes:\n      color:\n        string: \"black\"\n      size:\n        string: \"large\"\n      cat:\n        boolean: true\n```\n\nDynamic Resource Allocation | This ResourceSlice is managed by the resource-driver.example.com driver in the black-cat-pool pool. The allNodes: true field indicates that any node in the cluster can access the devices. There's one", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11527"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-with-cats\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: name-of-the-intended-node\n  ...\n```\n\nDynamic Resource Allocation | You may also be able to mutate the incoming Pod, at admission time, to unset the .spec.nodeName field and to use a node selector instead.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11528"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: large-black-cat-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n          deviceClassName: resource.example.com\n          allocationMode: All\n          adminAccess: true\n```\n\nDynamic Resource Allocation | If this feature is disabled, the adminAccess field will be removed automatically when creating such a ResourceClaim.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11529"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel:\n      expression: device.driver == 'gpu.example.com' && device.attributes['gpu.example.com'].type\n        == 'gpu'\n  extendedResourceName: example.com/gpu\n```\n\nDynamic Resource Allocation | In addition, users can use a special extended resource to allocate devices without having to explicitly create a ResourceClaim. Using the extended resource name prefix deviceclass.resource.kubernetes.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11530"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  sharedCounters:\n  - name: gpu-1-counters\n    counters:\n      memory:\n        value: 8Gi\n  devices:\n  - name: device-1\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n  - name: device-2\n    consumesCounters:\n    - counterSet: gpu-1-counters\n      counters:\n        memory:\n          value: 6Gi\n```\n\nDynamic Resource Allocation | Partitionable devices is an alpha feature and only enabled when the DRAPartitionableDevices feature gate is enabled in the kube-apiserver and kube-scheduler.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11531"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\nkind: ResourceSlice\napiVersion: resource.k8s.io/v1\nmetadata:\n  name: resourceslice\nspec:\n  nodeName: worker-1\n  pool:\n    name: pool\n    generation: 1\n    resourceSliceCount: 1\n  driver: dra.example.com\n  devices:\n  - name: eth1\n    allowMultipleAllocations: true\n    attributes:\n      name:\n        string: \"eth1\"\n    capacity:\n      bandwidth:\n        requestPolicy:\n          default: \"1M\"\n          validRange:\n            min: \"1M\"\n            step: \"8\"\n        value: \"10G\"\n```\n\nDynamic Resource Allocation | The consumable capacity can be requested as shown in the below example.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11532"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: bandwidth-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: req-0\n        exactly:\n        - deviceClassName: resource.example.com\n          capacity:\n            requests:\n              bandwidth: 1G\n```\n\nDynamic Resource Allocation | The allocation result will include the consumed capacity and the identifier of the share.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11533"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\n...\nstatus:\n  allocation:\n    devices:\n      results:\n      - consumedCapacity:\n          bandwidth: 1G\n        device: eth1\n        shareID: \"a671734a-e8e5-11e4-8fde-42010af09327\"\n```\n\nDynamic Resource Allocation | In this example, a multiply-allocatable device was chosen. However, any resource.example.com device with at least the requested 1G bandwidth could have met the requirement. If a non-multiply-allocatab", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11534"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\nkind: DeviceTaintRule\nmetadata:\n  name: example\nspec:\n  # The entire hardware installation for this\n  # particular driver is broken.\n  # Evict all pods and don't schedule new ones.\n  deviceSelector:\n    driver: dra.example.com\n  taint:\n    key: dra.example.com/unhealthy\n    value: Broken\n    effect: NoExecute\n```\n\nDynamic Resource Allocation | Device Binding Conditions allow the Kubernetes scheduler to delay Pod binding until external resources, such as fabric-attached GPUs or reprogrammable FPGAs, are confirmed to be ready.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11535"}
{"instruction": "Write a yaml example for dynamic resource allocation", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\nmetadata:\n  name: gpu-slice\nspec:\n  driver: dra.example.com\n  nodeSelector:\n    accelerator-type: high-performance\n  pool:\n    name: gpu-pool\n    generation: 1\n    resourceSliceCount: 1\n  devices:\n    - name: gpu-1\n      attributes:\n        vendor:\n          string: \"example\"\n        model:\n          string: \"example-gpu\"\n      bindsToNode: true\n      bindingConditions:\n        - dra.example.com/is-prepared\n      bindingFailureConditions:\n        - dra.example.com/preparing-failed\n```\n\nDynamic Resource Allocation | This example ResourceSlice has the following properties:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/", "id": "k8s_00734_code_11536"}
{"instruction": "What is the reference documentation for webhook mode?", "response": "Webhook ModeA WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST. A web application implementing WebHooks will POST a message to a URL when certain things happen.When specified, mode Webhook causes Kubernetes to query an outside REST service when determining user privileges.Configuration File FormatMode Webhook requires a file for HTTP configuration, specify by the --authorization-webhook-config-file=SOME_FILENAME flag.The configuration file uses the kubeconfig file format. Within the file \"users\" refers to the API Server webhook and \"clusters\" refers to the remote service.A configuration example which uses HTTPS client auth:# Kubernetes API version apiVersion: v1 # kind of the API object kind: Config # clusters refers to the remote service. clusters: - name: name-of-remote-authz-service cluster: # CA for verifying the remote service. certificate-authority: /path/to/ca.pem # URL of remote service to query. Must use 'https'. May not include parameters. server: https://authz.example.com/authorize # users refers to the API Server's webhook configuration. users: - name: name-of-api-server user: client-certificate: /path/to/cert.pem # cert for the webhook plugin to use client-key: /path/to/key.pem # key matching the cert # kubeconfig files require a context. Provide one for the API Server. current-context: webhook contexts: - context: cluster: name-of-remote-authz-service user: name-of-api-server name: webhook Request PayloadsWhen faced with an authorization decision, the API Server POSTs a JSON- serialized authorization.k8s.io/v1beta1 SubjectAccessReview object describing the action. This object contains fields describing the user attempting to make the request, and either details about the resource being accessed or requests attributes.Note that webhook API objects are subject to the same versioning compatibility rules as other Kubernetes API objects. Implementers should be aware of looser compatibility promises for beta objects and check the \"apiVersion\" field of the request to ensure correct deserialization. Additionally, the API Server must enable the authorization.k8s.io/v1beta1 API extensions group (--runtime-config=authorization.k8s.io/v1beta1=true).An example request body:{ \"apiVersion\": \"authorization.k8s.io/v1beta1\", \"kind\": \"SubjectAccessReview\", \"spec\": { \"resourceAttributes\": { \"namespace\": \"kittensandponies\", \"verb\": \"get\", \"group\": \"unicorn.example.org\", \"resource\": \"pods\" }, \"user\": \"jane\", \"group\": [ \"group1\", \"group2\" ] } } The remote service is expected to fill the status field of the request and respond to either allow or disallow access. The response body's spec field is ignored and may be omitted. A permissive response would return:{ \"apiVersion\": \"authorization.k8s.io/v1beta1\", \"kind\": \"SubjectAccessReview\", \"status\": { \"allowed\": true } } For disallowing access there are two methods.The first method is preferred in most cases, and indicates the authorization webhook does not allow, or has \"no opinion\" about the request, but if other authorizers are configured, they are given a chance to allow the request. If there are no other authorizers, or none of them allow the request, the request is forbidden. The webhook would return:{ \"apiVersion\": \"authorization.k8s.io/v1beta1\", \"kind\": \"SubjectAccessReview\", \"status\": { \"allowed\": false, \"reason\": \"user does not have read access to the namespace\" } } The second method denies immediately, short-circuiting evaluation by other configured authorizers. This should only be used by webhooks that have detailed knowledge of the full authorizer configuration of the cluster. The webhook would return:{ \"apiVersion\": \"authorization.k8s.io/v1beta1\", \"kind\": \"SubjectAccessReview\", \"status\": { \"allowed\": false, \"denied\": true, \"reason\": \"user does not have read access to the namespace\" } } Access to non-resource paths are sent as:{ \"apiVersion\": \"authorization.k8s.io/v1beta1\", \"kind\": \"SubjectAccessReview\", \"spe", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/webhook/", "id": "k8s_00735"}
{"instruction": "Write a yaml example for webhook mode", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authz-service\n    cluster:\n      # CA for verifying the remote service.\n      certificate-authority: /path/to/ca.pem\n      # URL of remote service to query. Must use 'https'. May not include parameters.\n      server: https://authz.example.com/authorize\n\n# users refers to the API Server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API Server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authz-service\n    user: name-of-api-server\n  name: webhook\n```\n\nWebhook Mode | When faced with an authorization decision, the API Server POSTs a JSON- serialized authorization.k8s.io/v1beta1 SubjectAccessReview object describing the action. This object contains fields describing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/webhook/", "id": "k8s_00735_code_11538"}
{"instruction": "Write a yaml example for webhook mode", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authz-service\n    cluster:\n      # CA for verifying the remote service.\n      certificate-authority: /path/to/ca.pem\n      # URL of remote service to query. Must use 'https'. May not include parameters.\n      server: https://authz.example.com/authorize\n\n# users refers to the API Server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API Server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authz-service\n    user: name-of-api-server\n  name: webhook\n```\n\nWebhook Mode | When faced with an authorization decision, the API Server POSTs a JSON- serialized authorization.k8s.io/v1beta1 SubjectAccessReview object describing the action. This object contains fields describing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/webhook/", "id": "k8s_00735_code_11539"}
{"instruction": "Write a yaml example for webhook mode", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authz-service\n    cluster:\n      # CA for verifying the remote service.\n      certificate-authority: /path/to/ca.pem\n      # URL of remote service to query. Must use 'https'. May not include parameters.\n      server: https://authz.example.com/authorize\n\n# users refers to the API Server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API Server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authz-service\n    user: name-of-api-server\n  name: webhook\n```\n\nWebhook Mode | When faced with an authorization decision, the API Server POSTs a JSON- serialized authorization.k8s.io/v1beta1 SubjectAccessReview object describing the action. This object contains fields describing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/webhook/", "id": "k8s_00735_code_11540"}
{"instruction": "What is the reference documentation for service?", "response": "ServiceService is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.apiVersion: v1import \"k8s.io/api/core/v1\"ServiceService is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.apiVersion: v1kind: Servicemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (ServiceSpec)Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (ServiceStatus)Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusServiceSpecServiceSpec describes the attributes that a user creates on a service.selector (map[string]string)Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/ports ([]ServicePort)Patch strategy: merge on key portMap: unique values on keys port, protocol will be kept during a mergeThe list of ports that are exposed by this service. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxiesServicePort contains information on service's port.ports.port (int32), requiredThe port that will be exposed by this service.ports.targetPort (IntOrString)Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-serviceIntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.ports.protocol (string)The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP.ports.name (string)The name of this port within the service. This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. When considering the endpoints for a Service, this must match the 'name' field in the EndpointPort. Optional if only one ServicePort is defined on this service.ports.nodePort (int32)The port on each node on which this service is exposed when type is NodePort or LoadBalancer. Usually assigned by the system. If a value is specified, in-range, and not in use it will be used, otherwise the operation will fail. If not specified, a port will be allocated if this Service requires one. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeportports.appProtocol (string)The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kuber", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/", "id": "k8s_00736"}
{"instruction": "Explain contribute to kubernetes in Kubernetes", "response": "There are lots of ways to contribute to Kubernetes. You can work on designs for new features, you can document the code we already have, you can write for our blogs. There's more: you can implement those new features or fix bugs. You can help people join our contributor community, or support existing contributors.With all these different ways to make a difference to the project, we - Kubernetes - have made a dedicated website: https://k8s.dev/. You can go there to learn more about contributing to Kubernetes.If you specifically want to learn about contributing to the documentation or other parts of this website, read Contribute to Kubernetes documentation. If you specifically want to help with the official Kubernetes blogs, read Contributing to Kubernetes blogs.You can also read the CNCF page about contributing to Kubernetes.", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/contribute/", "id": "k8s_00737"}
{"instruction": "What is the reference documentation for tokenrequest?", "response": "TokenRequestTokenRequest requests a token for a given service account.apiVersion: authentication.k8s.io/v1import \"k8s.io/api/authentication/v1\"TokenRequestTokenRequest requests a token for a given service account.apiVersion: authentication.k8s.io/v1kind: TokenRequestmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (TokenRequestSpec), requiredSpec holds information about the request being evaluatedstatus (TokenRequestStatus)Status is filled in by the server and indicates whether the token can be authenticated.TokenRequestSpecTokenRequestSpec contains client provided parameters of a token request.audiences ([]string), requiredAtomic: will be replaced during a mergeAudiences are the intended audiences of the token. A recipient of a token must identify themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences.boundObjectRef (BoundObjectReference)BoundObjectRef is a reference to an object that the token will be bound to. The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation.BoundObjectReference is a reference to an object that a token is bound to.boundObjectRef.apiVersion (string)API version of the referent.boundObjectRef.kind (string)Kind of the referent. Valid kinds are 'Pod' and 'Secret'.boundObjectRef.name (string)Name of the referent.boundObjectRef.uid (string)UID of the referent.expirationSeconds (int64)ExpirationSeconds is the requested duration of validity of the request. The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response.TokenRequestStatusTokenRequestStatus is the result of a token request.expirationTimestamp (Time), requiredExpirationTimestamp is the time of expiration of the returned token.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.token (string), requiredToken is the opaque bearer token.Operationscreate create token of a ServiceAccountHTTP RequestPOST /api/v1/namespaces/{namespace}/serviceaccounts/{name}/tokenParametersname (in path): string, requiredname of the TokenRequestnamespace (in path): string, requirednamespacebody: TokenRequest, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (TokenRequest): OK201 (TokenRequest): Created202 (TokenRequest): Accepted401: UnauthorizedThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/", "id": "k8s_00738"}
{"instruction": "Write a yaml example for tokenrequest", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\nTokenRequest | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/", "id": "k8s_00738_code_11544"}
{"instruction": "What is the reference documentation for kubectl config delete-user?", "response": "kubectl config delete-userSynopsisDelete the specified user from the kubeconfig.kubectl config delete-user NAME Examples # Delete the minikube user kubectl config delete-user minikube Options-h, --helphelp for delete-userParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl config - Modify kubeconfig filesThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-user/", "id": "k8s_00739"}
{"instruction": "Write a bash example for kubectl config delete-user", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user NAME\n```\n\nkubectl config delete-user | help for delete-user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-user/", "id": "k8s_00739_code_11546"}
{"instruction": "Write a bash example for kubectl config delete-user", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user NAME\n```\n\nkubectl config delete-user | help for delete-user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_config/kubectl_config_delete-user/", "id": "k8s_00739_code_11547"}
{"instruction": "What is the reference documentation for kubernetes deprecation policy?", "response": "Kubernetes Deprecation PolicyThis document details the deprecation policy for various facets of the system.Kubernetes is a large system with many components and many contributors. As with any such software, the feature set naturally evolves over time, and sometimes a feature may need to be removed. This could include an API, a flag, or even an entire feature. To avoid breaking existing users, Kubernetes follows a deprecation policy for aspects of the system that are slated to be removed.Deprecating parts of the APISince Kubernetes is an API-driven system, the API has evolved over time to reflect the evolving understanding of the problem space. The Kubernetes API is actually a set of APIs, called \"API groups\", and each API group is independently versioned. API versions fall into 3 main tracks, each of which has different policies for deprecation:ExampleTrackv1GA (generally available, stable)v1beta1Beta (pre-release)v1alpha1Alpha (experimental)A given release of Kubernetes can support any number of API groups and any number of versions of each.The following rules govern the deprecation of elements of the API. This includes:REST resources (aka API objects)Fields of REST resourcesAnnotations on REST resources, including \"beta\" annotations but not including \"alpha\" annotations.Enumerated or constant valuesComponent config structuresThese rules are enforced between official releases, not between arbitrary commits to master or release branches.Rule #1: API elements may only be removed by incrementing the version of the API group.Once an API element has been added to an API group at a particular version, it can not be removed from that version or have its behavior significantly changed, regardless of track.Note:For historical reasons, there are 2 \"monolithic\" API groups - \"core\" (no group name) and \"extensions\". Resources will incrementally be moved from these legacy API groups into more domain-specific API groups.Rule #2: API objects must be able to round-trip between API versions in a given release without information loss, with the exception of whole REST resources that do not exist in some versions.For example, an object can be written as v1 and then read back as v2 and converted to v1, and the resulting v1 resource will be identical to the original. The representation in v2 might be different from v1, but the system knows how to convert between them in both directions. Additionally, any new field added in v2 must be able to round-trip to v1 and back, which means v1 might have to add an equivalent field or represent it as an annotation.Rule #3: An API version in a given track may not be deprecated in favor of a less stable API version.GA API versions can replace beta and alpha API versions.Beta API versions can replace earlier beta and alpha API versions, but may not replace GA API versions.Alpha API versions can replace earlier alpha API versions, but may not replace GA or beta API versions.Rule #4a: API lifetime is determined by the API stability levelGA API versions may be marked as deprecated, but must not be removed within a major version of KubernetesBeta API versions are deprecated no more than 9 months or 3 minor releases after introduction (whichever is longer), and are no longer served 9 months or 3 minor releases after deprecation (whichever is longer)Alpha API versions may be removed in any release without prior deprecation noticeThis ensures beta API support covers the maximum supported version skew of 2 releases, and that APIs don't stagnate on unstable beta versions, accumulating production usage that will be disrupted when support for the beta API ends.Note:There are no current plans for a major version revision of Kubernetes that removes GA APIs.Note:Until #52185 is resolved, no API versions that have been persisted to storage may be removed. Serving REST endpoints for those versions may be disabled (subject to the deprecation timelines in this document), but the API server must remain capable of decoding/converti", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/using-api/deprecation-policy/", "id": "k8s_00740"}
{"instruction": "How do you configure memory and cpu quotas for a namespace in Kubernetes?", "response": "Configure Memory and CPU Quotas for a NamespaceDefine overall memory and CPU resource limits for a namespace.This page shows how to set quotas for the total amount memory and CPU that can be used by all Pods running in a namespace. You specify quotas in a ResourceQuota object.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 1 GiB of memory.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace quota-mem-cpu-example Create a ResourceQuotaHere is a manifest for an example ResourceQuota:admin/resource/quota-mem-cpu.yaml apiVersion: v1 kind: ResourceQuota metadata: name: mem-cpu-demo spec: hard: requests.cpu: \"1\" requests.memory: 1Gi limits.cpu: \"2\" limits.memory: 2Gi Create the ResourceQuota:kubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu.yaml --namespace=quota-mem-cpu-example View detailed information about the ResourceQuota:kubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml The ResourceQuota places these requirements on the quota-mem-cpu-example namespace:For every Pod in the namespace, each container must have a memory request, memory limit, cpu request, and cpu limit.The memory request total for all Pods in that namespace must not exceed 1 GiB.The memory limit total for all Pods in that namespace must not exceed 2 GiB.The CPU request total for all Pods in that namespace must not exceed 1 cpu.The CPU limit total for all Pods in that namespace must not exceed 2 cpu.See meaning of CPU to learn what Kubernetes means by “1 CPU”.Create a PodHere is a manifest for an example Pod:admin/resource/quota-mem-cpu-pod.yaml apiVersion: v1 kind: Pod metadata: name: quota-mem-cpu-demo spec: containers: - name: quota-mem-cpu-demo-ctr image: nginx resources: limits: memory: \"800Mi\" cpu: \"800m\" requests: memory: \"600Mi\" cpu: \"400m\" Create the Pod:kubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=quota-mem-cpu-example Verify that the Pod is running and that its (only) container is healthy:kubectl get pod quota-mem-cpu-demo --namespace=quota-mem-cpu-example Once again, view detailed information about the ResourceQuota:kubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml The output shows the quota along with how much of the quota has been used. You can see that the memory and CPU requests and limits for your Pod do not exceed the quota.status: hard: limits.cpu: \"2\" limits.memory: 2Gi requests.cpu: \"1\" requests.memory: 1Gi used: limits.cpu: 800m limits.memory: 800Mi requests.cpu: 400m requests.memory: 600Mi If you have the jq tool, you can also query (using JSONPath) for just the used values, and pretty-print that that of the output. For example:kubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example -o jsonpath='{ .status.used }' | jq . Attempt to create a second PodHere is a manifest for a second Pod:admin/resource/quota-mem-cpu-pod-2.yaml apiVersion: v1 kind: Pod metadata: name: quota-mem-cpu-demo-2 spec: containers: - name: quota-mem-cpu-demo-2-ctr image: redis resources: limits: memory: \"1Gi\" cpu: \"800m\" requests: memory: \"700Mi\" cpu: \"400m\" In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 MiB > 1 GiB.Attempt to create the Pod:kubectl apply -f https://k8s.io/examples/ad", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Here is a manifest for an example ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11550"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11551"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu.yaml --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11552"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\nConfigure Memory and CPU Quotas for a Namespace | The ResourceQuota places these requirements on the quota-mem-cpu-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11553"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11554"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Verify that the Pod is running and that its (only) container is healthy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11555"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod quota-mem-cpu-demo --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Once again, view detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11556"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\nConfigure Memory and CPU Quotas for a Namespace | The output shows the quota along with how much of the quota has been used. You can see that the memory and CPU requests and limits for your Pod do not exceed the quota.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11557"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example -o jsonpath='{ .status.used }' | jq .\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Here is a manifest for a second Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11558"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11559"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod-2.yaml --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | The second Pod does not get created. The output shows that creating the second Pod would cause the memory request total to exceed the memory request quota.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11560"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11561"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11562"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11563"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11564"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Here is a manifest for an example ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11565"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-mem-cpu.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11566"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11567"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu.yaml --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11568"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\nConfigure Memory and CPU Quotas for a Namespace | The ResourceQuota places these requirements on the quota-mem-cpu-example namespace:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11569"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-mem-cpu-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11570"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11571"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Verify that the Pod is running and that its (only) container is healthy:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11572"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get pod quota-mem-cpu-demo --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Once again, view detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11573"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\nConfigure Memory and CPU Quotas for a Namespace | The output shows the quota along with how much of the quota has been used. You can see that the memory and CPU requests and limits for your Pod do not exceed the quota.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11574"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example -o jsonpath='{ .status.used }' | jq .\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Here is a manifest for a second Pod:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11575"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-mem-cpu-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11576"}
{"instruction": "Write a yaml example for configure memory and cpu quotas for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\nConfigure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11577"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod-2.yaml --namespace=quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | The second Pod does not get created. The output shows that creating the second Pod would cause the memory request total to exceed the memory request quota.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11578"}
{"instruction": "Write a bash example for configure memory and cpu quotas for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-mem-cpu-example\n```\n\nConfigure Memory and CPU Quotas for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/", "id": "k8s_00741_code_11579"}
{"instruction": "What is the reference documentation for node?", "response": "NodeNode is a worker node in Kubernetes.apiVersion: v1import \"k8s.io/api/core/v1\"NodeNode is a worker node in Kubernetes. Each node will have a unique identifier in the cache (i.e. in etcd).apiVersion: v1kind: Nodemetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (NodeSpec)Spec defines the behavior of a node. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (NodeStatus)Most recently observed status of the node. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusNodeSpecNodeSpec describes the attributes that a node is created with.configSource (NodeConfigSource)Deprecated: Previously used to specify the source of the node's configuration for the DynamicKubeletConfig feature. This feature is removed.NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil. This API is deprecated since 1.22configSource.configMap (ConfigMapNodeConfigSource)ConfigMap is a reference to a Node's ConfigMapConfigMapNodeConfigSource contains the information to reference a ConfigMap as a config source for the Node. This API is deprecated since 1.22: https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configurationconfigSource.configMap.kubeletConfigKey (string), requiredKubeletConfigKey declares which key of the referenced ConfigMap corresponds to the KubeletConfiguration structure This field is required in all cases.configSource.configMap.name (string), requiredName is the metadata.name of the referenced ConfigMap. This field is required in all cases.configSource.configMap.namespace (string), requiredNamespace is the metadata.namespace of the referenced ConfigMap. This field is required in all cases.configSource.configMap.resourceVersion (string)ResourceVersion is the metadata.ResourceVersion of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status.configSource.configMap.uid (string)UID is the metadata.UID of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status.externalID (string)Deprecated. Not all kubelets will set this field. Remove field after 1.13. see: https://issues.k8s.io/61966podCIDR (string)PodCIDR represents the pod IP range assigned to the node.podCIDRs ([]string)Set: unique values will be kept during a mergepodCIDRs represents the IP ranges assigned to the node for usage by Pods on that node. If this field is specified, the 0th entry must match the podCIDR field. It may contain at most 1 value for each of IPv4 and IPv6.providerID (string)ID of the node assigned by the cloud provider in the format: <ProviderName>://<ProviderSpecificNodeID>taints ([]Taint)Atomic: will be replaced during a mergeIf specified, the node's taints.The node this Taint is attached to has the \"effect\" on any pod that does not tolerate the Taint.taints.effect (string), requiredRequired. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute.taints.key (string), requiredRequired. The taint key to be applied to a node.taints.timeAdded (Time)TimeAdded represents the time at which the taint was added.Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.taints.value (string)The taint value corresponding to the taint key.unschedulable (boolean)Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administrationNodeStatusNodeStatus is information about the current status of a node.addresses ([]NodeAddress)Patch strategy: merge on key typeMap: unique values on key type will be kept durin", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/node-v1/", "id": "k8s_00742"}
{"instruction": "What is the reference documentation for localsubjectaccessreview?", "response": "LocalSubjectAccessReviewLocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace.apiVersion: authorization.k8s.io/v1import \"k8s.io/api/authorization/v1\"LocalSubjectAccessReviewLocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.apiVersion: authorization.k8s.io/v1kind: LocalSubjectAccessReviewmetadata (ObjectMeta)Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (SubjectAccessReviewSpec), requiredSpec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.status (SubjectAccessReviewStatus)Status is filled in by the server and indicates whether the request is allowed or notOperationscreate create a LocalSubjectAccessReviewHTTP RequestPOST /apis/authorization.k8s.io/v1/namespaces/{namespace}/localsubjectaccessreviewsParametersnamespace (in path): string, requirednamespacebody: LocalSubjectAccessReview, requireddryRun (in query): stringdryRunfieldManager (in query): stringfieldManagerfieldValidation (in query): stringfieldValidationpretty (in query): stringprettyResponse200 (LocalSubjectAccessReview): OK201 (LocalSubjectAccessReview): Created202 (LocalSubjectAccessReview): Accepted401: UnauthorizedThis page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/local-subject-access-review-v1/", "id": "k8s_00743"}
{"instruction": "Write a yaml example for localsubjectaccessreview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\nLocalSubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/local-subject-access-review-v1/", "id": "k8s_00743_code_11582"}
{"instruction": "How do you accessing clusters in Kubernetes?", "response": "Accessing ClustersThis topic discusses multiple ways to interact with clusters.Accessing for the first time with kubectlWhen accessing the Kubernetes API for the first time, we suggest using the Kubernetes CLI, kubectl.To access a cluster, you need to know the location of the cluster and have credentials to access it. Typically, this is automatically set-up when you work through a Getting started guide, or someone else set up the cluster and provided you with credentials and a location.Check the location and credentials that kubectl knows about with this command:kubectl config view Many of the examples provide an introduction to using kubectl, and complete documentation is found in the kubectl reference.Directly accessing the REST APIKubectl handles locating and authenticating to the apiserver. If you want to directly access the REST API with an http client like curl or wget, or a browser, there are several ways to locate and authenticate:Run kubectl in proxy mode.Recommended approach.Uses stored apiserver location.Verifies identity of apiserver using self-signed cert. No MITM possible.Authenticates to apiserver.In future, may do intelligent client-side load-balancing and failover.Provide the location and credentials directly to the http client.Alternate approach.Works with some types of client code that are confused by using a proxy.Need to import a root cert into your browser to protect against MITM.Using kubectl proxyThe following command runs kubectl in a mode where it acts as a reverse proxy. It handles locating the apiserver and authenticating. Run it like this:kubectl proxy --port=8080 See kubectl proxy for more details.Then you can explore the API with curl, wget, or a browser, replacing localhost with [::1] for IPv6, like so:curl http://localhost:8080/api/ The output is similar to this:{ \"kind\": \"APIVersions\", \"versions\": [ \"v1\" ], \"serverAddressByClientCIDRs\": [ { \"clientCIDR\": \"0.0.0.0/0\", \"serverAddress\": \"10.0.1.149:443\" } ] } Without kubectl proxyUse kubectl apply and kubectl describe secret... to create a token for the default service account with grep/cut:First, create the Secret, requesting a token for the default ServiceAccount:kubectl apply -f - <<EOF apiVersion: v1 kind: Secret metadata: name: default-token annotations: kubernetes.io/service-account.name: default type: kubernetes.io/service-account-token EOF", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/", "id": "k8s_00744"}
{"instruction": "Write a bash example for accessing clusters", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nAccessing Clusters | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/", "id": "k8s_00744_code_11584"}
{"instruction": "Write a yaml example for accessing clusters", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n```\n\nAccessing Clusters | Next, wait for the token controller to populate the Secret with a token:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/", "id": "k8s_00744_code_11585"}
{"instruction": "Write a bash example for accessing clusters", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret...\n```\n\nAccessing Clusters | First, create the Secret, requesting a token for the default ServiceAccount:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/", "id": "k8s_00744_code_11586"}
{"instruction": "Write a bash example for accessing clusters", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\nAccessing Clusters | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/", "id": "k8s_00744_code_11587"}
{"instruction": "Write a yaml example for accessing clusters", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n```\n\nAccessing Clusters | Next, wait for the token controller to populate the Secret with a token:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/", "id": "k8s_00744_code_11588"}
{"instruction": "How do you configure a pod quota for a namespace in Kubernetes?", "response": "Configure a Pod Quota for a NamespaceRestrict how many Pods you can create within a namespace.This page shows how to set a quota for the total number of Pods that can run in a Namespace. You specify quotas in a ResourceQuota object.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace quota-pod-example Create a ResourceQuotaHere is an example manifest for a ResourceQuota:admin/resource/quota-pod.yaml apiVersion: v1 kind: ResourceQuota metadata: name: pod-demo spec: hard: pods: \"2\" Create the ResourceQuota:kubectl apply -f https://k8s.io/examples/admin/resource/quota-pod.yaml --namespace=quota-pod-example View detailed information about the ResourceQuota:kubectl get resourcequota pod-demo --namespace=quota-pod-example --output=yaml The output shows that the namespace has a quota of two Pods, and that currently there are no Pods; that is, none of the quota is used.spec: hard: pods: \"2\" status: hard: pods: \"2\" used: pods: \"0\" Here is an example manifest for a Deployment:admin/resource/quota-pod-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: pod-quota-demo spec: selector: matchLabels: purpose: quota-demo replicas: 3 template: metadata: labels: purpose: quota-demo spec: containers: - name: pod-quota-demo image: nginx In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.Create the Deployment:kubectl apply -f https://k8s.io/examples/admin/resource/quota-pod-deployment.yaml --namespace=quota-pod-example View detailed information about the Deployment:kubectl get deployment pod-quota-demo --namespace=quota-pod-example --output=yaml The output shows that even though the Deployment specifies three replicas, only two Pods were created because of the quota you defined earlier:spec: ... replicas: 3 ... status: availableReplicas: 2 ... lastUpdateTime: 2021-04-02T20:57:05Z message: 'unable to create pods: pods \"pod-quota-demo-1650323038-\" is forbidden: exceeded quota: pod-demo, requested: pods=1, used: pods=2, limited: pods=2' Choice of resourceIn this task you have defined a ResourceQuota that limited the total number of Pods, but you could also limit the total number of other kinds of object. For example, you might decide to limit how many CronJobs that can live in a single namespace.Clean upDelete your namespace:kubectl delete namespace quota-pod-example What's nextFor cluster administratorsConfigure Default Memory Requests and Limits for a NamespaceConfigure Default CPU Requests and Limits for a NamespaceConfigure Minimum and Maximum Memory Constraints for a NamespaceConfigure Minimum and Maximum CPU Constraints for a NamespaceConfigure Memory and CPU Quotas for a NamespaceConfigure Quotas for API ObjectsFor app developersAssign Memory Resources to Containers and PodsAssign CPU Resources to Containers and PodsAssign Pod-level CPU and memory resourcesConfigure Quality of Service for Pods", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | Here is an example manifest for a ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11590"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\nConfigure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11591"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod.yaml --namespace=quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11592"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota pod-demo --namespace=quota-pod-example --output=yaml\n```\n\nConfigure a Pod Quota for a Namespace | The output shows that the namespace has a quota of two Pods, and that currently there are no Pods; that is, none of the quota is used.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11593"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\nConfigure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11594"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod-deployment.yaml --namespace=quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | View detailed information about the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11595"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment pod-quota-demo --namespace=quota-pod-example --output=yaml\n```\n\nConfigure a Pod Quota for a Namespace | The output shows that even though the Deployment specifies three replicas, only two Pods were created because of the quota you defined earlier:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11596"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11597"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\nConfigure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11598"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  hard:\n    pods: \"2\"\nstatus:\n  hard:\n    pods: \"2\"\n  used:\n    pods: \"0\"\n```\n\nConfigure a Pod Quota for a Namespace | Here is an example manifest for a Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11599"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\nConfigure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11600"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ...\n  replicas: 3\n...\nstatus:\n  availableReplicas: 2\n...\nlastUpdateTime: 2021-04-02T20:57:05Z\n    message: 'unable to create pods: pods \"pod-quota-demo-1650323038-\" is forbidden:\n      exceeded quota: pod-demo, requested: pods=1, used: pods=2, limited: pods=2'\n```\n\nConfigure a Pod Quota for a Namespace | In this task you have defined a ResourceQuota that limited the total number of Pods, but you could also limit the total number of other kinds of object. For example, you might decide to limit how many", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11601"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | Here is an example manifest for a ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11602"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-pod.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\nConfigure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11603"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\nConfigure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11604"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod.yaml --namespace=quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11605"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota pod-demo --namespace=quota-pod-example --output=yaml\n```\n\nConfigure a Pod Quota for a Namespace | The output shows that the namespace has a quota of two Pods, and that currently there are no Pods; that is, none of the quota is used.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11606"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-pod-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\nConfigure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11607"}
{"instruction": "Write a yaml example for configure a pod quota for a namespace", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\nConfigure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11608"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod-deployment.yaml --namespace=quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | View detailed information about the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11609"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment pod-quota-demo --namespace=quota-pod-example --output=yaml\n```\n\nConfigure a Pod Quota for a Namespace | The output shows that even though the Deployment specifies three replicas, only two Pods were created because of the quota you defined earlier:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11610"}
{"instruction": "Write a bash example for configure a pod quota for a namespace", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-pod-example\n```\n\nConfigure a Pod Quota for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace/", "id": "k8s_00745_code_11611"}
{"instruction": "What is the reference documentation for config and storage resources?", "response": "Config and Storage ResourcesConfigMapConfigMap holds configuration data for pods to consume.SecretSecret holds secret data of a certain type.CSIDriverCSIDriver captures information about a Container Storage Interface (CSI) volume driver deployed on the cluster.CSINodeCSINode holds information about all CSI drivers installed on a node.CSIStorageCapacityCSIStorageCapacity stores the result of one CSI GetCapacity call.PersistentVolumeClaimPersistentVolumeClaim is a user's request for and claim to a persistent volume.PersistentVolumePersistentVolume (PV) is a storage resource provisioned by an administrator.StorageClassStorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.StorageVersionMigration v1alpha1StorageVersionMigration represents a migration of stored data to the latest storage version.VolumeVolume represents a named volume in a pod that may be accessed by any container in the pod.VolumeAttachmentVolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.VolumeAttributesClassVolumeAttributesClass represents a specification of mutable volume attributes defined by the CSI driver.This page is automatically generated.If you plan to report an issue with this page, mention that the page is auto-generated in your issue description. The fix may need to happen elsewhere in the Kubernetes project.", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/", "id": "k8s_00746"}
{"instruction": "How do you advertise extended resources for a node in Kubernetes?", "response": "Advertise Extended Resources for a NodeThis page shows how to specify extended resources for a Node. Extended resources allow cluster administrators to advertise node-level resources that would otherwise be unknown to Kubernetes.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Get the names of your Nodeskubectl get nodes Choose one of your Nodes to use for this exercise.Advertise a new extended resource on one of your NodesTo advertise a new extended resource on a Node, send an HTTP PATCH request to the Kubernetes API server. For example, suppose one of your Nodes has four dongles attached. Here's an example of a PATCH request that advertises four dongle resources for your Node.PATCH /api/v1/nodes/<your-node-name>/status HTTP/1.1 Accept: application/json Content-Type: application/json-patch+json Host: k8s-master:8080 [ { \"op\": \"add\", \"path\": \"/status/capacity/example.com~1dongle\", \"value\": \"4\" } ] Note that Kubernetes does not need to know what a dongle is or what a dongle is for. The preceding PATCH request tells Kubernetes that your Node has four things that you call dongles.Start a proxy, so that you can easily send requests to the Kubernetes API server:kubectl proxy In another command window, send the HTTP PATCH request. Replace <your-node-name> with the name of your Node:curl --header \"Content-Type: application/json-patch+json\" \\ --request PATCH \\ --data '[{\"op\": \"add\", \"path\": \"/status/capacity/example.com~1dongle\", \"value\": \"4\"}]' \\ http://localhost:8001/api/v1/nodes/<your-node-name>/status Note:In the preceding request, ~1 is the encoding for the character / in the patch path. The operation path value in JSON-Patch is interpreted as a JSON-Pointer. For more details, see IETF RFC 6901, section 3.The output shows that the Node has a capacity of 4 dongles:\"capacity\": { \"cpu\": \"2\", \"memory\": \"2049008Ki\", \"example.com/dongle\": \"4\", Describe your Node:kubectl describe node <your-node-name> Once again, the output shows the dongle resource:Capacity: cpu: 2 memory: 2049008Ki example.com/dongle: 4 Now, application developers can create Pods that request a certain number of dongles. See Assign Extended Resources to a Container.DiscussionExtended resources are similar to memory and CPU resources. For example, just as a Node has a certain amount of memory and CPU to be shared by all components running on the Node, it can have a certain number of dongles to be shared by all components running on the Node. And just as application developers can create Pods that request a certain amount of memory and CPU, they can create Pods that request a certain number of dongles.Extended resources are opaque to Kubernetes; Kubernetes does not know anything about what they are. Kubernetes knows only that a Node has a certain number of them. Extended resources must be advertised in integer amounts. For example, a Node can advertise four dongles, but not 4.5 dongles.Storage exampleSuppose a Node has 800 GiB of a special kind of disk storage. You could create a name for the special storage, say example.com/special-storage. Then you could advertise it in chunks of a certain size, say 100 GiB. In that case, your Node would advertise that it has eight resources of type example.com/special-storage.Capacity: ... example.com/special-storage: 8 If you want to allow arbitrary requests for special storage, you could advertise special storage in chunks of size 1 byte. In that case, you would advertise 800Gi resources of type example.com/special-storage.Capacity: ... example.com/special-storage: 800Gi Then a Container could request any ", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747"}
{"instruction": "Write a bash example for advertise extended resources for a node", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name>\n```\n\nAdvertise Extended Resources for a Node | Once again, the output shows the dongle resource:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747_code_11614"}
{"instruction": "Write a bash example for advertise extended resources for a node", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name> | grep dongle\n```\n\nAdvertise Extended Resources for a Node | (you should not see any output)", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747_code_11615"}
{"instruction": "Write a bash example for advertise extended resources for a node", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name>\n```\n\nAdvertise Extended Resources for a Node | Once again, the output shows the dongle resource:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747_code_11616"}
{"instruction": "Write a yaml example for advertise extended resources for a node", "response": "Here's a yaml example:\n\n```yaml\nCapacity:\n  cpu: 2\n  memory: 2049008Ki\n  example.com/dongle: 4\n```\n\nAdvertise Extended Resources for a Node | Now, application developers can create Pods that request a certain number of dongles. See Assign Extended Resources to a Container.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747_code_11617"}
{"instruction": "Write a yaml example for advertise extended resources for a node", "response": "Here's a yaml example:\n\n```yaml\nCapacity:\n ...\n example.com/special-storage: 8\n```\n\nAdvertise Extended Resources for a Node | If you want to allow arbitrary requests for special storage, you could advertise special storage in chunks of size 1 byte. In that case, you would advertise 800Gi resources of type example.com/special", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747_code_11618"}
{"instruction": "Write a yaml example for advertise extended resources for a node", "response": "Here's a yaml example:\n\n```yaml\nCapacity:\n ...\n example.com/special-storage:  800Gi\n```\n\nAdvertise Extended Resources for a Node | Then a Container could request any number of bytes of special storage, up to 800Gi.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747_code_11619"}
{"instruction": "Write a bash example for advertise extended resources for a node", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name> | grep dongle\n```\n\nAdvertise Extended Resources for a Node | (you should not see any output)", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/extended-resource-node/", "id": "k8s_00747_code_11620"}
{"instruction": "What is the reference documentation for kubectl auth whoami?", "response": "kubectl auth whoamiSynopsisExperimental: Check who you are and your attributes (groups, extra). This command is helpful to get yourself aware of the current user attributes, especially when dynamic authentication, e.g., token webhook, auth proxy, or OIDC provider, is enabled in the Kubernetes cluster. kubectl auth whoami Examples # Get your subject attributes kubectl auth whoami # Get your subject attributes in JSON format kubectl auth whoami -o json Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.-h, --helphelp for whoami-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_auth/kubectl_auth_whoami/", "id": "k8s_00748"}
{"instruction": "Explain the Kubernetes concept: Controlling Access to the Kubernetes API", "response": "Controlling Access to the Kubernetes APIThis page provides an overview of controlling access to the Kubernetes API.Users access the Kubernetes API using kubectl, client libraries, or by making REST requests. Both human users and Kubernetes service accounts can be authorized for API access. When a request reaches the API, it goes through several stages, illustrated in the following diagram:Transport securityBy default, the Kubernetes API server listens on port 6443 on the first non-localhost network interface, protected by TLS. In a typical production Kubernetes cluster, the API serves on port 443. The port can be changed with the --secure-port, and the listening IP address with the --bind-address flag.The API server presents a certificate. This certificate may be signed using a private certificate authority (CA), or based on a public key infrastructure linked to a generally recognized CA. The certificate and corresponding private key can be set by using the --tls-cert-file and --tls-private-key-file flags.If your cluster uses a private certificate authority, you need a copy of that CA certificate configured into your ~/.kube/config on the client, so that you can trust the connection and be confident it was not intercepted.Your client can present a TLS client certificate at this stage.AuthenticationOnce TLS is established, the HTTP request moves to the Authentication step. This is shown as step 1 in the diagram. The cluster creation script or cluster admin configures the API server to run one or more Authenticator modules. Authenticators are described in more detail in Authentication.The input to the authentication step is the entire HTTP request; however, it typically examines the headers and/or client certificate.Authentication modules include client certificates, password, and plain tokens, bootstrap tokens, and JSON Web Tokens (used for service accounts).Multiple authentication modules can be specified, in which case each one is tried in sequence, until one of them succeeds.If the request cannot be authenticated, it is rejected with HTTP status code 401. Otherwise, the user is authenticated as a specific username, and the user name is available to subsequent steps to use in their decisions. Some authenticators also provide the group memberships of the user, while other authenticators do not.While Kubernetes uses usernames for access control decisions and in request logging, it does not have a User object nor does it store usernames or other information about users in its API.AuthorizationAfter the request is authenticated as coming from a specific user, the request must be authorized. This is shown as step 2 in the diagram.A request must include the username of the requester, the requested action, and the object affected by the action. The request is authorized if an existing policy declares that the user has permissions to complete the requested action.For example, if Bob has the policy below, then he can read pods only in the namespace projectCaribou:{ \"apiVersion\": \"abac.authorization.kubernetes.io/v1beta1\", \"kind\": \"Policy\", \"spec\": { \"user\": \"bob\", \"namespace\": \"projectCaribou\", \"resource\": \"pods\", \"readonly\": true } } If Bob makes the following request, the request is authorized because he is allowed to read objects in the projectCaribou namespace:{ \"apiVersion\": \"authorization.k8s.io/v1beta1\", \"kind\": \"SubjectAccessReview\", \"spec\": { \"resourceAttributes\": { \"namespace\": \"projectCaribou\", \"verb\": \"get\", \"group\": \"unicorn.example.org\", \"resource\": \"pods\" } } } If Bob makes a request to write (create or update) to the objects in the projectCaribou namespace, his authorization is denied. If Bob makes a request to read (get) objects in a different namespace such as projectFish, then his authorization is denied.Kubernetes authorization requires that you use common REST attributes to interact with existing organization-wide or cloud-provider-wide access control systems. It is important to use REST formatting because these c", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/controlling-access/", "id": "k8s_00749"}
{"instruction": "How do you use cilium for networkpolicy in Kubernetes?", "response": "Use Cilium for NetworkPolicyThis page shows how to use Cilium for NetworkPolicy.For background on Cilium, read the Introduction to Cilium.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Deploying Cilium on Minikube for Basic TestingTo get familiar with Cilium easily you can follow the Cilium Kubernetes Getting Started Guide to perform a basic DaemonSet installation of Cilium in minikube.To start minikube, minimal version required is >= v1.5.2, run the with the following arguments:minikube version minikube version: v1.5.2 minikube start --network-plugin=cni For minikube you can install Cilium using its CLI tool. To do so, first download the latest version of the CLI with the following command:curl -LO https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz Then extract the downloaded file to your /usr/local/bin directory with the following command:sudo tar xzvfC cilium-linux-amd64.tar.gz /usr/local/bin rm cilium-linux-amd64.tar.gz After running the above commands, you can now install Cilium with the following command:cilium install Cilium will then automatically detect the cluster configuration and create and install the appropriate components for a successful installation. The components are:Certificate Authority (CA) in Secret cilium-ca and certificates for Hubble (Cilium's observability layer).Service accounts.Cluster roles.ConfigMap.Agent DaemonSet and an Operator Deployment.After the installation, you can view the overall status of the Cilium deployment with the cilium status command. See the expected output of the status command here.The remainder of the Getting Started Guide explains how to enforce both L3/L4 (i.e., IP address + port) security policies, as well as L7 (e.g., HTTP) security policies using an example application.Deploying Cilium for Production UseFor detailed instructions around deploying Cilium for production, see: Cilium Kubernetes Installation Guide This documentation includes detailed requirements, instructions and example production DaemonSet files.Understanding Cilium componentsDeploying a cluster with Cilium adds Pods to the kube-system namespace. To see this list of Pods run:kubectl get pods --namespace=kube-system -l k8s-app=cilium You'll see a list of Pods similar to this:NAME READY STATUS RESTARTS AGE cilium-kkdhz 1/1 Running 0 3m23s ... A cilium Pod runs on each node in your cluster and enforces network policy on the traffic to/from Pods on that node using Linux BPF.What's nextOnce your cluster is running, you can follow the Declare Network Policy to try out Kubernetes NetworkPolicy with Cilium. Have fun, and if you have questions, contact us using the Cilium Slack Channel.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/", "id": "k8s_00750"}
{"instruction": "Write a bash example for use cilium for networkpolicy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=cilium\n```\n\nUse Cilium for NetworkPolicy | You'll see a list of Pods similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/", "id": "k8s_00750_code_11624"}
{"instruction": "Write a bash example for use cilium for networkpolicy", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=cilium\n```\n\nUse Cilium for NetworkPolicy | You'll see a list of Pods similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/", "id": "k8s_00750_code_11625"}
{"instruction": "What is the reference documentation for kubectl rollout status?", "response": "kubectl rollout statusSynopsisShow the status of the rollout.By default 'rollout status' will watch the status of the latest rollout until it's done. If you don't want to wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts in-between, then 'rollout status' will continue watching the latest revision. If you want to pin to a specific revision and abort if it is rolled over by another revision, use --revision=N where N is the revision you need to watch for.kubectl rollout status (TYPE NAME | TYPE/NAME) [flags] Examples # Watch the rollout status of a deployment kubectl rollout status deployment/nginx Options-f, --filename stringsFilename, directory, or URL to files identifying the resource to get from a server.-h, --helphelp for status-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--revision intPin to a specific revision for showing its status. Defaults to 0 (last revision).-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--timeout durationThe length of time to wait before ending watch, zero means never. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).-w, --watch Default: trueWatch the status of the rollout until it's done.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Defau", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_status/", "id": "k8s_00751"}
{"instruction": "Write a bash example for kubectl rollout status", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status (TYPE NAME | TYPE/NAME) [flags]\n```\n\nkubectl rollout status | Filename, directory, or URL to files identifying the resource to get from a server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_status/", "id": "k8s_00751_code_11627"}
{"instruction": "Write a bash example for kubectl rollout status", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status (TYPE NAME | TYPE/NAME) [flags]\n```\n\nkubectl rollout status | Filename, directory, or URL to files identifying the resource to get from a server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_status/", "id": "k8s_00751_code_11628"}
{"instruction": "What is the reference documentation for endpointslice?", "response": "EndpointSliceEndpointSlice represents a set of service endpoints.apiVersion: discovery.k8s.io/v1import \"k8s.io/api/discovery/v1\"EndpointSliceEndpointSlice represents a set of service endpoints. Most EndpointSlices are created by the EndpointSlice controller to represent the Pods selected by Service objects. For a given service there may be multiple EndpointSlice objects which must be joined to produce the full set of endpoints; you can find all of the slices for a given service by listing EndpointSlices in the service's namespace whose kubernetes.io/service-name label contains the service's name.apiVersion: discovery.k8s.io/v1kind: EndpointSlicemetadata (ObjectMeta)Standard object's metadata.addressType (string), requiredaddressType specifies the type of address carried by this EndpointSlice. All addresses in this slice must be the same type. This field is immutable after creation. The following address types are currently supported: * IPv4: Represents an IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN: Represents a Fully Qualified Domain Name. (Deprecated) The EndpointSlice controller only generates, and kube-proxy only processes, slices of addressType \"IPv4\" and \"IPv6\". No semantics are defined for the \"FQDN\" type.endpoints ([]Endpoint), requiredAtomic: will be replaced during a mergeendpoints is a list of unique endpoints in this slice. Each slice may include a maximum of 1000 endpoints.Endpoint represents a single logical \"backend\" implementing a service.endpoints.addresses ([]string), requiredSet: unique values will be kept during a mergeaddresses of this endpoint. For EndpointSlices of addressType \"IPv4\" or \"IPv6\", the values are IP addresses in canonical form. The syntax and semantics of other addressType values are not defined. This must contain at least one address but no more than 100. EndpointSlices generated by the EndpointSlice controller will always have exactly 1 address. No semantics are defined for additional addresses beyond the first, and kube-proxy does not look at them.endpoints.conditions (EndpointConditions)conditions contains information about the current status of the endpoint.EndpointConditions represents the current condition of an endpoint.endpoints.conditions.ready (boolean)ready indicates that this endpoint is ready to receive traffic, according to whatever system is managing the endpoint. A nil value should be interpreted as \"true\". In general, an endpoint should be marked ready if it is serving and not terminating, though this can be overridden in some cases, such as when the associated Service has set the publishNotReadyAddresses flag.endpoints.conditions.serving (boolean)serving indicates that this endpoint is able to receive traffic, according to whatever system is managing the endpoint. For endpoints backed by pods, the EndpointSlice controller will mark the endpoint as serving if the pod's Ready condition is True. A nil value should be interpreted as \"true\".endpoints.conditions.terminating (boolean)terminating indicates that this endpoint is terminating. A nil value should be interpreted as \"false\".endpoints.deprecatedTopology (map[string]string)deprecatedTopology contains topology information part of the v1beta1 API. This field is deprecated, and will be removed when the v1beta1 API is removed (no sooner than kubernetes v1.24). While this field can hold values, it is not writable through the v1 API, and any attempts to write to it will be silently ignored. Topology information can be found in the zone and nodeName fields instead.endpoints.hints (EndpointHints)hints contains information associated with how an endpoint should be consumed.EndpointHints provides hints describing how an endpoint should be consumed.endpoints.hints.forNodes ([]ForNode)Atomic: will be replaced during a mergeforNodes indicates the node(s) this endpoint should be consumed by when using topology aware routing. May contain a maximum of 8 entries. This is an Alpha feature and is only used when the PreferSameTr", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/", "id": "k8s_00752"}
{"instruction": "Write a yaml example for endpointslice", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\n```\n\nEndpointSlice | import \"k8s.io/api/discovery/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/", "id": "k8s_00752_code_11630"}
{"instruction": "Provide a tutorial on learn kubernetes basics", "response": "Learn Kubernetes BasicsObjectivesThis tutorial provides a walkthrough of the basics of the Kubernetes cluster orchestration system. Each module contains some background information on major Kubernetes features and concepts, and a tutorial for you to follow along.Using the tutorials, you can learn to:Deploy a containerized application on a cluster.Scale the deployment.Update the containerized application with a new software version.Debug the containerized application.What can Kubernetes do for you?With modern web services, users expect applications to be available 24/7, and developers expect to deploy new versions of those applications several times a day. Containerization helps package software to serve these goals, enabling applications to be released and updated without downtime. Kubernetes helps you make sure those containerized applications run where and when you want, and helps them find the resources and tools they need to work. Kubernetes is a production-ready, open source platform designed with Google's accumulated experience in container orchestration, combined with best-of-breed ideas from the community.Kubernetes Basics Modules1. Create a Kubernetes cluster2. Deploy an app3. Explore your app4. Expose your app publicly5. Scale up your app6. Update your appWhat's nextTutorial Using Minikube to Create a Cluster", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/", "id": "k8s_00753"}
{"instruction": "Explain the Kubernetes concept: Security Checklist", "response": "Security ChecklistBaseline checklist for ensuring security in Kubernetes clusters.This checklist aims at providing a basic list of guidance with links to more comprehensive documentation on each topic. It does not claim to be exhaustive and is meant to evolve.On how to read and use this document:The order of topics does not reflect an order of priority.Some checklist items are detailed in the paragraph below the list of each section.Caution:Checklists are not sufficient for attaining a good security posture on their own. A good security posture requires constant attention and improvement, but a checklist can be the first step on the never-ending journey towards security preparedness. Some of the recommendations in this checklist may be too restrictive or too lax for your specific security needs. Since Kubernetes security is not \"one size fits all\", each category of checklist items should be evaluated on its merits.Authentication & Authorization system:masters group is not used for user or component authentication after bootstrapping. The kube-controller-manager is running with --use-service-account-credentials enabled. The root certificate is protected (either an offline CA, or a managed online CA with effective access controls). Intermediate and leaf certificates have an expiry date no more than 3 years in the future. A process exists for periodic access review, and reviews occur no more than 24 months apart. The Role Based Access Control Good Practices are followed for guidance related to authentication and authorization.After bootstrapping, neither users nor components should authenticate to the Kubernetes API as system:masters. Similarly, running all of kube-controller-manager as system:masters should be avoided. In fact, system:masters should only be used as a break-glass mechanism, as opposed to an admin user.Network security CNI plugins in use support network policies. Ingress and egress network policies are applied to all workloads in the cluster. Default network policies within each namespace, selecting all pods, denying everything, are in place. If appropriate, a service mesh is used to encrypt all communications inside of the cluster. The Kubernetes API, kubelet API and etcd are not exposed publicly on Internet. Access from the workloads to the cloud metadata API is filtered. Use of LoadBalancer and ExternalIPs is restricted.A number of Container Network Interface (CNI) plugins plugins provide the functionality to restrict network resources that pods may communicate with. This is most commonly done through Network Policies which provide a namespaced resource to define rules. Default network policies that block all egress and ingress, in each namespace, selecting all pods, can be useful to adopt an allow list approach to ensure that no workloads are missed.Not all CNI plugins provide encryption in transit. If the chosen plugin lacks this feature, an alternative solution could be to use a service mesh to provide that functionality.The etcd datastore of the control plane should have controls to limit access and not be publicly exposed on the Internet. Furthermore, mutual TLS (mTLS) should be used to communicate securely with it. The certificate authority for this should be unique to etcd.External Internet access to the Kubernetes API server should be restricted to not expose the API publicly. Be careful, as many managed Kubernetes distributions are publicly exposing the API server by default. You can then use a bastion host to access the server.The kubelet API access should be restricted and not exposed publicly, the default authentication and authorization settings, when no configuration file specified with the --config flag, are overly permissive.If a cloud provider is used for hosting Kubernetes, the access from pods to the cloud metadata API 169.254.169.254 should also be restricted or blocked if not needed because it may leak information.For restricted LoadBalancer and ExternalIPs use, see CVE-2020-8554: Man in th", "category": "concepts", "subcategory": "security-policies", "source": "https://kubernetes.io/docs/concepts/security/security-checklist/", "id": "k8s_00754"}
{"instruction": "Explain the Kubernetes concept: Kubernetes Components", "response": "Kubernetes ComponentsAn overview of the key components that make up a Kubernetes cluster.This page provides a high-level overview of the essential components that make up a Kubernetes cluster.The components of a Kubernetes clusterCore ComponentsA Kubernetes cluster consists of a control plane and one or more worker nodes. Here's a brief overview of the main components:Control Plane ComponentsManage the overall state of the cluster:kube-apiserverThe core component server that exposes the Kubernetes HTTP API.etcdConsistent and highly-available key value store for all API server data.kube-schedulerLooks for Pods not yet bound to a node, and assigns each Pod to a suitable node.kube-controller-managerRuns controllers to implement Kubernetes API behavior.cloud-controller-manager (optional)Integrates with underlying cloud provider(s).Node ComponentsRun on every node, maintaining running pods and providing the Kubernetes runtime environment:kubeletEnsures that Pods are running, including their containers.kube-proxy (optional)Maintains network rules on nodes to implement Services.Container runtimeSoftware responsible for running containers. Read Container Runtimes to learn more.🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationYour cluster may require additional software on each node; for example, you might also run systemd on a Linux node to supervise local components.AddonsAddons extend the functionality of Kubernetes. A few important examples include:DNSFor cluster-wide DNS resolution.Web UI (Dashboard)For cluster management via a web interface.Container Resource MonitoringFor collecting and storing container metrics.Cluster-level LoggingFor saving container logs to a central log store.Flexibility in ArchitectureKubernetes allows for flexibility in how these components are deployed and managed. The architecture can be adapted to various needs, from small development environments to large-scale production deployments.For more detailed information about each component and various ways to configure your cluster architecture, see the Cluster Architecture page.Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/components/", "id": "k8s_00755"}
{"instruction": "What is the reference documentation for kubectl certificate approve?", "response": "kubectl certificate approveSynopsisApprove a certificate signing request.kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requester with the attributes requested in the CSR.SECURITY NOTICE: Depending on the requested attributes, the issued certificate can potentially grant a requester access to cluster resources or to authenticate as a requested identity. Before approving a CSR, ensure you understand what the signed certificate can do.kubectl certificate approve (-f FILENAME | NAME) Examples # Approve CSR 'csr-sqgzp' kubectl certificate approve csr-sqgzp Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update--forceUpdate the CSR even if it is already approved.-h, --helphelp for approve-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string D", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/kubectl_certificate_approve/", "id": "k8s_00756"}
{"instruction": "Write a bash example for kubectl certificate approve", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve (-f FILENAME | NAME)\n```\n\nkubectl certificate approve | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/kubectl_certificate_approve/", "id": "k8s_00756_code_11635"}
{"instruction": "Write a bash example for kubectl certificate approve", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve (-f FILENAME | NAME)\n```\n\nkubectl certificate approve | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_certificate/kubectl_certificate_approve/", "id": "k8s_00756_code_11636"}
{"instruction": "Explain the Kubernetes concept: Custom Resources", "response": "Custom ResourcesCustom resources are extensions of the Kubernetes API. This page discusses when to add a custom resource to your Kubernetes cluster and when to use a standalone service. It describes the two methods for adding custom resources and how to choose between them.Custom resourcesA resource is an endpoint in the Kubernetes API that stores a collection of API objects of a certain kind; for example, the built-in pods resource contains a collection of Pod objects.A custom resource is an extension of the Kubernetes API that is not necessarily available in a default Kubernetes installation. It represents a customization of a particular Kubernetes installation. However, many core Kubernetes functions are now built using custom resources, making Kubernetes more modular.Custom resources can appear and disappear in a running cluster through dynamic registration, and cluster admins can update custom resources independently of the cluster itself. Once a custom resource is installed, users can create and access its objects using kubectl, just as they do for built-in resources like Pods.Custom controllersOn their own, custom resources let you store and retrieve structured data. When you combine a custom resource with a custom controller, custom resources provide a true declarative API.The Kubernetes declarative API enforces a separation of responsibilities. You declare the desired state of your resource. The Kubernetes controller keeps the current state of Kubernetes objects in sync with your declared desired state. This is in contrast to an imperative API, where you instruct a server what to do.You can deploy and update a custom controller on a running cluster, independently of the cluster's lifecycle. Custom controllers can work with any kind of resource, but they are especially effective when combined with custom resources. The Operator pattern combines custom resources and custom controllers. You can use custom controllers to encode domain knowledge for specific applications into an extension of the Kubernetes API.Should I add a custom resource to my Kubernetes cluster?When creating a new API, consider whether to aggregate your API with the Kubernetes cluster APIs or let your API stand alone.Consider API aggregation if:Prefer a stand-alone API if:Your API is Declarative.Your API does not fit the Declarative model.You want your new types to be readable and writable using kubectl.kubectl support is not requiredYou want to view your new types in a Kubernetes UI, such as dashboard, alongside built-in types.Kubernetes UI support is not required.You are developing a new API.You already have a program that serves your API and works well.You are willing to accept the format restriction that Kubernetes puts on REST resource paths, such as API Groups and Namespaces. (See the API Overview.)You need to have specific REST paths to be compatible with an already defined REST API.Your resources are naturally scoped to a cluster or namespaces of a cluster.Cluster or namespace scoped resources are a poor fit; you need control over the specifics of resource paths.You want to reuse Kubernetes API support features.You don't need those features.Declarative APIsIn a Declarative API, typically:Your API consists of a relatively small number of relatively small objects (resources).The objects define configuration of applications or infrastructure.The objects are updated relatively infrequently.Humans often need to read and write the objects.The main operations on the objects are CRUD-y (creating, reading, updating and deleting).Transactions across objects are not required: the API represents a desired state, not an exact state.Imperative APIs are not declarative. Signs that your API might not be declarative include:The client says \"do this\", and then gets a synchronous response back when it is done.The client says \"do this\", and then gets an operation ID back, and has to check a separate Operation object to determine completion of the request.You talk ", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757"}
{"instruction": "Write a yaml example for custom resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nCustom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757_code_11638"}
{"instruction": "Write a bash example for custom resources", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\nCustom Resources | The output should be:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757_code_11639"}
{"instruction": "Write a bash example for custom resources", "response": "Here's a bash example:\n\n```bash\nkubectl get my-object object-name\n```\n\nCustom Resources | Kubernetes provides two ways to add custom resources to your cluster:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757_code_11640"}
{"instruction": "Write a yaml example for custom resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nCustom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757_code_11641"}
{"instruction": "Write a yaml example for custom resources", "response": "Here's a yaml example:\n\n```yaml\ncustomresourcedefinition/shirt-resource-definition.yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nCustom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757_code_11642"}
{"instruction": "Write a yaml example for custom resources", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\nCustom Resources | Field selectors can then be used to get only resources with a color of blue:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757_code_11643"}
{"instruction": "Write a bash example for custom resources", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\nCustom Resources | The output should be:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/", "id": "k8s_00757_code_11644"}
{"instruction": "How do you delete a statefulset in Kubernetes?", "response": "Delete a StatefulSetThis task shows you how to delete a StatefulSet.Before you beginThis task assumes you have an application running on your cluster represented by a StatefulSet.Deleting a StatefulSetYou can delete a StatefulSet in the same way you delete other resources in Kubernetes: use the kubectl delete command, and specify the StatefulSet either by file or by name.kubectl delete -f <file.yaml> kubectl delete statefulsets <statefulset-name> You may need to delete the associated headless service separately after the StatefulSet itself is deleted.kubectl delete service <service-name> When deleting a StatefulSet through kubectl, the StatefulSet scales down to 0. All Pods that are part of this workload are also deleted. If you want to delete only the StatefulSet and not the Pods, use --cascade=orphan. For example:kubectl delete -f <file.yaml> --cascade=orphan By passing --cascade=orphan to kubectl delete, the Pods managed by the StatefulSet are left behind even after the StatefulSet object itself is deleted. If the pods have a label app.kubernetes.io/name=MyApp, you can then delete them as follows:kubectl delete pods -l app.kubernetes.io/name=MyApp Persistent VolumesDeleting the Pods in a StatefulSet will not delete the associated volumes. This is to ensure that you have the chance to copy data off the volume before deleting it. Deleting the PVC after the pods have terminated might trigger deletion of the backing Persistent Volumes depending on the storage class and reclaim policy. You should never assume ability to access a volume after claim deletion.Note:Use caution when deleting a PVC, as it may lead to data loss.Complete deletion of a StatefulSetTo delete everything in a StatefulSet, including the associated pods, you can run a series of commands similar to the following:grace=$(kubectl get pods <stateful-set-pod> --template '{{.spec.terminationGracePeriodSeconds}}') kubectl delete statefulset -l app.kubernetes.io/name=MyApp sleep $grace kubectl delete pvc -l app.kubernetes.io/name=MyApp In the example above, the Pods have the label app.kubernetes.io/name=MyApp; substitute your own label as appropriate.Force deletion of StatefulSet podsIf you find that some pods in your StatefulSet are stuck in the 'Terminating' or 'Unknown' states for an extended period of time, you may need to manually intervene to forcefully delete the pods from the apiserver. This is a potentially dangerous task. Refer to Force Delete StatefulSet Pods for details.What's nextLearn more about force deleting StatefulSet Pods.", "category": "tasks", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml>\n```\n\nDelete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11646"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulsets <statefulset-name>\n```\n\nDelete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11647"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete service <service-name>\n```\n\nDelete a StatefulSet | When deleting a StatefulSet through kubectl, the StatefulSet scales down to 0. All Pods that are part of this workload are also deleted. If you want to delete only the StatefulSet and not the Pods, us", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11648"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml> --cascade=orphan\n```\n\nDelete a StatefulSet | By passing --cascade=orphan to kubectl delete, the Pods managed by the StatefulSet are left behind even after the StatefulSet object itself is deleted. If the pods have a label app.kubernetes.io/name=", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11649"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods -l app.kubernetes.io/name=MyApp\n```\n\nDelete a StatefulSet | Deleting the Pods in a StatefulSet will not delete the associated volumes. This is to ensure that you have the chance to copy data off the volume before deleting it. Deleting the PVC after the pods ha", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11650"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml>\n```\n\nDelete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11651"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulsets <statefulset-name>\n```\n\nDelete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11652"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete service <service-name>\n```\n\nDelete a StatefulSet | When deleting a StatefulSet through kubectl, the StatefulSet scales down to 0. All Pods that are part of this workload are also deleted. If you want to delete only the StatefulSet and not the Pods, us", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11653"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml> --cascade=orphan\n```\n\nDelete a StatefulSet | By passing --cascade=orphan to kubectl delete, the Pods managed by the StatefulSet are left behind even after the StatefulSet object itself is deleted. If the pods have a label app.kubernetes.io/name=", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11654"}
{"instruction": "Write a bash example for delete a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods -l app.kubernetes.io/name=MyApp\n```\n\nDelete a StatefulSet | Deleting the Pods in a StatefulSet will not delete the associated volumes. This is to ensure that you have the chance to copy data off the volume before deleting it. Deleting the PVC after the pods ha", "category": "tasks_code", "subcategory": "access-applications", "source": "https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/", "id": "k8s_00758_code_11655"}
{"instruction": "How do you install tools in Kubernetes?", "response": "Install ToolsSet up Kubernetes tools on your computer.kubectlThe Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. For more information including a complete list of kubectl operations, see the kubectl reference documentation.kubectl is installable on a variety of Linux platforms, macOS and Windows. Find your preferred operating system below.Install kubectl on LinuxInstall kubectl on macOSInstall kubectl on Windowskindkind lets you run Kubernetes on your local computer. This tool requires that you have either Docker or Podman installed.The kind Quick Start page shows you what you need to do to get up and running with kind.View kind Quick Start GuideminikubeLike kind, minikube is a tool that lets you run Kubernetes locally. minikube runs an all-in-one or a multi-node local Kubernetes cluster on your personal computer (including Windows, macOS and Linux PCs) so that you can try out Kubernetes, or for daily development work.You can follow the official Get Started! guide if your focus is on getting the tool installed.View minikube Get Started! GuideOnce you have minikube working, you can use it to run a sample application.kubeadmYou can use the kubeadm tool to create and manage Kubernetes clusters. It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way.Installing kubeadm shows you how to install kubeadm. Once installed, you can use it to create a cluster.View kubeadm Install Guide", "category": "tasks", "subcategory": "install-setup", "source": "https://kubernetes.io/docs/tasks/tools/", "id": "k8s_00759"}
{"instruction": "What is the reference documentation for kubectl scale?", "response": "kubectl scaleSynopsisSet a new size for a deployment, replica set, replication controller, or stateful set.Scale also allows users to specify one or more preconditions for the scale action.If --current-replicas or --resource-version is specified, it is validated before the scale is attempted, and it is guaranteed that the precondition holds true when the scale is sent to the server.kubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME) Examples # Scale a replica set named 'foo' to 3 kubectl scale --replicas=3 rs/foo # Scale a resource identified by type and name specified in \"foo.yaml\" to 3 kubectl scale --replicas=3 -f foo.yaml # If the deployment named mysql's current size is 2, scale mysql to 3 kubectl scale --current-replicas=2 --replicas=3 deployment/mysql # Scale multiple replication controllers kubectl scale --replicas=5 rc/example1 rc/example2 rc/example3 # Scale stateful set named 'web' to 3 kubectl scale --replicas=3 statefulset/web Options--allSelect all resources in the namespace of the specified resource types--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--current-replicas int Default: -1Precondition for current size. Requires that the current size of the resource match this value in order to scale. -1 (default) for no condition.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.-f, --filename stringsFilename, directory, or URL to files identifying the resource to set a new size-h, --helphelp for scale-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--replicas intThe new desired number of replicas. Required.--resource-version stringPrecondition for resource version. Requires that the current resource version match this value in order to scale.-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--timeout durationThe length of time to wait before giving up on a scale operation, zero means don't wait. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not ", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_scale/", "id": "k8s_00760"}
{"instruction": "Write a bash example for kubectl scale", "response": "Here's a bash example:\n\n```bash\nkubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)\n```\n\nkubectl scale | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_scale/", "id": "k8s_00760_code_11658"}
{"instruction": "Write a bash example for kubectl scale", "response": "Here's a bash example:\n\n```bash\nkubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)\n```\n\nkubectl scale | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_scale/", "id": "k8s_00760_code_11659"}
{"instruction": "How do you upgrading linux nodes in Kubernetes?", "response": "Upgrading Linux nodesThis page explains how to upgrade a Linux Worker Nodes created with kubeadm.Before you beginYou need to have shell access to all the nodes, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts.To check the version, enter kubectl version.Familiarize yourself with the process for upgrading the rest of your kubeadm cluster. You will want to upgrade the control plane nodes before upgrading your Linux Worker nodes.Changing the package repositoryIf you're using the community-owned package repositories (pkgs.k8s.io), you need to enable the package repository for the desired Kubernetes minor release. This is explained in Changing the Kubernetes package repository document.Note: The legacy package repositories (apt.kubernetes.io and yum.kubernetes.io) have been deprecated and frozen starting from September 13, 2023. Using the new package repositories hosted at pkgs.k8s.io is strongly recommended and required in order to install Kubernetes versions released after September 13, 2023. The deprecated legacy repositories, and their contents, might be removed at any time in the future and without a further notice period. The new package repositories provide downloads for Kubernetes versions starting with v1.24.0.Upgrading worker nodesUpgrade kubeadmUpgrade kubeadm:# replace x in 1.34.x-* with the latest patch version sudo apt-mark unhold kubeadm && \\ sudo apt-get update && sudo apt-get install -y kubeadm='1.34.x-*' && \\ sudo apt-mark hold kubeadm For systems with DNF:# replace x in 1.34.x-* with the latest patch version sudo yum install -y kubeadm-'1.34.x-*' --disableexcludes=kubernetes For systems with DNF5:# replace x in 1.34.x-* with the latest patch version sudo yum install -y kubeadm-'1.34.x-*' --setopt=disable_excludes=kubernetes Call \"kubeadm upgrade\"For worker nodes this upgrades the local kubelet configuration:sudo kubeadm upgrade node Drain the nodePrepare the node for maintenance by marking it unschedulable and evicting the workloads:# execute this command on a control plane node # replace <node-to-drain> with the name of your node you are draining kubectl drain <node-to-drain> --ignore-daemonsets Upgrade kubelet and kubectlUpgrade the kubelet and kubectl:# replace x in 1.34.x-* with the latest patch version sudo apt-mark unhold kubelet kubectl && \\ sudo apt-get update && sudo apt-get install -y kubelet='1.34.x-*' kubectl='1.34.x-*' && \\ sudo apt-mark hold kubelet kubectl For systems with DNF:# replace x in 1.34.x-* with the latest patch version sudo yum install -y kubelet-'1.34.x-*' kubectl-'1.34.x-*' --disableexcludes=kubernetes For systems with DNF5:# replace x in 1.34.x-* with the latest patch version sudo yum install -y kubelet-'1.34.x-*' kubectl-'1.34.x-*' --setopt=disable_excludes=kubernetes Restart the kubelet:sudo systemctl daemon-reload sudo systemctl restart kubelet Uncordon the nodeBring the node back online by marking it schedulable:# execute this command on a control plane node # replace <node-to-uncordon> with the name of your node kubectl uncordon <node-to-uncordon> What's nextSee how to Upgrade Windows nodes.", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/upgrading-linux-nodes/", "id": "k8s_00761"}
{"instruction": "What is the reference documentation for kubectl top node?", "response": "kubectl top nodeSynopsisDisplay resource (CPU/memory) usage of nodes.The top-node command allows you to see the resource consumption of nodes.kubectl top node [NAME | -l label] Examples # Show metrics for all nodes kubectl top node # Show metrics for a given node kubectl top node NODE_NAME Options-h, --helphelp for node--no-headersIf present, print output without headers-l, --selector stringSelector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.--show-capacityPrint node resources based on Capacity instead of Allocatable(default) of the nodes.--show-swapPrint node resources related to swap memory.--sort-by stringIf non-empty, sort nodes list using specified field. The field can be either 'cpu' or 'memory'.--use-protocol-buffers Default: trueEnables using protocol-buffers to access Metrics API.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string Default: \"0\"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: \"cadvisor\"database name--storage-driver-host string Default: \"localhost:8086\"database host:port--storage-driver-password string Default: \"root\"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: \"stats\"table name--storage-driver-user string Default: \"root\"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=true]--version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version--warnings-as-errorsTreat warnings received from the server as errors and exit with a non-zero exit codeSee Alsokubectl top - Display resource (CPU/memory) usageTh", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/kubectl_top_node/", "id": "k8s_00762"}
{"instruction": "Write a bash example for kubectl top node", "response": "Here's a bash example:\n\n```bash\nkubectl top node [NAME | -l label]\n```\n\nkubectl top node | help for node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/kubectl_top_node/", "id": "k8s_00762_code_11662"}
{"instruction": "Write a bash example for kubectl top node", "response": "Here's a bash example:\n\n```bash\nkubectl top node [NAME | -l label]\n```\n\nkubectl top node | help for node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/kubectl_top_node/", "id": "k8s_00762_code_11663"}
{"instruction": "What is the reference documentation for kubectl autoscale?", "response": "kubectl autoscaleSynopsisCreates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster. The command will attempt to use the autoscaling/v2 API first, in case of an error, it will fall back to autoscaling/v1 API.Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the given resource as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY] Examples # Auto scale a deployment \"foo\", with the number of pods between 2 and 10, no target CPU utilization specified so a default autoscaling policy will be used kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a replication controller \"foo\", with the number of pods between 1 and 5, target CPU utilization at 80% kubectl autoscale rc foo --max=5 --cpu=80% # Auto scale a deployment \"bar\", with the number of pods between 3 and 6, target average CPU of 500m and memory of 200Mi kubectl autoscale deployment bar --min=3 --max=6 --cpu=500m --memory=200Mi # Auto scale a deployment \"bar\", with the number of pods between 2 and 8, target CPU utilization 60% and memory utilization 70% kubectl autoscale deployment bar --min=3 --max=6 --cpu=60% --memory=70% Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--cpu stringTarget CPU utilization over all the pods. When specified as a percentage (e.g.\"70%\" for 70% of requested CPU) it will target average utilization. When specified as quantity (e.g.\"500m\" for 500 milliCPU) it will target average value. Value without units is treated as a quantity with miliCPU being the unit (e.g.\"500\" is \"500m\").--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-autoscale\"Name of the manager used to track field ownership.-f, --filename stringsFilename, directory, or URL to files identifying the resource to autoscale.-h, --helphelp for autoscale-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--max int32 Default: -1The upper limit for the number of pods that can be set by the autoscaler. Required.--memory stringTarget memory utilization over all the pods. When specified as a percentage (e.g.\"60%\" for 60% of requested memory) it will target average utilization. When specified as quantity (e.g.\"200Mi\" for 200 MiB, \"1Gi\" for 1 GiB) it will target average value. Value without units is treated as a quantity with mebibytes being the unit (e.g.\"200\" is \"200Mi\").--min int32 Default: -1The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value.--name stringThe name for the newly created object. If not specified, the name of the input resource will be used.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=g", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_autoscale/", "id": "k8s_00763"}
{"instruction": "Write a bash example for kubectl autoscale", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY]\n```\n\nkubectl autoscale | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_autoscale/", "id": "k8s_00763_code_11665"}
{"instruction": "Write a bash example for kubectl autoscale", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY]\n```\n\nkubectl autoscale | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_autoscale/", "id": "k8s_00763_code_11666"}
{"instruction": "How do you set kubelet parameters via a configuration file in Kubernetes?", "response": "Set Kubelet Parameters Via A Configuration FileBefore you beginSome steps in this page use the jq tool. If you don't have jq, you can install it via your operating system's software sources, or fetch it from https://jqlang.github.io/jq/.Some steps also involve installing curl, which can be installed via your operating system's software sources.A subset of the kubelet's configuration parameters may be set via an on-disk config file, as a substitute for command-line flags.Providing parameters via a config file is the recommended approach because it simplifies node deployment and configuration management.Create the config fileThe subset of the kubelet's configuration that can be configured via a file is defined by the KubeletConfiguration struct.The configuration file must be a JSON or YAML representation of the parameters in this struct. Make sure the kubelet has read permissions on the file.Here is an example of what this file might look like:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration address: \"192.168.0.8\" port: 20250 serializeImagePulls: false evictionHard: memory.available: \"100Mi\" nodefs.available: \"10%\" nodefs.inodesFree: \"5%\" imagefs.available: \"15%\" imagefs.inodesFree: \"5%\" In this example, the kubelet is configured with the following settings:address: The kubelet will serve on IP address 192.168.0.8.port: The kubelet will serve on port 20250.serializeImagePulls: Image pulls will be done in parallel.evictionHard: The kubelet will evict Pods under one of the following conditions:When the node's available memory drops below 100MiB.When the node's main filesystem's available space is less than 10%.When the image filesystem's available space is less than 15%.When more than 95% of the node's main filesystem's inodes are in use.Note:In the example, by changing the default value of only one parameter for evictionHard, the default values of other parameters will not be inherited and will be set to zero. In order to provide custom values, you should provide all the threshold values respectively. Alternatively, you can set the MergeDefaultEvictionSettings to true in the kubelet configuration file, if any parameter is changed then the other parameters will inherit their default values instead of 0.The imagefs is an optional filesystem that container runtimes use to store container images and container writable layers.Start a kubelet process configured via the config fileNote:If you use kubeadm to initialize your cluster, use the kubelet-config while creating your cluster with kubeadm init. See configuring kubelet using kubeadm for details.Start the kubelet with the --config flag set to the path of the kubelet's config file. The kubelet will then load its config from this file.Note that command line flags which target the same value as a config file will override that value. This helps ensure backwards compatibility with the command-line API.Note that relative file paths in the kubelet config file are resolved relative to the location of the kubelet config file, whereas relative paths in command line flags are resolved relative to the kubelet's current working directory.Note that some default values differ between command-line flags and the kubelet config file. If --config is provided and the values are not specified via the command line, the defaults for the KubeletConfiguration version apply. In the above example, this version is kubelet.config.k8s.io/v1beta1.Drop-in directory for kubelet configuration filesFEATURE STATE: Kubernetes v1.30 [beta]You can specify a drop-in configuration directory for the kubelet. By default, the kubelet does not look for drop-in configuration files anywhere - you must specify a path. For example: --config-dir=/etc/kubernetes/kubelet.conf.dFor Kubernetes v1.28 to v1.29, you can only specify --config-dir if you also set the environment variable KUBELET_CONFIG_DROPIN_DIR_ALPHA for the kubelet process (the value of that variable does not matter).Note:The suffix of a valid kubele", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/", "id": "k8s_00764"}
{"instruction": "Write a yaml example for set kubelet parameters via a configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\naddress: \"192.168.0.8\"\nport: 20250\nserializeImagePulls: false\nevictionHard:\n    memory.available:  \"100Mi\"\n    nodefs.available:  \"10%\"\n    nodefs.inodesFree: \"5%\"\n    imagefs.available: \"15%\"\n    imagefs.inodesFree: \"5%\"\n```\n\nSet Kubelet Parameters Via A Configuration File | In this example, the kubelet is configured with the following settings:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/", "id": "k8s_00764_code_11668"}
{"instruction": "Write a yaml example for set kubelet parameters via a configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\naddress: \"192.168.0.8\"\nport: 20250\nserializeImagePulls: false\nevictionHard:\n    memory.available:  \"100Mi\"\n    nodefs.available:  \"10%\"\n    nodefs.inodesFree: \"5%\"\n    imagefs.available: \"15%\"\n    imagefs.inodesFree: \"5%\"\n```\n\nSet Kubelet Parameters Via A Configuration File | In this example, the kubelet is configured with the following settings:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/", "id": "k8s_00764_code_11669"}
{"instruction": "Write a bash example for set kubelet parameters via a configuration file", "response": "Here's a bash example:\n\n```bash\ncurl -X GET http://127.0.0.1:8001/api/v1/nodes/<node-name>/proxy/configz | jq .\n```\n\nSet Kubelet Parameters Via A Configuration File |", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/", "id": "k8s_00764_code_11670"}
{"instruction": "Write a yaml example for set kubelet parameters via a configuration file", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\naddress: \"192.168.0.8\"\nport: 20250\nserializeImagePulls: false\nevictionHard:\n    memory.available:  \"100Mi\"\n    nodefs.available:  \"10%\"\n    nodefs.inodesFree: \"5%\"\n    imagefs.available: \"15%\"\n    imagefs.inodesFree: \"5%\"\n```\n\nSet Kubelet Parameters Via A Configuration File | In this example, the kubelet is configured with the following settings:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/", "id": "k8s_00764_code_11671"}
{"instruction": "Provide a tutorial on install drivers and allocate devices with dra", "response": "Install Drivers and Allocate Devices with DRAFEATURE STATE: Kubernetes v1.34 [stable] (enabled by default: true)This tutorial shows you how to install Dynamic Resource Allocation (DRA) drivers in your cluster and how to use them in conjunction with the DRA APIs to allocate devices to Pods. This page is intended for cluster administrators.Dynamic Resource Allocation (DRA) lets a cluster manage availability and allocation of hardware resources to satisfy Pod-based claims for hardware requirements and preferences. To support this, a mixture of Kubernetes built-in components (like the Kubernetes scheduler, kubelet, and kube-controller-manager) and third-party drivers from device owners (called DRA drivers) share the responsibility to advertise, allocate, prepare, mount, healthcheck, unprepare, and cleanup resources throughout the Pod lifecycle. These components share information via a series of DRA specific APIs in the resource.k8s.io API group including DeviceClasses, ResourceSlices, ResourceClaims, as well as new fields in the Pod spec itself.ObjectivesDeploy an example DRA driverDeploy a Pod requesting a hardware claim using DRA APIsDelete a Pod that has a claimBefore you beginYour cluster should support RBAC. You can try this tutorial with a cluster using a different authorization mechanism, but in that case you will have to adapt the steps around defining roles and permissions.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesThis tutorial has been tested with Linux nodes, though it may also work with other types of nodes.Your Kubernetes server must be version v1.34.To check the version, enter kubectl version.If your cluster is not currently running Kubernetes 1.34 then please check the documentation for the version of Kubernetes that you plan to use.Explore the initial cluster stateYou can spend some time to observe the initial state of a cluster with DRA enabled, especially if you have not used these APIs extensively before. If you set up a new cluster for this tutorial, with no driver installed and no Pod claims yet to satisfy, the output of these commands won't show any resources.Get a list of DeviceClasses:kubectl get deviceclasses The output is similar to this:No resources found Get a list of ResourceSlices:kubectl get resourceslices The output is similar to this:No resources found Get a list of ResourceClaims and ResourceClaimTemplateskubectl get resourceclaims -A kubectl get resourceclaimtemplates -A The output is similar to this:No resources found No resources found At this point, you have confirmed that DRA is enabled and configured properly in the cluster, and that no DRA drivers have advertised any resources to the DRA APIs yet.Install an example DRA driverDRA drivers are third-party applications that run on each node of your cluster to interface with the hardware of that node and Kubernetes' built-in DRA components. The installation procedure depends on the driver you choose, but is likely deployed as a DaemonSet to all or a selection of the nodes (using selectors or similar mechanisms) in your cluster.Check your driver's documentation for specific installation instructions, which might include a Helm chart, a set of manifests, or other deployment tooling.This tutorial uses an example driver which can be found in the kubernetes-sigs/dra-example-driver repository to demonstrate driver installation. This example driver advertises simulated GPUs to Kubernetes for your Pods to interact with.Prepare your cluster for driver installationTo simplify cleanup, create a namespace named dra-tutorial:Create the namespace:kubectl create namespace dra-tutorial I", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11673"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11674"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -A\nkubectl get resourceclaimtemplates -A\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11675"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | In a production environment, you would likely be using a previously released or qualified image from the driver vendor or your own organization, and your nodes would need to have access to the image r", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11676"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\ndocker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n```\n\nInstall Drivers and Allocate Devices with DRA | For this tutorial, you will install the critical example resource driver components individually with kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11677"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11678"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/deviceclass.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11679"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11680"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/serviceaccount.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11681"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11682"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrole.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11683"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\nInstall Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11684"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrolebinding.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11685"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11686"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/priorityclass.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11687"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\nInstall Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11688"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/daemonset.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11689"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11690"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11691"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11692"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/resourceclaim.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11693"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\nInstall Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11694"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/pod.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11695"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod0 -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11696"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod0 -c ctr0 -n dra-tutorial | grep -E \"GPU_DEVICE_[0-9]+=\" | grep -v \"RESOURCE_CLAIM\"\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11697"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11698"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaim some-gpu -n dra-tutorial -o yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this: 1apiVersion: resource.k8s.io/v1 2kind: ResourceClaim 3metadata: 4 creationTimestamp: \"2025-08-20T18:17:31Z\" 5 finalizers: 6 - resource.kubernetes.io/delete", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11699"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\n1apiVersion: resource.k8s.io/v1\n 2kind: ResourceClaim\n 3metadata:\n 4    creationTimestamp: \"2025-08-20T18:17:31Z\"\n 5    finalizers:\n 6    - resource.kubernetes.io/delete-protection\n 7    name: some-gpu\n 8    namespace: dra-tutorial\n 9    resourceVersion: \"2326\"\n10    uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3\n11spec:\n12    devices:\n13        requests:\n14        - exactly:\n15            allocationMode: ExactCount\n16            count: 1\n17            deviceClassName: gpu.example.com\n18            selectors:\n19            - cel:\n20                expression: device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi'))\n21                >= 0\n22        name: some-gpu\n23status:\n24    allocation:\n25        devices:\n26        results:\n27        - device: gpu-0\n28            driver: gpu.example.com\n29            pool: kind-worker\n30            request: some-gpu\n31        nodeSelector:\n32        nodeSelectorTerms:\n33        - matchFields:\n34            - key: metadata.name\n35            operator: In\n36            values:\n37            - kind-worker\n38    reservedFor:\n39    - name: pod0\n40        resource: pods\n41        uid: c4dadf20-392a-474d-a47b-ab82080c8bd7\n```\n\nInstall Drivers and Allocate Devices with DRA | To check how the driver handled device allocation, get the logs for the driver DaemonSet Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11700"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11701"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod pod0 -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11702"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11703"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11704"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace dra-tutorial\nkubectl delete deviceclass gpu.example.com\nkubectl delete clusterrole dra-example-driver-role\nkubectl delete clusterrolebinding dra-example-driver-role-binding\nkubectl delete priorityclass dra-driver-high-priority\n```\n\nInstall Drivers and Allocate Devices with DRA |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11705"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11706"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11707"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11708"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\nInstall Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11709"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11710"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\nInstall Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11711"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11712"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\nInstall Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11713"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\n1apiVersion: resource.k8s.io/v1\n 2kind: ResourceClaim\n 3metadata:\n 4    creationTimestamp: \"2025-08-20T18:17:31Z\"\n 5    finalizers:\n 6    - resource.kubernetes.io/delete-protection\n 7    name: some-gpu\n 8    namespace: dra-tutorial\n 9    resourceVersion: \"2326\"\n10    uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3\n11spec:\n12    devices:\n13        requests:\n14        - exactly:\n15            allocationMode: ExactCount\n16            count: 1\n17            deviceClassName: gpu.example.com\n18            selectors:\n19            - cel:\n20                expression: device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi'))\n21                >= 0\n22        name: some-gpu\n23status:\n24    allocation:\n25        devices:\n26        results:\n27        - device: gpu-0\n28            driver: gpu.example.com\n29            pool: kind-worker\n30            request: some-gpu\n31        nodeSelector:\n32        nodeSelectorTerms:\n33        - matchFields:\n34            - key: metadata.name\n35            operator: In\n36            values:\n37            - kind-worker\n38    reservedFor:\n39    - name: pod0\n40        resource: pods\n41        uid: c4dadf20-392a-474d-a47b-ab82080c8bd7\n```\n\nInstall Drivers and Allocate Devices with DRA | To check how the driver handled device allocation, get the logs for the driver DaemonSet Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11714"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11715"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11716"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -A\nkubectl get resourceclaimtemplates -A\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11717"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | In a production environment, you would likely be using a previously released or qualified image from the driver vendor or your own organization, and your nodes would need to have access to the image r", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11718"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\ndocker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n```\n\nInstall Drivers and Allocate Devices with DRA | For this tutorial, you will install the critical example resource driver components individually with kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11719"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/deviceclass.yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11720"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11721"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/deviceclass.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11722"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/serviceaccount.yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11723"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11724"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/serviceaccount.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11725"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11726"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11727"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrole.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11728"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/clusterrolebinding.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\nInstall Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11729"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\nInstall Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11730"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrolebinding.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11731"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/priorityclass.yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11732"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11733"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/priorityclass.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11734"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\nInstall Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11735"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\nInstall Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11736"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/daemonset.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11737"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11738"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11739"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/example/resourceclaim.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11740"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\nInstall Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11741"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/resourceclaim.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11742"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/example/pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\nInstall Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11743"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\nInstall Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11744"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/pod.yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11745"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod0 -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11746"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod0 -c ctr0 -n dra-tutorial | grep -E \"GPU_DEVICE_[0-9]+=\" | grep -v \"RESOURCE_CLAIM\"\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11747"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11748"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaim some-gpu -n dra-tutorial -o yaml\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this: 1apiVersion: resource.k8s.io/v1 2kind: ResourceClaim 3metadata: 4 creationTimestamp: \"2025-08-20T18:17:31Z\" 5 finalizers: 6 - resource.kubernetes.io/delete", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11749"}
{"instruction": "Write a yaml example for install drivers and allocate devices with dra", "response": "Here's a yaml example:\n\n```yaml\n1apiVersion: resource.k8s.io/v1\n 2kind: ResourceClaim\n 3metadata:\n 4    creationTimestamp: \"2025-08-20T18:17:31Z\"\n 5    finalizers:\n 6    - resource.kubernetes.io/delete-protection\n 7    name: some-gpu\n 8    namespace: dra-tutorial\n 9    resourceVersion: \"2326\"\n10    uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3\n11spec:\n12    devices:\n13        requests:\n14        - exactly:\n15            allocationMode: ExactCount\n16            count: 1\n17            deviceClassName: gpu.example.com\n18            selectors:\n19            - cel:\n20                expression: device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi'))\n21                >= 0\n22        name: some-gpu\n23status:\n24    allocation:\n25        devices:\n26        results:\n27        - device: gpu-0\n28            driver: gpu.example.com\n29            pool: kind-worker\n30            request: some-gpu\n31        nodeSelector:\n32        nodeSelectorTerms:\n33        - matchFields:\n34            - key: metadata.name\n35            operator: In\n36            values:\n37            - kind-worker\n38    reservedFor:\n39    - name: pod0\n40        resource: pods\n41        uid: c4dadf20-392a-474d-a47b-ab82080c8bd7\n```\n\nInstall Drivers and Allocate Devices with DRA | To check how the driver handled device allocation, get the logs for the driver DaemonSet Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11750"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11751"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod pod0 -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11752"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11753"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\nInstall Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11754"}
{"instruction": "Write a bash example for install drivers and allocate devices with dra", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace dra-tutorial\nkubectl delete deviceclass gpu.example.com\nkubectl delete clusterrole dra-example-driver-role\nkubectl delete clusterrolebinding dra-example-driver-role-binding\nkubectl delete priorityclass dra-driver-high-priority\n```\n\nInstall Drivers and Allocate Devices with DRA |", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/cluster-management/install-use-dra/", "id": "k8s_00765_code_11755"}
{"instruction": "How do you create an external load balancer in Kubernetes?", "response": "Create an External Load BalancerThis page shows how to create an external load balancer.When creating a Service, you have the option of automatically creating a cloud load balancer. This provides an externally-accessible IP address that sends traffic to the correct port on your cluster nodes, provided your cluster runs in a supported environment and is configured with the correct cloud load balancer provider package.You can also use an Ingress in place of Service. For more information, check the Ingress documentation.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour cluster must be running in a cloud or other environment that already has support for configuring external load balancers.Create a ServiceCreate a Service from a manifestTo create an external load balancer, add the following line to your Service manifest: type: LoadBalancer Your manifest might then look like:apiVersion: v1 kind: Service metadata: name: example-service spec: selector: app: example ports: - port: 8765 targetPort: 9376 type: LoadBalancer Create a Service using kubectlYou can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:kubectl expose deployment example --port=8765 --target-port=9376 \\ --name=example-service --type=LoadBalancer This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).For more information, including optional flags, refer to the kubectl expose reference.Finding your IP addressYou can find the IP address created for your service by getting the service information through kubectl:kubectl describe services example-service which should produce output similar to:Name: example-service Namespace: default Labels: app=example Annotations: <none> Selector: app=example Type: LoadBalancer IP Families: <none> IP: 10.3.22.96 IPs: 10.3.22.96 LoadBalancer Ingress: 192.0.2.89 Port: <unset> 8765/TCP TargetPort: 9376/TCP NodePort: <unset> 30593/TCP Endpoints: 172.17.0.3:9376 Session Affinity: None External Traffic Policy: Cluster Events: <none> The load balancer's IP address is listed next to LoadBalancer Ingress.Note:If you are running your service on Minikube, you can find the assigned IP address and port with:minikube service example-service --url Preserving the client source IPBy default, the source IP seen in the target container is not the original source IP of the client. To enable preservation of the client IP, the following fields can be configured in the .spec of the Service:.spec.externalTrafficPolicy - denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints. There are two available options: Cluster (default) and Local. Cluster obscures the client source IP and may cause a second hop to another node, but should have good overall load-spreading. Local preserves the client source IP and avoids a second hop for LoadBalancer and NodePort type Services, but risks potentially imbalanced traffic spreading..spec.healthCheckNodePort - specifies the health check node port (numeric port number) for the service. If you don't specify healthCheckNodePort, the service controller allocates a port from your cluster's NodePort range.You can configure that range by setting an API server command line option, --service-node-port-range. The Service will use the user-specified healthCheckNodePort value if you specify it, provided that the Service type is set to LoadBalancer and externalTrafficPolicy is set to Local.Setting externalTrafficPolicy to Local in the Service manifest activates this featur", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766"}
{"instruction": "Write a yaml example for create an external load balancer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\nCreate an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11757"}
{"instruction": "Write a bash example for create an external load balancer", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\nCreate an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11758"}
{"instruction": "Write a bash example for create an external load balancer", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\nCreate an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11759"}
{"instruction": "Write a yaml example for create an external load balancer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\nCreate an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11760"}
{"instruction": "Write a yaml example for create an external load balancer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\nCreate an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11761"}
{"instruction": "Write a bash example for create an external load balancer", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\nCreate an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11762"}
{"instruction": "Write a bash example for create an external load balancer", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\nCreate an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11763"}
{"instruction": "Write a bash example for create an external load balancer", "response": "Here's a bash example:\n\n```bash\nminikube service example-service --url\n```\n\nCreate an External Load Balancer | By default, the source IP seen in the target container is not the original source IP of the client. To enable preservation of the client IP, the following fields can be configured in the .spec of the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11764"}
{"instruction": "Write a yaml example for create an external load balancer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\nCreate an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11765"}
{"instruction": "Write a yaml example for create an external load balancer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\nCreate an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11766"}
{"instruction": "Write a bash example for create an external load balancer", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\nCreate an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11767"}
{"instruction": "Write a bash example for create an external load balancer", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\nCreate an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11768"}
{"instruction": "Write a yaml example for create an external load balancer", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\nCreate an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/", "id": "k8s_00766_code_11769"}
{"instruction": "Provide a tutorial on example: deploying cassandra with a statefulset", "response": "Example: Deploying Cassandra with a StatefulSetThis tutorial shows you how to run Apache Cassandra on Kubernetes. Cassandra, a database, needs persistent storage to provide data durability (application state). In this example, a custom Cassandra seed provider lets the database discover new Cassandra instances as they join the Cassandra cluster.StatefulSets make it easier to deploy stateful applications into your Kubernetes cluster. For more information on the features used in this tutorial, see StatefulSet.Note:Cassandra and Kubernetes both use the term node to mean a member of a cluster. In this tutorial, the Pods that belong to the StatefulSet are Cassandra nodes and are members of the Cassandra cluster (called a ring). When those Pods run in your Kubernetes cluster, the Kubernetes control plane schedules those Pods onto Kubernetes Nodes.When a Cassandra node starts, it uses a seed list to bootstrap discovery of other nodes in the ring. This tutorial deploys a custom Cassandra seed provider that lets the database discover new Cassandra Pods as they appear inside your Kubernetes cluster.ObjectivesCreate and validate a Cassandra headless Service.Use a StatefulSet to create a Cassandra ring.Validate the StatefulSet.Modify the StatefulSet.Delete the StatefulSet and its Pods.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo complete this tutorial, you should already have a basic familiarity with Pods, Services, and StatefulSets.Additional Minikube setup instructionsCaution:Minikube defaults to 2048MB of memory and 2 CPU. Running Minikube with the default resource configuration results in insufficient resource errors during this tutorial. To avoid these errors, start Minikube with the following settings:minikube start --memory 5120 --cpus=4 Creating a headless Service for CassandraIn Kubernetes, a Service describes a set of Pods that perform the same task.The following Service is used for DNS lookups between Cassandra Pods and clients within your cluster:application/cassandra/cassandra-service.yaml apiVersion: v1 kind: Service metadata: labels: app: cassandra name: cassandra spec: clusterIP: None ports: - port: 9042 selector: app: cassandra Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:kubectl apply -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml Validating (optional)Get the Cassandra Service.kubectl get svc cassandra The response isNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE cassandra ClusterIP None <none> 9042/TCP 45s If you don't see a Service named cassandra, that means creation failed. Read Debug Services for help troubleshooting common issues.Using a StatefulSet to create a Cassandra ringThe StatefulSet manifest, included below, creates a Cassandra ring that consists of three Pods.Note:This example uses the default provisioner for Minikube. Please update the following StatefulSet for the cloud you are working with.application/cassandra/cassandra-statefulset.yaml apiVersion: apps/v1 kind: StatefulSet metadata: name: cassandra labels: app: cassandra spec: serviceName: cassandra replicas: 3 selector: matchLabels: app: cassandra template: metadata: labels: app: cassandra spec: terminationGracePeriodSeconds: 500 containers: - name: cassandra image: gcr.io/google-samples/cassandra:v13 imagePullPolicy: Always ports: - containerPort: 7000 name: intra-node - containerPort: 7001 name: tls-intra-node - containerPort: 7199 name: jmx - containerPort: 9042 name: cql resources: limits: cpu: \"500m\" memory: 1Gi requests: cpu: \"500m\" memory: 1Gi securityContext: capabilities: add: - ", "category": "tutorials", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11771"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml\n```\n\nExample: Deploying Cassandra with a StatefulSet | Get the Cassandra Service.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11772"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get svc cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response is", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11773"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11774"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11775"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l=\"app=cassandra\"\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11776"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra-0 -- nodetool status\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should look something like:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11777"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulset cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | This command opens an editor in your terminal. The line you need to change is the replicas field. The following sample is an excerpt of the StatefulSet file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11778"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\nExample: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11779"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11780"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The Pods in this tutorial use the gcr.io/google-samples/cassandra:v13 image from Google's container registry. The Docker image above is based on debian-base and includes OpenJDK 8.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11781"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11782"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11783"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\nExample: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11784"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napplication/cassandra/cassandra-service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11785"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11786"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml\n```\n\nExample: Deploying Cassandra with a StatefulSet | Get the Cassandra Service.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11787"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get svc cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response is", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11788"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napplication/cassandra/cassandra-statefulset.yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11789"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\nExample: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11790"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11791"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l=\"app=cassandra\"\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11792"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra-0 -- nodetool status\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should look something like:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11793"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulset cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | This command opens an editor in your terminal. The line you need to change is the replicas field. The following sample is an excerpt of the StatefulSet file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11794"}
{"instruction": "Write a yaml example for example: deploying cassandra with a statefulset", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\nExample: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11795"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11796"}
{"instruction": "Write a bash example for example: deploying cassandra with a statefulset", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=cassandra\n```\n\nExample: Deploying Cassandra with a StatefulSet | The Pods in this tutorial use the gcr.io/google-samples/cassandra:v13 image from Google's container registry. The Docker image above is based on debian-base and includes OpenJDK 8.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/cassandra/", "id": "k8s_00767_code_11797"}
{"instruction": "What is the reference documentation for csinode?", "response": "CSINodeCSINode holds information about all CSI drivers installed on a node.apiVersion: storage.k8s.io/v1import \"k8s.io/api/storage/v1\"CSINodeCSINode holds information about all CSI drivers installed on a node. CSI drivers do not need to create the CSINode object directly. As long as they use the node-driver-registrar sidecar container, the kubelet will automatically populate the CSINode object for the CSI driver as part of kubelet plugin registration. CSINode has the same name as a node. If the object is missing, it means either there are no CSI Drivers available on the node, or the Kubelet version is low enough that it doesn't create this object. CSINode has an OwnerReference that points to the corresponding node object.apiVersion: storage.k8s.io/v1kind: CSINodemetadata (ObjectMeta)Standard object's metadata. metadata.name must be the Kubernetes node name.spec (CSINodeSpec), requiredspec is the specification of CSINodeCSINodeSpecCSINodeSpec holds information about the specification of all CSI drivers installed on a nodedrivers ([]CSINodeDriver), requiredPatch strategy: merge on key nameMap: unique values on key name will be kept during a mergedrivers is a list of information of all CSI Drivers existing on a node. If all drivers in the list are uninstalled, this can become empty.CSINodeDriver holds information about the specification of one CSI driver installed on a nodedrivers.name (string), requiredname represents the name of the CSI driver that this object refers to. This MUST be the same name returned by the CSI GetPluginName() call for that driver.drivers.nodeID (string), requirednodeID of the node from the driver point of view. This field enables Kubernetes to communicate with storage systems that do not share the same nomenclature for nodes. For example, Kubernetes may refer to a given node as \"node1\", but the storage system may refer to the same node as \"nodeA\". When Kubernetes issues a command to the storage system to attach a volume to a specific node, it can use this field to refer to the node name using the ID that the storage system will understand, e.g. \"nodeA\" instead of \"node1\". This field is required.drivers.allocatable (VolumeNodeResources)allocatable represents the volume resources of a node that are available for scheduling. This field is beta.VolumeNodeResources is a set of resource limits for scheduling of volumes.drivers.allocatable.count (int32)count indicates the maximum number of unique volumes managed by the CSI driver that can be used on a node. A volume that is both attached and mounted on a node is considered to be used once, not twice. The same rule applies for a unique volume that is shared among multiple pods on the same node. If this field is not specified, then the supported number of volumes on this node is unbounded.drivers.topologyKeys ([]string)Atomic: will be replaced during a mergetopologyKeys is the list of keys supported by the driver. When a driver is initialized on a cluster, it provides a set of topology keys that it understands (e.g. \"company.com/zone\", \"company.com/region\"). When a driver is initialized on a node, it provides the same topology keys along with values. Kubelet will expose these topology keys as labels on its own node object. When Kubernetes does topology aware provisioning, it can use this list to determine which labels it should retrieve from the node object and pass back to the driver. It is possible for different nodes to use different topology keys. This can be empty if driver does not support topology.CSINodeListCSINodeList is a collection of CSINode objects.apiVersion: storage.k8s.io/v1kind: CSINodeListmetadata (ListMeta)Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataitems ([]CSINode), requireditems is the list of CSINodeOperationsget read the specified CSINodeHTTP RequestGET /apis/storage.k8s.io/v1/csinodes/{name}Parametersname (in path): string, requiredname of the CSINodepretty ", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/csi-node-v1/", "id": "k8s_00768"}
{"instruction": "Write a yaml example for csinode", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\nCSINode | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/csi-node-v1/", "id": "k8s_00768_code_11799"}
{"instruction": "Explain the Kubernetes concept: Operator pattern", "response": "Operator patternOperators are software extensions to Kubernetes that make use of custom resources to manage applications and their components. Operators follow Kubernetes principles, notably the control loop.MotivationThe operator pattern aims to capture the key aim of a human operator who is managing a service or set of services. Human operators who look after specific applications and services have deep knowledge of how the system ought to behave, how to deploy it, and how to react if there are problems.People who run workloads on Kubernetes often like to use automation to take care of repeatable tasks. The operator pattern captures how you can write code to automate a task beyond what Kubernetes itself provides.Operators in KubernetesKubernetes is designed for automation. Out of the box, you get lots of built-in automation from the core of Kubernetes. You can use Kubernetes to automate deploying and running workloads, and you can automate how Kubernetes does that.Kubernetes' operator pattern concept lets you extend the cluster's behaviour without modifying the code of Kubernetes itself by linking controllers to one or more custom resources. Operators are clients of the Kubernetes API that act as controllers for a Custom Resource.An example operatorSome of the things that you can use an operator to automate include:deploying an application on demandtaking and restoring backups of that application's statehandling upgrades of the application code alongside related changes such as database schemas or extra configuration settingspublishing a Service to applications that don't support Kubernetes APIs to discover themsimulating failure in all or part of your cluster to test its resiliencechoosing a leader for a distributed application without an internal member election processWhat might an operator look like in more detail? Here's an example:A custom resource named SampleDB, that you can configure into the cluster.A Deployment that makes sure a Pod is running that contains the controller part of the operator.A container image of the operator code.Controller code that queries the control plane to find out what SampleDB resources are configured.The core of the operator is code to tell the API server how to make reality match the configured resources.If you add a new SampleDB, the operator sets up PersistentVolumeClaims to provide durable database storage, a StatefulSet to run SampleDB and a Job to handle initial configuration.If you delete it, the operator takes a snapshot, then makes sure that the StatefulSet and Volumes are also removed.The operator also manages regular database backups. For each SampleDB resource, the operator determines when to create a Pod that can connect to the database and take backups. These Pods would rely on a ConfigMap and / or a Secret that has database connection details and credentials.Because the operator aims to provide robust automation for the resource it manages, there would be additional supporting code. For this example, code checks to see if the database is running an old version and, if so, creates Job objects that upgrade it for you.Deploying operatorsThe most common way to deploy an operator is to add the Custom Resource Definition and its associated Controller to your cluster. The Controller will normally run outside of the control plane, much as you would run any containerized application. For example, you can run the controller in your cluster as a Deployment.Using an operatorOnce you have an operator deployed, you'd use it by adding, modifying or deleting the kind of resource that the operator uses. Following the above example, you would set up a Deployment for the operator itself, and then:kubectl get SampleDB # find configured databases kubectl edit SampleDB/example-database # manually change some settings …and that's it! The operator will take care of applying the changes as well as keeping the existing service in good shape.Writing your own operatorIf there isn't an operator in the", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/operator/", "id": "k8s_00769"}
{"instruction": "Write a bash example for operator pattern", "response": "Here's a bash example:\n\n```bash\nkubectl get SampleDB                   # find configured databases\n\nkubectl edit SampleDB/example-database # manually change some settings\n```\n\nOperator pattern | …and that's it! The operator will take care of applying the changes as well as keeping the existing service in good shape.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/operator/", "id": "k8s_00769_code_11801"}
{"instruction": "Write a bash example for operator pattern", "response": "Here's a bash example:\n\n```bash\nkubectl get SampleDB                   # find configured databases\n\nkubectl edit SampleDB/example-database # manually change some settings\n```\n\nOperator pattern | …and that's it! The operator will take care of applying the changes as well as keeping the existing service in good shape.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/extend-kubernetes/operator/", "id": "k8s_00769_code_11802"}
{"instruction": "How do you configure a security context for a pod or container in Kubernetes?", "response": "Configure a Security Context for a Pod or ContainerA security context defines privilege and access control settings for a Pod or Container. Security context settings include, but are not limited to:Discretionary Access Control: Permission to access an object, like a file, is based on user ID (UID) and group ID (GID).Security Enhanced Linux (SELinux): Objects are assigned security labels.Running as privileged or unprivileged.Linux Capabilities: Give a process some privileges, but not all the privileges of the root user.AppArmor: Use program profiles to restrict the capabilities of individual programs.Seccomp: Filter a process's system calls.allowPrivilegeEscalation: Controls whether a process can gain more privileges than its parent process. This bool directly controls whether the no_new_privs flag gets set on the container process. allowPrivilegeEscalation is always true when the container:is run as privileged, orhas CAP_SYS_ADMINreadOnlyRootFilesystem: Mounts the container's root filesystem as read-only.The above bullets are not a complete set of security context settings -- please see SecurityContext for a comprehensive list.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Set the security context for a PodTo specify security settings for a Pod, include the securityContext field in the Pod specification. The securityContext field is a PodSecurityContext object. The security settings that you specify for a Pod apply to all Containers in the Pod. Here is a configuration file for a Pod that has a securityContext and an emptyDir volume:pods/security/security-context.yaml apiVersion: v1 kind: Pod metadata: name: security-context-demo spec: securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000 supplementalGroups: [4000] volumes: - name: sec-ctx-vol emptyDir: {} containers: - name: sec-ctx-demo image: busybox:1.28 command: [ \"sh\", \"-c\", \"sleep 1h\" ] volumeMounts: - name: sec-ctx-vol mountPath: /data/demo securityContext: allowPrivilegeEscalation: false In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all processes within any containers of the Pod. If this field is omitted, the primary group ID of the containers will be root(0). Any files created will also be owned by user 1000 and group 3000 when runAsGroup is specified. Since fsGroup field is specified, all processes of the container are also part of the supplementary group ID 2000. The owner for volume /data/demo and any files created in that volume will be Group ID 2000. Additionally, when the supplementalGroups field is specified, all processes of the container are also part of the specified groups. If this field is omitted, it means empty.Create the Pod:kubectl apply -f https://k8s.io/examples/pods/security/security-context.yaml Verify that the Pod's Container is running:kubectl get pod security-context-demo Get a shell to the running Container:kubectl exec -it security-context-demo -- sh In your shell, list the running processes:ps The output shows that the processes are running as user 1000, which is the value of runAsUser:PID USER TIME COMMAND 1 1000 0:00 sleep 1h 6 1000 0:00 sh ... In your shell, navigate to /data, and list the one directory:cd /data ls -l The output shows that the /data/demo directory has group ID 2000, which is the value of fsGroup.drwxrwsrwx 2 root 2000 4096 Jun 6 20:08 demo In your shell, navigate to /data/demo, and create a file:cd demo echo hello > testfile List the file i", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11804"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11805"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11806"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11807"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11808"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-5.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11809"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11810"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\nConfigure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11811"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11812"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-6.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11813"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\nConfigure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11814"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- id\n```\n\nConfigure a Security Context for a Pod or Container | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11815"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo -o yaml\n```\n\nConfigure a Security Context for a Pod or Container | You can see that the status.containerStatuses[].user.linux field exposes the process identity attached to the first container process.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11816"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\nConfigure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11817"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\nConfigure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11818"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11819"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-2.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11820"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-2\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11821"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-2 -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11822"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11823"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-3.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11824"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-3\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11825"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-3 -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11826"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11827"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-4.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11828"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-4 -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, view the capabilities for process 1:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11829"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod security-context-demo\nkubectl delete pod security-context-demo-2\nkubectl delete pod security-context-demo-3\nkubectl delete pod security-context-demo-4\n```\n\nConfigure a Security Context for a Pod or Container | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11830"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11831"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11832"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11833"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\nConfigure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11834"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\nConfigure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11835"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  runAsUser: 1000\n  runAsGroup: 3000\n  fsGroup: 2000\n  fsGroupChangePolicy: \"OnRootMismatch\"\n```\n\nConfigure a Security Context for a Pod or Container | If you deploy a Container Storage Interface (CSI) driver which supports the VOLUME_MOUNT_GROUP NodeServiceCapability, the process of setting file ownership and permissions based on the fsGroup specifi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11836"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11837"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11838"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11839"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seccompProfile:\n    type: RuntimeDefault\n```\n\nConfigure a Security Context for a Pod or Container | Here is an example that sets the Seccomp profile to a pre-configured file at <kubelet-root-dir>/seccomp/my-profiles/profile-allow.json:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11840"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seccompProfile:\n    type: Localhost\n    localhostProfile: my-profiles/profile-allow.json\n```\n\nConfigure a Security Context for a Pod or Container | To set the AppArmor profile for a Container, include the appArmorProfile field in the securityContext section of your Container. The appArmorProfile field is a AppArmorProfile object consisting of typ", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11841"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n- name: container-1\n  securityContext:\n    appArmorProfile:\n      type: RuntimeDefault\n```\n\nConfigure a Security Context for a Pod or Container | Here is an example that sets the AppArmor profile to a pre-configured profile named k8s-apparmor-example-deny-write:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11842"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n- name: container-1\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n```\n\nConfigure a Security Context for a Pod or Container | For more details please see, Restrict a Container's Access to Resources with AppArmor.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11843"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seLinuxOptions:\n    level: \"s0:c123,c456\"\n```\n\nConfigure a Security Context for a Pod or Container | Kubernetes v1.27 introduced an early limited form of this behavior that was only applicable to volumes (and PersistentVolumeClaims) using the ReadWriteOncePod access mode.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11844"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\nConfigure a Security Context for a Pod or Container | A cluster admin can use this information to identify pods affected by the planning change and proactively opt-out Pods from the optimization (i.e. set spec.securityContext.seLinuxChangePolicy: Recursi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11845"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  procMount: Unmasked\n```\n\nConfigure a Security Context for a Pod or Container | The security context for a Pod applies to the Pod's Containers and also to the Pod's Volumes when applicable. Specifically fsGroup and seLinuxOptions are applied to Volumes as follows:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11846"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11847"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11848"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11849"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11850"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11851"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-5.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11852"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11853"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-5.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11854"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11855"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\nConfigure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11856"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-6.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11857"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11858"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-6.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11859"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\nConfigure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11860"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- id\n```\n\nConfigure a Security Context for a Pod or Container | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11861"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo -o yaml\n```\n\nConfigure a Security Context for a Pod or Container | You can see that the status.containerStatuses[].user.linux field exposes the process identity attached to the first container process.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11862"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\nConfigure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11863"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\nConfigure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11864"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11865"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11866"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-2.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11867"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-2\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11868"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-2 -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11869"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11870"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11871"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-3.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11872"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-3\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11873"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-3 -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11874"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11875"}
{"instruction": "Write a yaml example for configure a security context for a pod or container", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\nConfigure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11876"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-4.yaml\n```\n\nConfigure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11877"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-4 -- sh\n```\n\nConfigure a Security Context for a Pod or Container | In your shell, view the capabilities for process 1:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11878"}
{"instruction": "Write a bash example for configure a security context for a pod or container", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod security-context-demo\nkubectl delete pod security-context-demo-2\nkubectl delete pod security-context-demo-3\nkubectl delete pod security-context-demo-4\n```\n\nConfigure a Security Context for a Pod or Container | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", "id": "k8s_00770_code_11879"}
{"instruction": "How do you extend service ip ranges in Kubernetes?", "response": "Extend Service IP RangesFEATURE STATE: Kubernetes v1.33 [stable] (enabled by default: true)This document shares how to extend the existing Service IP range assigned to a cluster.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYour Kubernetes server must be at or later than version v1.29.To check the version, enter kubectl version.Note:While you can use this feature with an earlier version, the feature is only GA and officially supported since v1.33.Extend Service IP RangesKubernetes clusters with kube-apiservers that have enabled the MultiCIDRServiceAllocator feature gate and have the networking.k8s.io/v1beta1 API group active, will create a ServiceCIDR object that takes the well-known name kubernetes, and that specifies an IP address range based on the value of the --service-cluster-ip-range command line argument to kube-apiserver.kubectl get servicecidr NAME CIDRS AGE kubernetes 10.96.0.0/28 17d The well-known kubernetes Service, that exposes the kube-apiserver endpoint to the Pods, calculates the first IP address from the default ServiceCIDR range and uses that IP address as its cluster IP address.kubectl get service kubernetes NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 17d The default Service, in this case, uses the ClusterIP 10.96.0.1, that has the corresponding IPAddress object.kubectl get ipaddress 10.96.0.1 NAME PARENTREF 10.96.0.1 services/default/kubernetes The ServiceCIDRs are protected with finalizers, to avoid leaving Service ClusterIPs orphans; the finalizer is only removed if there is another subnet that contains the existing IPAddresses or there are no IPAddresses belonging to the subnet.Extend the number of available IPs for ServicesThere are cases that users will need to increase the number addresses available to Services, previously, increasing the Service range was a disruptive operation that could also cause data loss. With this new feature users only need to add a new ServiceCIDR to increase the number of available addresses.Adding a new ServiceCIDROn a cluster with a 10.96.0.0/28 range for Services, there is only 2^(32-28) - 2 = 14 IP addresses available. The kubernetes.default Service is always created; for this example, that leaves you with only 13 possible Services.for i in $(seq 1 13); do kubectl create service clusterip \"test-$i\" --tcp 80 -o json | jq -r .spec.clusterIP; done 10.96.0.11 10.96.0.5 10.96.0.12 10.96.0.13 10.96.0.14 10.96.0.2 10.96.0.3 10.96.0.4 10.96.0.6 10.96.0.7 10.96.0.8 10.96.0.9 error: failed to create ClusterIP service: Internal error occurred: failed to allocate a serviceIP: range is full You can increase the number of IP addresses available for Services, by creating a new ServiceCIDR that extends or adds new IP address ranges.cat <EOF | kubectl apply -f - apiVersion: networking.k8s.io/v1beta1 kind: ServiceCIDR metadata: name: newcidr1 spec: cidrs: - 10.96.0.0/24 EOF servicecidr.networking.k8s.io/newcidr1 created and this will allow you to create new Services with ClusterIPs that will be picked from this new range.for i in $(seq 13 16); do kubectl create service clusterip \"test-$i\" --tcp 80 -o json | jq -r .spec.clusterIP; done 10.96.0.48 10.96.0.200 10.96.0.121 10.96.0.144 Deleting a ServiceCIDRYou cannot delete a ServiceCIDR if there are IPAddresses that depend on the ServiceCIDR.kubectl delete servicecidr newcidr1 servicecidr.networking.k8s.io \"newcidr1\" deleted Kubernetes uses a finalizer on the ServiceCIDR to track this dependent relationship.kubectl get servicecidr newcidr1 -o yaml apiVersion: networking.k8s.io/v1beta1 kind: ServiceCIDR metad", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr\n```\n\nExtend Service IP Ranges | The well-known kubernetes Service, that exposes the kube-apiserver endpoint to the Pods, calculates the first IP address from the default ServiceCIDR range and uses that IP address as its cluster IP a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11881"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get service kubernetes\n```\n\nExtend Service IP Ranges | The default Service, in this case, uses the ClusterIP 10.96.0.1, that has the corresponding IPAddress object.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11882"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddress 10.96.0.1\n```\n\nExtend Service IP Ranges | The ServiceCIDRs are protected with finalizers, to avoid leaving Service ClusterIPs orphans; the finalizer is only removed if there is another subnet that contains the existing IPAddresses or there ar", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11883"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\ncat <EOF | kubectl apply -f -\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  name: newcidr1\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\nExtend Service IP Ranges | and this will allow you to create new Services with ClusterIPs that will be picked from this new range.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11884"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl delete servicecidr newcidr1\n```\n\nExtend Service IP Ranges | Kubernetes uses a finalizer on the ServiceCIDR to track this dependent relationship.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11885"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1 -o yaml\n```\n\nExtend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11886"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  creationTimestamp: \"2023-10-12T15:11:07Z\"\n  deletionGracePeriodSeconds: 0\n  deletionTimestamp: \"2023-10-12T15:12:45Z\"\n  finalizers:\n  - networking.k8s.io/service-cidr-finalizer\n  name: newcidr1\n  resourceVersion: \"1133\"\n  uid: 5ffd8afe-c78f-4e60-ae76-cec448a8af40\nspec:\n  cidrs:\n  - 10.96.0.0/24\nstatus:\n  conditions:\n  - lastTransitionTime: \"2023-10-12T15:12:45Z\"\n    message: There are still IPAddresses referencing the ServiceCIDR, please remove\n      them or create a new ServiceCIDR\n    reason: OrphanIPAddress\n    status: \"False\"\n    type: Ready\n```\n\nExtend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11887"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1\n```\n\nExtend Service IP Ranges | Cluster administrators can implement policies to control the creation and modification of ServiceCIDR resources within the cluster. This allows for centralized management of the IP address ranges used", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11888"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(newCIDR, variables.allowed.exists(allowedCIDR, cidr(allowedCIDR).containsCIDR(newCIDR)))\"\n  # For all CIDRs (newCIDR) listed in the spec.cidrs of the submitted ServiceCIDR\n  # object, check if there exists at least one CIDR (allowedCIDR) in the `allowed`\n  # list of the VAP such that the allowedCIDR fully contains the newCIDR.\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs.default\"\n  validationActions: [Deny,Audit]\n```\n\nExtend Service IP Ranges | Consult the CEL documentation to learn more about CEL if you want to write your own validation expression.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11889"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.deny\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  validations:\n  - expression: \"object.metadata.name == 'kubernetes'\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-deny-binding\"\nspec:\n  policyName: \"servicecidrs.deny\"\n  validationActions: [Deny,Audit]\n```\n\nExtend Service IP Ranges |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11890"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  creationTimestamp: \"2023-10-12T15:11:07Z\"\n  deletionGracePeriodSeconds: 0\n  deletionTimestamp: \"2023-10-12T15:12:45Z\"\n  finalizers:\n  - networking.k8s.io/service-cidr-finalizer\n  name: newcidr1\n  resourceVersion: \"1133\"\n  uid: 5ffd8afe-c78f-4e60-ae76-cec448a8af40\nspec:\n  cidrs:\n  - 10.96.0.0/24\nstatus:\n  conditions:\n  - lastTransitionTime: \"2023-10-12T15:12:45Z\"\n    message: There are still IPAddresses referencing the ServiceCIDR, please remove\n      them or create a new ServiceCIDR\n    reason: OrphanIPAddress\n    status: \"False\"\n    type: Ready\n```\n\nExtend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11891"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\nmatchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n```\n\nExtend Service IP Ranges | as in the examples below.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11892"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(newCIDR, variables.allowed.exists(allowedCIDR, cidr(allowedCIDR).containsCIDR(newCIDR)))\"\n  # For all CIDRs (newCIDR) listed in the spec.cidrs of the submitted ServiceCIDR\n  # object, check if there exists at least one CIDR (allowedCIDR) in the `allowed`\n  # list of the VAP such that the allowedCIDR fully contains the newCIDR.\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs.default\"\n  validationActions: [Deny,Audit]\n```\n\nExtend Service IP Ranges | Consult the CEL documentation to learn more about CEL if you want to write your own validation expression.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11893"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.deny\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  validations:\n  - expression: \"object.metadata.name == 'kubernetes'\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-deny-binding\"\nspec:\n  policyName: \"servicecidrs.deny\"\n  validationActions: [Deny,Audit]\n```\n\nExtend Service IP Ranges |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11894"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr\n```\n\nExtend Service IP Ranges | The well-known kubernetes Service, that exposes the kube-apiserver endpoint to the Pods, calculates the first IP address from the default ServiceCIDR range and uses that IP address as its cluster IP a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11895"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get service kubernetes\n```\n\nExtend Service IP Ranges | The default Service, in this case, uses the ClusterIP 10.96.0.1, that has the corresponding IPAddress object.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11896"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddress 10.96.0.1\n```\n\nExtend Service IP Ranges | The ServiceCIDRs are protected with finalizers, to avoid leaving Service ClusterIPs orphans; the finalizer is only removed if there is another subnet that contains the existing IPAddresses or there ar", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11897"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\ncat <EOF | kubectl apply -f -\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  name: newcidr1\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\nExtend Service IP Ranges | and this will allow you to create new Services with ClusterIPs that will be picked from this new range.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11898"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl delete servicecidr newcidr1\n```\n\nExtend Service IP Ranges | Kubernetes uses a finalizer on the ServiceCIDR to track this dependent relationship.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11899"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1 -o yaml\n```\n\nExtend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11900"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  creationTimestamp: \"2023-10-12T15:11:07Z\"\n  deletionGracePeriodSeconds: 0\n  deletionTimestamp: \"2023-10-12T15:12:45Z\"\n  finalizers:\n  - networking.k8s.io/service-cidr-finalizer\n  name: newcidr1\n  resourceVersion: \"1133\"\n  uid: 5ffd8afe-c78f-4e60-ae76-cec448a8af40\nspec:\n  cidrs:\n  - 10.96.0.0/24\nstatus:\n  conditions:\n  - lastTransitionTime: \"2023-10-12T15:12:45Z\"\n    message: There are still IPAddresses referencing the ServiceCIDR, please remove\n      them or create a new ServiceCIDR\n    reason: OrphanIPAddress\n    status: \"False\"\n    type: Ready\n```\n\nExtend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11901"}
{"instruction": "Write a bash example for extend service ip ranges", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1\n```\n\nExtend Service IP Ranges | Cluster administrators can implement policies to control the creation and modification of ServiceCIDR resources within the cluster. This allows for centralized management of the IP address ranges used", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11902"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(newCIDR, variables.allowed.exists(allowedCIDR, cidr(allowedCIDR).containsCIDR(newCIDR)))\"\n  # For all CIDRs (newCIDR) listed in the spec.cidrs of the submitted ServiceCIDR\n  # object, check if there exists at least one CIDR (allowedCIDR) in the `allowed`\n  # list of the VAP such that the allowedCIDR fully contains the newCIDR.\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs.default\"\n  validationActions: [Deny,Audit]\n```\n\nExtend Service IP Ranges | Consult the CEL documentation to learn more about CEL if you want to write your own validation expression.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11903"}
{"instruction": "Write a yaml example for extend service ip ranges", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.deny\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  validations:\n  - expression: \"object.metadata.name == 'kubernetes'\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-deny-binding\"\nspec:\n  policyName: \"servicecidrs.deny\"\n  validationActions: [Deny,Audit]\n```\n\nExtend Service IP Ranges |", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/", "id": "k8s_00771_code_11904"}
{"instruction": "What is the reference documentation for kubectl create job?", "response": "kubectl create jobSynopsisCreate a job with the specified name.kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...] Examples # Create a job kubectl create job my-job --image=busybox # Create a job with a command kubectl create job my-job --image=busybox -- date # Create a job from a cron job named \"a-cronjob\" kubectl create job test-job --from=cronjob/a-cronjob Options--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[=\"unchanged\"] Default: \"none\"Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: \"kubectl-create\"Name of the manager used to track field ownership.--from stringThe name of the resource to create a Job from (only cronjob is supported).-h, --helphelp for job--image stringImage name to run.-o, --output stringOutput format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.--show-managed-fieldsIf true, keep the managedFields when printing objects in JSON or YAML format.--template stringTemplate string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate string[=\"strict\"] Default: \"strict\"Must be one of: strict (or true), warn, ignore (or false). \"true\" or \"strict\" will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. \"warn\" will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as \"ignore\" otherwise. \"false\" or \"ignore\" will not perform any schema validation, silently dropping any unknown or duplicate fields.Parent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: \"$HOME/.kube/cache\"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringPath to the kubeconfig file to use for CLI requests.--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: \"none\"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: \"profile.pprof\"Name of the file to write the profile to--request-timeout string", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_job/", "id": "k8s_00772"}
{"instruction": "Write a bash example for kubectl create job", "response": "Here's a bash example:\n\n```bash\nkubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]\n```\n\nkubectl create job | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_job/", "id": "k8s_00772_code_11906"}
{"instruction": "Write a bash example for kubectl create job", "response": "Here's a bash example:\n\n```bash\nkubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]\n```\n\nkubectl create job | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_job/", "id": "k8s_00772_code_11907"}
{"instruction": "Explain the Kubernetes concept: Metrics for Kubernetes Object States", "response": "Metrics for Kubernetes Object Stateskube-state-metrics, an add-on agent to generate and expose cluster-level metrics.The state of Kubernetes objects in the Kubernetes API can be exposed as metrics. An add-on agent called kube-state-metrics can connect to the Kubernetes API server and expose a HTTP endpoint with metrics generated from the state of individual objects in the cluster. It exposes various information about the state of objects like labels and annotations, startup and termination times, status or the phase the object currently is in. For example, containers running in pods create a kube_pod_container_info metric. This includes the name of the container, the name of the pod it is part of, the namespace the pod is running in, the name of the container image, the ID of the image, the image name from the spec of the container, the ID of the running container and the ID of the pod as labels.🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationAn external component that is able and capable to scrape the endpoint of kube-state-metrics (for example via Prometheus) can now be used to enable the following use cases.Example: using metrics from kube-state-metrics to query the cluster stateMetric series generated by kube-state-metrics are helpful to gather further insights into the cluster, as they can be used for querying.If you use Prometheus or another tool that uses the same query language, the following PromQL query returns the number of pods that are not ready:count(kube_pod_status_ready{condition=\"false\"}) by (namespace, pod) Example: alerting based on from kube-state-metricsMetrics generated from kube-state-metrics also allow for alerting on issues in the cluster.If you use Prometheus or a similar tool that uses the same alert rule language, the following alert will fire if there are pods that have been in a Terminating state for more than 5 minutes:groups: - name: Pod state rules: - alert: PodsBlockedInTerminatingState expr: count(kube_pod_deletion_timestamp) by (namespace, pod) * count(kube_pod_status_reason{reason=\"NodeLost\"} == 0) by (namespace, pod) > 0 for: 5m labels: severity: page annotations: summary: Pod {{$labels.namespace}}/{{$labels.pod}} blocked in Terminating state. Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or projects. See the CNCF website guidelines for more details.You should read the content guide before proposing a change that adds an extra third-party link.", "category": "concepts", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/kube-state-metrics/", "id": "k8s_00773"}
{"instruction": "Write a yaml example for metrics for kubernetes object states", "response": "Here's a yaml example:\n\n```yaml\ngroups:\n- name: Pod state\n  rules:\n  - alert: PodsBlockedInTerminatingState\n    expr: count(kube_pod_deletion_timestamp) by (namespace, pod) * count(kube_pod_status_reason{reason=\"NodeLost\"} == 0) by (namespace, pod) > 0\n    for: 5m\n    labels:\n      severity: page\n    annotations:\n      summary: Pod {{$labels.namespace}}/{{$labels.pod}} blocked in Terminating state.\n```\n\nMetrics for Kubernetes Object States | Items on this page refer to third party products or projects that provide functionality required by Kubernetes. The Kubernetes project authors aren't responsible for those third-party products or proj", "category": "concepts_code", "subcategory": "cluster-administration", "source": "https://kubernetes.io/docs/concepts/cluster-administration/kube-state-metrics/", "id": "k8s_00773_code_11909"}
{"instruction": "What is the reference documentation for authorization?", "response": "AuthorizationDetails of Kubernetes authorization mechanisms and supported authorization modes.Kubernetes authorization takes place following authentication. Usually, a client making a request must be authenticated (logged in) before its request can be allowed; however, Kubernetes also allows anonymous requests in some circumstances.For an overview of how authorization fits into the wider context of API access control, read Controlling Access to the Kubernetes API.Authorization verdictsKubernetes authorization of API requests takes place within the API server. The API server evaluates all of the request attributes against all policies, potentially also consulting external services, and then allows or denies the request.All parts of an API request must be allowed by some authorization mechanism in order to proceed. In other words: access is denied by default.Note:Access controls and policies that depend on specific fields of specific kinds of objects are handled by admission controllers.Kubernetes admission control happens after authorization has completed (and, therefore, only when the authorization decision was to allow the request).When multiple authorization modules are configured, each is checked in sequence. If any authorizer approves or denies a request, that decision is immediately returned and no other authorizer is consulted. If all modules have no opinion on the request, then the request is denied. An overall deny verdict means that the API server rejects the request and responds with an HTTP 403 (Forbidden) status.Request attributes used in authorizationKubernetes reviews only the following API request attributes:user - The user string provided during authentication.group - The list of group names to which the authenticated user belongs.extra - A map of arbitrary string keys to string values, provided by the authentication layer.API - Indicates whether the request is for an API resource.Request path - Path to miscellaneous non-resource endpoints like /api or /healthz.API request verb - API verbs like get, list, create, update, patch, watch, delete, and deletecollection are used for resource requests. To determine the request verb for a resource API endpoint, see request verbs and authorization.HTTP request verb - Lowercased HTTP methods like get, post, put, and delete are used for non-resource requests.Resource - The ID or name of the resource that is being accessed (for resource requests only) -- For resource requests using get, update, patch, and delete verbs, you must provide the resource name.Subresource - The subresource that is being accessed (for resource requests only).Namespace - The namespace of the object that is being accessed (for namespaced resource requests only).API group - The API Group being accessed (for resource requests only). An empty string designates the core API group.Request verbs and authorizationNon-resource requestsRequests to endpoints other than /api/v1/... or /apis/<group>/<version>/... are considered non-resource requests, and use the lower-cased HTTP method of the request as the verb. For example, making a GET request using HTTP to endpoints such as /api or /healthz would use get as the verb.Resource requestsTo determine the request verb for a resource API endpoint, Kubernetes maps the HTTP verb used and considers whether or not the request acts on an individual resource or on a collection of resources:HTTP verbrequest verbPOSTcreateGET, HEADget (for individual resources), list (for collections, including full object content), watch (for watching an individual resource or collection of resources)PUTupdatePATCHpatchDELETEdelete (for individual resources), deletecollection (for collections)Caution:+The get, list and watch verbs can all return the full details of a resource. In terms of access to the returned data they are equivalent. For example, list on secrets will reveal the data attributes of any returned resources.Kubernetes sometimes checks authorization for additional permission", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# DO NOT USE THE CONFIG AS IS. THIS IS AN EXAMPLE.\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  - type: Webhook\n    # Name used to describe the authorizer\n    # This is explicitly used in monitoring machinery for metrics\n    # Note:\n    #   - Validation for this field is similar to how K8s labels are validated today.\n    # Required, with no default\n    name: webhook\n    webhook:\n      # The duration to cache 'authorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag\n      # Default: 5m0s\n      authorizedTTL: 30s\n      # If set to false, 'authorized' responses from the webhook are not cached\n      # and the specified authorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag to `0`.\n      # Note: Setting authorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheAuthorizedRequests: true\n      # The duration to cache 'unauthorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag\n      # Default: 30s\n      unauthorizedTTL: 30s\n      # If set to false, 'unauthorized' responses from the webhook are not cached\n      # and the specified unauthorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag to `0`.\n      # Note: Setting unauthorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheUnauthorizedRequests: true\n      # Timeout for the webhook request\n      # Maximum allowed is 30s.\n      # Required, with no default.\n      timeout: 3s\n      # The API version of the authorization.k8s.io SubjectAccessReview to\n      # send to and expect from the webhook.\n      # Same as setting `--authorization-webhook-version` flag\n      # Required, with no default\n      # Valid values: v1beta1, v1\n      subjectAccessReviewVersion: v1\n      # MatchConditionSubjectAccessReviewVersion specifies the SubjectAccessReview\n      # version the CEL expressions are evaluated against\n      # Valid values: v1\n      # Required, no default value\n      matchConditionSubjectAccessReviewVersion: v1\n      # Controls the authorization decision when a webhook request fails to\n      # complete or returns a malformed response or errors evaluating\n      # matchConditions.\n      # Valid values:\n      #   - NoOpinion: continue to subsequent authorizers to see if one of\n      #     them allows the request\n      #   - Deny: reject the request without consulting subsequent authorizers\n      # Required, with no default.\n      failurePolicy: Deny\n      connectionInfo:\n        # Controls how the webhook should communicate with the server.\n        # Valid values:\n        # - KubeConfigFile: use the file specified in kubeConfigFile to locate the\n        #   server.\n        # - InClusterConfig: use the in-cluster configuration to call the\n        #   SubjectAccessReview API hosted by kube-apiserver. This mode is not\n        #   allowed for kube-apiserver.\n        type: KubeConfigFile\n        # Path to KubeConfigFile for connection info\n        # Required, if connectionInfo.Type is KubeConfigFile\n        kubeConfigFile: /kube-system-authz-webhook.yaml\n        # matchConditions is a list of conditions that must be met for a request to be sent to this\n        # webhook. An empty list of matchConditions matches all requests.\n        # There are a maximum of 64 match conditions allowed.\n        #\n        # The exact matching logic is (in order):\n        #   1. If at least one matchCondition evaluates to FALSE, then the webhook is skipped.\n        #   2. If ALL matchConditions evaluate to TRUE, then the webhook is called.\n        #   3. If at least one matchCondition evaluates to an error (but none are FALSE):\n        #      - If failurePolicy=Deny, then the webhook rejects the request\n        #      - If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped\n      matchConditions:\n      # expression represents the expression which will be evaluated by CEL. Must evaluate to bool.\n      # CEL expressions have access to the contents of the SubjectAccessReview in v1 version.\n      # If version specified by subjectAccessReviewVersion in the request variable is v1beta1,\n      # the contents would be converted to the v1 version before evaluating the CEL expression.\n      #\n      # Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n      #\n      # only send resource requests to the webhook\n      - expression: has(request.resourceAttributes)\n      # only intercept requests to kube-system\n      - expression: request.resourceAttributes.namespace == 'kube-system'\n      # don't intercept requests from kube-system service accounts\n      - expression: \"!('system:serviceaccounts:kube-system' in request.groups)\"\n  - type: Node\n    name: node\n  - type: RBAC\n    name: rbac\n  - type: Webhook\n    name: in-cluster-authorizer\n    webhook:\n      authorizedTTL: 5m\n      unauthorizedTTL: 30s\n      timeout: 3s\n      subjectAccessReviewVersion: v1\n      failurePolicy: NoOpinion\n      connectionInfo:\n        type: InClusterConfig\n```\n\nAuthorization | When configuring the authorizer chain using a configuration file, make sure all the control plane nodes have the same file contents. Take a note of the API server configuration when upgrading / downgr", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11911"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace dev\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11912"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace prod\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11913"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list secrets --namespace dev --as dave\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11914"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list pods \\\n    --namespace target \\\n    --as system:serviceaccount:dev:dev-sa\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11915"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f - -o yaml << EOF\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    verb: create\n    namespace: dev\nEOF\n```\n\nAuthorization | The generated SelfSubjectAccessReview is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11916"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nmetadata:\n  creationTimestamp: null\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    namespace: dev\n    verb: create\nstatus:\n  allowed: true\n  denied: false\n```\n\nAuthorization |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11917"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# DO NOT USE THE CONFIG AS IS. THIS IS AN EXAMPLE.\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  - type: Webhook\n    # Name used to describe the authorizer\n    # This is explicitly used in monitoring machinery for metrics\n    # Note:\n    #   - Validation for this field is similar to how K8s labels are validated today.\n    # Required, with no default\n    name: webhook\n    webhook:\n      # The duration to cache 'authorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag\n      # Default: 5m0s\n      authorizedTTL: 30s\n      # If set to false, 'authorized' responses from the webhook are not cached\n      # and the specified authorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag to `0`.\n      # Note: Setting authorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheAuthorizedRequests: true\n      # The duration to cache 'unauthorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag\n      # Default: 30s\n      unauthorizedTTL: 30s\n      # If set to false, 'unauthorized' responses from the webhook are not cached\n      # and the specified unauthorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag to `0`.\n      # Note: Setting unauthorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheUnauthorizedRequests: true\n      # Timeout for the webhook request\n      # Maximum allowed is 30s.\n      # Required, with no default.\n      timeout: 3s\n      # The API version of the authorization.k8s.io SubjectAccessReview to\n      # send to and expect from the webhook.\n      # Same as setting `--authorization-webhook-version` flag\n      # Required, with no default\n      # Valid values: v1beta1, v1\n      subjectAccessReviewVersion: v1\n      # MatchConditionSubjectAccessReviewVersion specifies the SubjectAccessReview\n      # version the CEL expressions are evaluated against\n      # Valid values: v1\n      # Required, no default value\n      matchConditionSubjectAccessReviewVersion: v1\n      # Controls the authorization decision when a webhook request fails to\n      # complete or returns a malformed response or errors evaluating\n      # matchConditions.\n      # Valid values:\n      #   - NoOpinion: continue to subsequent authorizers to see if one of\n      #     them allows the request\n      #   - Deny: reject the request without consulting subsequent authorizers\n      # Required, with no default.\n      failurePolicy: Deny\n      connectionInfo:\n        # Controls how the webhook should communicate with the server.\n        # Valid values:\n        # - KubeConfigFile: use the file specified in kubeConfigFile to locate the\n        #   server.\n        # - InClusterConfig: use the in-cluster configuration to call the\n        #   SubjectAccessReview API hosted by kube-apiserver. This mode is not\n        #   allowed for kube-apiserver.\n        type: KubeConfigFile\n        # Path to KubeConfigFile for connection info\n        # Required, if connectionInfo.Type is KubeConfigFile\n        kubeConfigFile: /kube-system-authz-webhook.yaml\n        # matchConditions is a list of conditions that must be met for a request to be sent to this\n        # webhook. An empty list of matchConditions matches all requests.\n        # There are a maximum of 64 match conditions allowed.\n        #\n        # The exact matching logic is (in order):\n        #   1. If at least one matchCondition evaluates to FALSE, then the webhook is skipped.\n        #   2. If ALL matchConditions evaluate to TRUE, then the webhook is called.\n        #   3. If at least one matchCondition evaluates to an error (but none are FALSE):\n        #      - If failurePolicy=Deny, then the webhook rejects the request\n        #      - If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped\n      matchConditions:\n      # expression represents the expression which will be evaluated by CEL. Must evaluate to bool.\n      # CEL expressions have access to the contents of the SubjectAccessReview in v1 version.\n      # If version specified by subjectAccessReviewVersion in the request variable is v1beta1,\n      # the contents would be converted to the v1 version before evaluating the CEL expression.\n      #\n      # Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n      #\n      # only send resource requests to the webhook\n      - expression: has(request.resourceAttributes)\n      # only intercept requests to kube-system\n      - expression: request.resourceAttributes.namespace == 'kube-system'\n      # don't intercept requests from kube-system service accounts\n      - expression: \"!('system:serviceaccounts:kube-system' in request.groups)\"\n  - type: Node\n    name: node\n  - type: RBAC\n    name: rbac\n  - type: Webhook\n    name: in-cluster-authorizer\n    webhook:\n      authorizedTTL: 5m\n      unauthorizedTTL: 30s\n      timeout: 3s\n      subjectAccessReviewVersion: v1\n      failurePolicy: NoOpinion\n      connectionInfo:\n        type: InClusterConfig\n```\n\nAuthorization | When configuring the authorizer chain using a configuration file, make sure all the control plane nodes have the same file contents. Take a note of the API server configuration when upgrading / downgr", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11918"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace dev\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11919"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list secrets --namespace dev --as dave\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11920"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list pods \\\n    --namespace target \\\n    --as system:serviceaccount:dev:dev-sa\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11921"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl create -f - -o yaml << EOF\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    verb: create\n    namespace: dev\nEOF\n```\n\nAuthorization | The generated SelfSubjectAccessReview is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11922"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nmetadata:\n  creationTimestamp: null\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    namespace: dev\n    verb: create\nstatus:\n  allowed: true\n  denied: false\n```\n\nAuthorization |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11923"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# DO NOT USE THE CONFIG AS IS. THIS IS AN EXAMPLE.\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  - type: Webhook\n    # Name used to describe the authorizer\n    # This is explicitly used in monitoring machinery for metrics\n    # Note:\n    #   - Validation for this field is similar to how K8s labels are validated today.\n    # Required, with no default\n    name: webhook\n    webhook:\n      # The duration to cache 'authorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag\n      # Default: 5m0s\n      authorizedTTL: 30s\n      # If set to false, 'authorized' responses from the webhook are not cached\n      # and the specified authorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag to `0`.\n      # Note: Setting authorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheAuthorizedRequests: true\n      # The duration to cache 'unauthorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag\n      # Default: 30s\n      unauthorizedTTL: 30s\n      # If set to false, 'unauthorized' responses from the webhook are not cached\n      # and the specified unauthorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag to `0`.\n      # Note: Setting unauthorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheUnauthorizedRequests: true\n      # Timeout for the webhook request\n      # Maximum allowed is 30s.\n      # Required, with no default.\n      timeout: 3s\n      # The API version of the authorization.k8s.io SubjectAccessReview to\n      # send to and expect from the webhook.\n      # Same as setting `--authorization-webhook-version` flag\n      # Required, with no default\n      # Valid values: v1beta1, v1\n      subjectAccessReviewVersion: v1\n      # MatchConditionSubjectAccessReviewVersion specifies the SubjectAccessReview\n      # version the CEL expressions are evaluated against\n      # Valid values: v1\n      # Required, no default value\n      matchConditionSubjectAccessReviewVersion: v1\n      # Controls the authorization decision when a webhook request fails to\n      # complete or returns a malformed response or errors evaluating\n      # matchConditions.\n      # Valid values:\n      #   - NoOpinion: continue to subsequent authorizers to see if one of\n      #     them allows the request\n      #   - Deny: reject the request without consulting subsequent authorizers\n      # Required, with no default.\n      failurePolicy: Deny\n      connectionInfo:\n        # Controls how the webhook should communicate with the server.\n        # Valid values:\n        # - KubeConfigFile: use the file specified in kubeConfigFile to locate the\n        #   server.\n        # - InClusterConfig: use the in-cluster configuration to call the\n        #   SubjectAccessReview API hosted by kube-apiserver. This mode is not\n        #   allowed for kube-apiserver.\n        type: KubeConfigFile\n        # Path to KubeConfigFile for connection info\n        # Required, if connectionInfo.Type is KubeConfigFile\n        kubeConfigFile: /kube-system-authz-webhook.yaml\n        # matchConditions is a list of conditions that must be met for a request to be sent to this\n        # webhook. An empty list of matchConditions matches all requests.\n        # There are a maximum of 64 match conditions allowed.\n        #\n        # The exact matching logic is (in order):\n        #   1. If at least one matchCondition evaluates to FALSE, then the webhook is skipped.\n        #   2. If ALL matchConditions evaluate to TRUE, then the webhook is called.\n        #   3. If at least one matchCondition evaluates to an error (but none are FALSE):\n        #      - If failurePolicy=Deny, then the webhook rejects the request\n        #      - If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped\n      matchConditions:\n      # expression represents the expression which will be evaluated by CEL. Must evaluate to bool.\n      # CEL expressions have access to the contents of the SubjectAccessReview in v1 version.\n      # If version specified by subjectAccessReviewVersion in the request variable is v1beta1,\n      # the contents would be converted to the v1 version before evaluating the CEL expression.\n      #\n      # Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n      #\n      # only send resource requests to the webhook\n      - expression: has(request.resourceAttributes)\n      # only intercept requests to kube-system\n      - expression: request.resourceAttributes.namespace == 'kube-system'\n      # don't intercept requests from kube-system service accounts\n      - expression: \"!('system:serviceaccounts:kube-system' in request.groups)\"\n  - type: Node\n    name: node\n  - type: RBAC\n    name: rbac\n  - type: Webhook\n    name: in-cluster-authorizer\n    webhook:\n      authorizedTTL: 5m\n      unauthorizedTTL: 30s\n      timeout: 3s\n      subjectAccessReviewVersion: v1\n      failurePolicy: NoOpinion\n      connectionInfo:\n        type: InClusterConfig\n```\n\nAuthorization | When configuring the authorizer chain using a configuration file, make sure all the control plane nodes have the same file contents. Take a note of the API server configuration when upgrading / downgr", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11924"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace dev\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11925"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace prod\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11926"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list secrets --namespace dev --as dave\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11927"}
{"instruction": "Write a bash example for authorization", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list pods \\\n    --namespace target \\\n    --as system:serviceaccount:dev:dev-sa\n```\n\nAuthorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11928"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f - -o yaml << EOF\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    verb: create\n    namespace: dev\nEOF\n```\n\nAuthorization | The generated SelfSubjectAccessReview is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11929"}
{"instruction": "Write a yaml example for authorization", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nmetadata:\n  creationTimestamp: null\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    namespace: dev\n    verb: create\nstatus:\n  allowed: true\n  denied: false\n```\n\nAuthorization |", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/access-authn-authz/authorization/", "id": "k8s_00774_code_11930"}
{"instruction": "Provide a tutorial on learn kubernetes basics", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Learn Kubernetes Basics1: Create a Cluster1.1: Using Minikube to Create a Cluster2: Deploy an App2.1: Using kubectl to Create a Deployment3: Explore Your App3.1: Viewing Pods and Nodes4: Expose Your App Publicly4.1: Using a Service to Expose Your App5: Scale Your App5.1: Running Multiple Instances of Your App6: Update Your App6.1: Performing a Rolling UpdateObjectivesThis tutorial provides a walkthrough of the basics of the Kubernetes cluster orchestration system. Each module contains some background information on major Kubernetes features and concepts, and a tutorial for you to follow along.Using the tutorials, you can learn to:Deploy a containerized application on a cluster.Scale the deployment.Update the containerized application with a new software version.Debug the containerized application.What can Kubernetes do for you?With modern web services, users expect applications to be available 24/7, and developers expect to deploy new versions of those applications several times a day. Containerization helps package software to serve these goals, enabling applications to be released and updated without downtime. Kubernetes helps you make sure those containerized applications run where and when you want, and helps them find the resources and tools they need to work. Kubernetes is a production-ready, open source platform designed with Google's accumulated experience in container orchestration, combined with best-of-breed ideas from the community.Kubernetes Basics Modules1. Create a Kubernetes cluster2. Deploy an app3. Explore your app4. Expose your app publicly5. Scale up your app6. Update your appWhat's", "category": "tutorials", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1\n```\n\n2.1 - Using kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11932"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.1 - Using kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11933"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n3.1 - Viewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11934"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl exec \"$POD_NAME\" -- env\n```\n\n3.1 - Viewing Pods and Nodes | Again, it's worth mentioning that the name of the container itself can be omitted since we only have a single container in the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11935"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- bash\n```\n\n3.1 - Viewing Pods and Nodes | We have now an open console on the container where we run our NodeJS application. The source code of the app is in the server.js file:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11936"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n4.1 - Using a Service to Expose Your App | We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11937"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11938"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n4.1 - Using a Service to Expose Your App | Let’s use this label to query our list of Pods. We’ll use the kubectl get pods command with -l as a parameter, followed by the label values:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11939"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | You can do the same to list the existing Services:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11940"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get services -l app=kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | Get the name of the Pod and store it in the POD_NAME environment variable:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11941"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl label pods \"$POD_NAME\" version=v1\n```\n\n4.1 - Using a Service to Expose Your App | This will apply a new label to our Pod (we pinned the application version to the Pod), and we can check it with the describe pod command:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11942"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods \"$POD_NAME\"\n```\n\n4.1 - Using a Service to Expose Your App | We see here that the label is attached now to our Pod. And we can query now the list of pods using the new label:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11943"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l version=v1\n```\n\n4.1 - Using a Service to Expose Your App | And we see the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11944"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | Confirm that the Service is gone:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11945"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- curl http://localhost:8080\n```\n\n4.1 - Using a Service to Expose Your App | We see here that the application is up. This is because the Deployment is managing the application. To shut down the application, you would need to delete the Deployment as well.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11946"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"LoadBalancer\" --port 8080\n```\n\n5.1 - Running Multiple Instances of Your App | Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling will increase the number of Pods to the new desired state. Kubernetes also supports a", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11947"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n5.1 - Running Multiple Instances of Your App | The output should be similar to:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11948"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=4\n```\n\n5.1 - Running Multiple Instances of Your App | To list your Deployments once again, use get deployments:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11949"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n5.1 - Running Multiple Instances of Your App | The change was applied, and we have 4 instances of the application available. Next, let’s check if the number of Pods changed:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11950"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n5.1 - Running Multiple Instances of Your App | There are 4 Pods now, with different IP addresses. The change was registered in the Deployment events log. To check that, use the describe subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11951"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments/kubernetes-bootcamp\n```\n\n5.1 - Running Multiple Instances of Your App | You can also view in the output of this command that there are 4 replicas now.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11952"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n5.1 - Running Multiple Instances of Your App | Create an environment variable called NODE_PORT that has a value as the Node port:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11953"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=2\n```\n\n5.1 - Running Multiple Instances of Your App | List the Deployments to check if the change was applied with the get deployments subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11954"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n5.1 - Running Multiple Instances of Your App | The number of replicas decreased to 2. List the number of Pods, with get pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11955"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n5.1 - Running Multiple Instances of Your App | This confirms that 2 Pods were terminated.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11956"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n6.1 - Performing a Rolling Update | To list the running Pods, run the get pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11957"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | To update the image of the application to version 2, use the set image subcommand, followed by the deployment name and the new image version:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11958"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2\n```\n\n6.1 - Performing a Rolling Update | The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the get pods subcomman", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11959"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n6.1 - Performing a Rolling Update | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11960"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployments/kubernetes-bootcamp\n```\n\n6.1 - Performing a Rolling Update | To view the current image version of the app, run the describe pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11961"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | In the Image field of the output, verify that you are running the latest image version (v2).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11962"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10\n```\n\n6.1 - Performing a Rolling Update | Use get deployments to see the status of the deployment:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11963"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n6.1 - Performing a Rolling Update | Notice that the output doesn't list the desired number of available Pods. Run the get pods subcommand to list all Pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11964"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | In the Events section of the output for the affected Pods, notice that the v10 image version did not exist in the repository.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11965"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployments/kubernetes-bootcamp\n```\n\n6.1 - Performing a Rolling Update | The rollout undo command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a Deployment.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11966"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | The Deployment is once again using a stable version of the app (v2). The rollback was successful.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11967"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/kubernetes-bootcamp services/kubernetes-bootcamp\n```\n\n6.1 - Performing a Rolling Update | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11968"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl action resource\n```\n\n2.1 - Using kubectl to Create a Deployment | This performs the specified action (like create, describe or delete) on the specified resource (like node or deployment. You can use --help after the subcommand to get additional info about possible p", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11969"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --help\n```\n\n2.1 - Using kubectl to Create a Deployment | Check that kubectl is configured to talk to your cluster, by running the kubectl version command.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11970"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\n2.1 - Using kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11971"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.1 - Using kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11972"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n3.1 - Viewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11973"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1\n```\n\n2.1 - Using kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11974"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.1 - Using kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11975"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n3.1 - Viewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11976"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl exec \"$POD_NAME\" -- env\n```\n\n3.1 - Viewing Pods and Nodes | Again, it's worth mentioning that the name of the container itself can be omitted since we only have a single container in the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11977"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- bash\n```\n\n3.1 - Viewing Pods and Nodes | We have now an open console on the container where we run our NodeJS application. The source code of the app is in the server.js file:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11978"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n4.1 - Using a Service to Expose Your App | We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11979"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11980"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n4.1 - Using a Service to Expose Your App | Let’s use this label to query our list of Pods. We’ll use the kubectl get pods command with -l as a parameter, followed by the label values:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11981"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | You can do the same to list the existing Services:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11982"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get services -l app=kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | Get the name of the Pod and store it in the POD_NAME environment variable:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11983"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl label pods \"$POD_NAME\" version=v1\n```\n\n4.1 - Using a Service to Expose Your App | This will apply a new label to our Pod (we pinned the application version to the Pod), and we can check it with the describe pod command:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11984"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods \"$POD_NAME\"\n```\n\n4.1 - Using a Service to Expose Your App | We see here that the label is attached now to our Pod. And we can query now the list of pods using the new label:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11985"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l version=v1\n```\n\n4.1 - Using a Service to Expose Your App | And we see the Pod.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11986"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=kubernetes-bootcamp\n```\n\n4.1 - Using a Service to Expose Your App | Confirm that the Service is gone:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11987"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- curl http://localhost:8080\n```\n\n4.1 - Using a Service to Expose Your App | We see here that the application is up. This is because the Deployment is managing the application. To shut down the application, you would need to delete the Deployment as well.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11988"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"LoadBalancer\" --port 8080\n```\n\n5.1 - Running Multiple Instances of Your App | Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling will increase the number of Pods to the new desired state. Kubernetes also supports a", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11989"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n5.1 - Running Multiple Instances of Your App | The output should be similar to:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11990"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=4\n```\n\n5.1 - Running Multiple Instances of Your App | To list your Deployments once again, use get deployments:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11991"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n5.1 - Running Multiple Instances of Your App | The change was applied, and we have 4 instances of the application available. Next, let’s check if the number of Pods changed:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11992"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n5.1 - Running Multiple Instances of Your App | There are 4 Pods now, with different IP addresses. The change was registered in the Deployment events log. To check that, use the describe subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11993"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments/kubernetes-bootcamp\n```\n\n5.1 - Running Multiple Instances of Your App | You can also view in the output of this command that there are 4 replicas now.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11994"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n5.1 - Running Multiple Instances of Your App | Create an environment variable called NODE_PORT that has a value as the Node port:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11995"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=2\n```\n\n5.1 - Running Multiple Instances of Your App | List the Deployments to check if the change was applied with the get deployments subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11996"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n5.1 - Running Multiple Instances of Your App | The number of replicas decreased to 2. List the number of Pods, with get pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11997"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n5.1 - Running Multiple Instances of Your App | This confirms that 2 Pods were terminated.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11998"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n6.1 - Performing a Rolling Update | To list the running Pods, run the get pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_11999"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | To update the image of the application to version 2, use the set image subcommand, followed by the deployment name and the new image version:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12000"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2\n```\n\n6.1 - Performing a Rolling Update | The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the get pods subcomman", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12001"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n6.1 - Performing a Rolling Update | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12002"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployments/kubernetes-bootcamp\n```\n\n6.1 - Performing a Rolling Update | To view the current image version of the app, run the describe pods subcommand:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12003"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | In the Image field of the output, verify that you are running the latest image version (v2).", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12004"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10\n```\n\n6.1 - Performing a Rolling Update | Use get deployments to see the status of the deployment:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12005"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n6.1 - Performing a Rolling Update | Notice that the output doesn't list the desired number of available Pods. Run the get pods subcommand to list all Pods:", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12006"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | In the Events section of the output for the affected Pods, notice that the v10 image version did not exist in the repository.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12007"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployments/kubernetes-bootcamp\n```\n\n6.1 - Performing a Rolling Update | The rollout undo command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a Deployment.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12008"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n6.1 - Performing a Rolling Update | The Deployment is once again using a stable version of the app (v2). The rollback was successful.", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12009"}
{"instruction": "Write a bash example for learn kubernetes basics", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/kubernetes-bootcamp services/kubernetes-bootcamp\n```\n\n6.1 - Performing a Rolling Update | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tutorials_code", "subcategory": "kubernetes-basics", "source": "https://kubernetes.io/docs/tutorials/kubernetes-basics/_print/", "id": "k8s_00775_code_12010"}
{"instruction": "Provide a tutorial on tutorials", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Tutorials1: Hello Minikube2: Learn Kubernetes Basics2.1: Create a Cluster2.1.1: Using Minikube to Create a Cluster2.2: Deploy an App2.2.1: Using kubectl to Create a Deployment2.3: Explore Your App2.3.1: Viewing Pods and Nodes2.4: Expose Your App Publicly2.4.1: Using a Service to Expose Your App2.5: Scale Your App2.5.1: Running Multiple Instances of Your App2.6: Update Your App2.6.1: Performing a Rolling Update3: Configuration3.1: Updating Configuration via a ConfigMap3.2: Configuring Redis using a ConfigMap3.3: Adopting Sidecar Containers4: Security4.1: Apply Pod Security Standards at the Cluster Level4.2: Apply Pod Security Standards at the Namespace Level4.3: Restrict a Container's Access to Resources with AppArmor4.4: Restrict a Container's Syscalls with seccomp5: Stateless Applications5.1: Exposing an External IP Address to Access an Application in a Cluster5.2: Example: Deploying PHP Guestbook application with Redis6: Stateful Applications6.1: StatefulSet Basics6.2: Example: Deploying WordPress and MySQL with Persistent Volumes6.3: Example: Deploying Cassandra with a StatefulSet6.4: Running ZooKeeper, A Distributed System Coordinator7: Cluster Management7.1: Running Kubelet in Standalone Mode7.2: Configuring swap memory on Kubernetes nodes7.3: Install Drivers and Allocate Devices with DRA7.4: Namespaces Walkthrough8: Services8.1: Connecting Applications with Services8.2: Using Source IP8.3: Explore Termination Behavior for Pods And Their EndpointsThis section of the Kubernetes documentation contains tutorials. A tutorial shows how to accomplish a goal that is larger than a single task. Typically a tutorial has several sections, each of which has a sequence of steps. Before walking through each tutorial, you may want to bookmark the Standardized Glossary page for later references.BasicsKubernetes Basics is an in-depth interactive tutorial that helps you understand the Kubernetes system and try out some basic Kubernetes features.Introduction to Kubernetes (edX)Hello MinikubeConfigurationConfiguring Redis Using a ConfigMapAuthoring PodsAdopting Sidecar ContainersStateless ApplicationsExposing an External IP Address to Access an Application in a ClusterExample: Deploying PHP Guestbook application with RedisStateful ApplicationsStatefulSet BasicsExample: WordPress and MySQL with Persistent VolumesExample: Deploying Cassandra with Stateful SetsRunning ZooKeeper, A CP Distributed SystemServicesConnecting Applications with ServicesUsing Source IPSecurityApply Pod Security Standards at Cluster levelApply Pod Security Standards at Namespace levelRestrict a Container's Access to Resources with AppArmorSeccompCluster ManagementConfiguring Swap Memory on Kubernetes NodesRunning Kubelet in Standalone ModeInstall Drivers and Allocate Devices with DRAWhat's", "category": "tutorials", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n1 - Hello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12012"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs hello-node-5f76cf6ccf-br9b5\n```\n\n1 - Hello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12013"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-node --type=LoadBalancer --port=8080\n```\n\n1 - Hello Minikube | The --type=LoadBalancer flag indicates that you want to expose your Service outside of the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12014"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod,svc -n kube-system\n```\n\n1 - Hello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12015"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service hello-node\nkubectl delete deployment hello-node\n```\n\n1 - Hello Minikube | Stop the Minikube cluster", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12016"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1\n```\n\n2.2.1 - Using kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12017"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.2.1 - Using kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12018"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.3.1 - Viewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12019"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec \"$POD_NAME\" -- env\n```\n\n2.3.1 - Viewing Pods and Nodes | Again, it's worth mentioning that the name of the container itself can be omitted since we only have a single container in the Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12020"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- bash\n```\n\n2.3.1 - Viewing Pods and Nodes | We have now an open console on the container where we run our NodeJS application. The source code of the app is in the server.js file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12021"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n2.4.1 - Using a Service to Expose Your App | We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12022"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12023"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n2.4.1 - Using a Service to Expose Your App | Let’s use this label to query our list of Pods. We’ll use the kubectl get pods command with -l as a parameter, followed by the label values:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12024"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | You can do the same to list the existing Services:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12025"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services -l app=kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | Get the name of the Pod and store it in the POD_NAME environment variable:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12026"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label pods \"$POD_NAME\" version=v1\n```\n\n2.4.1 - Using a Service to Expose Your App | This will apply a new label to our Pod (we pinned the application version to the Pod), and we can check it with the describe pod command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12027"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods \"$POD_NAME\"\n```\n\n2.4.1 - Using a Service to Expose Your App | We see here that the label is attached now to our Pod. And we can query now the list of pods using the new label:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12028"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l version=v1\n```\n\n2.4.1 - Using a Service to Expose Your App | And we see the Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12029"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | Confirm that the Service is gone:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12030"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- curl http://localhost:8080\n```\n\n2.4.1 - Using a Service to Expose Your App | We see here that the application is up. This is because the Deployment is managing the application. To shut down the application, you would need to delete the Deployment as well.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12031"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"LoadBalancer\" --port 8080\n```\n\n2.5.1 - Running Multiple Instances of Your App | Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling will increase the number of Pods to the new desired state. Kubernetes also supports a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12032"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.5.1 - Running Multiple Instances of Your App | The output should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12033"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=4\n```\n\n2.5.1 - Running Multiple Instances of Your App | To list your Deployments once again, use get deployments:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12034"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.5.1 - Running Multiple Instances of Your App | The change was applied, and we have 4 instances of the application available. Next, let’s check if the number of Pods changed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12035"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n2.5.1 - Running Multiple Instances of Your App | There are 4 Pods now, with different IP addresses. The change was registered in the Deployment events log. To check that, use the describe subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12036"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments/kubernetes-bootcamp\n```\n\n2.5.1 - Running Multiple Instances of Your App | You can also view in the output of this command that there are 4 replicas now.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12037"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n2.5.1 - Running Multiple Instances of Your App | Create an environment variable called NODE_PORT that has a value as the Node port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12038"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=2\n```\n\n2.5.1 - Running Multiple Instances of Your App | List the Deployments to check if the change was applied with the get deployments subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12039"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.5.1 - Running Multiple Instances of Your App | The number of replicas decreased to 2. List the number of Pods, with get pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12040"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n2.5.1 - Running Multiple Instances of Your App | This confirms that 2 Pods were terminated.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12041"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.6.1 - Performing a Rolling Update | To list the running Pods, run the get pods subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12042"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | To update the image of the application to version 2, use the set image subcommand, followed by the deployment name and the new image version:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12043"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2\n```\n\n2.6.1 - Performing a Rolling Update | The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the get pods subcomman", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12044"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n2.6.1 - Performing a Rolling Update | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12045"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployments/kubernetes-bootcamp\n```\n\n2.6.1 - Performing a Rolling Update | To view the current image version of the app, run the describe pods subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12046"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | In the Image field of the output, verify that you are running the latest image version (v2).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12047"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10\n```\n\n2.6.1 - Performing a Rolling Update | Use get deployments to see the status of the deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12048"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.6.1 - Performing a Rolling Update | Notice that the output doesn't list the desired number of available Pods. Run the get pods subcommand to list all Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12049"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | In the Events section of the output for the affected Pods, notice that the v10 image version did not exist in the repository.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12050"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployments/kubernetes-bootcamp\n```\n\n2.6.1 - Performing a Rolling Update | The rollout undo command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a Deployment.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12051"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | The Deployment is once again using a stable version of the app (v2). The rollback was successful.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12052"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/kubernetes-bootcamp services/kubernetes-bootcamp\n```\n\n2.6.1 - Performing a Rolling Update | This page provides a step-by-step example of updating configuration within a Pod via a ConfigMap and builds upon the Configure a Pod to Use a ConfigMap task.At the end of this tutorial, you will under", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12053"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap sport --from-literal=sport=football\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the ConfigMap sport mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12054"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12055"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-volume.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12056"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12057"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap sport\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key sport from football to cricket. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12058"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  sport: cricket\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T14:05:06Z\"\n  name: sport\n  namespace: default\n  resourceVersion: \"1743935\"\n  uid: 024ee001-fe72-487e-872e-34d6464a8a23\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12059"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployments/configmap-volume --follow\n```\n\n3.1 - Updating Configuration via a ConfigMap | After few seconds, you should see the log output change as follows:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12060"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap fruits --from-literal=fruits=apples\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with an environment variable configured via the ConfigMap fruits.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12061"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12062"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-envvar.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12063"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12064"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12065"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap fruits\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key fruits from apples to mangoes. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12066"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  fruits: mangoes\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T16:04:19Z\"\n  name: fruits\n  namespace: default\n  resourceVersion: \"1749472\"\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12067"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12068"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | The rollout causes Kubernetes to make a new ReplicaSet for the Deployment; that means the existing Pods eventually terminate, and new ones are created. After few seconds, you should see an output simi", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12069"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=red\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with two containers. The two containers share an emptyDir volume that they use to communicate. The first container runs a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12070"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12071"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-two-containers.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12072"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-two-containers\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12073"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-two-containers --name=configmap-service --port=8080 --target-port=80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12074"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key color from red to blue. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12075"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: blue\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-05T08:12:05Z\"\n  name: color\n  namespace: configmap\n  resourceVersion: \"1801272\"\n  uid: 80d33e4a-cbb4-4bc9-ba8c-544c68e425d6\n```\n\n3.1 - Updating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12076"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=blue\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with a main container and a sidecar container. The two containers share an emptyDir volume that they use to communicate.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12077"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12078"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-and-sidecar-container.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12079"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-sidecar-container\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12080"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-sidecar-container --name=configmap-sidecar-service --port=8081 --target-port=80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12081"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key color from blue to green. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12082"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: green\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-02-17T12:20:30Z\"\n  name: color\n  namespace: default\n  resourceVersion: \"1054\"\n  uid: e40bb34c-58df-4280-8bea-6ed16edccfaa\n```\n\n3.1 - Updating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12083"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12084"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/immutable-configmap.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the Immutable ConfigMap company-name-20150801 mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12085"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12086"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-immutable-configmap-as-volume.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12087"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12088"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12089"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/new-immutable-configmap.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12090"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output displaying both the old and new ConfigMaps:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12091"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment immutable-configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, update the existing volume definition to use the new ConfigMap.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12092"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should eventually see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12093"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Changes to a ConfigMap mounted as a Volume on a Pod are available seamlessly after the subsequent kubelet sync.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12094"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment configmap-volume configmap-env-var configmap-two-containers configmap-sidecar-container immutable-configmap-volume\nkubectl delete service configmap-service configmap-sidecar-service\nkubectl delete configmap sport fruits color company-name-20240312\n\nkubectl delete configmap company-name-20150801 # In case it was not handled during the task execution\n```\n\n3.1 - Updating Configuration via a ConfigMap | This page provides a real world example of how to configure Redis using a ConfigMap and builds upon the Configure a Pod to Use a ConfigMap task.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12095"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF >./example-redis-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: \"\"\nEOF\n```\n\n3.2 - Configuring Redis using a ConfigMap | Apply the ConfigMap created above, along with a Redis pod manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12096"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\n3.2 - Configuring Redis using a ConfigMap | Examine the contents of the Redis pod manifest and note the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12097"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\n3.2 - Configuring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12098"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/redis configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12099"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | You should see an empty redis-config key:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12100"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\n3.2 - Configuring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12101"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\n3.2 - Configuring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12102"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\n```\n\n3.2 - Configuring Redis using a ConfigMap | Confirm that the ConfigMap was updated:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12103"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | You should see the configuration values we just added:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12104"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\n3.2 - Configuring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12105"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\n3.2 - Configuring Redis using a ConfigMap | Now re-check the configuration values one last time:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12106"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\n3.2 - Configuring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12107"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/redis configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | This section is relevant for people adopting a new built-in sidecar containers feature for their workloads.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12108"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\n3.3 - Adopting Sidecar Containers | For the individual node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12109"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\n3.3 - Adopting Sidecar Containers | If you see something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12110"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-wo-cluster-pss\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12111"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=privileged\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12112"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=baseline\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12113"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=restricted\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12114"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nmkdir -p /tmp/pss\ncat <<EOF > /tmp/pss/cluster-level-pss.yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1\n    kind: PodSecurityConfiguration\n    defaults:\n      enforce: \"baseline\"\n      enforce-version: \"latest\"\n      audit: \"restricted\"\n      audit-version: \"latest\"\n      warn: \"restricted\"\n      warn-version: \"latest\"\n    exemptions:\n      usernames: []\n      runtimeClasses: []\n      namespaces: [kube-system]\nEOF\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | Configure the API server to consume this file during cluster creation:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12115"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > /tmp/pss/cluster-config.yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n- role: control-plane\n  kubeadmConfigPatches:\n  - |\n    kind: ClusterConfiguration\n    apiServer:\n        extraArgs:\n          admission-control-config-file: /etc/config/cluster-level-pss.yaml\n        extraVolumes:\n          - name: accf\n            hostPath: /etc/config\n            mountPath: /etc/config\n            readOnly: false\n            pathType: \"DirectoryOrCreate\"\n  extraMounts:\n  - hostPath: /tmp/pss\n    containerPath: /etc/config\n    # optional: if set, the mount is read-only.\n    # default false\n    readOnly: false\n    # optional: if set, the mount needs SELinux relabeling.\n    # default false\n    selinuxRelabel: false\n    # optional: set propagation mode (None, HostToContainer or Bidirectional)\n    # see https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation\n    # default None\n    propagation: None\nEOF\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | Create a cluster that uses Pod Security Admission to apply these Pod Security Standards:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12116"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-with-cluster-pss\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12117"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12118"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12119"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-ns-level\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12120"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create ns example\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12121"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n   pod-security.kubernetes.io/warn=baseline \\\n   pod-security.kubernetes.io/warn-version=latest\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | You can configure multiple pod security standard checks on any namespace, using labels. The following command will enforce the baseline Pod Security Standard, but warn and audit for restricted Pod Sec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12122"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n  pod-security.kubernetes.io/enforce=baseline \\\n  pod-security.kubernetes.io/enforce-version=latest \\\n  pod-security.kubernetes.io/warn=restricted \\\n  pod-security.kubernetes.io/warn-version=latest \\\n  pod-security.kubernetes.io/audit=restricted \\\n  pod-security.kubernetes.io/audit-version=latest\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | Create a baseline Pod in the example namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12123"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n example -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | The Pod does start OK; the output includes a warning. For example:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12124"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n default -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | Output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12125"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod_name> -- cat /proc/1/attr/current\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | The output should look something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12126"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12127"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create -f hello-apparmor.yaml\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12128"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- cat /proc/1/attr/current\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | The output should be:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12129"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- touch /tmp/test\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | To wrap up, see what happens if you try to specify a profile that hasn't been loaded:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12130"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f /dev/stdin <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor-2\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-allow-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\nEOF\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | Although the Pod was created successfully, further examination will show that it is stuck in pending:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12131"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod hello-apparmor-2\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | An Event provides the error message with the reason, the specific wording is runtime-dependent:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12132"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12133"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12134"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12135"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12136"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | To start off, apply the audit.json profile, which will log all syscalls of the process, to a new Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12137"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12138"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/audit-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | This profile does not restrict any syscalls, so the Pod should start successfully.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12139"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod audit-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | In order to be able to interact with this endpoint exposed by this container, create a NodePort Service that allows access to the endpoint from inside the kind control plane container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12140"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod audit-pod --type NodePort --port 5678\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12141"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service audit-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12142"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service audit-pod --wait\nkubectl delete pod audit-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | For demonstration, apply a profile to the Pod that does not allow for any syscalls.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12143"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12144"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/violation-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod creates, but there is an issue. If you check the status of the Pod, you should see that it failed to start.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12145"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod violation-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | As seen in the previous example, the http-echo process requires quite a few syscalls. Here seccomp has been instructed to error on any syscall by setting \"defaultAction\": \"SCMP_ACT_ERRNO\". This is ext", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12146"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod violation-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | If you take a look at the fine-grained.json profile, you will notice some of the syscalls seen in syslog of the first example where the profile set \"defaultAction\": \"SCMP_ACT_LOG\". Now the profile is", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12147"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12148"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/fine-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12149"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod fine-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12150"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod fine-pod --type NodePort --port 5678\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12151"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service fine-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12152"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service fine-pod --wait\nkubectl delete pod fine-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | To use seccomp profile defaulting, you must run the kubelet with the --seccomp-default command line flag enabled for each node where you want to use it.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12153"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n  - role: control-plane\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"        \n  - role: worker\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | If the cluster is ready, then running a pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12154"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run --rm -it --restart=Never --image=alpine alpine -- sh\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Should now have the default seccomp profile attached. This can be verified by using docker exec to run crictl inspect for the container on the kind worker:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12155"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\ndocker exec -it kind-worker bash -c \\\n    'crictl inspect $(crictl ps --name=alpine -q) | jq .info.runtimeSpec.linux.seccomp'\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | You can learn more about Linux seccomp:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12156"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12157"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/load-balancer-example.yaml\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12158"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12159"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12160"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=LoadBalancer --name=my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Display information about the Service:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12161"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12162"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe services my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12163"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12164"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete services my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12165"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Learn more about connecting applications with services.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12166"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12167"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-deployment.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the Redis Pod is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12168"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f deployment/redis-leader\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The guestbook application needs to communicate to the Redis to write its data. You need to apply a Service to proxy the traffic to the Redis Pod. A Service defines a policy to access the Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12169"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12170"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-service.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12171"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12172"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-deployment.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Verify that the two Redis follower replicas are running by querying the list of Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12173"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12174"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-service.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12175"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12176"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-deployment.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the three frontend replicas are running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12177"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=guestbook -l tier=frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12178"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12179"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-service.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the frontend Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12180"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward svc/frontend 8080:80\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12181"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12182"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=5\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12183"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=2\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12184"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment -l app=redis\nkubectl delete service -l app=redis\nkubectl delete deployment frontend\nkubectl delete service frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should look similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12185"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12186"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n6.1 - StatefulSet Basics | The command above creates two Pods, each running an NGINX webserver. Get the nginx Service...", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12187"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service nginx\n```\n\n6.1 - StatefulSet Basics | ...then get the web StatefulSet, to verify that both were created successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12188"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset web\n```\n\n6.1 - StatefulSet Basics | A StatefulSet defaults to creating its Pods in a strict order.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12189"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n6.1 - StatefulSet Basics | As mentioned in the StatefulSets concept, the Pods in a StatefulSet have a sticky, unique identity. This identity is based on a unique ordinal index that is assigned to each Pod by the StatefulSet con", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12190"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n6.1 - StatefulSet Basics | which starts a new shell. In that new shell, run:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12191"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n6.1 - StatefulSet Basics | Wait for the StatefulSet to restart them, and for both Pods to transition to Running and Ready:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12192"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n6.1 - StatefulSet Basics | which starts a new shell.In that new shell, run:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12193"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n6.1 - StatefulSet Basics | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12194"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n6.1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for all of the Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12195"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale sts web --replicas=5\n```\n\n6.1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for the three additional Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12196"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts web -p '{\"spec\":{\"replicas\":3}}'\n```\n\n6.1 - StatefulSet Basics | Wait for web-4 and web-3 to transition to Terminating.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12197"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n6.1 - StatefulSet Basics | There are still five PersistentVolumeClaims and five PersistentVolumes. When exploring a Pod's stable storage, you saw that the PersistentVolumes mounted to the Pods of a StatefulSet are not deleted w", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12198"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.24\"}]'\n```\n\n6.1 - StatefulSet Basics | In another terminal, watch the Pods in the StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12199"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.21\"}]'\n```\n\n6.1 - StatefulSet Basics | Delete a Pod in the StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12200"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-2\n```\n\n6.1 - StatefulSet Basics | Wait for the replacement web-2 Pod to be Running and Ready:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12201"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n6.1 - StatefulSet Basics | Notice that, even though the update strategy is RollingUpdate the StatefulSet restored the Pod with the original container image. This is because the ordinal of the Pod is less than the partition spec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12202"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n6.1 - StatefulSet Basics | When you changed the partition, the StatefulSet controller automatically updated the web-2 Pod because the Pod's ordinal was greater than or equal to the partition.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12203"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-1\n```\n\n6.1 - StatefulSet Basics | Wait for the web-1 Pod to be Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12204"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-1 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n6.1 - StatefulSet Basics | web-1 was restored to its original configuration because the Pod's ordinal was less than the partition. When a partition is specified, all Pods with an ordinal that is greater than or equal to the par", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12205"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"partition\":0}}}}'\n```\n\n6.1 - StatefulSet Basics | Wait for all of the Pods in the StatefulSet to become Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12206"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"OnDelete\", \"rollingUpdate\": null}}}'\n```\n\n6.1 - StatefulSet Basics | When you select this update strategy, the StatefulSet controller does not automatically update Pods when a modification is made to the StatefulSet's .spec.template field. You need to manage the rollou", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12207"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web --cascade=orphan\n```\n\n6.1 - StatefulSet Basics | Get the Pods, to examine their status:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12208"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n6.1 - StatefulSet Basics | Even though web has been deleted, all of the Pods are still Running and Ready. Delete web-0:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12209"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-0\n```\n\n6.1 - StatefulSet Basics | Get the StatefulSet's Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12210"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n6.1 - StatefulSet Basics | As the web StatefulSet has been deleted, web-0 has not been relaunched.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12211"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n6.1 - StatefulSet Basics | Ignore the error. It only indicates that an attempt was made to create the nginx headless Service even though that Service already exists.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12212"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n6.1 - StatefulSet Basics | Examine the output of the kubectl get command running in the first terminal, and wait for all of the Pods to transition to Terminating.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12213"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n6.1 - StatefulSet Basics | Recreate the StatefulSet and headless Service one more time:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12214"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n6.1 - StatefulSet Basics | When all of the StatefulSet's Pods transition to Running and Ready, retrieve the contents of their index.html files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12215"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n6.1 - StatefulSet Basics | ...and the web StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12216"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n6.1 - StatefulSet Basics | For some distributed systems, the StatefulSet ordering guarantees are unnecessary and/or undesirable. These systems require only uniqueness and identity.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12217"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12218"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web-parallel.yaml\n```\n\n6.1 - StatefulSet Basics | Keep the terminal open where you're running the watch. In another terminal window, scale the StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12219"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset/web --replicas=5\n```\n\n6.1 - StatefulSet Basics | Examine the output of the terminal where the kubectl get command is running. It may look something like", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12220"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete sts web\n# sts is an abbreviation for statefulset\n```\n\n6.1 - StatefulSet Basics | You can watch kubectl get to see those Pods being deleted.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12221"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc nginx\n```\n\n6.1 - StatefulSet Basics | Delete the persistent storage media for the PersistentVolumes used in this tutorial.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12222"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc www-web-0 www-web-1 www-web-2 www-web-3 www-web-4\n```\n\n6.1 - StatefulSet Basics | This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12223"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12224"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12225"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services wordpress\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The response should be like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12226"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12227"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Get the Cassandra Service.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12228"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response is", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12229"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12230"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12231"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l=\"app=cassandra\"\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12232"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra-0 -- nodetool status\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should look something like:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12233"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulset cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | This command opens an editor in your terminal. The line you need to change is the replicas field. The following sample is an excerpt of the StatefulSet file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12234"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12235"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12236"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The Pods in this tutorial use the gcr.io/google-samples/cassandra:v13 image from Google's container registry. The Docker image above is based on debian-base and includes OpenJDK 8.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12237"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12238"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk-hs Headless Service, the zk-cs Service, the zk-pdb PodDisruptionBudget, and the zk StatefulSet.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12239"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12240"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- cat /opt/zookeeper/conf/zoo.cfg\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In the server.1, server.2, and server.3 properties at the bottom of the file, the 1, 2, and 3 correspond to the identifiers in the ZooKeeper servers' myid files. They are set to the FQDNs for the Pods", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12241"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The A records for each Pod are entered when the Pod becomes Ready. Therefore, the FQDNs of the ZooKeeper servers will resolve to a single endpoint, and that endpoint will be the unique ZooKeeper serve", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12242"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- zkCli.sh create /hello world\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | To get the data from the zk-1 Pod use the following command.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12243"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-1 -- zkCli.sh get /hello\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The data that you created on zk-0 is available on all the servers in the ensemble.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12244"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Watch the termination of the Pods in the StatefulSet.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12245"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | When zk-0 if fully terminated, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12246"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk StatefulSet object, but the other API objects in the manifest are not modified because they already exist.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12247"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12248"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-2 zkCli.sh get /hello\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Even though you terminated and recreated all of the Pods in the zk StatefulSet, the ensemble still serves the original value.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12249"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | When the StatefulSet recreated its Pods, it remounts the Pods' PersistentVolumes.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12250"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get sts zk -o yaml\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The command used to start the ZooKeeper servers passed the configuration as command line parameter. You can also use environment variables to pass configuration to the ensemble.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12251"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 cat /usr/etc/zookeeper/log4j.properties\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The logging configuration below will cause the ZooKeeper process to write all of its logs to the standard output file stream.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12252"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs zk-0 --tail 20\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | You can view application logs written to standard out or standard error using kubectl logs and from the Kubernetes Dashboard.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12253"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -elf\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | As the runAsUser field of the securityContext object is set to 1000, instead of running as root, the ZooKeeper process runs as the zookeeper user.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12254"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti zk-0 -- ls -ld /var/lib/zookeeper/data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Because the fsGroup field of the securityContext object is set to 1000, the ownership of the Pods' PersistentVolumes is set to the zookeeper group, and the ZooKeeper process is able to read and write", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12255"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts zk --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/resources/requests/cpu\", \"value\":\"0.3\"}]'\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Use kubectl rollout status to watch the status of the update.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12256"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12257"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history sts/zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12258"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo sts/zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12259"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -ef\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The command used as the container's entry point has PID 1, and the ZooKeeper process, a child of the entry point, has PID 27.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12260"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, terminate the ZooKeeper process in Pod zk-0 with the following command.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12261"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- pkill java\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The termination of the ZooKeeper process caused its parent process to terminate. Because the RestartPolicy of the container is Always, it restarted the parent process.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12262"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In another window, using the following command to delete the zookeeper-ready script from the file system of Pod zk-0.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12263"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- rm /opt/zookeeper/bin/zookeeper-ready\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | When the liveness probe for the ZooKeeper process fails, Kubernetes will automatically restart the process for you, ensuring that unhealthy processes in the ensemble are restarted.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12264"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Readiness is not the same as liveness. If a process is alive, it is scheduled and healthy. If a process is ready, it is able to process input. Liveness is a necessary, but not sufficient, condition fo", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12265"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cordon <node-name>\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Use this command to get the zk-pdb PodDisruptionBudget.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12266"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pdb zk-pdb\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The max-unavailable field indicates to Kubernetes that at most one Pod from zk StatefulSet can be unavailable at any time.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12267"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, use this command to get the nodes that the Pods are currently scheduled on.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12268"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-0 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12269"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-1 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12270"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12271"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12272"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 zkCli.sh get /hello\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The service is still available because its PodDisruptionBudget is respected.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12273"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-pb41\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12274"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12275"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12276"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-ixsl\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12277"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nsudo tee /etc/kubernetes/kubelet.yaml <<EOF\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthentication:\n  webhook:\n    enabled: false # Do NOT use in production clusters!\nauthorization:\n  mode: AlwaysAllow # Do NOT use in production clusters!\nenableServer: false\nlogging:\n  format: text\naddress: 127.0.0.1 # Restrict access to localhost\nreadOnlyPort: 10255 # Do NOT use in production clusters!\nstaticPodPath: /etc/kubernetes/manifests\ncontainerRuntimeEndpoint: unix:///var/run/crio/crio.sock\nEOF\n```\n\n7.1 - Running Kubelet in Standalone Mode | Because you are not setting up a production cluster, you are using plain HTTP (readOnlyPort: 10255) for unauthenticated queries to the kubelet's API.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12278"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\n7.1 - Running Kubelet in Standalone Mode | Copy the static-web.yaml manifest file to the /etc/kubernetes/manifests directory.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12279"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12280"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12281"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -A\nkubectl get resourceclaimtemplates -A\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12282"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | In a production environment, you would likely be using a previously released or qualified image from the driver vendor or your own organization, and your nodes would need to have access to the image r", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12283"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\ndocker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | For this tutorial, you will install the critical example resource driver components individually with kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12284"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12285"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/deviceclass.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12286"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12287"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/serviceaccount.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12288"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12289"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrole.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12290"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12291"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrolebinding.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12292"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12293"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/priorityclass.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12294"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12295"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/daemonset.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12296"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12297"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12298"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12299"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/resourceclaim.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12300"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12301"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/pod.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12302"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod0 -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12303"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod0 -c ctr0 -n dra-tutorial | grep -E \"GPU_DEVICE_[0-9]+=\" | grep -v \"RESOURCE_CLAIM\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12304"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12305"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaim some-gpu -n dra-tutorial -o yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this: 1apiVersion: resource.k8s.io/v1 2kind: ResourceClaim 3metadata: 4 creationTimestamp: \"2025-08-20T18:17:31Z\" 5 finalizers: 6 - resource.kubernetes.io/delete", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12306"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n1apiVersion: resource.k8s.io/v1\n 2kind: ResourceClaim\n 3metadata:\n 4    creationTimestamp: \"2025-08-20T18:17:31Z\"\n 5    finalizers:\n 6    - resource.kubernetes.io/delete-protection\n 7    name: some-gpu\n 8    namespace: dra-tutorial\n 9    resourceVersion: \"2326\"\n10    uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3\n11spec:\n12    devices:\n13        requests:\n14        - exactly:\n15            allocationMode: ExactCount\n16            count: 1\n17            deviceClassName: gpu.example.com\n18            selectors:\n19            - cel:\n20                expression: device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi'))\n21                >= 0\n22        name: some-gpu\n23status:\n24    allocation:\n25        devices:\n26        results:\n27        - device: gpu-0\n28            driver: gpu.example.com\n29            pool: kind-worker\n30            request: some-gpu\n31        nodeSelector:\n32        nodeSelectorTerms:\n33        - matchFields:\n34            - key: metadata.name\n35            operator: In\n36            values:\n37            - kind-worker\n38    reservedFor:\n39    - name: pod0\n40        resource: pods\n41        uid: c4dadf20-392a-474d-a47b-ab82080c8bd7\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | To check how the driver handled device allocation, get the logs for the driver DaemonSet Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12307"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12308"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod pod0 -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12309"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12310"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12311"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace dra-tutorial\nkubectl delete deviceclass gpu.example.com\nkubectl delete clusterrole dra-example-driver-role\nkubectl delete clusterrolebinding dra-example-driver-role-binding\nkubectl delete priorityclass dra-driver-high-priority\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Kubernetes namespaces help different projects, teams, or customers to share a Kubernetes cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12312"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\n7.4 - Namespaces Walkthrough | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12313"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\n7.4 - Namespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12314"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.yaml\n```\n\n7.4 - Namespaces Walkthrough | Save the following contents into file namespace-prod.yaml which describes a production namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12315"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\n7.4 - Namespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12316"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.yaml\n```\n\n7.4 - Namespaces Walkthrough | To be sure things are right, let's list all of the namespaces in our cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12317"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\n7.4 - Namespaces Walkthrough | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12318"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\n7.4 - Namespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12319"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\n7.4 - Namespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12320"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context dev --namespace=development \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n\nkubectl config set-context prod --namespace=production \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n```\n\n7.4 - Namespaces Walkthrough | By default, the above commands add two contexts that are saved into file .kube/config. You can now view the contexts and alternate against the two new request contexts depending on which namespace you", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12321"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: development\n    user: lithe-cocoa-92103_kubernetes\n  name: dev\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: production\n    user: lithe-cocoa-92103_kubernetes\n  name: prod\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\n7.4 - Namespaces Walkthrough | Let's switch to operate in the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12322"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context dev\n```\n\n7.4 - Namespaces Walkthrough | You can verify your current context by doing the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12323"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\n7.4 - Namespaces Walkthrough | At this point, all requests we make to the Kubernetes cluster from the command line are scoped to the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12324"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\n7.4 - Namespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12325"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/snowflake-deployment.yaml\n```\n\n7.4 - Namespaces Walkthrough | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12326"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\n7.4 - Namespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12327"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake\n```\n\n7.4 - Namespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12328"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context prod\n```\n\n7.4 - Namespaces Walkthrough | The production namespace should be empty, and the following commands should return nothing.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12329"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\nkubectl get pods\n```\n\n7.4 - Namespaces Walkthrough | Production likes to run cattle, so let's create some cattle pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12330"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname --replicas=5\n\nkubectl get deployment\n```\n\n7.4 - Namespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12331"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle\n```\n\n7.4 - Namespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12332"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Connecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12333"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./run-my-nginx.yaml\nkubectl get pods -l run=my-nginx -o wide\n```\n\n8.1 - Connecting Applications with Services | Check your pods' IPs:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12334"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.4]]\n    [map[ip:10.244.2.5]]\n```\n\n8.1 - Connecting Applications with Services | You should be able to ssh into any node in your cluster and use a tool such as curl to make queries against both IPs. Note that the containers are not using port 80 on the node, nor are there any spec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12335"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/my-nginx\n```\n\n8.1 - Connecting Applications with Services | This is equivalent to kubectl apply -f in the following yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12336"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\n8.1 - Connecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12337"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx\n```\n\n8.1 - Connecting Applications with Services | As mentioned previously, a Service is backed by a group of Pods. These Pods are exposed through EndpointSlices. The Service's selector will be evaluated continuously and the results will be POSTed to", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12338"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc my-nginx\n```\n\n8.1 - Connecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12339"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=my-nginx\n```\n\n8.1 - Connecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12340"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-jr4a2 -- printenv | grep SERVICE\n```\n\n8.1 - Connecting Applications with Services | Note there's no mention of your Service. This is because you created the replicas before the Service. Another disadvantage of doing this is that the scheduler might put both Pods on the same machine,", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12341"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment my-nginx --replicas=0; kubectl scale deployment my-nginx --replicas=2;\n\nkubectl get pods -l run=my-nginx -o wide\n```\n\n8.1 - Connecting Applications with Services | You may notice that the pods have different names, since they are killed and recreated.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12342"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-e9ihh -- printenv | grep SERVICE\n```\n\n8.1 - Connecting Applications with Services | Kubernetes offers a DNS cluster addon Service that automatically assigns dns names to other Services. You can check if it's running on your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12343"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services kube-dns --namespace=kube-system\n```\n\n8.1 - Connecting Applications with Services | The rest of this section will assume you have a Service with a long lived IP (my-nginx), and a DNS server that has assigned a name to that IP. Here we use the CoreDNS cluster addon (application name k", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12344"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run curl --image=radial/busyboxplus:curl -i --tty --rm\n```\n\n8.1 - Connecting Applications with Services | Then, hit enter and run nslookup my-nginx:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12345"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap nginxconfigmap --from-file=default.conf\n```\n\n8.1 - Connecting Applications with Services | You can find an example for default.conf in the Kubernetes examples project repo.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12346"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps\n```\n\n8.1 - Connecting Applications with Services | You can view the details of the nginxconfigmap ConfigMap using the following command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12347"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap  nginxconfigmap\n```\n\n8.1 - Connecting Applications with Services | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12348"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"v1\"\nkind: \"Secret\"\nmetadata:\n  name: \"nginxsecret\"\n  namespace: \"default\"\ntype: kubernetes.io/tls\ndata:\n # NOTE: Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n8.1 - Connecting Applications with Services | Now create the secrets using the file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12349"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginxsecrets.yaml\nkubectl get secrets\n```\n\n8.1 - Connecting Applications with Services | Now modify your nginx replicas to start an https server using the certificate in the secret, and the Service, to expose both ports (80 and 443):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12350"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\n8.1 - Connecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12351"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments,svc my-nginx; kubectl create -f ./nginx-secure-app.yaml\n```\n\n8.1 - Connecting Applications with Services | At this point you can reach the nginx server from any node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12352"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.5]]\n```\n\n8.1 - Connecting Applications with Services | Note how we supplied the -k parameter to curl in the last step, this is because we don't know anything about the pods running nginx at certificate generation time, so we have to tell curl to ignore th", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12353"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12354"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./curlpod.yaml\nkubectl get pods -l app=curlpod\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12355"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec curl-deployment-1515033274-1410r -- curl https://my-nginx --cacert /etc/nginx/ssl/tls.crt\n...\n<title>Welcome to nginx!</title>\n...\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12356"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx -o yaml | grep nodePort -C 5\n  uid: 07191fb3-f61a-11e5-8ae5-42010af00002\nspec:\n  clusterIP: 10.0.162.149\n  ports:\n  - name: http\n    nodePort: 31704\n    port: 8080\n    protocol: TCP\n    targetPort: 80\n  - name: https\n    nodePort: 32453\n    port: 443\n    protocol: TCP\n    targetPort: 443\n  selector:\n    run: my-nginx\n```\n\n8.1 - Connecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12357"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o yaml | grep ExternalIP -C 1\n    - address: 104.197.41.11\n      type: ExternalIP\n    allocatable:\n--\n    - address: 23.251.152.56\n      type: ExternalIP\n    allocatable:\n...\n\n$ curl https://<EXTERNAL-IP>:<NODE-PORT> -k\n...\n<h1>Welcome to nginx!</h1>\n```\n\n8.1 - Connecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12358"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc my-nginx\nkubectl get svc my-nginx\n```\n\n8.1 - Connecting Applications with Services | The IP address in the EXTERNAL-IP column is the one that is available on the public internet. The CLUSTER-IP is only available inside your cluster/private cloud network.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12359"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe service my-nginx\n...\nLoadBalancer Ingress:   a320587ffd19711e5a37606cf4a74574-1142138393.us-east-1.elb.amazonaws.com\n...\n```\n\n8.1 - Connecting Applications with Services | Applications running in a Kubernetes cluster find and communicate with each other, and the outside world, through the Service abstraction. This document explains what happens to the source IP of packe", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12360"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment source-ip-app --image=registry.k8s.io/echoserver:1.10\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12361"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=clusterip --port=80 --target-port=8080\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12362"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc clusterip\n```\n\n8.2 - Using Source IP | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12363"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox -it --image=busybox:1.28 --restart=Never --rm\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12364"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=nodeport --port=80 --target-port=8080 --type=NodePort\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12365"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc nodeport -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12366"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=loadbalancer --port=80 --target-port=8080 --type=LoadBalancer\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12367"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12368"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc loadbalancer -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\n8.2 - Using Source IP | You should immediately see the service.spec.healthCheckNodePort field allocated by Kubernetes:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12369"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer -o yaml | grep -i healthCheckNodePort\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12370"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -o wide -l app=source-ip-app\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12371"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc -l app=source-ip-app\n```\n\n8.2 - Using Source IP | Delete the Deployment, ReplicaSet and Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12372"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment source-ip-app\n```\n\n8.2 - Using Source IP | Once you connected your Application with Service following steps like those outlined in Connecting Applications with Services, you have a continuously running, replicated application, that is exposed", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12373"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12374"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12375"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f pod-with-graceful-termination.yaml\nkubectl apply -f explore-graceful-termination-nginx.yaml\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Once the Pod and Service are running, you can get the name of any associated EndpointSlices:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12376"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12377"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -o json -l kubernetes.io/service-name=nginx-service\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12378"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod nginx-deployment-7768647bf9-b4b9s\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | All pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12379"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice -o json nginx-service-6tjbr\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12380"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl action resource\n```\n\n2.2.1 - Using kubectl to Create a Deployment | This performs the specified action (like create, describe or delete) on the specified resource (like node or deployment. You can use --help after the subcommand to get additional info about possible p", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12381"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --help\n```\n\n2.2.1 - Using kubectl to Create a Deployment | Check that kubectl is configured to talk to your cluster, by running the kubectl version command.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12382"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\n2.2.1 - Using kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12383"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.2.1 - Using kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12384"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.3.1 - Viewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12385"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the ConfigMap sport mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12386"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12387"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  sport: cricket\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T14:05:06Z\"\n  name: sport\n  namespace: default\n  resourceVersion: \"1743935\"\n  uid: 024ee001-fe72-487e-872e-34d6464a8a23\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12388"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with an environment variable configured via the ConfigMap fruits.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12389"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12390"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  fruits: mangoes\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T16:04:19Z\"\n  name: fruits\n  namespace: default\n  resourceVersion: \"1749472\"\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12391"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with two containers. The two containers share an emptyDir volume that they use to communicate. The first container runs a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12392"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12393"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: blue\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-05T08:12:05Z\"\n  name: color\n  namespace: configmap\n  resourceVersion: \"1801272\"\n  uid: 80d33e4a-cbb4-4bc9-ba8c-544c68e425d6\n```\n\n3.1 - Updating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12394"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with a main container and a sidecar container. The two containers share an emptyDir volume that they use to communicate.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12395"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12396"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: green\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-02-17T12:20:30Z\"\n  name: color\n  namespace: default\n  resourceVersion: \"1054\"\n  uid: e40bb34c-58df-4280-8bea-6ed16edccfaa\n```\n\n3.1 - Updating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12397"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12398"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12399"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12400"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nvolumes:\n- configMap:\n    defaultMode: 420\n    name: company-name-20240312 # Update this field\n  name: config-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12401"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\n3.2 - Configuring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12402"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\n3.2 - Configuring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12403"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nmkdir -p /tmp/pss\ncat <<EOF > /tmp/pss/cluster-level-pss.yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1\n    kind: PodSecurityConfiguration\n    defaults:\n      enforce: \"baseline\"\n      enforce-version: \"latest\"\n      audit: \"restricted\"\n      audit-version: \"latest\"\n      warn: \"restricted\"\n      warn-version: \"latest\"\n    exemptions:\n      usernames: []\n      runtimeClasses: []\n      namespaces: [kube-system]\nEOF\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | Configure the API server to consume this file during cluster creation:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12404"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > /tmp/pss/cluster-config.yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n- role: control-plane\n  kubeadmConfigPatches:\n  - |\n    kind: ClusterConfiguration\n    apiServer:\n        extraArgs:\n          admission-control-config-file: /etc/config/cluster-level-pss.yaml\n        extraVolumes:\n          - name: accf\n            hostPath: /etc/config\n            mountPath: /etc/config\n            readOnly: false\n            pathType: \"DirectoryOrCreate\"\n  extraMounts:\n  - hostPath: /tmp/pss\n    containerPath: /etc/config\n    # optional: if set, the mount is read-only.\n    # default false\n    readOnly: false\n    # optional: if set, the mount needs SELinux relabeling.\n    # default false\n    selinuxRelabel: false\n    # optional: set propagation mode (None, HostToContainer or Bidirectional)\n    # see https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation\n    # default None\n    propagation: None\nEOF\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | Create a cluster that uses Pod Security Admission to apply these Pod Security Standards:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12405"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12406"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  appArmorProfile:\n    type: <profile_type>\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | Where <profile_type> is one of:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12407"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12408"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12409"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12410"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12411"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12412"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12413"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n  - role: control-plane\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"        \n  - role: worker\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | If the cluster is ready, then running a pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12414"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12415"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12416"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12417"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12418"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12419"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12420"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12421"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12422"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/<name>\n```\n\n6.1 - StatefulSet Basics | You can split updates to a StatefulSet that uses the RollingUpdate strategy into partitions, by specifying .spec.updateStrategy.rollingUpdate.partition.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12423"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12424"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12425"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12426"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12427"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12428"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12429"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12430"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nvolumeClaimTemplates:\n  - metadata:\n      name: datadir\n      annotations:\n        volume.alpha.kubernetes.io/storage-class: anything\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 20Gi\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The StatefulSet controller generates a PersistentVolumeClaim for each Pod in the StatefulSet.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12431"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nvolumeMounts:\n- name: datadir\n  mountPath: /var/lib/zookeeper\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | When a Pod in the zk StatefulSet is (re)scheduled, it will always have the same PersistentVolume mounted to the ZooKeeper server's data directory. Even when the Pods are rescheduled, all the writes ma", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12432"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  runAsUser: 1000\n  fsGroup: 1000\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In the Pods' containers, UID 1000 corresponds to the zookeeper user and GID 1000 corresponds to the zookeeper group.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12433"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12434"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12435"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n    exec:\n      command:\n      - sh\n      - -c\n      - \"zookeeper-ready 2181\"\n    initialDelaySeconds: 15\n    timeoutSeconds: 5\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The probe calls a bash script that uses the ZooKeeper ruok four letter word to test the server's health.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12436"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nreadinessProbe:\n    exec:\n      command:\n      - sh\n      - -c\n      - \"zookeeper-ready 2181\"\n    initialDelaySeconds: 15\n    timeoutSeconds: 5\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Even though the liveness and readiness probes are identical, it is important to specify both. This ensures that only healthy servers in the ZooKeeper ensemble receive network traffic.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12437"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\naffinity:\n  podAntiAffinity:\n    requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n            - key: \"app\"\n              operator: In\n              values:\n                - zk\n        topologyKey: \"kubernetes.io/hostname\"\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The requiredDuringSchedulingIgnoredDuringExecution field tells the Kubernetes Scheduler that it should never co-locate two Pods which have app label as zk in the domain defined by the topologyKey. The", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12438"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubelet\"\n```\n\n7.1 - Running Kubelet in Standalone Mode | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubelet\"", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12439"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubelet\"\n```\n\n7.1 - Running Kubelet in Standalone Mode | Configure:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12440"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\n# Allocate storage and restrict access\nfallocate --length 4GiB /swapfile\nchmod 600 /swapfile\n\n# Create an encrypted device backed by the allocated storage\ncryptsetup --type plain --cipher aes-xts-plain64 --key-size 256 -d /dev/urandom open /swapfile cryptswap\n\n# Format the swap space\nmkswap /dev/mapper/cryptswap\n\n# Activate the swap space for paging\nswapon /dev/mapper/cryptswap\n```\n\n7.2 - Configuring swap memory on Kubernetes nodes | An unencrypted swap file can be set up as follows.# Allocate storage and restrict access fallocate --length 4GiB /swapfile chmod 600 /swapfile # Format the swap space mkswap /swapfile # Activate the", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12441"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\n# Allocate storage and restrict access\nfallocate --length 4GiB /swapfile\nchmod 600 /swapfile\n\n# Format the swap space\nmkswap /swapfile\n\n# Activate the swap space for paging\nswapon /swapfile\n```\n\n7.2 - Configuring swap memory on Kubernetes nodes | Swap can be verified to be enabled with both swapon -s command or the free command.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12442"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# this fragment goes into the kubelet's configuration file\n failSwapOn: false\n memorySwap:\n     swapBehavior: LimitedSwap\n```\n\n7.2 - Configuring swap memory on Kubernetes nodes | In order for these configurations to take effect, kubelet needs to be restarted. Typically you do that by running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12443"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12444"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12445"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12446"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12447"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12448"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12449"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12450"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12451"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n1apiVersion: resource.k8s.io/v1\n 2kind: ResourceClaim\n 3metadata:\n 4    creationTimestamp: \"2025-08-20T18:17:31Z\"\n 5    finalizers:\n 6    - resource.kubernetes.io/delete-protection\n 7    name: some-gpu\n 8    namespace: dra-tutorial\n 9    resourceVersion: \"2326\"\n10    uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3\n11spec:\n12    devices:\n13        requests:\n14        - exactly:\n15            allocationMode: ExactCount\n16            count: 1\n17            deviceClassName: gpu.example.com\n18            selectors:\n19            - cel:\n20                expression: device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi'))\n21                >= 0\n22        name: some-gpu\n23status:\n24    allocation:\n25        devices:\n26        results:\n27        - device: gpu-0\n28            driver: gpu.example.com\n29            pool: kind-worker\n30            request: some-gpu\n31        nodeSelector:\n32        nodeSelectorTerms:\n33        - matchFields:\n34            - key: metadata.name\n35            operator: In\n36            values:\n37            - kind-worker\n38    reservedFor:\n39    - name: pod0\n40        resource: pods\n41        uid: c4dadf20-392a-474d-a47b-ab82080c8bd7\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | To check how the driver handled device allocation, get the logs for the driver DaemonSet Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12452"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\n7.4 - Namespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12453"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\n7.4 - Namespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12454"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\n7.4 - Namespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12455"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: development\n    user: lithe-cocoa-92103_kubernetes\n  name: dev\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: production\n    user: lithe-cocoa-92103_kubernetes\n  name: prod\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\n7.4 - Namespaces Walkthrough | Let's switch to operate in the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12456"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\n7.4 - Namespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12457"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Connecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12458"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\n8.1 - Connecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12459"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"v1\"\nkind: \"Secret\"\nmetadata:\n  name: \"nginxsecret\"\n  namespace: \"default\"\ntype: kubernetes.io/tls\ndata:\n # NOTE: Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n8.1 - Connecting Applications with Services | Now create the secrets using the file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12460"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\n8.1 - Connecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12461"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12462"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe service my-nginx\n```\n\n8.1 - Connecting Applications with Services | Applications running in a Kubernetes cluster find and communicate with each other, and the outside world, through the Service abstraction. This document explains what happens to the source IP of packe", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12463"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nhealthCheckNodePort: 32122\n```\n\n8.2 - Using Source IP | The service.spec.healthCheckNodePort field points to a port on every node serving the health check at /healthz. You can test this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12464"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12465"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12466"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n1 - Hello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12467"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs hello-node-5f76cf6ccf-br9b5\n```\n\n1 - Hello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12468"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-node --type=LoadBalancer --port=8080\n```\n\n1 - Hello Minikube | The --type=LoadBalancer flag indicates that you want to expose your Service outside of the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12469"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod,svc -n kube-system\n```\n\n1 - Hello Minikube | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12470"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service hello-node\nkubectl delete deployment hello-node\n```\n\n1 - Hello Minikube | Stop the Minikube cluster", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12471"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1\n```\n\n2.2.1 - Using kubectl to Create a Deployment | Great! You just deployed your first application by creating a deployment. This performed a few things for you:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12472"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.2.1 - Using kubectl to Create a Deployment | We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12473"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.3.1 - Viewing Pods and Nodes | We see here details about the Pod’s container: IP address, the ports used and a list of events related to the lifecycle of the Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12474"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec \"$POD_NAME\" -- env\n```\n\n2.3.1 - Viewing Pods and Nodes | Again, it's worth mentioning that the name of the container itself can be omitted since we only have a single container in the Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12475"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- bash\n```\n\n2.3.1 - Viewing Pods and Nodes | We have now an open console on the container where we run our NodeJS application. The source code of the app is in the server.js file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12476"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n2.4.1 - Using a Service to Expose Your App | We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12477"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12478"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment\n```\n\n2.4.1 - Using a Service to Expose Your App | Let’s use this label to query our list of Pods. We’ll use the kubectl get pods command with -l as a parameter, followed by the label values:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12479"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | You can do the same to list the existing Services:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12480"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services -l app=kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | Get the name of the Pod and store it in the POD_NAME environment variable:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12481"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label pods \"$POD_NAME\" version=v1\n```\n\n2.4.1 - Using a Service to Expose Your App | This will apply a new label to our Pod (we pinned the application version to the Pod), and we can check it with the describe pod command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12482"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods \"$POD_NAME\"\n```\n\n2.4.1 - Using a Service to Expose Your App | We see here that the label is attached now to our Pod. And we can query now the list of pods using the new label:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12483"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l version=v1\n```\n\n2.4.1 - Using a Service to Expose Your App | And we see the Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12484"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=kubernetes-bootcamp\n```\n\n2.4.1 - Using a Service to Expose Your App | Confirm that the Service is gone:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12485"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti $POD_NAME -- curl http://localhost:8080\n```\n\n2.4.1 - Using a Service to Expose Your App | We see here that the application is up. This is because the Deployment is managing the application. To shut down the application, you would need to delete the Deployment as well.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12486"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"LoadBalancer\" --port 8080\n```\n\n2.5.1 - Running Multiple Instances of Your App | Scaling out a Deployment will ensure new Pods are created and scheduled to Nodes with available resources. Scaling will increase the number of Pods to the new desired state. Kubernetes also supports a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12487"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.5.1 - Running Multiple Instances of Your App | The output should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12488"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=4\n```\n\n2.5.1 - Running Multiple Instances of Your App | To list your Deployments once again, use get deployments:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12489"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.5.1 - Running Multiple Instances of Your App | The change was applied, and we have 4 instances of the application available. Next, let’s check if the number of Pods changed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12490"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n2.5.1 - Running Multiple Instances of Your App | There are 4 Pods now, with different IP addresses. The change was registered in the Deployment events log. To check that, use the describe subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12491"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployments/kubernetes-bootcamp\n```\n\n2.5.1 - Running Multiple Instances of Your App | You can also view in the output of this command that there are 4 replicas now.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12492"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe services/kubernetes-bootcamp\n```\n\n2.5.1 - Running Multiple Instances of Your App | Create an environment variable called NODE_PORT that has a value as the Node port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12493"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployments/kubernetes-bootcamp --replicas=2\n```\n\n2.5.1 - Running Multiple Instances of Your App | List the Deployments to check if the change was applied with the get deployments subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12494"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.5.1 - Running Multiple Instances of Your App | The number of replicas decreased to 2. List the number of Pods, with get pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12495"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n2.5.1 - Running Multiple Instances of Your App | This confirms that 2 Pods were terminated.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12496"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.6.1 - Performing a Rolling Update | To list the running Pods, run the get pods subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12497"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | To update the image of the application to version 2, use the set image subcommand, followed by the deployment name and the new image version:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12498"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=docker.io/jocatalin/kubernetes-bootcamp:v2\n```\n\n2.6.1 - Performing a Rolling Update | The command notified the Deployment to use a different image for your app and initiated a rolling update. Check the status of the new Pods, and view the old one terminating with the get pods subcomman", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12499"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/kubernetes-bootcamp --type=\"NodePort\" --port 8080\n```\n\n2.6.1 - Performing a Rolling Update | Create an environment variable called NODE_PORT that has the value of the Node port assigned:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12500"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status deployments/kubernetes-bootcamp\n```\n\n2.6.1 - Performing a Rolling Update | To view the current image version of the app, run the describe pods subcommand:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12501"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | In the Image field of the output, verify that you are running the latest image version (v2).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12502"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=gcr.io/google-samples/kubernetes-bootcamp:v10\n```\n\n2.6.1 - Performing a Rolling Update | Use get deployments to see the status of the deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12503"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments\n```\n\n2.6.1 - Performing a Rolling Update | Notice that the output doesn't list the desired number of available Pods. Run the get pods subcommand to list all Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12504"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | In the Events section of the output for the affected Pods, notice that the v10 image version did not exist in the repository.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12505"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo deployments/kubernetes-bootcamp\n```\n\n2.6.1 - Performing a Rolling Update | The rollout undo command reverts the deployment to the previous known state (v2 of the image). Updates are versioned and you can revert to any previously known state of a Deployment.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12506"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods\n```\n\n2.6.1 - Performing a Rolling Update | The Deployment is once again using a stable version of the app (v2). The rollback was successful.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12507"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments/kubernetes-bootcamp services/kubernetes-bootcamp\n```\n\n2.6.1 - Performing a Rolling Update | This page provides a step-by-step example of updating configuration within a Pod via a ConfigMap and builds upon the Configure a Pod to Use a ConfigMap task.At the end of this tutorial, you will under", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12508"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap sport --from-literal=sport=football\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the ConfigMap sport mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12509"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-as-volume.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12510"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-volume\n  labels:\n    app.kubernetes.io/name: configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred sport is $(cat /etc/config/sport)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: sport\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12511"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-volume.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12512"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12513"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap sport\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key sport from football to cricket. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12514"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  sport: cricket\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T14:05:06Z\"\n  name: sport\n  namespace: default\n  resourceVersion: \"1743935\"\n  uid: 024ee001-fe72-487e-872e-34d6464a8a23\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12515"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployments/configmap-volume --follow\n```\n\n3.1 - Updating Configuration via a ConfigMap | After few seconds, you should see the log output change as follows:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12516"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap fruits --from-literal=fruits=apples\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with an environment variable configured via the ConfigMap fruits.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12517"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-as-envvar.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12518"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-env-var\n  labels:\n    app.kubernetes.io/name: configmap-env-var\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-env-var\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-env-var\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          env:\n            - name: FRUITS\n              valueFrom:\n                configMapKeyRef:\n                  key: fruits\n                  name: fruits\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The basket is full of $FRUITS\";\n                sleep 10; done;\n          ports:\n            - containerPort: 80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12519"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-as-envvar.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12520"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12521"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs deployment/configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12522"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap fruits\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key fruits from apples to mangoes. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12523"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  fruits: mangoes\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-04T16:04:19Z\"\n  name: fruits\n  namespace: default\n  resourceVersion: \"1749472\"\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12524"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12525"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-env-var\n```\n\n3.1 - Updating Configuration via a ConfigMap | The rollout causes Kubernetes to make a new ReplicaSet for the Deployment; that means the existing Pods eventually terminate, and new ones are created. After few seconds, you should see an output simi", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12526"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=red\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with two containers. The two containers share an emptyDir volume that they use to communicate. The first container runs a", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12527"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-two-containers.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12528"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-two-containers\n  labels:\n    app.kubernetes.io/name: configmap-two-containers\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-two-containers\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-two-containers\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n        - name: alpine\n          image: alpine:3\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12529"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-two-containers.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12530"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-two-containers\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12531"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-two-containers --name=configmap-service --port=8080 --target-port=80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12532"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key color from red to blue. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12533"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: blue\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-01-05T08:12:05Z\"\n  name: color\n  namespace: configmap\n  resourceVersion: \"1801272\"\n  uid: 80d33e4a-cbb4-4bc9-ba8c-544c68e425d6\n```\n\n3.1 - Updating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12534"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap color --from-literal=color=blue\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example manifest for a Deployment that manages a set of Pods, each with a main container and a sidecar container. The two containers share an emptyDir volume that they use to communicate.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12535"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-configmap-and-sidecar-container.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12536"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: configmap-sidecar-container\n  labels:\n    app.kubernetes.io/name: configmap-sidecar-container\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: configmap-sidecar-container\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: configmap-sidecar-container\n    spec:\n      volumes:\n        - name: shared-data\n          emptyDir: {}\n        - name: config-volume\n          configMap:\n            name: color\n      containers:\n        - name: nginx\n          image: nginx\n          volumeMounts:\n            - name: shared-data\n              mountPath: /usr/share/nginx/html\n      initContainers:\n        - name: alpine\n          image: alpine:3\n          restartPolicy: Always\n          volumeMounts:\n            - name: shared-data\n              mountPath: /pod-data\n            - name: config-volume\n              mountPath: /etc/config\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) My preferred color is $(cat /etc/config/color)\" > /pod-data/index.html;\n              sleep 10; done;\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12537"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-configmap-and-sidecar-container.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12538"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=configmap-sidecar-container\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12539"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment configmap-sidecar-container --name=configmap-sidecar-service --port=8081 --target-port=80\n```\n\n3.1 - Updating Configuration via a ConfigMap | Use kubectl to forward the port:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12540"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap color\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, change the value of key color from blue to green. Save your changes. The kubectl tool updates the ConfigMap accordingly (if you see an error, try again).", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12541"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  color: green\nkind: ConfigMap\n# You can leave the existing metadata as they are.\n# The values you'll see won't exactly match these.\nmetadata:\n  creationTimestamp: \"2024-02-17T12:20:30Z\"\n  name: color\n  namespace: default\n  resourceVersion: \"1054\"\n  uid: e40bb34c-58df-4280-8bea-6ed16edccfaa\n```\n\n3.1 - Updating Configuration via a ConfigMap | Loop over the service URL for few seconds.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12542"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/immutable-configmap.yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12543"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"ACME, Inc.\" # existing fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Immutable ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12544"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/immutable-configmap.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Below is an example of a Deployment manifest with the Immutable ConfigMap company-name-20150801 mounted as a volume into the Pod's only container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12545"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-immutable-configmap-as-volume.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12546"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: immutable-configmap-volume\n  labels:\n    app.kubernetes.io/name: immutable-configmap-volume\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: immutable-configmap-volume\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: immutable-configmap-volume\n    spec:\n      containers:\n        - name: alpine\n          image: alpine:3\n          command:\n            - /bin/sh\n            - -c\n            - while true; do echo \"$(date) The name of the company is $(cat /etc/config/company_name)\";\n              sleep 10; done;\n          ports:\n            - containerPort: 80\n          volumeMounts:\n            - name: config-volume\n              mountPath: /etc/config\n      volumes:\n        - name: config-volume\n          configMap:\n            name: company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Create the Deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12547"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/deployments/deployment-with-immutable-configmap-as-volume.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | Check the pods for this Deployment to ensure they are ready (matching by selector):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12548"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12549"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/new-immutable-configmap.yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12550"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  company_name: \"Fiktivesunternehmen GmbH\" # new fictional company name\nkind: ConfigMap\nimmutable: true\nmetadata:\n  name: company-name-20240312\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12551"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/configmap/new-immutable-configmap.yaml\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12552"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should see an output displaying both the old and new ConfigMaps:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12553"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment immutable-configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | In the editor that appears, update the existing volume definition to use the new ConfigMap.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12554"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=app.kubernetes.io/name=immutable-configmap-volume\n```\n\n3.1 - Updating Configuration via a ConfigMap | You should eventually see an output similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12555"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap company-name-20150801\n```\n\n3.1 - Updating Configuration via a ConfigMap | Changes to a ConfigMap mounted as a Volume on a Pod are available seamlessly after the subsequent kubelet sync.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12556"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment configmap-volume configmap-env-var configmap-two-containers configmap-sidecar-container immutable-configmap-volume\nkubectl delete service configmap-service configmap-sidecar-service\nkubectl delete configmap sport fruits color company-name-20240312\n\nkubectl delete configmap company-name-20150801 # In case it was not handled during the task execution\n```\n\n3.1 - Updating Configuration via a ConfigMap | This page provides a real world example of how to configure Redis using a ConfigMap and builds upon the Configure a Pod to Use a ConfigMap task.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12557"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF >./example-redis-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: \"\"\nEOF\n```\n\n3.2 - Configuring Redis using a ConfigMap | Apply the ConfigMap created above, along with a Redis pod manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12558"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\n3.2 - Configuring Redis using a ConfigMap | Examine the contents of the Redis pod manifest and note the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12559"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/config/redis-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\n3.2 - Configuring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12560"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis:8.0.2\n    command:\n      - redis-server\n      - \"/redis-master/redis.conf\"\n    env:\n    - name: MASTER\n      value: \"true\"\n    ports:\n    - containerPort: 6379\n    resources:\n      limits:\n        cpu: \"0.1\"\n    volumeMounts:\n    - mountPath: /redis-master-data\n      name: data\n    - mountPath: /redis-master\n      name: config\n  volumes:\n    - name: data\n      emptyDir: {}\n    - name: config\n      configMap:\n        name: example-redis-config\n        items:\n        - key: redis-config\n          path: redis.conf\n```\n\n3.2 - Configuring Redis using a ConfigMap | Examine the created objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12561"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/redis configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | You should see the following output:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12562"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | You should see an empty redis-config key:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12563"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\n3.2 - Configuring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12564"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/config/example-redis-config.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\n3.2 - Configuring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12565"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: example-redis-config\ndata:\n  redis-config: |\n    maxmemory 2mb\n    maxmemory-policy allkeys-lru\n```\n\n3.2 - Configuring Redis using a ConfigMap | Apply the updated ConfigMap:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12566"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-redis-config.yaml\n```\n\n3.2 - Configuring Redis using a ConfigMap | Confirm that the ConfigMap was updated:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12567"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | You should see the configuration values we just added:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12568"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\n3.2 - Configuring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12569"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml\n```\n\n3.2 - Configuring Redis using a ConfigMap | Now re-check the configuration values one last time:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12570"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- redis-cli\n```\n\n3.2 - Configuring Redis using a ConfigMap | Check maxmemory:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12571"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/redis configmap/example-redis-config\n```\n\n3.2 - Configuring Redis using a ConfigMap | This section is relevant for people adopting a new built-in sidecar containers feature for their workloads.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12572"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\n3.3 - Adopting Sidecar Containers | For the individual node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12573"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /api/v1/nodes/<node-name>/proxy/metrics | grep kubernetes_feature_enabled | grep SidecarContainers\n```\n\n3.3 - Adopting Sidecar Containers | If you see something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12574"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-wo-cluster-pss\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12575"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=privileged\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12576"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=baseline\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12577"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\npod-security.kubernetes.io/enforce=restricted\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12578"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-with-cluster-pss\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12579"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nsecurity/example-baseline-pod.yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12580"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n kind: Pod\n metadata:\n   name: nginx\n spec:\n   containers:\n     - image: nginx\n       name: nginx\n       ports:\n         - containerPort: 80\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12581"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\n4.1 - Apply Pod Security Standards at the Cluster Level | The pod is started normally, but the output includes a warning:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12582"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info --context kind-psa-ns-level\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12583"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create ns example\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12584"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n   pod-security.kubernetes.io/warn=baseline \\\n   pod-security.kubernetes.io/warn-version=latest\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | You can configure multiple pod security standard checks on any namespace, using labels. The following command will enforce the baseline Pod Security Standard, but warn and audit for restricted Pod Sec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12585"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns example \\\n  pod-security.kubernetes.io/enforce=baseline \\\n  pod-security.kubernetes.io/enforce-version=latest \\\n  pod-security.kubernetes.io/warn=restricted \\\n  pod-security.kubernetes.io/warn-version=latest \\\n  pod-security.kubernetes.io/audit=restricted \\\n  pod-security.kubernetes.io/audit-version=latest\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | Create a baseline Pod in the example namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12586"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n example -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | The Pod does start OK; the output includes a warning. For example:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12587"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -n default -f https://k8s.io/examples/security/example-baseline-pod.yaml\n```\n\n4.2 - Apply Pod Security Standards at the Namespace Level | Output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12588"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod_name> -- cat /proc/1/attr/current\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | The output should look something like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12589"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/security/hello-apparmor.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12590"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12591"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create -f hello-apparmor.yaml\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | You can verify that the container is actually running with that profile by checking /proc/1/attr/current:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12592"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- cat /proc/1/attr/current\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | The output should be:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12593"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec hello-apparmor -- touch /tmp/test\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | To wrap up, see what happens if you try to specify a profile that hasn't been loaded:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12594"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f /dev/stdin <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-apparmor-2\nspec:\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-allow-write\n  containers:\n  - name: hello\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"echo 'Hello AppArmor!' && sleep 1h\" ]\nEOF\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | Although the Pod was created successfully, further examination will show that it is stuck in pending:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12595"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod hello-apparmor-2\n```\n\n4.3 - Restrict a Container's Access to Resources with AppArmor | An Event provides the error message with the reason, the specific wording is runtime-dependent:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12596"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/kind.yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12597"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kind.x-k8s.io/v1alpha4\nkind: Cluster\nnodes:\n- role: control-plane\n  extraMounts:\n  - hostPath: \"./profiles\"\n    containerPath: \"/var/lib/kubelet/seccomp/profiles\"\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Download that example kind configuration, and save it to a file named kind.yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12598"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/default-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12599"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-pod\n  labels:\n    app: default-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some more syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create that Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12600"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12601"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12602"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | To start off, apply the audit.json profile, which will log all syscalls of the process, to a new Pod.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12603"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/audit-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12604"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: audit-pod\n  labels:\n    app: audit-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/audit.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12605"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/audit-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | This profile does not restrict any syscalls, so the Pod should start successfully.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12606"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod audit-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | In order to be able to interact with this endpoint exposed by this container, create a NodePort Service that allows access to the endpoint from inside the kind control plane container.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12607"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod audit-pod --type NodePort --port 5678\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12608"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service audit-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12609"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service audit-pod --wait\nkubectl delete pod audit-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | For demonstration, apply a profile to the Pod that does not allow for any syscalls.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12610"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/violation-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12611"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: violation-pod\n  labels:\n    app: violation-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/violation.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Attempt to create the Pod in the cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12612"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/violation-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod creates, but there is an issue. If you check the status of the Pod, you should see that it failed to start.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12613"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod violation-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | As seen in the previous example, the http-echo process requires quite a few syscalls. Here seccomp has been instructed to error on any syscall by setting \"defaultAction\": \"SCMP_ACT_ERRNO\". This is ext", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12614"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod violation-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | If you take a look at the fine-grained.json profile, you will notice some of the syscalls seen in syslog of the first example where the profile set \"defaultAction\": \"SCMP_ACT_LOG\". Now the profile is", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12615"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/ga/fine-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12616"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: fine-pod\n  labels:\n    app: fine-pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Localhost\n      localhostProfile: profiles/fine-grained.json\n  containers:\n  - name: test-container\n    image: hashicorp/http-echo:1.0\n    args:\n    - \"-text=just made some syscalls!\"\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Create the Pod in your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12617"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/fine-pod.yaml\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12618"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod fine-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The Pod should be showing as having started successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12619"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose pod fine-pod --type NodePort --port 5678\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Check what port the Service has been assigned on the node:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12620"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service fine-pod\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12621"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service fine-pod --wait\nkubectl delete pod fine-pod --wait --now\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | To use seccomp profile defaulting, you must run the kubelet with the --seccomp-default command line flag enabled for each node where you want to use it.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12622"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n  - role: control-plane\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"        \n  - role: worker\n    image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c\n    kubeadmConfigPatches:\n      - |\n        kind: JoinConfiguration\n        nodeRegistration:\n          kubeletExtraArgs:\n            seccomp-default: \"true\"\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | If the cluster is ready, then running a pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12623"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run --rm -it --restart=Never --image=alpine alpine -- sh\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | Should now have the default seccomp profile attached. This can be verified by using docker exec to run crictl inspect for the container on the kind worker:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12624"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\ndocker exec -it kind-worker bash -c \\\n    'crictl inspect $(crictl ps --name=alpine -q) | jq .info.runtimeSpec.linux.seccomp'\n```\n\n4.4 - Restrict a Container's Syscalls with seccomp | You can learn more about Linux seccomp:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12625"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nservice/load-balancer-example.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12626"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app.kubernetes.io/name: load-balancer-example\n  name: hello-world\nspec:\n  replicas: 5\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: load-balancer-example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: load-balancer-example\n    spec:\n      containers:\n      - image: gcr.io/google-samples/hello-app:2.0\n        name: hello-world\n        ports:\n        - containerPort: 8080\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12627"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/load-balancer-example.yaml\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has five Pods each of which runs the Hello World application.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12628"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12629"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12630"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=LoadBalancer --name=my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Display information about the Service:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12631"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12632"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe services my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12633"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12634"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete services my-service\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12635"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\n5.1 - Exposing an External IP Address to Access an Application in a Cluster | Learn more about connecting applications with services.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12636"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-leader-deployment.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12637"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: leader\n        tier: backend\n    spec:\n      containers:\n      - name: leader\n        image: \"docker.io/redis:6.0.5\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Launch a terminal window in the directory you downloaded the manifest files.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12638"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-deployment.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the Redis Pod is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12639"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f deployment/redis-leader\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The guestbook application needs to communicate to the Redis to write its data. You need to apply a Service to proxy the traffic to the Redis Pod. A Service defines a policy to access the Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12640"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-leader-service.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12641"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-leader\n  labels:\n    app: redis\n    role: leader\n    tier: backend\nspec:\n  ports:\n  - port: 6379\n    targetPort: 6379\n  selector:\n    app: redis\n    role: leader\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-leader-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12642"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-service.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12643"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-follower-deployment.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12644"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n        role: follower\n        tier: backend\n    spec:\n      containers:\n      - name: follower\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 6379\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Deployment from the following redis-follower-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12645"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-deployment.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Verify that the two Redis follower replicas are running by querying the list of Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12646"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/redis-follower-service.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12647"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: redis-follower\n  labels:\n    app: redis\n    role: follower\n    tier: backend\nspec:\n  ports:\n    # the port that this service should serve on\n  - port: 6379\n  selector:\n    app: redis\n    role: follower\n    tier: backend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the Redis Service from the following redis-follower-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12648"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/redis-follower-service.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the Redis Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12649"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/frontend-deployment.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12650"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n        app: guestbook\n        tier: frontend\n  template:\n    metadata:\n      labels:\n        app: guestbook\n        tier: frontend\n    spec:\n      containers:\n      - name: php-redis\n        image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5\n        env:\n        - name: GET_HOSTS_FROM\n          value: \"dns\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Deployment from the frontend-deployment.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12651"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-deployment.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify that the three frontend replicas are running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12652"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=guestbook -l tier=frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12653"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/guestbook/frontend-service.yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12654"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\n  labels:\n    app: guestbook\n    tier: frontend\nspec:\n  # if your cluster supports it, uncomment the following to automatically create\n  # an external load-balanced IP for the frontend service.\n  # type: LoadBalancer\n  #type: LoadBalancer\n  ports:\n    # the port that this service should serve on\n  - port: 80\n  selector:\n    app: guestbook\n    tier: frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Apply the frontend Service from the frontend-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12655"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/guestbook/frontend-service.yaml\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Services to verify that the frontend Service is running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12656"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward svc/frontend 8080:80\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12657"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should be similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12658"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=5\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12659"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment frontend --replicas=2\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | Query the list of Pods to verify the number of frontend Pods running:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12660"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment -l app=redis\nkubectl delete service -l app=redis\nkubectl delete deployment frontend\nkubectl delete service frontend\n```\n\n5.2 - Example: Deploying PHP Guestbook application with Redis | The response should look similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12661"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/web/web.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12662"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12663"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n6.1 - StatefulSet Basics | The command above creates two Pods, each running an NGINX webserver. Get the nginx Service...", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12664"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get service nginx\n```\n\n6.1 - StatefulSet Basics | ...then get the web StatefulSet, to verify that both were created successfully:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12665"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset web\n```\n\n6.1 - StatefulSet Basics | A StatefulSet defaults to creating its Pods in a strict order.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12666"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n6.1 - StatefulSet Basics | As mentioned in the StatefulSets concept, the Pods in a StatefulSet have a sticky, unique identity. This identity is based on a unique ordinal index that is assigned to each Pod by the StatefulSet con", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12667"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n6.1 - StatefulSet Basics | which starts a new shell. In that new shell, run:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12668"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n6.1 - StatefulSet Basics | Wait for the StatefulSet to restart them, and for both Pods to transition to Running and Ready:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12669"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n6.1 - StatefulSet Basics | which starts a new shell.In that new shell, run:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12670"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n6.1 - StatefulSet Basics | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12671"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n6.1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for all of the Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12672"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale sts web --replicas=5\n```\n\n6.1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for the three additional Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12673"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts web -p '{\"spec\":{\"replicas\":3}}'\n```\n\n6.1 - StatefulSet Basics | Wait for web-4 and web-3 to transition to Terminating.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12674"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n6.1 - StatefulSet Basics | There are still five PersistentVolumeClaims and five PersistentVolumes. When exploring a Pod's stable storage, you saw that the PersistentVolumes mounted to the Pods of a StatefulSet are not deleted w", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12675"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.24\"}]'\n```\n\n6.1 - StatefulSet Basics | In another terminal, watch the Pods in the StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12676"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.21\"}]'\n```\n\n6.1 - StatefulSet Basics | Delete a Pod in the StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12677"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-2\n```\n\n6.1 - StatefulSet Basics | Wait for the replacement web-2 Pod to be Running and Ready:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12678"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n6.1 - StatefulSet Basics | Notice that, even though the update strategy is RollingUpdate the StatefulSet restored the Pod with the original container image. This is because the ordinal of the Pod is less than the partition spec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12679"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n6.1 - StatefulSet Basics | When you changed the partition, the StatefulSet controller automatically updated the web-2 Pod because the Pod's ordinal was greater than or equal to the partition.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12680"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-1\n```\n\n6.1 - StatefulSet Basics | Wait for the web-1 Pod to be Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12681"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-1 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n6.1 - StatefulSet Basics | web-1 was restored to its original configuration because the Pod's ordinal was less than the partition. When a partition is specified, all Pods with an ordinal that is greater than or equal to the par", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12682"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"partition\":0}}}}'\n```\n\n6.1 - StatefulSet Basics | Wait for all of the Pods in the StatefulSet to become Running and Ready.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12683"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"OnDelete\", \"rollingUpdate\": null}}}'\n```\n\n6.1 - StatefulSet Basics | When you select this update strategy, the StatefulSet controller does not automatically update Pods when a modification is made to the StatefulSet's .spec.template field. You need to manage the rollou", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12684"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web --cascade=orphan\n```\n\n6.1 - StatefulSet Basics | Get the Pods, to examine their status:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12685"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n6.1 - StatefulSet Basics | Even though web has been deleted, all of the Pods are still Running and Ready. Delete web-0:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12686"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-0\n```\n\n6.1 - StatefulSet Basics | Get the StatefulSet's Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12687"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n6.1 - StatefulSet Basics | As the web StatefulSet has been deleted, web-0 has not been relaunched.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12688"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n6.1 - StatefulSet Basics | Ignore the error. It only indicates that an attempt was made to create the nginx headless Service even though that Service already exists.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12689"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n6.1 - StatefulSet Basics | Examine the output of the kubectl get command running in the first terminal, and wait for all of the Pods to transition to Terminating.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12690"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n6.1 - StatefulSet Basics | Recreate the StatefulSet and headless Service one more time:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12691"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n6.1 - StatefulSet Basics | When all of the StatefulSet's Pods transition to Running and Ready, retrieve the contents of their index.html files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12692"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n6.1 - StatefulSet Basics | ...and the web StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12693"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n6.1 - StatefulSet Basics | For some distributed systems, the StatefulSet ordering guarantees are unnecessary and/or undesirable. These systems require only uniqueness and identity.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12694"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/web/web-parallel.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12695"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n6.1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12696"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web-parallel.yaml\n```\n\n6.1 - StatefulSet Basics | Keep the terminal open where you're running the watch. In another terminal window, scale the StatefulSet:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12697"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset/web --replicas=5\n```\n\n6.1 - StatefulSet Basics | Examine the output of the terminal where the kubectl get command is running. It may look something like", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12698"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete sts web\n# sts is an abbreviation for statefulset\n```\n\n6.1 - StatefulSet Basics | You can watch kubectl get to see those Pods being deleted.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12699"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc nginx\n```\n\n6.1 - StatefulSet Basics | Delete the persistent storage media for the PersistentVolumes used in this tutorial.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12700"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc www-web-0 www-web-1 www-web-2 www-web-3 www-web-4\n```\n\n6.1 - StatefulSet Basics | This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12701"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/wordpress/mysql-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12702"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12703"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/wordpress/wordpress-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12704"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12705"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services wordpress\n```\n\n6.2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The response should be like this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12706"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/cassandra/cassandra-service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12707"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12708"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Get the Cassandra Service.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12709"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response is", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12710"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/cassandra/cassandra-statefulset.yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12711"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12712"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12713"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l=\"app=cassandra\"\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12714"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra-0 -- nodetool status\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should look something like:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12715"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulset cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | This command opens an editor in your terminal. The line you need to change is the replicas field. The following sample is an excerpt of the StatefulSet file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12716"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12717"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12718"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=cassandra\n```\n\n6.3 - Example: Deploying Cassandra with a StatefulSet | The Pods in this tutorial use the gcr.io/google-samples/cassandra:v13 image from Google's container registry. The Docker image above is based on debian-base and includes OpenJDK 8.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12719"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napplication/zookeeper/zookeeper.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12720"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12721"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk-hs Headless Service, the zk-cs Service, the zk-pdb PodDisruptionBudget, and the zk StatefulSet.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12722"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12723"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- cat /opt/zookeeper/conf/zoo.cfg\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In the server.1, server.2, and server.3 properties at the bottom of the file, the 1, 2, and 3 correspond to the identifiers in the ZooKeeper servers' myid files. They are set to the FQDNs for the Pods", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12724"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The A records for each Pod are entered when the Pod becomes Ready. Therefore, the FQDNs of the ZooKeeper servers will resolve to a single endpoint, and that endpoint will be the unique ZooKeeper serve", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12725"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- zkCli.sh create /hello world\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | To get the data from the zk-1 Pod use the following command.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12726"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-1 -- zkCli.sh get /hello\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The data that you created on zk-0 is available on all the servers in the ensemble.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12727"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Watch the termination of the Pods in the StatefulSet.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12728"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | When zk-0 if fully terminated, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12729"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk StatefulSet object, but the other API objects in the manifest are not modified because they already exist.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12730"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12731"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-2 zkCli.sh get /hello\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Even though you terminated and recreated all of the Pods in the zk StatefulSet, the ensemble still serves the original value.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12732"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | When the StatefulSet recreated its Pods, it remounts the Pods' PersistentVolumes.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12733"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get sts zk -o yaml\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The command used to start the ZooKeeper servers passed the configuration as command line parameter. You can also use environment variables to pass configuration to the ensemble.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12734"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 cat /usr/etc/zookeeper/log4j.properties\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The logging configuration below will cause the ZooKeeper process to write all of its logs to the standard output file stream.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12735"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs zk-0 --tail 20\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | You can view application logs written to standard out or standard error using kubectl logs and from the Kubernetes Dashboard.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12736"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -elf\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | As the runAsUser field of the securityContext object is set to 1000, instead of running as root, the ZooKeeper process runs as the zookeeper user.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12737"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti zk-0 -- ls -ld /var/lib/zookeeper/data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Because the fsGroup field of the securityContext object is set to 1000, the ownership of the Pods' PersistentVolumes is set to the zookeeper group, and the ZooKeeper process is able to read and write", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12738"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts zk --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/resources/requests/cpu\", \"value\":\"0.3\"}]'\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Use kubectl rollout status to watch the status of the update.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12739"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12740"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history sts/zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12741"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo sts/zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12742"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -ef\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The command used as the container's entry point has PID 1, and the ZooKeeper process, a child of the entry point, has PID 27.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12743"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, terminate the ZooKeeper process in Pod zk-0 with the following command.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12744"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- pkill java\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The termination of the ZooKeeper process caused its parent process to terminate. Because the RestartPolicy of the container is Always, it restarted the parent process.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12745"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In another window, using the following command to delete the zookeeper-ready script from the file system of Pod zk-0.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12746"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- rm /opt/zookeeper/bin/zookeeper-ready\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | When the liveness probe for the ZooKeeper process fails, Kubernetes will automatically restart the process for you, ensuring that unhealthy processes in the ensemble are restarted.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12747"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Readiness is not the same as liveness. If a process is alive, it is scheduled and healthy. If a process is ready, it is able to process input. Liveness is a necessary, but not sufficient, condition fo", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12748"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl cordon <node-name>\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | Use this command to get the zk-pdb PodDisruptionBudget.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12749"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pdb zk-pdb\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The max-unavailable field indicates to Kubernetes that at most one Pod from zk StatefulSet can be unavailable at any time.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12750"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, use this command to get the nodes that the Pods are currently scheduled on.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12751"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-0 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12752"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-1 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12753"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12754"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12755"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 zkCli.sh get /hello\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The service is still available because its PodDisruptionBudget is respected.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12756"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-pb41\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12757"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12758"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12759"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-ixsl\n```\n\n6.4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12760"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nsudo tee /etc/kubernetes/kubelet.yaml <<EOF\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthentication:\n  webhook:\n    enabled: false # Do NOT use in production clusters!\nauthorization:\n  mode: AlwaysAllow # Do NOT use in production clusters!\nenableServer: false\nlogging:\n  format: text\naddress: 127.0.0.1 # Restrict access to localhost\nreadOnlyPort: 10255 # Do NOT use in production clusters!\nstaticPodPath: /etc/kubernetes/manifests\ncontainerRuntimeEndpoint: unix:///var/run/crio/crio.sock\nEOF\n```\n\n7.1 - Running Kubelet in Standalone Mode | Because you are not setting up a production cluster, you are using plain HTTP (readOnlyPort: 10255) for unauthenticated queries to the kubelet's API.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12761"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\n7.1 - Running Kubelet in Standalone Mode | Copy the static-web.yaml manifest file to the /etc/kubernetes/manifests directory.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12762"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12763"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12764"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -A\nkubectl get resourceclaimtemplates -A\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12765"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | In a production environment, you would likely be using a previously released or qualified image from the driver vendor or your own organization, and your nodes would need to have access to the image r", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12766"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\ndocker pull registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | For this tutorial, you will install the critical example resource driver components individually with kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12767"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/deviceclass.yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12768"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: gpu.example.com\nspec:\n  selectors:\n  - cel: \n      expression: \"device.driver == 'gpu.example.com'\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12769"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/deviceclass.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ServiceAccount, ClusterRole and ClusterRoleBinding that will be used by the driver to gain permissions to interact with the Kubernetes API on this cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12770"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/serviceaccount.yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12771"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\n    app.kubernetes.io/instance: dra-example-driver\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12772"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/serviceaccount.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRole:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12773"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12774"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: dra-example-driver-role\nrules:\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceclaims\"]\n  verbs: [\"get\"]\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"get\"]\n- apiGroups: [\"resource.k8s.io\"]\n  resources: [\"resourceslices\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12775"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrole.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create the ClusterRoleBinding:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12776"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/clusterrolebinding.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12777"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: dra-example-driver-role-binding\nsubjects:\n- kind: ServiceAccount\n  name: dra-example-driver-service-account\n  namespace: dra-tutorial\nroleRef:\n  kind: ClusterRole\n  name: dra-example-driver-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12778"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/clusterrolebinding.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Create a PriorityClass for the DRA driver. The PriorityClass prevents preemption of th DRA driver component, which is responsible for important lifecycle operations for Pods with claims. Learn more ab", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12779"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/priorityclass.yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12780"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: dra-driver-high-priority\nvalue: 1000000\nglobalDefault: false\ndescription: \"This priority class should be used for DRA driver pods only.\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12781"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/priorityclass.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Deploy the actual DRA driver as a DaemonSet configured to run the example driver binary with the permissions provisioned above. The DaemonSet has the permissions that you granted to the ServiceAccount", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12782"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12783"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: dra-example-driver-kubeletplugin\n  namespace: dra-tutorial\n  labels:\n    app.kubernetes.io/name: dra-example-driver\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: dra-example-driver\n  updateStrategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: dra-example-driver\n    spec:\n      priorityClassName: dra-driver-high-priority\n      serviceAccountName: dra-example-driver-service-account\n      securityContext:\n        {}\n      containers:\n      - name: plugin\n        securityContext:\n          privileged: true\n        image: registry.k8s.io/dra-example-driver/dra-example-driver:v0.2.0\n        imagePullPolicy: IfNotPresent\n        command: [\"dra-example-kubeletplugin\"]\n        resources:\n          {}\n        # Production drivers should always implement a liveness probe\n        # For the tutorial we simply omit it\n        # livenessProbe:\n        #   grpc:\n        #     port: 51515\n        #     service: liveness\n        #   failureThreshold: 3\n        #   periodSeconds: 10\n        env:\n        - name: CDI_ROOT\n          value: /var/run/cdi\n        - name: KUBELET_REGISTRAR_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins_registry\"\n        - name: KUBELET_PLUGINS_DIRECTORY_PATH\n          value: \"/var/lib/kubelet/plugins\"\n        - name: NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        # Simulated number of devices the example driver will pretend to have.\n        - name: NUM_DEVICES\n          value: \"9\"\n        - name: HEALTHCHECK_PORT\n          value: \"51515\"\n        volumeMounts:\n        - name: plugins-registry\n          mountPath: \"/var/lib/kubelet/plugins_registry\"\n        - name: plugins\n          mountPath: \"/var/lib/kubelet/plugins\"\n        - name: cdi\n          mountPath: /var/run/cdi\n      volumes:\n      - name: plugins-registry\n        hostPath:\n          path: \"/var/lib/kubelet/plugins_registry\"\n      - name: plugins\n        hostPath:\n          path: \"/var/lib/kubelet/plugins\"\n      - name: cdi\n        hostPath:\n          path: /var/run/cdi\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12784"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/daemonset.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The DaemonSet is configured with the volume mounts necessary to interact with the underlying Container Device Interface (CDI) directory, and to expose its socket to kubelet via the kubelet/plugins dir", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12785"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12786"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12787"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/example/resourceclaim.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12788"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n name: some-gpu\n namespace: dra-tutorial\nspec:\n   devices:\n     requests:\n     - name: some-gpu\n       exactly:\n         deviceClassName: gpu.example.com\n         selectors:\n         - cel:\n             expression: \"device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi')) >= 0\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12789"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/resourceclaim.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Below is the Pod manifest referencing the ResourceClaim you just made, some-gpu, in the spec.resourceClaims.resourceClaimName field. The local name for that claim, gpu, is then used in the spec.contai", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12790"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\ndra/driver-install/example/pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12791"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod0\n  namespace: dra-tutorial\n  labels:\n    app: pod\nspec:\n  containers:\n  - name: ctr0\n    image: ubuntu:24.04\n    command: [\"bash\", \"-c\"]\n    args: [\"export; trap 'exit 0' TERM; sleep 9999 & wait\"]\n    resources:\n      claims:\n      - name: gpu\n  resourceClaims:\n  - name: gpu\n    resourceClaimName: some-gpu\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12792"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side -f http://k8s.io/examples/dra/driver-install/example/pod.yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Confirm the pod has deployed:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12793"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod0 -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12794"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod0 -c ctr0 -n dra-tutorial | grep -E \"GPU_DEVICE_[0-9]+=\" | grep -v \"RESOURCE_CLAIM\"\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12795"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12796"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaim some-gpu -n dra-tutorial -o yaml\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this: 1apiVersion: resource.k8s.io/v1 2kind: ResourceClaim 3metadata: 4 creationTimestamp: \"2025-08-20T18:17:31Z\" 5 finalizers: 6 - resource.kubernetes.io/delete", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12797"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\n1apiVersion: resource.k8s.io/v1\n 2kind: ResourceClaim\n 3metadata:\n 4    creationTimestamp: \"2025-08-20T18:17:31Z\"\n 5    finalizers:\n 6    - resource.kubernetes.io/delete-protection\n 7    name: some-gpu\n 8    namespace: dra-tutorial\n 9    resourceVersion: \"2326\"\n10    uid: d3e48dbf-40da-47c3-a7b9-f7d54d1051c3\n11spec:\n12    devices:\n13        requests:\n14        - exactly:\n15            allocationMode: ExactCount\n16            count: 1\n17            deviceClassName: gpu.example.com\n18            selectors:\n19            - cel:\n20                expression: device.capacity['gpu.example.com'].memory.compareTo(quantity('10Gi'))\n21                >= 0\n22        name: some-gpu\n23status:\n24    allocation:\n25        devices:\n26        results:\n27        - device: gpu-0\n28            driver: gpu.example.com\n29            pool: kind-worker\n30            request: some-gpu\n31        nodeSelector:\n32        nodeSelectorTerms:\n33        - matchFields:\n34            - key: metadata.name\n35            operator: In\n36            values:\n37            - kind-worker\n38    reservedFor:\n39    - name: pod0\n40        resource: pods\n41        uid: c4dadf20-392a-474d-a47b-ab82080c8bd7\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | To check how the driver handled device allocation, get the logs for the driver DaemonSet Pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12798"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12799"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod pod0 -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12800"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceclaims -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12801"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl logs -l app.kubernetes.io/name=dra-example-driver -n dra-tutorial\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12802"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace dra-tutorial\nkubectl delete deviceclass gpu.example.com\nkubectl delete clusterrole dra-example-driver-role\nkubectl delete clusterrolebinding dra-example-driver-role-binding\nkubectl delete priorityclass dra-driver-high-priority\n```\n\n7.3 - Install Drivers and Allocate Devices with DRA | Kubernetes namespaces help different projects, teams, or customers to share a Kubernetes cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12803"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\n7.4 - Namespaces Walkthrough | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12804"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nadmin/namespace-dev.yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\n7.4 - Namespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12805"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: development\n  labels:\n    name: development\n```\n\n7.4 - Namespaces Walkthrough | Create the development namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12806"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.yaml\n```\n\n7.4 - Namespaces Walkthrough | Save the following contents into file namespace-prod.yaml which describes a production namespace:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12807"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nadmin/namespace-prod.yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\n7.4 - Namespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12808"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    name: production\n```\n\n7.4 - Namespaces Walkthrough | And then let's create the production namespace using kubectl.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12809"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.yaml\n```\n\n7.4 - Namespaces Walkthrough | To be sure things are right, let's list all of the namespaces in our cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12810"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\n7.4 - Namespaces Walkthrough | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12811"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\n7.4 - Namespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12812"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\n7.4 - Namespaces Walkthrough | The next step is to define a context for the kubectl client to work in each namespace. The value of \"cluster\" and \"user\" fields are copied from the current context.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12813"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context dev --namespace=development \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n\nkubectl config set-context prod --namespace=production \\\n  --cluster=lithe-cocoa-92103_kubernetes \\\n  --user=lithe-cocoa-92103_kubernetes\n```\n\n7.4 - Namespaces Walkthrough | By default, the above commands add two contexts that are saved into file .kube/config. You can now view the contexts and alternate against the two new request contexts depending on which namespace you", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12814"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: REDACTED\n    server: https://130.211.122.180\n  name: lithe-cocoa-92103_kubernetes\ncontexts:\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    user: lithe-cocoa-92103_kubernetes\n  name: lithe-cocoa-92103_kubernetes\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: development\n    user: lithe-cocoa-92103_kubernetes\n  name: dev\n- context:\n    cluster: lithe-cocoa-92103_kubernetes\n    namespace: production\n    user: lithe-cocoa-92103_kubernetes\n  name: prod\ncurrent-context: lithe-cocoa-92103_kubernetes\nkind: Config\npreferences: {}\nusers:\n- name: lithe-cocoa-92103_kubernetes\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n    token: 65rZW78y8HbwXXtSXuUw9DbP4FLjHi4b\n- name: lithe-cocoa-92103_kubernetes-basic-auth\n  user:\n    password: h5M0FtUUIflBSdI7\n    username: admin\n```\n\n7.4 - Namespaces Walkthrough | Let's switch to operate in the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12815"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context dev\n```\n\n7.4 - Namespaces Walkthrough | You can verify your current context by doing the following:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12816"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context\n```\n\n7.4 - Namespaces Walkthrough | At this point, all requests we make to the Kubernetes cluster from the command line are scoped to the development namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12817"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nadmin/snowflake-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\n7.4 - Namespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12818"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: snowflake\n  name: snowflake\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: snowflake\n  template:\n    metadata:\n      labels:\n        app: snowflake\n    spec:\n      containers:\n      - image: registry.k8s.io/serve_hostname\n        imagePullPolicy: Always\n        name: snowflake\n```\n\n7.4 - Namespaces Walkthrough | Apply the manifest to create a Deployment", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12819"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/snowflake-deployment.yaml\n```\n\n7.4 - Namespaces Walkthrough | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12820"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\n7.4 - Namespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12821"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake\n```\n\n7.4 - Namespaces Walkthrough | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12822"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context prod\n```\n\n7.4 - Namespaces Walkthrough | The production namespace should be empty, and the following commands should return nothing.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12823"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\nkubectl get pods\n```\n\n7.4 - Namespaces Walkthrough | Production likes to run cattle, so let's create some cattle pods.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12824"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname --replicas=5\n\nkubectl get deployment\n```\n\n7.4 - Namespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12825"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle\n```\n\n7.4 - Namespaces Walkthrough | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12826"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/run-my-nginx.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Connecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12827"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Connecting Applications with Services | This makes it accessible from any node in your cluster. Check the nodes the Pod is running on:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12828"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./run-my-nginx.yaml\nkubectl get pods -l run=my-nginx -o wide\n```\n\n8.1 - Connecting Applications with Services | Check your pods' IPs:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12829"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.4]]\n    [map[ip:10.244.2.5]]\n```\n\n8.1 - Connecting Applications with Services | You should be able to ssh into any node in your cluster and use a tool such as curl to make queries against both IPs. Note that the containers are not using port 80 on the node, nor are there any spec", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12830"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment/my-nginx\n```\n\n8.1 - Connecting Applications with Services | This is equivalent to kubectl apply -f in the following yaml:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12831"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/nginx-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\n8.1 - Connecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12832"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\n```\n\n8.1 - Connecting Applications with Services | This specification will create a Service which targets TCP port 80 on any Pod with the run: my-nginx label, and expose it on an abstracted Service port (targetPort: is the port the container accepts t", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12833"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx\n```\n\n8.1 - Connecting Applications with Services | As mentioned previously, a Service is backed by a group of Pods. These Pods are exposed through EndpointSlices. The Service's selector will be evaluated continuously and the results will be POSTed to", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12834"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc my-nginx\n```\n\n8.1 - Connecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12835"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=my-nginx\n```\n\n8.1 - Connecting Applications with Services | You should now be able to curl the nginx Service on <CLUSTER-IP>:<PORT> from any node in your cluster. Note that the Service IP is completely virtual, it never hits the wire. If you're curious about h", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12836"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-jr4a2 -- printenv | grep SERVICE\n```\n\n8.1 - Connecting Applications with Services | Note there's no mention of your Service. This is because you created the replicas before the Service. Another disadvantage of doing this is that the scheduler might put both Pods on the same machine,", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12837"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment my-nginx --replicas=0; kubectl scale deployment my-nginx --replicas=2;\n\nkubectl get pods -l run=my-nginx -o wide\n```\n\n8.1 - Connecting Applications with Services | You may notice that the pods have different names, since they are killed and recreated.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12838"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec my-nginx-3800858182-e9ihh -- printenv | grep SERVICE\n```\n\n8.1 - Connecting Applications with Services | Kubernetes offers a DNS cluster addon Service that automatically assigns dns names to other Services. You can check if it's running on your cluster:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12839"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get services kube-dns --namespace=kube-system\n```\n\n8.1 - Connecting Applications with Services | The rest of this section will assume you have a Service with a long lived IP (my-nginx), and a DNS server that has assigned a name to that IP. Here we use the CoreDNS cluster addon (application name k", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12840"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run curl --image=radial/busyboxplus:curl -i --tty --rm\n```\n\n8.1 - Connecting Applications with Services | Then, hit enter and run nslookup my-nginx:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12841"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap nginxconfigmap --from-file=default.conf\n```\n\n8.1 - Connecting Applications with Services | You can find an example for default.conf in the Kubernetes examples project repo.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12842"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps\n```\n\n8.1 - Connecting Applications with Services | You can view the details of the nginxconfigmap ConfigMap using the following command:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12843"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmap  nginxconfigmap\n```\n\n8.1 - Connecting Applications with Services | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12844"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"v1\"\nkind: \"Secret\"\nmetadata:\n  name: \"nginxsecret\"\n  namespace: \"default\"\ntype: kubernetes.io/tls\ndata:\n # NOTE: Replace the following values with your own base64-encoded certificate and key.\n  tls.crt: \"REPLACE_WITH_BASE64_CERT\" \n  tls.key: \"REPLACE_WITH_BASE64_KEY\"\n```\n\n8.1 - Connecting Applications with Services | Now create the secrets using the file:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12845"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginxsecrets.yaml\nkubectl get secrets\n```\n\n8.1 - Connecting Applications with Services | Now modify your nginx replicas to start an https server using the certificate in the secret, and the Service, to expose both ports (80 and 443):", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12846"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/nginx-secure-app.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\n8.1 - Connecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12847"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 8080\n    targetPort: 80\n    protocol: TCP\n    name: http\n  - port: 443\n    protocol: TCP\n    name: https\n  selector:\n    run: my-nginx\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      - name: configmap-volume\n        configMap:\n          name: nginxconfigmap\n      containers:\n      - name: nginxhttps\n        image: bprashanth/nginxhttps:1.0\n        ports:\n        - containerPort: 443\n        - containerPort: 80\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n        - mountPath: /etc/nginx/conf.d\n          name: configmap-volume\n```\n\n8.1 - Connecting Applications with Services | Noteworthy points about the nginx-secure-app manifest:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12848"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployments,svc my-nginx; kubectl create -f ./nginx-secure-app.yaml\n```\n\n8.1 - Connecting Applications with Services | At this point you can reach the nginx server from any node.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12849"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l run=my-nginx -o custom-columns=POD_IP:.status.podIPs\n    POD_IP\n    [map[ip:10.244.3.5]]\n```\n\n8.1 - Connecting Applications with Services | Note how we supplied the -k parameter to curl in the last step, this is because we don't know anything about the pods running nginx at certificate generation time, so we have to tell curl to ignore th", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12850"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/curlpod.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12851"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: curl-deployment\nspec:\n  selector:\n    matchLabels:\n      app: curlpod\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: curlpod\n    spec:\n      volumes:\n      - name: secret-volume\n        secret:\n          secretName: nginxsecret\n      containers:\n      - name: curlpod\n        command:\n        - sh\n        - -c\n        - while true; do sleep 1; done\n        image: radial/busyboxplus:curl\n        volumeMounts:\n        - mountPath: /etc/nginx/ssl\n          name: secret-volume\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12852"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./curlpod.yaml\nkubectl get pods -l app=curlpod\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12853"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl exec curl-deployment-1515033274-1410r -- curl https://my-nginx --cacert /etc/nginx/ssl/tls.crt\n...\n<title>Welcome to nginx!</title>\n...\n```\n\n8.1 - Connecting Applications with Services | For some parts of your applications you may want to expose a Service onto an external IP address. Kubernetes supports two ways of doing this: NodePorts and LoadBalancers. The Service created in the la", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12854"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-nginx -o yaml | grep nodePort -C 5\n  uid: 07191fb3-f61a-11e5-8ae5-42010af00002\nspec:\n  clusterIP: 10.0.162.149\n  ports:\n  - name: http\n    nodePort: 31704\n    port: 8080\n    protocol: TCP\n    targetPort: 80\n  - name: https\n    nodePort: 32453\n    port: 443\n    protocol: TCP\n    targetPort: 443\n  selector:\n    run: my-nginx\n```\n\n8.1 - Connecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12855"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o yaml | grep ExternalIP -C 1\n    - address: 104.197.41.11\n      type: ExternalIP\n    allocatable:\n--\n    - address: 23.251.152.56\n      type: ExternalIP\n    allocatable:\n...\n\n$ curl https://<EXTERNAL-IP>:<NODE-PORT> -k\n...\n<h1>Welcome to nginx!</h1>\n```\n\n8.1 - Connecting Applications with Services | Let's now recreate the Service to use a cloud load balancer. Change the Type of my-nginx Service from NodePort to LoadBalancer:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12856"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc my-nginx\nkubectl get svc my-nginx\n```\n\n8.1 - Connecting Applications with Services | The IP address in the EXTERNAL-IP column is the one that is available on the public internet. The CLUSTER-IP is only available inside your cluster/private cloud network.", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12857"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl describe service my-nginx\n...\nLoadBalancer Ingress:   a320587ffd19711e5a37606cf4a74574-1142138393.us-east-1.elb.amazonaws.com\n...\n```\n\n8.1 - Connecting Applications with Services | Applications running in a Kubernetes cluster find and communicate with each other, and the outside world, through the Service abstraction. This document explains what happens to the source IP of packe", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12858"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment source-ip-app --image=registry.k8s.io/echoserver:1.10\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12859"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=clusterip --port=80 --target-port=8080\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12860"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc clusterip\n```\n\n8.2 - Using Source IP | The output is similar to:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12861"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox -it --image=busybox:1.28 --restart=Never --rm\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12862"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=nodeport --port=80 --target-port=8080 --type=NodePort\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12863"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc nodeport -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12864"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment source-ip-app --name=loadbalancer --port=80 --target-port=8080 --type=LoadBalancer\n```\n\n8.2 - Using Source IP | The output is:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12865"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12866"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl patch svc loadbalancer -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'\n```\n\n8.2 - Using Source IP | You should immediately see the service.spec.healthCheckNodePort field allocated by Kubernetes:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12867"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get svc loadbalancer -o yaml | grep -i healthCheckNodePort\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12868"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -o wide -l app=source-ip-app\n```\n\n8.2 - Using Source IP | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12869"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc -l app=source-ip-app\n```\n\n8.2 - Using Source IP | Delete the Deployment, ReplicaSet and Pod:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12870"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment source-ip-app\n```\n\n8.2 - Using Source IP | Once you connected your Application with Service following steps like those outlined in Connecting Applications with Services, you have a continuously running, replicated application, that is exposed", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12871"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nservice/pod-with-graceful-termination.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12872"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      terminationGracePeriodSeconds: 120 # extra long grace period\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n        lifecycle:\n          preStop:\n            exec:\n              # Real life termination may take any time up to terminationGracePeriodSeconds.\n              # In this example - just hang around for at least the duration of terminationGracePeriodSeconds,\n              # at 120 seconds container will be forcibly terminated.\n              # Note, all this time nginx will keep processing requests.\n              command: [\n                \"/bin/sh\", \"-c\", \"sleep 180\"\n              ]\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12873"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\nservice/explore-graceful-termination-nginx.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12874"}
{"instruction": "Write a yaml example for tutorials", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Now create the Deployment Pod and Service using the above files:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12875"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f pod-with-graceful-termination.yaml\nkubectl apply -f explore-graceful-termination-nginx.yaml\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | Once the Pod and Service are running, you can get the name of any associated EndpointSlices:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12876"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12877"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -o json -l kubernetes.io/service-name=nginx-service\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12878"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod nginx-deployment-7768647bf9-b4b9s\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | All pods:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12879"}
{"instruction": "Write a bash example for tutorials", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice -o json nginx-service-6tjbr\n```\n\n8.3 - Explore Termination Behavior for Pods And Their Endpoints | The output is similar to this:", "category": "tutorials_code", "subcategory": "example-walkthroughs", "source": "https://kubernetes.io/docs/tutorials/_print/", "id": "k8s_00776_code_12880"}
{"instruction": "Provide a tutorial on stateful applications", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Stateful Applications1: StatefulSet Basics2: Example: Deploying WordPress and MySQL with Persistent Volumes3: Example: Deploying Cassandra with a StatefulSet4: Running ZooKeeper, A Distributed System Coordinator1 - StatefulSet BasicsThis tutorial provides an introduction to managing applications with StatefulSets. It demonstrates how to create, delete, scale, and update the Pods of StatefulSets.Before you beginBefore you begin this tutorial, you should familiarize yourself with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningThe kubectl command line toolYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou should configure kubectl to use a context that uses the default namespace. If you are using an existing cluster, make sure that it's OK to use that cluster's default namespace to practice. Ideally, practice in a cluster that doesn't run any real workloads.It's also useful to read the concept page about StatefulSets.Note:This tutorial assumes that your cluster is configured to dynamically provision PersistentVolumes. You'll also need to have a default StorageClass. If your cluster is not configured to provision storage dynamically, you will have to manually provision two 1 GiB volumes prior to starting this tutorial and set up your cluster so that those PersistentVolumes map to the PersistentVolumeClaim templates that the StatefulSet defines.ObjectivesStatefulSets are intended to be used with stateful applications and distributed systems. However, the administration of stateful applications and distributed systems on Kubernetes is a broad, complex topic. In order to demonstrate the basic features of a StatefulSet, and not to conflate the former topic with the latter, you will deploy a simple web application using a StatefulSet.After this tutorial, you will be familiar with the following.How to create a StatefulSetHow a StatefulSet manages its PodsHow to delete a StatefulSetHow to scale a StatefulSetHow to update a StatefulSet's PodsCreating a StatefulSetBegin by creating a StatefulSet (and the Service that it relies upon) using the example below. It is similar to the example presented in the StatefulSets concept. It creates a headless Service, nginx, to publish the IP addresses of Pods in the StatefulSet, web.application/web/web.yaml apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: \"nginx\" replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: registry.k8s.io/nginx-slim:0.21 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates: - metadata: name: www spec: accessModes: [ \"ReadWriteOnce\" ] resources: requests: storage: 1Gi You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.# use this terminal to run commands that specify --watch # end this watch when you are asked to start a new watch kubectl get pods --watch -l app=nginx In the second terminal, use kubectl apply to create the headless Service and StatefulSet:kubectl apply -f https://k8s.io/examples/application/web/web.yaml service/nginx created statefulset.apps/web created The command above creates two Pods, each running an NGINX webserver. Get the ", "category": "tutorials", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12882"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n1 - StatefulSet Basics | The command above creates two Pods, each running an NGINX webserver. Get the nginx Service...", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12883"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get service nginx\n```\n\n1 - StatefulSet Basics | ...then get the web StatefulSet, to verify that both were created successfully:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12884"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset web\n```\n\n1 - StatefulSet Basics | A StatefulSet defaults to creating its Pods in a strict order.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12885"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n1 - StatefulSet Basics | As mentioned in the StatefulSets concept, the Pods in a StatefulSet have a sticky, unique identity. This identity is based on a unique ordinal index that is assigned to each Pod by the StatefulSet con", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12886"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n1 - StatefulSet Basics | which starts a new shell. In that new shell, run:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12887"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n1 - StatefulSet Basics | Wait for the StatefulSet to restart them, and for both Pods to transition to Running and Ready:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12888"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n1 - StatefulSet Basics | which starts a new shell.In that new shell, run:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12889"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n1 - StatefulSet Basics | The output is similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12890"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for all of the Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12891"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl scale sts web --replicas=5\n```\n\n1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for the three additional Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12892"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts web -p '{\"spec\":{\"replicas\":3}}'\n```\n\n1 - StatefulSet Basics | Wait for web-4 and web-3 to transition to Terminating.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12893"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n1 - StatefulSet Basics | There are still five PersistentVolumeClaims and five PersistentVolumes. When exploring a Pod's stable storage, you saw that the PersistentVolumes mounted to the Pods of a StatefulSet are not deleted w", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12894"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.24\"}]'\n```\n\n1 - StatefulSet Basics | In another terminal, watch the Pods in the StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12895"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.21\"}]'\n```\n\n1 - StatefulSet Basics | Delete a Pod in the StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12896"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-2\n```\n\n1 - StatefulSet Basics | Wait for the replacement web-2 Pod to be Running and Ready:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12897"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n1 - StatefulSet Basics | Notice that, even though the update strategy is RollingUpdate the StatefulSet restored the Pod with the original container image. This is because the ordinal of the Pod is less than the partition spec", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12898"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n1 - StatefulSet Basics | When you changed the partition, the StatefulSet controller automatically updated the web-2 Pod because the Pod's ordinal was greater than or equal to the partition.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12899"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-1\n```\n\n1 - StatefulSet Basics | Wait for the web-1 Pod to be Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12900"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-1 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n1 - StatefulSet Basics | web-1 was restored to its original configuration because the Pod's ordinal was less than the partition. When a partition is specified, all Pods with an ordinal that is greater than or equal to the par", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12901"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"partition\":0}}}}'\n```\n\n1 - StatefulSet Basics | Wait for all of the Pods in the StatefulSet to become Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12902"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"OnDelete\", \"rollingUpdate\": null}}}'\n```\n\n1 - StatefulSet Basics | When you select this update strategy, the StatefulSet controller does not automatically update Pods when a modification is made to the StatefulSet's .spec.template field. You need to manage the rollou", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12903"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web --cascade=orphan\n```\n\n1 - StatefulSet Basics | Get the Pods, to examine their status:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12904"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n1 - StatefulSet Basics | Even though web has been deleted, all of the Pods are still Running and Ready. Delete web-0:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12905"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-0\n```\n\n1 - StatefulSet Basics | Get the StatefulSet's Pods:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12906"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n1 - StatefulSet Basics | As the web StatefulSet has been deleted, web-0 has not been relaunched.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12907"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n1 - StatefulSet Basics | Ignore the error. It only indicates that an attempt was made to create the nginx headless Service even though that Service already exists.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12908"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n1 - StatefulSet Basics | Examine the output of the kubectl get command running in the first terminal, and wait for all of the Pods to transition to Terminating.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12909"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n1 - StatefulSet Basics | Recreate the StatefulSet and headless Service one more time:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12910"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n1 - StatefulSet Basics | When all of the StatefulSet's Pods transition to Running and Ready, retrieve the contents of their index.html files:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12911"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n1 - StatefulSet Basics | ...and the web StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12912"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n1 - StatefulSet Basics | For some distributed systems, the StatefulSet ordering guarantees are unnecessary and/or undesirable. These systems require only uniqueness and identity.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12913"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12914"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web-parallel.yaml\n```\n\n1 - StatefulSet Basics | Keep the terminal open where you're running the watch. In another terminal window, scale the StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12915"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset/web --replicas=5\n```\n\n1 - StatefulSet Basics | Examine the output of the terminal where the kubectl get command is running. It may look something like", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12916"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete sts web\n# sts is an abbreviation for statefulset\n```\n\n1 - StatefulSet Basics | You can watch kubectl get to see those Pods being deleted.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12917"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc nginx\n```\n\n1 - StatefulSet Basics | Delete the persistent storage media for the PersistentVolumes used in this tutorial.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12918"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc www-web-0 www-web-1 www-web-2 www-web-3 www-web-4\n```\n\n1 - StatefulSet Basics | This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12919"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12920"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12921"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get services wordpress\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The response should be like this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12922"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12923"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Get the Cassandra Service.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12924"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get svc cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response is", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12925"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12926"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12927"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l=\"app=cassandra\"\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12928"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra-0 -- nodetool status\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should look something like:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12929"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulset cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | This command opens an editor in your terminal. The line you need to change is the replicas field. The following sample is an excerpt of the StatefulSet file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12930"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12931"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12932"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The Pods in this tutorial use the gcr.io/google-samples/cassandra:v13 image from Google's container registry. The Docker image above is based on debian-base and includes OpenJDK 8.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12933"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12934"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk-hs Headless Service, the zk-cs Service, the zk-pdb PodDisruptionBudget, and the zk StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12935"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12936"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- cat /opt/zookeeper/conf/zoo.cfg\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In the server.1, server.2, and server.3 properties at the bottom of the file, the 1, 2, and 3 correspond to the identifiers in the ZooKeeper servers' myid files. They are set to the FQDNs for the Pods", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12937"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The A records for each Pod are entered when the Pod becomes Ready. Therefore, the FQDNs of the ZooKeeper servers will resolve to a single endpoint, and that endpoint will be the unique ZooKeeper serve", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12938"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- zkCli.sh create /hello world\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | To get the data from the zk-1 Pod use the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12939"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-1 -- zkCli.sh get /hello\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The data that you created on zk-0 is available on all the servers in the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12940"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Watch the termination of the Pods in the StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12941"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | When zk-0 if fully terminated, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12942"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk StatefulSet object, but the other API objects in the manifest are not modified because they already exist.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12943"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12944"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-2 zkCli.sh get /hello\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Even though you terminated and recreated all of the Pods in the zk StatefulSet, the ensemble still serves the original value.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12945"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | When the StatefulSet recreated its Pods, it remounts the Pods' PersistentVolumes.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12946"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get sts zk -o yaml\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The command used to start the ZooKeeper servers passed the configuration as command line parameter. You can also use environment variables to pass configuration to the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12947"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 cat /usr/etc/zookeeper/log4j.properties\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The logging configuration below will cause the ZooKeeper process to write all of its logs to the standard output file stream.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12948"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl logs zk-0 --tail 20\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | You can view application logs written to standard out or standard error using kubectl logs and from the Kubernetes Dashboard.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12949"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -elf\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | As the runAsUser field of the securityContext object is set to 1000, instead of running as root, the ZooKeeper process runs as the zookeeper user.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12950"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti zk-0 -- ls -ld /var/lib/zookeeper/data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Because the fsGroup field of the securityContext object is set to 1000, the ownership of the Pods' PersistentVolumes is set to the zookeeper group, and the ZooKeeper process is able to read and write", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12951"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts zk --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/resources/requests/cpu\", \"value\":\"0.3\"}]'\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Use kubectl rollout status to watch the status of the update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12952"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12953"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history sts/zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12954"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo sts/zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12955"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -ef\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The command used as the container's entry point has PID 1, and the ZooKeeper process, a child of the entry point, has PID 27.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12956"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, terminate the ZooKeeper process in Pod zk-0 with the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12957"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- pkill java\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The termination of the ZooKeeper process caused its parent process to terminate. Because the RestartPolicy of the container is Always, it restarted the parent process.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12958"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In another window, using the following command to delete the zookeeper-ready script from the file system of Pod zk-0.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12959"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- rm /opt/zookeeper/bin/zookeeper-ready\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | When the liveness probe for the ZooKeeper process fails, Kubernetes will automatically restart the process for you, ensuring that unhealthy processes in the ensemble are restarted.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12960"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Readiness is not the same as liveness. If a process is alive, it is scheduled and healthy. If a process is ready, it is able to process input. Liveness is a necessary, but not sufficient, condition fo", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12961"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl cordon <node-name>\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Use this command to get the zk-pdb PodDisruptionBudget.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12962"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pdb zk-pdb\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The max-unavailable field indicates to Kubernetes that at most one Pod from zk StatefulSet can be unavailable at any time.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12963"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, use this command to get the nodes that the Pods are currently scheduled on.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12964"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-0 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12965"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-1 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12966"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12967"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12968"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 zkCli.sh get /hello\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The service is still available because its PodDisruptionBudget is respected.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12969"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-pb41\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12970"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12971"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12972"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-ixsl\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12973"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12974"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/<name>\n```\n\n1 - StatefulSet Basics | You can split updates to a StatefulSet that uses the RollingUpdate strategy into partitions, by specifying .spec.updateStrategy.rollingUpdate.partition.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12975"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12976"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12977"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12978"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12979"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12980"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12981"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12982"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\nvolumeClaimTemplates:\n  - metadata:\n      name: datadir\n      annotations:\n        volume.alpha.kubernetes.io/storage-class: anything\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 20Gi\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The StatefulSet controller generates a PersistentVolumeClaim for each Pod in the StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12983"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\nvolumeMounts:\n- name: datadir\n  mountPath: /var/lib/zookeeper\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | When a Pod in the zk StatefulSet is (re)scheduled, it will always have the same PersistentVolume mounted to the ZooKeeper server's data directory. Even when the Pods are rescheduled, all the writes ma", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12984"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  runAsUser: 1000\n  fsGroup: 1000\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In the Pods' containers, UID 1000 corresponds to the zookeeper user and GID 1000 corresponds to the zookeeper group.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12985"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12986"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12987"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n    exec:\n      command:\n      - sh\n      - -c\n      - \"zookeeper-ready 2181\"\n    initialDelaySeconds: 15\n    timeoutSeconds: 5\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The probe calls a bash script that uses the ZooKeeper ruok four letter word to test the server's health.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12988"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\nreadinessProbe:\n    exec:\n      command:\n      - sh\n      - -c\n      - \"zookeeper-ready 2181\"\n    initialDelaySeconds: 15\n    timeoutSeconds: 5\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Even though the liveness and readiness probes are identical, it is important to specify both. This ensures that only healthy servers in the ZooKeeper ensemble receive network traffic.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12989"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\naffinity:\n  podAntiAffinity:\n    requiredDuringSchedulingIgnoredDuringExecution:\n      - labelSelector:\n          matchExpressions:\n            - key: \"app\"\n              operator: In\n              values:\n                - zk\n        topologyKey: \"kubernetes.io/hostname\"\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The requiredDuringSchedulingIgnoredDuringExecution field tells the Kubernetes Scheduler that it should never co-locate two Pods which have app label as zk in the domain defined by the topologyKey. The", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12990"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napplication/web/web.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12991"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.21\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | You will need to use at least two terminal windows. In the first terminal, use kubectl get to watch the creation of the StatefulSet's Pods.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12992"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n1 - StatefulSet Basics | The command above creates two Pods, each running an NGINX webserver. Get the nginx Service...", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12993"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get service nginx\n```\n\n1 - StatefulSet Basics | ...then get the web StatefulSet, to verify that both were created successfully:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12994"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset web\n```\n\n1 - StatefulSet Basics | A StatefulSet defaults to creating its Pods in a strict order.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12995"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n1 - StatefulSet Basics | As mentioned in the StatefulSets concept, the Pods in a StatefulSet have a sticky, unique identity. This identity is based on a unique ordinal index that is assigned to each Pod by the StatefulSet con", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12996"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n1 - StatefulSet Basics | which starts a new shell. In that new shell, run:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12997"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n1 - StatefulSet Basics | Wait for the StatefulSet to restart them, and for both Pods to transition to Running and Ready:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12998"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm\n```\n\n1 - StatefulSet Basics | which starts a new shell.In that new shell, run:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_12999"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n1 - StatefulSet Basics | The output is similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13000"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod -l app=nginx\n```\n\n1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for all of the Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13001"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl scale sts web --replicas=5\n```\n\n1 - StatefulSet Basics | Examine the output of the kubectl get command in the first terminal, and wait for the three additional Pods to transition to Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13002"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts web -p '{\"spec\":{\"replicas\":3}}'\n```\n\n1 - StatefulSet Basics | Wait for web-4 and web-3 to transition to Terminating.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13003"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=nginx\n```\n\n1 - StatefulSet Basics | There are still five PersistentVolumeClaims and five PersistentVolumes. When exploring a Pod's stable storage, you saw that the PersistentVolumes mounted to the Pods of a StatefulSet are not deleted w", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13004"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.24\"}]'\n```\n\n1 - StatefulSet Basics | In another terminal, watch the Pods in the StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13005"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/image\", \"value\":\"registry.k8s.io/nginx-slim:0.21\"}]'\n```\n\n1 - StatefulSet Basics | Delete a Pod in the StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13006"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-2\n```\n\n1 - StatefulSet Basics | Wait for the replacement web-2 Pod to be Running and Ready:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13007"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n1 - StatefulSet Basics | Notice that, even though the update strategy is RollingUpdate the StatefulSet restored the Pod with the original container image. This is because the ordinal of the Pod is less than the partition spec", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13008"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n1 - StatefulSet Basics | When you changed the partition, the StatefulSet controller automatically updated the web-2 Pod because the Pod's ordinal was greater than or equal to the partition.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13009"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-1\n```\n\n1 - StatefulSet Basics | Wait for the web-1 Pod to be Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13010"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-1 --template '{{range $i, $c := .spec.containers}}{{$c.image}}{{end}}'\n```\n\n1 - StatefulSet Basics | web-1 was restored to its original configuration because the Pod's ordinal was less than the partition. When a partition is specified, all Pods with an ordinal that is greater than or equal to the par", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13011"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"partition\":0}}}}'\n```\n\n1 - StatefulSet Basics | Wait for all of the Pods in the StatefulSet to become Running and Ready.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13012"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulset web -p '{\"spec\":{\"updateStrategy\":{\"type\":\"OnDelete\", \"rollingUpdate\": null}}}'\n```\n\n1 - StatefulSet Basics | When you select this update strategy, the StatefulSet controller does not automatically update Pods when a modification is made to the StatefulSet's .spec.template field. You need to manage the rollou", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13013"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web --cascade=orphan\n```\n\n1 - StatefulSet Basics | Get the Pods, to examine their status:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13014"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n1 - StatefulSet Basics | Even though web has been deleted, all of the Pods are still Running and Ready. Delete web-0:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13015"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod web-0\n```\n\n1 - StatefulSet Basics | Get the StatefulSet's Pods:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13016"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n1 - StatefulSet Basics | As the web StatefulSet has been deleted, web-0 has not been relaunched.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13017"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n1 - StatefulSet Basics | Ignore the error. It only indicates that an attempt was made to create the nginx headless Service even though that Service already exists.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13018"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n1 - StatefulSet Basics | Examine the output of the kubectl get command running in the first terminal, and wait for all of the Pods to transition to Terminating.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13019"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n1 - StatefulSet Basics | Recreate the StatefulSet and headless Service one more time:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13020"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web.yaml\n```\n\n1 - StatefulSet Basics | When all of the StatefulSet's Pods transition to Running and Ready, retrieve the contents of their index.html files:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13021"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete service nginx\n```\n\n1 - StatefulSet Basics | ...and the web StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13022"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset web\n```\n\n1 - StatefulSet Basics | For some distributed systems, the StatefulSet ordering guarantees are unnecessary and/or undesirable. These systems require only uniqueness and identity.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13023"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napplication/web/web-parallel.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13024"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: nginx\n  labels:\n    app: nginx\nspec:\n  ports:\n  - port: 80\n    name: web\n  clusterIP: None\n  selector:\n    app: nginx\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: web\nspec:\n  serviceName: \"nginx\"\n  podManagementPolicy: \"Parallel\"\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: registry.k8s.io/nginx-slim:0.24\n        ports:\n        - containerPort: 80\n          name: web\n        volumeMounts:\n        - name: www\n          mountPath: /usr/share/nginx/html\n  volumeClaimTemplates:\n  - metadata:\n      name: www\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\n```\n\n1 - StatefulSet Basics | This manifest is identical to the one you downloaded above except that the .spec.podManagementPolicy of the web StatefulSet is set to Parallel.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13025"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/web/web-parallel.yaml\n```\n\n1 - StatefulSet Basics | Keep the terminal open where you're running the watch. In another terminal window, scale the StatefulSet:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13026"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset/web --replicas=5\n```\n\n1 - StatefulSet Basics | Examine the output of the terminal where the kubectl get command is running. It may look something like", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13027"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete sts web\n# sts is an abbreviation for statefulset\n```\n\n1 - StatefulSet Basics | You can watch kubectl get to see those Pods being deleted.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13028"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete svc nginx\n```\n\n1 - StatefulSet Basics | Delete the persistent storage media for the PersistentVolumes used in this tutorial.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13029"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc www-web-0 www-web-1 www-web-2 www-web-3 www-web-4\n```\n\n1 - StatefulSet Basics | This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13030"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napplication/wordpress/mysql-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13031"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 3306\n  selector:\n    app: wordpress\n    tier: mysql\n  clusterIP: None\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: mysql\n    spec:\n      containers:\n      - image: mysql:8.0\n        name: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_USER\n          value: wordpress\n        - name: MYSQL_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The following manifest describes a single-instance WordPress Deployment. The WordPress container mounts the PersistentVolume at /var/www/html for website data files. The WORDPRESS_DB_HOST environment", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13032"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napplication/wordpress/wordpress-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13033"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: LoadBalancer\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n      - image: wordpress:6.2.1-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: wordpress-mysql\n        - name: WORDPRESS_DB_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        - name: WORDPRESS_DB_USER\n          value: wordpress\n        ports:\n        - containerPort: 80\n          name: wordpress\n        volumeMounts:\n        - name: wordpress-persistent-storage\n          mountPath: /var/www/html\n      volumes:\n      - name: wordpress-persistent-storage\n        persistentVolumeClaim:\n          claimName: wp-pv-claim\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | Download the MySQL deployment configuration file.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13034"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get services wordpress\n```\n\n2 - Example: Deploying WordPress and MySQL with Persistent Volumes | The response should be like this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13035"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napplication/cassandra/cassandra-service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13036"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: cassandra\n  name: cassandra\nspec:\n  clusterIP: None\n  ports:\n  - port: 9042\n  selector:\n    app: cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create a Service to track all Cassandra StatefulSet members from the cassandra-service.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13037"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/cassandra/cassandra-service.yaml\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Get the Cassandra Service.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13038"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get svc cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response is", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13039"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napplication/cassandra/cassandra-statefulset.yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13040"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: cassandra\n  labels:\n    app: cassandra\nspec:\n  serviceName: cassandra\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cassandra\n  template:\n    metadata:\n      labels:\n        app: cassandra\n    spec:\n      terminationGracePeriodSeconds: 500\n      containers:\n      - name: cassandra\n        image: gcr.io/google-samples/cassandra:v13\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 7000\n          name: intra-node\n        - containerPort: 7001\n          name: tls-intra-node\n        - containerPort: 7199\n          name: jmx\n        - containerPort: 9042\n          name: cql\n        resources:\n          limits:\n            cpu: \"500m\"\n            memory: 1Gi\n          requests:\n            cpu: \"500m\"\n            memory: 1Gi\n        securityContext:\n          capabilities:\n            add:\n              - IPC_LOCK\n        lifecycle:\n          preStop:\n            exec:\n              command: \n              - /bin/sh\n              - -c\n              - nodetool drain\n        env:\n          - name: MAX_HEAP_SIZE\n            value: 512M\n          - name: HEAP_NEWSIZE\n            value: 100M\n          - name: CASSANDRA_SEEDS\n            value: \"cassandra-0.cassandra.default.svc.cluster.local\"\n          - name: CASSANDRA_CLUSTER_NAME\n            value: \"K8Demo\"\n          - name: CASSANDRA_DC\n            value: \"DC1-K8Demo\"\n          - name: CASSANDRA_RACK\n            value: \"Rack1-K8Demo\"\n          - name: POD_IP\n            valueFrom:\n              fieldRef:\n                fieldPath: status.podIP\n        readinessProbe:\n          exec:\n            command:\n            - /bin/bash\n            - -c\n            - /ready-probe.sh\n          initialDelaySeconds: 15\n          timeoutSeconds: 5\n        # These volume mounts are persistent. They are like inline claims,\n        # but not exactly because the names need to match exactly one of\n        # the stateful pod volumes.\n        volumeMounts:\n        - name: cassandra-data\n          mountPath: /cassandra_data\n  # These are converted to volume claims by the controller\n  # and mounted at the paths mentioned above.\n  # do not use these in production until ssd GCEPersistentDisk or other ssd pd\n  volumeClaimTemplates:\n  - metadata:\n      name: cassandra-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      storageClassName: fast\n      resources:\n        requests:\n          storage: 1Gi\n---\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: fast\nprovisioner: k8s.io/minikube-hostpath\nparameters:\n  type: pd-ssd\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Create the Cassandra StatefulSet from the cassandra-statefulset.yaml file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13041"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13042"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l=\"app=cassandra\"\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13043"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra-0 -- nodetool status\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should look something like:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13044"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulset cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | This command opens an editor in your terminal. The line you need to change is the replicas field. The following sample is an excerpt of the StatefulSet file:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13045"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  creationTimestamp: 2016-08-13T18:40:58Z\n  generation: 1\n  labels:\n  app: cassandra\n  name: cassandra\n  namespace: default\n  resourceVersion: \"323\"\n  uid: 7a219483-6185-11e6-a910-42010a8a0fc0\nspec:\n  replicas: 3\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | Change the number of replicas to 4, and then save the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13046"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulset cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The response should be similar to:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13047"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete service -l app=cassandra\n```\n\n3 - Example: Deploying Cassandra with a StatefulSet | The Pods in this tutorial use the gcr.io/google-samples/cassandra:v13 image from Google's container registry. The Docker image above is based on debian-base and includes OpenJDK 8.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13048"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napplication/zookeeper/zookeeper.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13049"}
{"instruction": "Write a yaml example for stateful applications", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-hs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2888\n    name: server\n  - port: 3888\n    name: leader-election\n  clusterIP: None\n  selector:\n    app: zk\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: zk-cs\n  labels:\n    app: zk\nspec:\n  ports:\n  - port: 2181\n    name: client\n  selector:\n    app: zk\n---\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  maxUnavailable: 1\n---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: zk\nspec:\n  selector:\n    matchLabels:\n      app: zk\n  serviceName: zk-hs\n  replicas: 3\n  updateStrategy:\n    type: RollingUpdate\n  podManagementPolicy: OrderedReady\n  template:\n    metadata:\n      labels:\n        app: zk\n    spec:\n      affinity:\n        podAntiAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            - labelSelector:\n                matchExpressions:\n                  - key: \"app\"\n                    operator: In\n                    values:\n                    - zk\n              topologyKey: \"kubernetes.io/hostname\"\n      containers:\n      - name: kubernetes-zookeeper\n        imagePullPolicy: Always\n        image: \"registry.k8s.io/kubernetes-zookeeper:1.0-3.4.10\"\n        resources:\n          requests:\n            memory: \"1Gi\"\n            cpu: \"0.5\"\n        ports:\n        - containerPort: 2181\n          name: client\n        - containerPort: 2888\n          name: server\n        - containerPort: 3888\n          name: leader-election\n        command:\n        - sh\n        - -c\n        - \"start-zookeeper \\\n          --servers=3 \\\n          --data_dir=/var/lib/zookeeper/data \\\n          --data_log_dir=/var/lib/zookeeper/data/log \\\n          --conf_dir=/opt/zookeeper/conf \\\n          --client_port=2181 \\\n          --election_port=3888 \\\n          --server_port=2888 \\\n          --tick_time=2000 \\\n          --init_limit=10 \\\n          --sync_limit=5 \\\n          --heap=512M \\\n          --max_client_cnxns=60 \\\n          --snap_retain_count=3 \\\n          --purge_interval=12 \\\n          --max_session_timeout=40000 \\\n          --min_session_timeout=4000 \\\n          --log_level=INFO\"\n        readinessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        livenessProbe:\n          exec:\n            command:\n            - sh\n            - -c\n            - \"zookeeper-ready 2181\"\n          initialDelaySeconds: 10\n          timeoutSeconds: 5\n        volumeMounts:\n        - name: datadir\n          mountPath: /var/lib/zookeeper\n      securityContext:\n        runAsUser: 1000\n        fsGroup: 1000\n  volumeClaimTemplates:\n  - metadata:\n      name: datadir\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Open a terminal, and use the kubectl apply command to create the manifest.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13050"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk-hs Headless Service, the zk-cs Service, the zk-pdb PodDisruptionBudget, and the zk StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13051"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13052"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- cat /opt/zookeeper/conf/zoo.cfg\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In the server.1, server.2, and server.3 properties at the bottom of the file, the 1, 2, and 3 correspond to the identifiers in the ZooKeeper servers' myid files. They are set to the FQDNs for the Pods", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13053"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The A records for each Pod are entered when the Pod becomes Ready. Therefore, the FQDNs of the ZooKeeper servers will resolve to a single endpoint, and that endpoint will be the unique ZooKeeper serve", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13054"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- zkCli.sh create /hello world\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | To get the data from the zk-1 Pod use the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13055"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-1 -- zkCli.sh get /hello\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The data that you created on zk-0 is available on all the servers in the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13056"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Watch the termination of the Pods in the StatefulSet.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13057"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | When zk-0 if fully terminated, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13058"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/zookeeper/zookeeper.yaml\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | This creates the zk StatefulSet object, but the other API objects in the manifest are not modified because they already exist.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13059"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Once the zk-2 Pod is Running and Ready, use CTRL-C to terminate kubectl.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13060"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-2 zkCli.sh get /hello\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Even though you terminated and recreated all of the Pods in the zk StatefulSet, the ensemble still serves the original value.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13061"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | When the StatefulSet recreated its Pods, it remounts the Pods' PersistentVolumes.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13062"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get sts zk -o yaml\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The command used to start the ZooKeeper servers passed the configuration as command line parameter. You can also use environment variables to pass configuration to the ensemble.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13063"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 cat /usr/etc/zookeeper/log4j.properties\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The logging configuration below will cause the ZooKeeper process to write all of its logs to the standard output file stream.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13064"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl logs zk-0 --tail 20\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | You can view application logs written to standard out or standard error using kubectl logs and from the Kubernetes Dashboard.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13065"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -elf\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | As the runAsUser field of the securityContext object is set to 1000, instead of running as root, the ZooKeeper process runs as the zookeeper user.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13066"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti zk-0 -- ls -ld /var/lib/zookeeper/data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Because the fsGroup field of the securityContext object is set to 1000, the ownership of the Pods' PersistentVolumes is set to the zookeeper group, and the ZooKeeper process is able to read and write", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13067"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl patch sts zk --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/resources/requests/cpu\", \"value\":\"0.3\"}]'\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Use kubectl rollout status to watch the status of the update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13068"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status sts/zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | This terminates the Pods, one at a time, in reverse ordinal order, and recreates them with the new configuration. This ensures that quorum is maintained during a rolling update.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13069"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history sts/zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13070"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo sts/zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13071"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- ps -ef\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The command used as the container's entry point has PID 1, and the ZooKeeper process, a child of the entry point, has PID 27.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13072"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, terminate the ZooKeeper process in Pod zk-0 with the following command.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13073"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- pkill java\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The termination of the ZooKeeper process caused its parent process to terminate. Because the RestartPolicy of the container is Always, it restarted the parent process.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13074"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In another window, using the following command to delete the zookeeper-ready script from the file system of Pod zk-0.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13075"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 -- rm /opt/zookeeper/bin/zookeeper-ready\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | When the liveness probe for the ZooKeeper process fails, Kubernetes will automatically restart the process for you, ensuring that unhealthy processes in the ensemble are restarted.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13076"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pod -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Readiness is not the same as liveness. If a process is alive, it is scheduled and healthy. If a process is ready, it is able to process input. Liveness is a necessary, but not sufficient, condition fo", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13077"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl cordon <node-name>\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | Use this command to get the zk-pdb PodDisruptionBudget.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13078"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pdb zk-pdb\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The max-unavailable field indicates to Kubernetes that at most one Pod from zk StatefulSet can be unavailable at any time.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13079"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | In another terminal, use this command to get the nodes that the Pods are currently scheduled on.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13080"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-0 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13081"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-1 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13082"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13083"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13084"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl exec zk-0 zkCli.sh get /hello\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The service is still available because its PodDisruptionBudget is respected.", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13085"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-pb41\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13086"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -w -l app=zk\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13087"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl drain $(kubectl get pod zk-2 --template {{.spec.nodeName}}) --ignore-daemonsets --force --delete-emptydir-data\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13088"}
{"instruction": "Write a bash example for stateful applications", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon kubernetes-node-ixsl\n```\n\n4 - Running ZooKeeper, A Distributed System Coordinator | The output is similar to this:", "category": "tutorials_code", "subcategory": "stateful-applications", "source": "https://kubernetes.io/docs/tutorials/stateful-application/_print/", "id": "k8s_00777_code_13089"}
{"instruction": "How do you manage kubernetes objects in Kubernetes?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Manage Kubernetes ObjectsDeclarative and imperative paradigms for interacting with the Kubernetes API.1: Declarative Management of Kubernetes Objects Using Configuration Files2: Declarative Management of Kubernetes Objects Using Kustomize3: Managing Kubernetes Objects Using Imperative Commands4: Imperative Management of Kubernetes Objects Using Configuration Files5: Update API Objects in Place Using kubectl patch6: Migrate Kubernetes Objects Using Storage Version Migration1 - Declarative Management of Kubernetes Objects Using Configuration FilesKubernetes objects can be created, updated, and deleted by storing multiple object configuration files in a directory and using kubectl apply to recursively create and update those objects as needed. This method retains writes made to live objects without merging the changes back into the object configuration files. kubectl diff also gives you a preview of what changes apply will make.Before you beginInstall kubectl.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Trade-offsThe kubectl tool supports three kinds of object management:Imperative commandsImperative object configurationDeclarative object configurationSee Kubernetes Object Management for a discussion of the advantages and disadvantage of each kind of object management.OverviewDeclarative object configuration requires a firm understanding of the Kubernetes object definitions and configuration. Read and complete the following documents if you have not already:Managing Kubernetes Objects Using Imperative CommandsImperative Management of Kubernetes Objects Using Configuration FilesFollowing are definitions for terms used in this document:object configuration file / configuration file: A file that defines the configuration for a Kubernetes object. This topic shows how to pass configuration files to kubectl apply. Configuration files are typically stored in source control, such as Git.live object configuration / live configuration: The live configuration values of an object, as observed by the Kubernetes cluster. These are kept in the Kubernetes cluster storage, typically etcd.declarative configuration writer / declarative writer: A person or software component that makes updates to a live object. The live writers referred to in this topic make changes to object configuration files and run kubectl apply to write the changes.How to create objectsUse kubectl apply to create all objects, except those that already exist, defined by configuration files in a specified directory:kubectl apply -f <directory> This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the object.Note:Add the -R flag to recursively process directories.Here's an example of an object configuration file:application/simple_deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx minReadySeconds: 5 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Run kubectl diff to print the object that will be created:kubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml Note:diff uses server-side dry-run, which needs to be enabled on kube-apiserver.Since diff performs a server-side apply request in dry-run mode, it requires granting PATCH, CREATE, and UPDATE permissio", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the obj", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13091"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13092"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | diff uses server-side dry-run, which needs to be enabled on kube-apiserver.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13093"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13094"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13095"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13096"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f <directory>\nkubectl apply -f <directory>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13097"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13098"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13099"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13100"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13101"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=2\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13102"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the replicas field has been set to 2, and the last-applied-configuration annotation does not contain a replicas field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13103"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13104"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13105"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/update_deployment.yaml\nkubectl apply -f https://k8s.io/examples/application/update_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13106"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/update_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows the following changes to the live configuration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13107"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13108"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13109"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune -l <labels> --prune-allowlist=<gvk-list>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13110"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | When kubectl apply updates the live configuration for an object, it does so by sending a patch request to the API server. The patch defines updates scoped to specific fields of the live object configu", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13111"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13112"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13113"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13114"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13115"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13116"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the API server set several fields to default values in the live configuration. These fields were not specified in the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13117"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13118"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13119"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13120"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13121"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <kustomization_directory>\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To apply those resources, run kubectl apply with --kustomize or -k flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13122"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization_directory>\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Install kubectl.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13123"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13124"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13125"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13126"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13127"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13128"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13129"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13130"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a password.txt file\ncat <<EOF >./password.txt\nusername=admin\npassword=secret\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: password\n          mountPath: /secrets\n      volumes:\n      - name: password\n        secret:\n          secretName: example-secret-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nsecretGenerator:\n- name: example-secret-1\n  files:\n  - password.txt\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | The generated ConfigMaps and Secrets have a content hash suffix appended. This ensures that a new ConfigMap or Secret is generated when the contents are changed. To disable the behavior of appending a", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13131"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13132"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml\ncat <<EOF >./deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamespace: my-namespace\nnamePrefix: dev-\nnameSuffix: \"-001\"\nlabels:\n  - pairs:\n      app: bingo\n    includeSelectors: true \ncommonAnnotations:\n  oncallPager: 800-555-1212\nresources:\n- deployment.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view those fields are all set in the Deployment Resource:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13133"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13134"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\n# Create a kustomization.yaml composing them\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | The resources from kubectl kustomize ./ contain both the Deployment and the Service objects.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13135"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a patch increase_replicas.yaml\ncat <<EOF > increase_replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\nEOF\n\n# Create another patch set_memory.yaml\ncat <<EOF > set_memory.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  template:\n    spec:\n      containers:\n      - name: my-nginx\n        resources:\n          limits:\n            memory: 512Mi\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\npatches:\n  - path: increase_replicas.yaml\n  - path: set_memory.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13136"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13137"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a json patch\ncat <<EOF > patch.yaml\n- op: replace\n  path: /spec/replicas\n  value: 3\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n\npatches:\n- target:\n    group: apps\n    version: v1\n    kind: Deployment\n    name: my-nginx\n  path: patch.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see the replicas field is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13138"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13139"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nimages:\n- name: nginx\n  newName: my.image.registry/nginx\n  newTag: \"1.4.0\"\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the image being used is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13140"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13141"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file (quoting the here doc delimiter)\ncat <<'EOF' > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        command: [\"start\", \"--host\", \"MY_SERVICE_NAME_PLACEHOLDER\"]\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nnameSuffix: \"-001\"\n\nresources:\n- deployment.yaml\n- service.yaml\n\nreplacements:\n- source:\n    kind: Service\n    name: my-nginx\n    fieldPath: metadata.name\n  targets:\n  - select:\n      kind: Deployment\n      name: my-nginx\n    fieldPaths:\n    - spec.template.spec.containers.0.command.2\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the Service name injected into containers is dev-my-nginx-001:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13142"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13143"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a directory to hold the base\nmkdir base\n# Create a base/deployment.yaml\ncat <<EOF > base/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\nEOF\n\n# Create a base/service.yaml file\ncat <<EOF > base/service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n# Create a base/kustomization.yaml\ncat <<EOF > base/kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | This base can be used in multiple overlays. You can add different namePrefix or other cross-cutting fields in different overlays. Here are two overlays using the same base.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13144"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization directory>/\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Given the following kustomization.yaml,", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13145"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nlabels:\n  - pairs:\n      app: my-nginx\n    includeSelectors: true \nresources:\n- deployment.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to apply the Deployment object dev-my-nginx:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13146"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl describe -k ./\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to compare the Deployment object dev-my-nginx against the state that the cluster would be in if the manifest was applied:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13147"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport <myservicename>\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | In the preceding example, the create service nodeport command is called a subcommand of the create service command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13148"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport -h\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | The kubectl command supports verb-driven commands for some common update operations. These commands are named to enable users unfamiliar with Kubernetes objects to perform updates without knowing the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13149"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment/nginx\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | There are several commands for printing information about an object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13150"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13151"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client > /tmp/srv.yaml\nkubectl create --edit -f /tmp/srv.yaml\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13152"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete <type> <name>\nkubectl delete <type> -l <label>\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13153"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <url> --edit\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13154"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the object configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13155"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <kind>_<name>.yaml\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | The recommended approach is to define a single, immutable PodTemplate label used only by the controller selector with no other semantic meaning.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13156"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13157"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-patch.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13158"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13159"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has two Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13160"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <your-pod-name> --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the Pod has two Containers: one running nginx and one running redis:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13161"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13162"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has only one Toleration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13163"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --type merge --patch-file patch-file-2.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13164"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The containers list that you specified in the patch has only one Container. The output shows that your list of one Container replaced the existing containers list.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13165"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13166"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-retainkeys.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | At this point, the deployment is created and is using the RollingUpdate strategy.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13167"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-no-retainkeys.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | In the output, you can see that it is not possible to set type as Recreate when a value is defined for spec.strategy.rollingUpdate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13168"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-retainkeys.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | Examine the content of the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13169"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment retainkeys-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the strategy object in the Deployment does not contain the rollingUpdate key anymore:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13170"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\nkubectl patch deployment patch-demo --patch 'spec:\\n template:\\n  spec:\\n   containers:\\n   - name: patch-demo-ctr-2\\n     image: redis'\n\nkubectl patch deployment patch-demo --patch-file patch-file.json\nkubectl patch deployment patch-demo --patch '{\"spec\": {\"template\": {\"spec\": {\"containers\": [{\"name\": \"patch-demo-ctr-2\",\"image\": \"redis\"}]}}}}'\n```\n\n5 - Update API Objects in Place Using kubectl patch | The flag --subresource=[subresource-name] is used with kubectl commands like get, patch, edit, apply and replace to fetch and update status, scale and resize subresource of the resources you specify.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13171"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13172"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13173"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | In the output, you can see that Deployment has two Pods. For example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13174"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":3}}'\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13175"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | In the output, you can see one new pod is created, so now you have 3 running pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13176"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13177"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13178"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the serialized data for that Secret object is prefixed with k8s:enc:aescbc:v1:key1.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13179"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13180"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13181"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-secret.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of Secrets by checking the .status of the StorageVersionMigration. A successful migration should have its Succeeded condition set to true. Get the StorageVersionMigration object as f", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13182"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/secrets-migration -o yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13183"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13184"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13185"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create a manifest for an example testcrd. Name the manifest cr1.yaml and use these contents:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13186"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13187"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr1.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v1 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13188"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13189"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR resource file with name cr2.yaml as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13190"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13191"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr2.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13192"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13193"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-crd.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of secrets using status. Successful migration should have Succeeded condition set to \"True\" in the status field. Get the migration resource as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13194"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/crdsvm -o yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13195"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13196"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration: '{...}'\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example of an object configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13197"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13198"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13199"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13200"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13201"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13202"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13203"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13204"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13205"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13206"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13207"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Manually deleting objects using the imperative command is the recommended approach, as it is more explicit about what is being deleted, and less likely to result in the user deleting something uninten", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13208"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13209"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13210"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune --applyset\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | To use ApplySet-based pruning, set the KUBECTL_APPLYSET=true environment variable, and add the following flags to your kubectl apply invocation:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13211"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example. Suppose this is the configuration file for a Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13212"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13213"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13214"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13215"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration value\n    args: [\"a\", \"b\"]\n\n# configuration file value\n    args: [\"a\", \"c\"]\n\n# live configuration\n    args: [\"a\", \"b\", \"d\"]\n\n# result after merge\n    args: [\"a\", \"c\"]\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Explanation: The merge used the configuration file value as the new list value.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13216"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration value\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-a # key: nginx-helper-a; will be deleted in result\n      image: helper:1.3\n    - name: nginx-helper-b # key: nginx-helper-b; will be retained\n      image: helper:1.3\n\n# configuration file value\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-b\n      image: helper:1.3\n    - name: nginx-helper-c # key: nginx-helper-c; will be added in result\n      image: helper:1.3\n\n# live configuration\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-a\n      image: helper:1.3\n    - name: nginx-helper-b\n      image: helper:1.3\n      args: [\"run\"] # Field will be retained\n    - name: nginx-helper-d # key: nginx-helper-d; will be retained\n      image: helper:1.3\n\n# result after merge\n    containers:\n    - name: nginx\n      image: nginx:1.16\n      # Element nginx-helper-a was deleted\n    - name: nginx-helper-b\n      image: helper:1.3\n      args: [\"run\"] # Field was retained\n    - name: nginx-helper-c # Element was added\n      image: helper:1.3\n    - name: nginx-helper-d # Element was ignored\n      image: helper:1.3\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Explanation:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13217"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13218"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13219"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration\nspec:\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# configuration file\nspec:\n  strategy:\n    type: Recreate # updated value\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# live configuration\nspec:\n  strategy:\n    type: RollingUpdate # defaulted value\n    rollingUpdate: # defaulted value derived from type\n      maxSurge : 1\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# result after merge - ERROR!\nspec:\n  strategy:\n    type: Recreate # updated value: incompatible with rollingUpdate\n    rollingUpdate: # defaulted value: incompatible with \"type: Recreate\"\n      maxSurge : 1\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Explanation:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13220"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Kubernetes objects should be managed using only one method at a time. Switching from one method to another is possible, but is a manual process.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13221"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13222"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13223"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n      controller-selector: \"apps/v1/deployment/nginx\"\ntemplate:\n  metadata:\n    labels:\n      controller-selector: \"apps/v1/deployment/nginx\"\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Kustomize is a standalone tool to customize Kubernetes objects through a kustomization file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13224"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13225"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13226"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13227"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13228"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13229"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13230"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13231"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13232"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13233"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13234"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13235"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13236"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13237"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service -o yaml --dry-run=client\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13238"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl set selector --local -f - -o yaml\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13239"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13240"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13241"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13242"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <filename|url>\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl replace -f to update a live object according to a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13243"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <filename|url>\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl delete -f to delete an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13244"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename|url>\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | If configuration file has specified the generateName field in the metadata section instead of the name field, you cannot delete the object using kubectl delete -f <filename|url>. You will have to use", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13245"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename|url>\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13246"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | The -o yaml flag specifies that the full object configuration is printed. Use kubectl get -h to see a list of options.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13247"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13248"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n      controller-selector: \"apps/v1/deployment/nginx\"\ntemplate:\n  metadata:\n    labels:\n      controller-selector: \"apps/v1/deployment/nginx\"\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | This task shows how to use kubectl patch to update an API object in place. The exercises in this task demonstrate a strategic merge patch and a JSON merge patch.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13249"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13250"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      containers:\n      - name: patch-demo-ctr-2\n        image: redis\n```\n\n5 - Update API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13251"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\ncontainers:\n- image: redis\n  imagePullPolicy: Always\n  name: patch-demo-ctr-2\n  ...\n- image: nginx\n  imagePullPolicy: Always\n  name: patch-demo-ctr\n  ...\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13252"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n\"io.k8s.api.core.v1.PodSpec\": {\n    ...,\n    \"containers\": {\n        \"description\": \"List of containers belonging to the pod.  ....\"\n    },\n    \"x-kubernetes-patch-merge-key\": \"name\",\n    \"x-kubernetes-patch-strategy\": \"merge\"\n}\n```\n\n5 - Update API Objects in Place Using kubectl patch | And you can see the patch strategy in the Kubernetes API documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13253"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      tolerations:\n      - effect: NoSchedule\n        key: disktype\n        value: ssd\n```\n\n5 - Update API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13254"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- effect: NoSchedule\n  key: disktype\n  value: ssd\n```\n\n5 - Update API Objects in Place Using kubectl patch | Notice that the tolerations list in the PodSpec was replaced, not merged. This is because the Tolerations field of PodSpec does not have a patchStrategy key in its field tag. So the strategic merge pa", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13255"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      containers:\n      - name: patch-demo-ctr-3\n        image: gcr.io/google-samples/hello-app:2.0\n```\n\n5 - Update API Objects in Place Using kubectl patch | In your patch command, set type to merge:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13256"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - image: gcr.io/google-samples/hello-app:2.0\n    ...\n    name: patch-demo-ctr-3\n```\n\n5 - Update API Objects in Place Using kubectl patch | List the running Pods:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13257"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13258"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    type: Recreate\n```\n\n5 - Update API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13259"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    $retainKeys:\n    - type\n    type: Recreate\n```\n\n5 - Update API Objects in Place Using kubectl patch | With this patch, we indicate that we want to retain only the type key of the strategy object. Thus, the rollingUpdate will be removed during the patch operation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13260"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    type: Recreate\n  template:\n```\n\n5 - Update API Objects in Place Using kubectl patch | The patch you did in the preceding exercise is called a strategic merge patch with retainKeys strategy. This method introduces a new directive $retainKeys that has the following strategies:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13261"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n\"io.k8s.api.apps.v1.DeploymentSpec\": {\n    ...,\n    \"strategy\": {\n        \"$ref\": \"#/definitions/io.k8s.api.apps.v1.DeploymentStrategy\",\n        \"description\": \"The deployment strategy to use to replace existing pods with new ones.\",\n        \"x-kubernetes-patch-strategy\": \"retainKeys\"\n    },\n    ....\n}\n```\n\n5 - Update API Objects in Place Using kubectl patch | And you can see the retainKeys strategy in the Kubernetes API documentation.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13262"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13263"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n...\nspec:\n  replicas: 3\n  ...\nstatus:\n  ...\n  availableReplicas: 3\n  readyReplicas: 3\n  replicas: 3\n```\n\n5 - Update API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13264"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13265"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13266"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13267"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13268"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13269"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13270"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13271"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13272"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13273"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13274"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the obj", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13275"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13276"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13277"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | diff uses server-side dry-run, which needs to be enabled on kube-apiserver.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13278"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13279"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13280"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13281"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f <directory>\nkubectl apply -f <directory>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13282"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13283"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13284"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13285"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13286"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13287"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=2\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13288"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the replicas field has been set to 2, and the last-applied-configuration annotation does not contain a replicas field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13289"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13290"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/update_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13291"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13292"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/update_deployment.yaml\nkubectl apply -f https://k8s.io/examples/application/update_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13293"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/update_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows the following changes to the live configuration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13294"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13295"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13296"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune -l <labels> --prune-allowlist=<gvk-list>\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13297"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | When kubectl apply updates the live configuration for an object, it does so by sending a patch request to the API server. The patch defines updates scoped to specific fields of the live object configu", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13298"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/update_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13299"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13300"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13301"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13302"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13303"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13304"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13305"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the API server set several fields to default values in the live configuration. These fields were not specified in the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13306"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13307"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13308"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13309"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13310"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <kustomization_directory>\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To apply those resources, run kubectl apply with --kustomize or -k flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13311"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization_directory>\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Install kubectl.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13312"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13313"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13314"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13315"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13316"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13317"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13318"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13319"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a password.txt file\ncat <<EOF >./password.txt\nusername=admin\npassword=secret\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: password\n          mountPath: /secrets\n      volumes:\n      - name: password\n        secret:\n          secretName: example-secret-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nsecretGenerator:\n- name: example-secret-1\n  files:\n  - password.txt\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | The generated ConfigMaps and Secrets have a content hash suffix appended. This ensures that a new ConfigMap or Secret is generated when the contents are changed. To disable the behavior of appending a", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13320"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13321"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml\ncat <<EOF >./deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamespace: my-namespace\nnamePrefix: dev-\nnameSuffix: \"-001\"\nlabels:\n  - pairs:\n      app: bingo\n    includeSelectors: true \ncommonAnnotations:\n  oncallPager: 800-555-1212\nresources:\n- deployment.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view those fields are all set in the Deployment Resource:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13322"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13323"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\n# Create a kustomization.yaml composing them\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | The resources from kubectl kustomize ./ contain both the Deployment and the Service objects.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13324"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a patch increase_replicas.yaml\ncat <<EOF > increase_replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\nEOF\n\n# Create another patch set_memory.yaml\ncat <<EOF > set_memory.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  template:\n    spec:\n      containers:\n      - name: my-nginx\n        resources:\n          limits:\n            memory: 512Mi\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\npatches:\n  - path: increase_replicas.yaml\n  - path: set_memory.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13325"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13326"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a json patch\ncat <<EOF > patch.yaml\n- op: replace\n  path: /spec/replicas\n  value: 3\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n\npatches:\n- target:\n    group: apps\n    version: v1\n    kind: Deployment\n    name: my-nginx\n  path: patch.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see the replicas field is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13327"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13328"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nimages:\n- name: nginx\n  newName: my.image.registry/nginx\n  newTag: \"1.4.0\"\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the image being used is updated:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13329"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13330"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file (quoting the here doc delimiter)\ncat <<'EOF' > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        command: [\"start\", \"--host\", \"MY_SERVICE_NAME_PLACEHOLDER\"]\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nnameSuffix: \"-001\"\n\nresources:\n- deployment.yaml\n- service.yaml\n\nreplacements:\n- source:\n    kind: Service\n    name: my-nginx\n    fieldPath: metadata.name\n  targets:\n  - select:\n      kind: Deployment\n      name: my-nginx\n    fieldPaths:\n    - spec.template.spec.containers.0.command.2\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the Service name injected into containers is dev-my-nginx-001:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13331"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13332"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a directory to hold the base\nmkdir base\n# Create a base/deployment.yaml\ncat <<EOF > base/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\nEOF\n\n# Create a base/service.yaml file\ncat <<EOF > base/service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n# Create a base/kustomization.yaml\ncat <<EOF > base/kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | This base can be used in multiple overlays. You can add different namePrefix or other cross-cutting fields in different overlays. Here are two overlays using the same base.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13333"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization directory>/\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Given the following kustomization.yaml,", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13334"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nlabels:\n  - pairs:\n      app: my-nginx\n    includeSelectors: true \nresources:\n- deployment.yaml\nEOF\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to apply the Deployment object dev-my-nginx:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13335"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl describe -k ./\n```\n\n2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to compare the Deployment object dev-my-nginx against the state that the cluster would be in if the manifest was applied:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13336"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport <myservicename>\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | In the preceding example, the create service nodeport command is called a subcommand of the create service command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13337"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport -h\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | The kubectl command supports verb-driven commands for some common update operations. These commands are named to enable users unfamiliar with Kubernetes objects to perform updates without knowing the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13338"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment/nginx\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | There are several commands for printing information about an object:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13339"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13340"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client > /tmp/srv.yaml\nkubectl create --edit -f /tmp/srv.yaml\n```\n\n3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13341"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl delete <type> <name>\nkubectl delete <type> -l <label>\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13342"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <url> --edit\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13343"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the object configuration file.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13344"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <kind>_<name>.yaml\n```\n\n4 - Imperative Management of Kubernetes Objects Using Configuration Files | The recommended approach is to define a single, immutable PodTemplate label used only by the controller selector with no other semantic meaning.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13345"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-patch.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13346"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13347"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-patch.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13348"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13349"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has two Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13350"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <your-pod-name> --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the Pod has two Containers: one running nginx and one running redis:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13351"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13352"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has only one Toleration:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13353"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --type merge --patch-file patch-file-2.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13354"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The containers list that you specified in the patch has only one Container. The output shows that your list of one Container replaced the existing containers list.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13355"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-retainkeys.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13356"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13357"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-retainkeys.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | At this point, the deployment is created and is using the RollingUpdate strategy.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13358"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-no-retainkeys.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | In the output, you can see that it is not possible to set type as Recreate when a value is defined for spec.strategy.rollingUpdate:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13359"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-retainkeys.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | Examine the content of the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13360"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment retainkeys-demo --output yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output shows that the strategy object in the Deployment does not contain the rollingUpdate key anymore:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13361"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\nkubectl patch deployment patch-demo --patch 'spec:\\n template:\\n  spec:\\n   containers:\\n   - name: patch-demo-ctr-2\\n     image: redis'\n\nkubectl patch deployment patch-demo --patch-file patch-file.json\nkubectl patch deployment patch-demo --patch '{\"spec\": {\"template\": {\"spec\": {\"containers\": [{\"name\": \"patch-demo-ctr-2\",\"image\": \"redis\"}]}}}}'\n```\n\n5 - Update API Objects in Place Using kubectl patch | The flag --subresource=[subresource-name] is used with kubectl commands like get, patch, edit, apply and replace to fetch and update status, scale and resize subresource of the resources you specify.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13362"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13363"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13364"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13365"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | In the output, you can see that Deployment has two Pods. For example:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13366"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":3}}'\n```\n\n5 - Update API Objects in Place Using kubectl patch | The output is:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13367"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5 - Update API Objects in Place Using kubectl patch | In the output, you can see one new pod is created, so now you have 3 running pods.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13368"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n5 - Update API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13369"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13370"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the serialized data for that Secret object is prefixed with k8s:enc:aescbc:v1:key1.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13371"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13372"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13373"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-secret.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of Secrets by checking the .status of the StorageVersionMigration. A successful migration should have its Succeeded condition set to true. Get the StorageVersionMigration object as f", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13374"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/secrets-migration -o yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13375"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13376"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13377"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create a manifest for an example testcrd. Name the manifest cr1.yaml and use these contents:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13378"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13379"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr1.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v1 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13380"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13381"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR resource file with name cr2.yaml as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13382"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13383"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr2.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13384"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13385"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-crd.yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of secrets using status. Successful migration should have Succeeded condition set to \"True\" in the status field. Get the migration resource as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13386"}
{"instruction": "Write a bash example for manage kubernetes objects", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/crdsvm -o yaml\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13387"}
{"instruction": "Write a yaml example for manage kubernetes objects", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\n6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/manage-kubernetes-objects/_print/", "id": "k8s_00778_code_13388"}
{"instruction": "How do you tasks in Kubernetes?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Tasks1: Install Tools1.1: Install and Set Up kubectl on Linux1.2: Install and Set Up kubectl on macOS1.3: Install and Set Up kubectl on Windows2: Administer a Cluster2.1: Administration with kubeadm2.1.1: Adding Linux worker nodes2.1.2: Adding Windows worker nodes2.1.3: Upgrading kubeadm clusters2.1.4: Upgrading Linux nodes2.1.5: Upgrading Windows nodes2.1.6: Configuring a cgroup driver2.1.7: Certificate Management with kubeadm2.1.8: Reconfiguring a kubeadm cluster2.1.9: Changing The Kubernetes Package Repository2.2: Overprovision Node Capacity For A Cluster2.3: Migrating from dockershim2.3.1: Changing the Container Runtime on a Node from Docker Engine to containerd2.3.2: Find Out What Container Runtime is Used on a Node2.3.3: Troubleshooting CNI plugin-related errors2.3.4: Check whether dockershim removal affects you2.3.5: Migrating telemetry and security agents from dockershim2.4: Generate Certificates Manually2.5: Manage Memory, CPU, and API Resources2.5.1: Configure Default Memory Requests and Limits for a Namespace2.5.2: Configure Default CPU Requests and Limits for a Namespace2.5.3: Configure Minimum and Maximum Memory Constraints for a Namespace2.5.4: Configure Minimum and Maximum CPU Constraints for a Namespace2.5.5: Configure Memory and CPU Quotas for a Namespace2.5.6: Configure a Pod Quota for a Namespace2.6: Install a Network Policy Provider2.6.1: Use Antrea for NetworkPolicy2.6.2: Use Calico for NetworkPolicy2.6.3: Use Cilium for NetworkPolicy2.6.4: Use Kube-router for NetworkPolicy2.6.5: Romana for NetworkPolicy2.6.6: Weave Net for NetworkPolicy2.7: Access Clusters Using the Kubernetes API2.8: Advertise Extended Resources for a Node2.9: Autoscale the DNS Service in a Cluster2.10: Change the Access Mode of a PersistentVolume to ReadWriteOncePod2.11: Change the default StorageClass2.12: Switching from Polling to CRI Event-based Updates to Container Status2.13: Change the Reclaim Policy of a PersistentVolume2.14: Cloud Controller Manager Administration2.15: Configure a kubelet image credential provider2.16: Configure Quotas for API Objects2.17: Control CPU Management Policies on the Node2.18: Control Topology Management Policies on a node2.19: Customizing DNS Service2.20: Debugging DNS Resolution2.21: Declare Network Policy2.22: Developing Cloud Controller Manager2.23: Enable Or Disable A Kubernetes API2.24: Encrypting Confidential Data at Rest2.25: Decrypt Confidential Data that is Already Encrypted at Rest2.26: Guaranteed Scheduling For Critical Add-On Pods2.27: IP Masquerade Agent User Guide2.28: Limit Storage Consumption2.29: Migrate Replicated Control Plane To Use Cloud Controller Manager2.30: Operating etcd clusters for Kubernetes2.31: Reserve Compute Resources for System Daemons2.32: Running Kubernetes Node Components as a Non-root User2.33: Safely Drain a Node2.34: Securing a Cluster2.35: Set Kubelet Parameters Via A Configuration File2.36: Share a Cluster with Namespaces2.37: Upgrade A Cluster2.38: Use Cascading Deletion in a Cluster2.39: Using a KMS provider for data encryption2.40: Using CoreDNS for Service Discovery2.41: Using NodeLocal DNSCache in Kubernetes Clusters2.42: Using sysctls in a Kubernetes Cluster2.43: Utilizing the NUMA-aware Memory Manager2.44: Verify Signed Kubernetes Artifacts3: Configure Pods and Containers3.1: Assign Memory Resources to Containers and Pods3.2: Assign CPU Resources to Containers and Pods3.3: Assign Devices to Pods and Containers3.3.1: Set Up DRA in a Cluster3.3.2: Allocate Devices to Workloads with DRA3.4: Assign Pod-level CPU and memory resources3.5: Configure GMSA for Windows Pods and containers3.6: Resize CPU and Memory Resources assigned to Containers3.7: Configure RunAsUserName for Windows pods and containers3.8: Create a Windows HostProcess Pod3.9: Configure Quality of Service for Pods3.10: Assign Extended Resources to a Container3.11: Configure a Pod ", "category": "tasks", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\n1.1 - Install and Set Up kubectl on Linux | Install kubectl", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13390"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.1 - Install and Set Up kubectl on Linux | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13391"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\n1.1 - Install and Set Up kubectl on Linux | Update the apt package index and install packages needed to use the Kubernetes apt repository:sudo apt-get update # apt-transport-https may be a dummy package; if so, you can skip that package sudo ap", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13392"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n1.1 - Install and Set Up kubectl on Linux | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13393"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null\nsudo chmod a+r /etc/bash_completion.d/kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13394"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\n1.1 - Install and Set Up kubectl on Linux | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13395"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\n1.1 - Install and Set Up kubectl on Linux | Install kubectl-convert", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13396"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\n1.1 - Install and Set Up kubectl on Linux | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13397"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\n1.2 - Install and Set Up kubectl on macOS | Make the kubectl binary executable.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13398"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13399"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\n1.2 - Install and Set Up kubectl on macOS | After installing and validating kubectl, delete the checksum file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13400"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you are on macOS and using Macports package manager, you can install kubectl with Macports.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13401"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | In order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cl", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13402"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n1.2 - Install and Set Up kubectl on macOS | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13403"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash >/usr/local/etc/bash_completion.d/kubectl\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13404"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\n1.2 - Install and Set Up kubectl on macOS | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13405"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\n1.2 - Install and Set Up kubectl on macOS | Make kubectl-convert binary executable", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13406"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13407"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.3 - Install and Set Up kubectl on Windows | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13408"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\n1.3 - Install and Set Up kubectl on Windows | To install kubectl on Windows you can use either Chocolatey package manager, Scoop command-line installer, or winget package manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13409"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.3 - Install and Set Up kubectl on Windows | Navigate to your home directory:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13410"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n1.3 - Install and Set Up kubectl on Windows | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13411"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell | Out-String | Invoke-Expression\n```\n\n1.3 - Install and Set Up kubectl on Windows | This command will regenerate the auto-completion script on every PowerShell start up. You can also add the generated script directly to your $PROFILE file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13412"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell >> $PROFILE\n```\n\n1.3 - Install and Set Up kubectl on Windows | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13413"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\n1.3 - Install and Set Up kubectl on Windows | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13414"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# kubeadm-config.yaml\nkind: ClusterConfiguration\napiVersion: kubeadm.k8s.io/v1beta4\nkubernetesVersion: v1.21.0\n---\nkind: KubeletConfiguration\napiVersion: kubelet.config.k8s.io/v1beta1\ncgroupDriver: systemd\n```\n\n2.1.6 - Configuring a cgroup driver | Such a configuration file can then be passed to the kubeadm command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13415"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nencryptionAlgorithm: <ALGORITHM>\n```\n\n2.1.7 - Certificate Management with kubeadm | <ALGORITHM> can be one of RSA-2048 (default), RSA-3072, RSA-4096 or ECDSA-P256.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13416"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncertificateValidityPeriod: 8760h # Default: 365 days × 24 hours = 1 year\ncaCertificateValidityPeriod: 87600h # Default: 365 days × 24 hours * 10 = 10 years\n```\n\n2.1.7 - Certificate Management with kubeadm | The values of the fields follow the accepted format for Go's time.Duration values, with the longest supported unit being h (hours).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13417"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-cert-file\"\n    value: \"/etc/kubernetes/pki/ca.crt\"\n  - name: \"cluster-signing-key-file\"\n    value: \"/etc/kubernetes/pki/ca.key\"\n```\n\n2.1.7 - Certificate Management with kubeadm | See Create CertificateSigningRequest for creating CSRs with the Kubernetes API.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13418"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nserverTLSBootstrap: true\n```\n\n2.1.7 - Certificate Management with kubeadm | If you have already created the cluster you must adapt it by doing the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13419"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <CSR-name>\n```\n\n2.1.7 - Certificate Management with kubeadm | By default, these serving certificate will expire after one year. Kubeadm sets the KubeletConfiguration field rotateCertificates to true, which means that close to expiration a new set of CSRs for the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13420"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# example.yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n# Will be used as the target \"cluster\" in the kubeconfig\nclusterName: \"kubernetes\"\n# Will be used as the \"server\" (IP or DNS name) of this cluster in the kubeconfig\ncontrolPlaneEndpoint: \"some-dns-address:6443\"\n# The cluster CA key and certificate will be loaded from this local directory\ncertificatesDir: \"/etc/kubernetes/pki\"\n```\n\n2.1.7 - Certificate Management with kubeadm | Make sure that these settings match the desired target cluster settings. To see the settings of an existing cluster use:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13421"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get cm kubeadm-config -n kube-system -o=jsonpath=\"{.data.ClusterConfiguration}\"\n```\n\n2.1.7 - Certificate Management with kubeadm | The following example will generate a kubeconfig file with credentials valid for 24 hours for a new user johndoe that is part of the appdevs group:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13422"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubeadm-config\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The configuration is located under the data.ClusterConfiguration key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13423"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubelet-config\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The configuration is located under the data.kubelet key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13424"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kube-proxy\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The configuration is located under the data.config.conf key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13425"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete po -n kube-system -l k8s-app=kube-proxy\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | New Pods that use the updated ConfigMap will be created.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13426"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment -n kube-system coredns\nkubectl edit service -n kube-system kube-dns\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | Once the CoreDNS changes are applied you can restart the CoreDNS deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13427"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment -n kube-system coredns\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | During the execution of kubeadm upgrade on a managed node, kubeadm might overwrite configuration that was applied after the cluster was created (reconfiguration).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13428"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit no <node-name>\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | During kubeadm upgrade the contents of such a Node might get overwritten. If you would like to persist your modifications to the Node object after upgrade, you can prepare a kubectl patch and apply it", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13429"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch no <node-name> --patch-file <patch-file>\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The main source of control plane configuration is the ClusterConfiguration object stored in the cluster. To extend the static Pod manifests configuration, patches can be used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13430"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13431"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capac", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13432"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13433"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment capacity-reservation\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, define the resource requests and limits for a single placeholder pod as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13434"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment capacity-reservation --replicas=5\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | Verify the scaling:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13435"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment capacity-reservation\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | The output should reflect the updated number of replicas:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13436"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node-to-drain> --ignore-daemonsets\n```\n\n2.3.1 - Changing the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-drain> with the name of your node you are draining.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13437"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-to-uncordon>\n```\n\n2.3.1 - Changing the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-uncordon> with the name of your node you previously drained.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13438"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o wide\n```\n\n2.3.2 - Find Out What Container Runtime is Used on a Node | The output is similar to the following. The column CONTAINER-RUNTIME outputs the runtime and its version.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13439"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces \\\n-o=jsonpath='{range .items[*]}{\"\\n\"}{.metadata.namespace}{\":\\t\"}{.metadata.name}{\":\\t\"}{range .spec.volumes[*]}{.hostPath.path}{\", \"}{end}{end}' \\\n| sort \\\n| grep '/var/run/docker.sock'\n```\n\n2.3.5 - Migrating telemetry and security agents from dockershim | If your cluster nodes are customized and install additional security and telemetry agents on the node, check with the agent vendor to verify whether it has any dependency on Docker.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13440"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13441"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13442"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies defa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13443"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13444"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13445"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13446"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-mem-demo --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory limit, but not a request:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13447"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13448"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-2.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13449"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-2 --output=yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to match its memory limit. Notice that the container was not assigned the default memory request value of 256Mi.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13450"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13451"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-3.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13452"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-3 --output=yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to the value specified in the container's manifest. The container is limited to use no more than 512MiB of memory, which matches the default", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13453"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Configure Default CPU Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13454"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default CPU request and a default CPU limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13455"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13456"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Now if you create a Pod in the default-cpu-example namespace, and any container in that Pod does not specify its own values for CPU request and CPU limit, then the control plane applies default values", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13457"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13458"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13459"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo --output=yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | The output shows that the Pod's only container has a CPU request of 500m cpu (which you can read as “500 millicpu”), and a CPU limit of 1 cpu. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13460"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13461"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-2.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13462"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-2 --output=yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to match its CPU limit. Notice that the container was not assigned the default CPU request value of 0.5 cpu:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13463"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13464"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-3.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13465"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-3 --output=yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to the value you specified at the time you created the Pod (in other words: it matches the manifest). However, the same container's CPU limit i", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13466"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13467"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Here's an example manifest for a LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13468"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13469"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13470"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13471"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13472"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13473"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13474"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --output=yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the container within that Pod has a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the constraints imposed by the LimitRange for this namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13475"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory request of 800 MiB and a memory limit of 1.5 GiB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13476"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13477"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-2.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests more memory than is allowed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13478"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13479"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-3.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests less memory than the enforced minimum:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13480"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13481"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-4.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13482"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo-4 --namespace=constraints-mem-example --output=yaml\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod's only container has a memory request of 1 GiB and a memory limit of 1 GiB. How did that container get those values?", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13483"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo-4 --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The maximum and minimum memory constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were cr", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13484"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13485"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for an example LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13486"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13487"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13488"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange cpu-min-max-demo-lr --output=yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows the minimum and maximum CPU constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created auto", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13489"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13490"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13491"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13492"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --output=yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's only container has a CPU request of 500 millicpu and CPU limit of 800 millicpu. These satisfy the constraints imposed by the LimitRange.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13493"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a CPU request of 500 millicpu and a cpu limit of 1.5 cpu.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13494"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13495"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-2.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU limit that is too large:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13496"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13497"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-3.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU request that is lower than the enforced mi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13498"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13499"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-4.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13500"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo-4 --namespace=constraints-cpu-example --output=yaml\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's single container has a CPU request of 800 millicpu and a CPU limit of 800 millicpu. How did that container get those values?", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13501"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo-4 --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The maximum and minimum CPU constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were creat", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13502"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13503"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Here is a manifest for an example ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13504"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13505"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu.yaml --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13506"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | The ResourceQuota places these requirements on the quota-mem-cpu-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13507"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13508"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Verify that the Pod is running and that its (only) container is healthy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13509"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod quota-mem-cpu-demo --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Once again, view detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13510"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | The output shows the quota along with how much of the quota has been used. You can see that the memory and CPU requests and limits for your Pod do not exceed the quota.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13511"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example -o jsonpath='{ .status.used }' | jq .\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Here is a manifest for a second Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13512"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13513"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod-2.yaml --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | The second Pod does not get created. The output shows that creating the second Pod would cause the memory request total to exceed the memory request quota.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13514"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13515"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Here is an example manifest for a ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13516"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13517"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod.yaml --namespace=quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13518"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota pod-demo --namespace=quota-pod-example --output=yaml\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | The output shows that the namespace has a quota of two Pods, and that currently there are no Pods; that is, none of the quota is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13519"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13520"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod-deployment.yaml --namespace=quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | View detailed information about the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13521"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment pod-quota-demo --namespace=quota-pod-example --output=yaml\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | The output shows that even though the Deployment specifies three replicas, only two Pods were created because of the quota you defined earlier:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13522"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13523"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\n2.6.2 - Use Calico for NetworkPolicy | The Calico pods begin with calico. Check to make sure each one has a status of Running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13524"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=cilium\n```\n\n2.6.3 - Use Cilium for NetworkPolicy | You'll see a list of Pods similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13525"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system -o wide\n```\n\n2.6.6 - Weave Net for NetworkPolicy | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13526"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080 &\n```\n\n2.7 - Access Clusters Using the Kubernetes API | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13527"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Check all possible clusters, as your .KUBECONFIG may have multiple contexts:\nkubectl config view -o jsonpath='{\"Cluster name\\tServer\\n\"}{range .clusters[*]}{.name}{\"\\t\"}{.cluster.server}{\"\\n\"}{end}'\n\n# Select name of cluster you want to interact with from above output:\nexport CLUSTER_NAME=\"some_server_name\"\n\n# Point to the API server referring the cluster name\nAPISERVER=$(kubectl config view -o jsonpath=\"{.clusters[?(@.name==\\\"$CLUSTER_NAME\\\")].cluster.server}\")\n\n# Create a secret to hold a token for the default service account\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n\n# Wait for the token controller to populate the secret with a token:\nwhile ! kubectl describe secret default-token | grep -E '^token' >/dev/null; do\n  echo \"waiting for token...\" >&2\n  sleep 1\ndone\n\n# Get the token value\nTOKEN=$(kubectl get secret default-token -o jsonpath='{.data.token}' | base64 --decode)\n\n# Explore the API with TOKEN\ncurl -X GET $APISERVER/api --header \"Authorization: Bearer $TOKEN\" --insecure\n```\n\n2.7 - Access Clusters Using the Kubernetes API | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13528"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name>\n```\n\n2.8 - Advertise Extended Resources for a Node | Once again, the output shows the dongle resource:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13529"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name> | grep dongle\n```\n\n2.8 - Advertise Extended Resources for a Node | (you should not see any output)", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13530"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13531"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -l k8s-app=kube-dns --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13532"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | and look for a deployment named coredns or kube-dns.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13533"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13534"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f dns-horizontal-autoscaler.yaml\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output of a successful command is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13535"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13536"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap kube-dns-autoscaler --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | Look for this line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13537"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment --replicas=0 kube-dns-autoscaler --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13538"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output displays 0 in the DESIRED and CURRENT columns:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13539"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment kube-dns-autoscaler --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13540"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc cat-pictures-pvc -o jsonpath='{.spec.volumeName}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | And you can view the PVC before you make changes. Either view the manifest locally, or run kubectl get pvc <name-of-pvc> -o yaml. The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13541"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-pvc.yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: cat-pictures-pvc\nspec:\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13542"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-writer-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: cat-pictures-writer\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cat-pictures-writer\n  template:\n    metadata:\n      labels:\n        app: cat-pictures-writer\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n        volumeMounts:\n        - name: cat-pictures\n          mountPath: /mnt\n      volumes:\n      - name: cat-pictures\n        persistentVolumeClaim:\n          claimName: cat-pictures-pvc\n          readOnly: false\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | As a first step, you need to edit your PersistentVolume's spec.persistentVolumeReclaimPolicy and set it to Retain. This ensures your PersistentVolume will not be deleted when you delete the correspond", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13543"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to stop any workloads that are using the PersistentVolumeClaim bound to the PersistentVolume you want to migrate, and then delete the PersistentVolumeClaim. Avoid making any other change", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13544"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=0 deployment cat-pictures-writer\nkubectl delete pvc cat-pictures-pvc\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"claimRef\":{\"uid\":\"\"}}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | After that, replace the PersistentVolume's list of valid access modes to be (only) ReadWriteOncePod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13545"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"accessModes\":[\"ReadWriteOncePod\"]}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to modify your PersistentVolumeClaim to set ReadWriteOncePod as the only access mode. You should also set the PersistentVolumeClaim's spec.volumeName to the name of your PersistentVolume", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13546"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Delete\"}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | This page shows how to change the default Storage Class that is used to provision volumes for PersistentVolumeClaims that have no special requirements.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13547"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\n2.11 - Change the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13548"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass standard -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"false\"}}}'\n```\n\n2.11 - Change the default StorageClass | where standard is the name of your chosen StorageClass.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13549"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass gold -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}'\n```\n\n2.11 - Change the default StorageClass | Please note you can have multiple StorageClass marked as default. If more than one StorageClass is marked as default, a PersistentVolumeClaim without an explicitly defined storageClassName will be cre", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13550"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\n2.11 - Change the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13551"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\n2.13 - Change the Reclaim Policy of a PersistentVolume | where <your-pv-name> is the name of your chosen PersistentVolume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13552"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p \"{\\\"spec\\\":{\\\"persistentVolumeReclaimPolicy\\\":\\\"Retain\\\"}}\"\n```\n\n2.13 - Change the Reclaim Policy of a PersistentVolume | Verify that your chosen PersistentVolume has the right policy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13553"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\n2.14 - Cloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13554"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1\nkind: CredentialProviderConfig\n# providers is a list of credential provider helper plugins that will be enabled by the kubelet.\n# Multiple providers may match against a single image, in which case credentials\n# from all providers will be returned to the kubelet. If multiple providers are called\n# for a single image, the results are combined. If providers return overlapping\n# auth keys, the value from the provider earlier in this list is used.\nproviders:\n  # name is the required name of the credential provider. It must match the name of the\n  # provider executable as seen by the kubelet. The executable must be in the kubelet's\n  # bin directory (set by the --image-credential-provider-bin-dir flag).\n  - name: ecr-credential-provider\n    # matchImages is a required list of strings used to match against images in order to\n    # determine if this provider should be invoked. If one of the strings matches the\n    # requested image from the kubelet, the plugin will be invoked and given a chance\n    # to provide credentials. Images are expected to contain the registry domain\n    # and URL path.\n    #\n    # Each entry in matchImages is a pattern which can optionally contain a port and a path.\n    # Globs can be used in the domain, but not in the port or the path. Globs are supported\n    # as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'.\n    # Matching partial subdomains like 'app*.k8s.io' is also supported. Each glob can only match\n    # a single subdomain segment, so `*.io` does **not** match `*.k8s.io`.\n    #\n    # A match exists between an image and a matchImage when all of the below are true:\n    # - Both contain the same number of domain parts and each part matches.\n    # - The URL path of an matchImages must be a prefix of the target image URL path.\n    # - If the matchImages contains a port, then the port must match in the image as well.\n    #\n    # Example values of matchImages:\n    # - 123456789.dkr.ecr.us-east-1.amazonaws.com\n    # - *.azurecr.io\n    # - gcr.io\n    # - *.*.registry.io\n    # - registry.io:8080/path\n    matchImages:\n      - \"*.dkr.ecr.*.amazonaws.com\"\n      - \"*.dkr.ecr.*.amazonaws.com.cn\"\n      - \"*.dkr.ecr-fips.*.amazonaws.com\"\n      - \"*.dkr.ecr.us-iso-east-1.c2s.ic.gov\"\n      - \"*.dkr.ecr.us-isob-east-1.sc2s.sgov.gov\"\n    # defaultCacheDuration is the default duration the plugin will cache credentials in-memory\n    # if a cache duration is not provided in the plugin response. This field is required.\n    defaultCacheDuration: \"12h\"\n    # Required input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse\n    # MUST use the same encoding version as the input. Current supported values are:\n    # - credentialprovider.kubelet.k8s.io/v1\n    apiVersion: credentialprovider.kubelet.k8s.io/v1\n    # Arguments to pass to the command when executing it.\n    # +optional\n    # args:\n    #   - --example-argument\n    # Env defines additional environment variables to expose to the process. These\n    # are unioned with the host's environment, as well as variables client-go uses\n    # to pass argument to the plugin.\n    # +optional\n    env:\n      - name: AWS_PROFILE\n        value: example_profile\n\n    # tokenAttributes is the configuration for the service account token that will be passed to the plugin.\n    # The credential provider opts in to using service account tokens for image pull by setting this field.\n    # if this field is set without the `KubeletServiceAccountTokenForCredentialProviders` feature gate enabled, \n    # kubelet will fail to start with invalid configuration error.\n    # +optional\n    tokenAttributes:\n      # serviceAccountTokenAudience is the intended audience for the projected service account token.\n      # +required\n      serviceAccountTokenAudience: \"<audience for the token>\"\n      # cacheType indicates the type of cache key use for caching the credentials returned by the plugin\n      # when the service account token is used.\n      # The most conservative option is to set this to \"Token\", which means the kubelet will cache\n      # returned credentials on a per-token basis. This should be set if the returned credential's\n      # lifetime is limited to the service account token's lifetime.\n      # If the plugin's credential retrieval logic depends only on the service account and not on\n      # pod-specific claims, then the plugin can set this to \"ServiceAccount\". In this case, the\n      # kubelet will cache returned credentials on a per-serviceaccount basis. Use this when the\n      # returned credential is valid for all pods using the same service account.\n      # +required\n      cacheType: \"<Token or ServiceAccount>\"\n      # requireServiceAccount indicates whether the plugin requires the pod to have a service account.\n      # If set to true, kubelet will only invoke the plugin if the pod has a service account.\n      # If set to false, kubelet will invoke the plugin even if the pod does not have a service account\n      # and will not include a token in the CredentialProviderRequest. This is useful for plugins\n      # that are used to pull images for pods without service accounts (e.g., static pods).\n      # +required\n      requireServiceAccount: true\n      # requiredServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are required to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. If any of the keys defined in this list\n      # are not present in the service account, kubelet will not invoke the plugin and will return an error.\n      # This field is optional and may be empty. Plugins may use this field to extract additional information\n      # required to fetch credentials or allow workloads to opt in to using service account tokens for image pull.\n      # If non-empty, requireServiceAccount must be set to true.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # optionalServiceAccountAnnotationKeys list.\n      # +optional\n      requiredServiceAccountAnnotationKeys:\n      - \"example.com/required-annotation-key-1\"\n      - \"example.com/required-annotation-key-2\"\n      # optionalServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are optional to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. The plugin is responsible for validating the\n      # existence of annotations and their values. This field is optional and may be empty.\n      # Plugins may use this field to extract additional information required to fetch credentials.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # requiredServiceAccountAnnotationKeys list.\n      # +optional\n      optionalServiceAccountAnnotationKeys:\n      - \"example.com/optional-annotation-key-1\"\n      - \"example.com/optional-annotation-key-2\"\n```\n\n2.15 - Configure a kubelet image credential provider | The providers field is a list of enabled plugins used by the kubelet. Each entry has a few required fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13555"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | Here is the configuration file for a ResourceQuota object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13556"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\n2.16 - Configure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13557"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects.yaml --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13558"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota object-quota-demo --namespace=quota-object-example --output=yaml\n```\n\n2.16 - Configure Quotas for API Objects | The output shows that in the quota-object-example namespace, there can be at most one PersistentVolumeClaim, at most two Services of type LoadBalancer, and no Services of type NodePort.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13559"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n2.16 - Configure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13560"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc.yaml --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | Verify that the PersistentVolumeClaim was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13561"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get persistentvolumeclaims --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | The output shows that the PersistentVolumeClaim exists and has status Pending:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13562"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\n2.16 - Configure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13563"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc-2.yaml --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | The output shows that the second PersistentVolumeClaim was not created, because it would have exceeded the quota for the namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13564"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13565"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health {\n            lameduck 5s\n        }\n        ready\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n            pods insecure\n            fallthrough in-addr.arpa ip6.arpa\n            ttl 30\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\n2.19 - Customizing DNS Service | The Corefile configuration includes the following plugins of CoreDNS:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13566"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n           pods insecure\n           fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . 172.16.0.1\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n    consul.local:53 {\n        errors\n        cache 30\n        forward . 10.150.0.1\n    }\n```\n\n2.19 - Customizing DNS Service | This page provides hints on diagnosing DNS problems.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13567"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\n2.20 - Debugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13568"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml\n```\n\n2.20 - Debugging DNS Resolution | …and verify its status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13569"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dnsutils\n```\n\n2.20 - Debugging DNS Resolution | Once that Pod is running, you can exec nslookup in that environment. If you see something like the following, DNS is working correctly.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13570"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\n2.20 - Debugging DNS Resolution | If the nslookup command fails, check the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13571"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti dnsutils -- cat /etc/resolv.conf\n```\n\n2.20 - Debugging DNS Resolution | Verify that the search path and name server are set up like the following (note that search path may vary for different cloud providers):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13572"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\n2.20 - Debugging DNS Resolution | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13573"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\n2.20 - Debugging DNS Resolution | Use the kubectl get pods command to verify that the DNS pod is running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13574"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=kube-dns\n```\n\n2.20 - Debugging DNS Resolution | If you see that no CoreDNS Pod is running or that the Pod has failed/completed, the DNS add-on may not be deployed by default in your current environment and you will have to deploy it manually.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13575"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs --namespace=kube-system -l k8s-app=kube-dns\n```\n\n2.20 - Debugging DNS Resolution | Here is an example of a healthy CoreDNS log:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13576"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc --namespace=kube-system\n```\n\n2.20 - Debugging DNS Resolution | If you have created the Service or in the case it should be created by default but it does not appear, see debugging Services for more information.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13577"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=kube-dns --namespace=kube-system\n```\n\n2.20 - Debugging DNS Resolution | If you do not see the endpoints, see the endpoints section in the debugging Services documentation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13578"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system edit configmap coredns\n```\n\n2.20 - Debugging DNS Resolution | Then add log in the Corefile section per the example below:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13579"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        log\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n          pods insecure\n          upstream\n          fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\n2.20 - Debugging DNS Resolution | After saving the changes, it may take up to minute or two for Kubernetes to propagate these changes to the CoreDNS pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13580"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe clusterrole system:coredns -n kube-system\n```\n\n2.20 - Debugging DNS Resolution | Expected output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13581"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:coredns -n kube-system\n```\n\n2.20 - Debugging DNS Resolution | Example insertion of EndpointSlices permissions:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13582"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>\n```\n\n2.20 - Debugging DNS Resolution | This query specifies the namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13583"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>.<namespace>\n```\n\n2.20 - Debugging DNS Resolution | To learn more about name resolution, see DNS for Services and Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13584"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx\n```\n\n2.21 - Declare Network Policy | Expose the Deployment through a Service called nginx.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13585"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80\n```\n\n2.21 - Declare Network Policy | The above commands create a Deployment with an nginx Pod and expose the Deployment through a Service named nginx. The nginx Pod and Deployment are found in the default namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13586"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\n2.21 - Declare Network Policy | In your shell, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13587"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\n2.21 - Declare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13588"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/nginx-policy.yaml\n```\n\n2.21 - Declare Network Policy | When you attempt to access the nginx Service from a Pod without the correct labels, the request times out:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13589"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\n2.21 - Declare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13590"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --labels=\"access=true\" --image=busybox -- /bin/sh\n```\n\n2.21 - Declare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13591"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example # a custom resource API\n    providers:\n      # This configuration does not provide data confidentiality. The first\n      # configured provider is specifying the \"identity\" mechanism, which\n      # stores resources as plain text.\n      #\n      - identity: {} # plain text, in other words NO encryption\n      - aesgcm:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - secretbox:\n          keys:\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n  - resources:\n      - events\n    providers:\n      - identity: {} # do not encrypt Events even though *.* is specified below\n  - resources:\n      - '*.apps' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key2\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n  - resources:\n      - '*.*' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key3\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\n2.24 - Encrypting Confidential Data at Rest | Each resources array item is a separate config and contains a complete configuration. The resources.resources field is an array of Kubernetes resource names (resource or resource.group) that should be", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13592"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              # See the following text for more details about the secret value\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # this fallback allows reading unencrypted secrets;\n                     # for example, during initial migration\n```\n\n2.24 - Encrypting Confidential Data at Rest | To create a new encryption key (that does not use KMS), see Generate the encryption key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13593"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# This is a fragment of a manifest for a static Pod.\n# Check whether this is correct for your cluster and for your API server.\n#\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.20.30.40:443\n  creationTimestamp: null\n  labels:\n    app.kubernetes.io/component: kube-apiserver\n    tier: control-plane\n  name: kube-apiserver\n  namespace: kube-system\nspec:\n  containers:\n  - command:\n    - kube-apiserver\n    ...\n    - --encryption-provider-config=/etc/kubernetes/enc/enc.yaml  # add this line\n    volumeMounts:\n    ...\n    - name: enc                           # add this line\n      mountPath: /etc/kubernetes/enc      # add this line\n      readOnly: true                      # add this line\n    ...\n  volumes:\n  ...\n  - name: enc                             # add this line\n    hostPath:                             # add this line\n      path: /etc/kubernetes/enc           # add this line\n      type: DirectoryOrCreate             # add this line\n  ...\n```\n\n2.24 - Encrypting Confidential Data at Rest | Restart your API server.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13594"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\n2.24 - Encrypting Confidential Data at Rest | Using the etcdctl command line tool, read that Secret out of etcd:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13595"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret1 -n default -o yaml\n```\n\n2.24 - Encrypting Confidential Data at Rest | The output should contain mykey: bXlkYXRh, with contents of mydata encoded using base64; read decoding a Secret to learn how to completely decode the Secret.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13596"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # REMOVE THIS LINE\n```\n\n2.24 - Encrypting Confidential Data at Rest | …and then restart each API server in turn. This change prevents the API server from accessing a plain-text Secret, even by accident.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13597"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      # list any other resources here that you previously were\n      # encrypting at rest\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET> # keep this in place\n                                               # make sure it comes after \"identity\"\n```\n\n2.24 - Encrypting Confidential Data at Rest | Then run the following command to force decryption of all Secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13598"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\n2.24 - Encrypting Confidential Data at Rest | Once you have replaced all existing encrypted resources with backing data that don't use encryption, you can remove the encryption settings from the kube-apiserver.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13599"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            # Do not use this (invalid) example key for encryption\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\n2.25 - Decrypt Confidential Data that is Already Encrypted at Rest | then change it to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13600"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\n2.25 - Decrypt Confidential Data that is Already Encrypted at Rest | and restart the kube-apiserver Pod on this node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13601"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/ip-masq-agent/master/ip-masq-agent.yaml\n```\n\n2.27 - IP Masquerade Agent User Guide | You must also apply the appropriate node label to any nodes in your cluster that you want the agent to run on.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13602"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes my-node node.kubernetes.io/masq-agent-ds-ready=true\n```\n\n2.27 - IP Masquerade Agent User Guide | More information can be found in the ip-masq-agent documentation here.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13603"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap ip-masq-agent --from-file=config --namespace=kube-system\n```\n\n2.27 - IP Masquerade Agent User Guide | This will update a file located at /etc/config/ip-masq-agent which is periodically checked every resyncInterval and applied to the cluster node. After the resync interval has expired, you should see t", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13604"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: storagelimits\nspec:\n  limits:\n  - type: PersistentVolumeClaim\n    max:\n      storage: 2Gi\n    min:\n      storage: 1Gi\n```\n\n2.28 - Limit Storage Consumption | Minimum storage requests are used when the underlying storage provider requires certain minimums. For example, AWS EBS volumes have a 1Gi minimum requirement.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13605"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: storagequota\nspec:\n  hard:\n    persistentvolumeclaims: \"5\"\n    requests.storage: \"5Gi\"\n```\n\n2.28 - Limit Storage Consumption | A limit range can put a ceiling on how much storage is requested while a resource quota can effectively cap the storage consumed by a namespace through claim counts and cumulative storage capacity. Th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13606"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-kube-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | Do the same to the system::leader-locking-cloud-controller-manager role.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13607"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-cloud-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | Leader Migration optionally takes a configuration file representing the state of controller-to-manager assignment. At this moment, with in-tree cloud provider, kube-controller-manager runs route, serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13608"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: kube-controller-manager\n  - name: service\n    component: kube-controller-manager\n  - name: cloud-node-lifecycle\n    component: kube-controller-manager\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | Alternatively, because the controllers can run under either controller managers, setting component to * for both sides makes the configuration file consistent between both parties of the migration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13609"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | On each control plane node, save the content to /etc/leadermigration.conf, and update the manifest of kube-controller-manager so that the file is mounted inside the container at the same location. Als", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13610"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: cloud-controller-manager\n  - name: service\n    component: cloud-controller-manager\n  - name: cloud-node-lifecycle\n    component: cloud-controller-manager\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | When creating control plane nodes of version N + 1, the content should be deployed to /etc/leadermigration.conf. The manifest of cloud-controller-manager should be updated to mount the configuration f", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13611"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version, with nodeipam\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n  - name: nodeipam\n-   component: *\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | etcd is a consistent and highly-available key value store used as Kubernetes' backing store for all cluster data.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13612"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  KubeletInUserNamespace: true\n# We use cgroupfs that is delegated by systemd, so we do not use \"systemd\" driver\n# (unless you run another systemd in the namespace)\ncgroupDriver: \"cgroupfs\"\n```\n\n2.32 - Running Kubernetes Node Components as a Non-root User | When the KubeletInUserNamespace feature gate is enabled, the kubelet ignores errors that may happen during setting the following sysctl values on the node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13613"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\nmode: \"iptables\" # or \"userspace\"\nconntrack:\n# Skip setting sysctl value \"net.netfilter.nf_conntrack_max\"\n  maxPerCore: 0\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_established\"\n  tcpEstablishedTimeout: 0s\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_close\"\n  tcpCloseWaitTimeout: 0s\n```\n\n2.32 - Running Kubernetes Node Components as a Non-root User | Most of \"non-local\" volume drivers such as nfs and iscsi do not work. Local volumes like local, hostPath, emptyDir, configMap, secret, and downwardAPI are known to work.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13614"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl drain --ignore-daemonsets <node name>\n```\n\n2.33 - Safely Drain a Node | If there are pods managed by a DaemonSet, you will need to specify --ignore-daemonsets with kubectl to successfully drain the node. The kubectl drain subcommand on its own does not actually drain a no", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13615"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node name>\n```\n\n2.33 - Safely Drain a Node | afterwards to tell Kubernetes that it can resume scheduling new pods onto the node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13616"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\naddress: \"192.168.0.8\"\nport: 20250\nserializeImagePulls: false\nevictionHard:\n    memory.available:  \"100Mi\"\n    nodefs.available:  \"10%\"\n    nodefs.inodesFree: \"5%\"\n    imagefs.available: \"15%\"\n    imagefs.inodesFree: \"5%\"\n```\n\n2.35 - Set Kubelet Parameters Via A Configuration File | In this example, the kubelet is configured with the following settings:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13617"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\n2.36 - Share a Cluster with Namespaces | Kubernetes starts with four initial namespaces:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13618"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces <name>\n```\n\n2.36 - Share a Cluster with Namespaces | Or you can get detailed information with:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13619"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe namespaces <name>\n```\n\n2.36 - Share a Cluster with Namespaces | Note that these details show both resource quota (if present) as well as resource limit ranges.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13620"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: <insert-namespace-name-here>\n```\n\n2.36 - Share a Cluster with Namespaces | Then run:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13621"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./my-namespace.yaml\n```\n\n2.36 - Share a Cluster with Namespaces | Alternatively, you can create namespace using below command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13622"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace <insert-namespace-name-here>\n```\n\n2.36 - Share a Cluster with Namespaces | The name of your namespace must be a valid DNS label.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13623"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespaces <insert-some-namespace-name>\n```\n\n2.36 - Share a Cluster with Namespaces | This delete is asynchronous, so for a time you will see the namespace in the Terminating state.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13624"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\n2.36 - Share a Cluster with Namespaces | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13625"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.json\n```\n\n2.36 - Share a Cluster with Namespaces | And then let's create the production namespace using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13626"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.json\n```\n\n2.36 - Share a Cluster with Namespaces | To be sure things are right, list all of the namespaces in our cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13627"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\n2.36 - Share a Cluster with Namespaces | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster. Users interacting with one namespace do not see the content in another namespace. To demonstrate this, let", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13628"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment snowflake \\\n  --image=registry.k8s.io/serve_hostname \\\n  -n=development --replicas=2\n```\n\n2.36 - Share a Cluster with Namespaces | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13629"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=development\n```\n\n2.36 - Share a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13630"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake -n=development\n```\n\n2.36 - Share a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13631"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=production\nkubectl get pods -n=production\n```\n\n2.36 - Share a Cluster with Namespaces | Production likes to run cattle, so let's create some cattle pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13632"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname -n=production\nkubectl scale deployment cattle --replicas=5 -n=production\n\nkubectl get deployment -n=production\n```\n\n2.36 - Share a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13633"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle -n=production\n```\n\n2.36 - Share a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13634"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f pod.yaml --output-version v1\n```\n\n2.37 - Upgrade A Cluster | The kubectl tool replaces the contents of pod.yaml with a manifest that sets kind to Pod (unchanged), but with a revised apiVersion.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13635"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx --output=yaml\n```\n\n2.38 - Use Cascading Deletion in a Cluster | The output has an ownerReferences field similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13636"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n    ...\n    ownerReferences:\n    - apiVersion: apps/v1\n      blockOwnerDeletion: true\n      controller: true\n      kind: ReplicaSet\n      name: nginx-deployment-6b474476c4\n      uid: 4fdcd81c-bd5d-41f7-97af-3a3b759af9a7\n    ...\n```\n\n2.38 - Use Cascading Deletion in a Cluster | By default, Kubernetes uses background cascading deletion to delete dependents of an object. You can switch to foreground cascading deletion using either kubectl or the Kubernetes API, depending on th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13637"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=foreground\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13638"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13639"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=background\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13640"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13641"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=orphan\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13642"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13643"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n2.38 - Use Cascading Deletion in a Cluster | This page shows how to configure a Key Management Service (KMS) provider and plugin to enable secret data encryption. In Kubernetes 1.34 there are two versions of KMS at-rest encryption. You should us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13644"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          cachesize: 100\n          timeout: 3s\n      - kms:\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          cachesize: 100\n          timeout: 3s\n```\n\n2.39 - Using a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13645"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          timeout: 3s\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          timeout: 3s\n```\n\n2.39 - Using a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13646"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\n2.39 - Using a KMS provider for data encryption | Using the etcdctl command line, read that secret out of etcd:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13647"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret secret1 -n default\n```\n\n2.39 - Using a KMS provider for data encryption | The Secret should contain mykey: mydata", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13648"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\n2.39 - Using a KMS provider for data encryption | To switch from a local encryption provider to the kms provider and re-encrypt all of the secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13649"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - kms:\n          apiVersion: v2\n          name : myKmsPlugin\n          endpoint: unix:///tmp/socketfile.sock\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n```\n\n2.39 - Using a KMS provider for data encryption | Restart all kube-apiserver processes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13650"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\n2.39 - Using a KMS provider for data encryption | If you no longer want to use encryption for data persisted in the Kubernetes API, read decrypt data that are already stored at rest.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13651"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sysctl-example\nspec:\n  securityContext:\n    sysctls:\n    - name: kernel.shm_rmid_forced\n      value: \"0\"\n    - name: net.core.somaxconn\n      value: \"1024\"\n    - name: kernel.msgmax\n      value: \"65536\"\n  ...\n```\n\n2.42 - Using sysctls in a Kubernetes Cluster | It is good practice to consider nodes with special sysctl settings as tainted within a cluster, and only schedule pods onto them which need those sysctl settings. It is suggested to use the Kubernetes", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13652"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: guaranteed\nspec:\n  containers:\n  - name: guaranteed\n    image: consumer\n    imagePullPolicy: Never\n    resources:\n      limits:\n        cpu: \"2\"\n        memory: 150Gi\n      requests:\n        cpu: \"2\"\n        memory: 150Gi\n    command: [\"sleep\",\"infinity\"]\n```\n\n2.43 - Utilizing the NUMA-aware Memory Manager | Next, let us log into the node where it was deployed and examine the state file in /var/lib/kubelet/memory_manager_state:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13653"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | If the resource metrics API is available, the output includes a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13654"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | To specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13655"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13656"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13657"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13658"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the one Container in the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13659"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13660"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | A Container can exceed its memory request if the Node has memory available. But a Container is not allowed to use more than its memory limit. If a Container allocates more memory than its limit, the C", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13661"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13662"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-2.yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13663"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | At this point, the Container might be running or killed. Repeat the preceding command until the Container is killed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13664"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --output=yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container was killed because it is out of memory (OOM):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13665"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container is killed, restarted, killed again, restarted again, and so on:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13666"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS      RESTARTS   AGE\nmemory-demo-2   0/1       OOMKilled   1          37s\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13667"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-2   1/1       Running   2          40s\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13668"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container starts and fails repeatedly:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13669"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output includes a record of the Container being killed because of an out-of-memory condition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13670"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Memory requests and limits are associated with Containers, but it is useful to think of a Pod as having a memory request and limit. The memory request for the Pod is the sum of the memory requests for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13671"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13672"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-3.yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13673"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod status is PENDING. That is, the Pod is not scheduled to run on any Node, and it will remain in the PENDING state indefinitely:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13674"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-3   0/1       Pending   0          25s\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod, including events:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13675"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-3 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient memory on the Nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13676"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-3 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | If you do not specify a memory limit for a Container, one of the following situations applies:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13677"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Assign CPU Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13678"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | If the resource metrics API is available, the output will include a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13679"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | To specify a CPU request for a container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13680"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13681"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13682"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13683"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The output shows that the one container in the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13684"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13685"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | CPU requests and limits are associated with Containers, but it is useful to think of a Pod as having a CPU request and limit. The CPU request for a Pod is the sum of the CPU requests for all the Conta", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13686"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13687"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13688"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo-2 --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The output shows that the Pod status is Pending. That is, the Pod has not been scheduled to run on any Node, and it will remain in the Pending state indefinitely:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13689"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod cpu-demo-2 --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient CPU resources on the Nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13690"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo-2 --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | If you do not specify a CPU limit for a Container, then one of these situations applies:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13691"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13692"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.3.1 - Set Up DRA in a Cluster | If the component configuration was correct, the output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13693"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n3.3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13694"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslice <resourceslice-name> -o yaml\n```\n\n3.3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13695"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\n3.3.1 - Set Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13696"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13697"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.3.1 - Set Up DRA in a Cluster | To delete the DeviceClass that you created in this task, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13698"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.3.1 - Set Up DRA in a Cluster | This page shows you how to allocate devices to your Pods by using dynamic resource allocation (DRA). These instructions are for workload operators. Before reading this page, familiarize yourself with", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13699"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | The output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13700"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13701"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Review the following example manifest:dra/resourceclaim.yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaim metadata: name: example-resource-claim spec: devices: requests: - name: sing", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13702"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13703"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | To request device allocation, specify a ResourceClaim or a ResourceClaimTemplate in the resourceClaims field of the Pod specification. Then, request a specific claim by name in the resources.claims fi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13704"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13705"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Try the following troubleshooting steps:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13706"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | To delete your resource claims, run one of the following commands:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13707"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Delete the ResourceClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13708"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This page shows how to specify CPU and memory resources for a Pod at pod-level in addition to container-level resource specifications. A Kubernetes node allocates resources to a pod based on the pod's", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13709"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | To specify memory requests for a Pod at pod-level, include the resources.requests.memory field in the Pod spec manifest. To specify a memory limit, include resources.limits.memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13710"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13711"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-memory-request-limit.yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13712"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13713"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13714"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13715"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13716"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-cpu-request-limit.yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13717"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13718"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13719"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13720"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13721"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-resources.yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13722"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod-resources-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13723"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that one container in the Pod has a memory request of 50 MiB and a CPU request of 0.5 cores, with a memory limit of 100 MiB and a CPU limit of 0.5 cores. The Pod itself has a memory r", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13724"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13725"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13726"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13727"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13728"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13729"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13730"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it iis-auth-7776966999-n5nzr powershell.exe\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | nltest.exe /parentdomain results in the following error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13731"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13732"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod-resize.yaml\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | This pod starts in the Guaranteed QoS class. Verify its initial state:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13733"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"cpu\":\"800m\"}, \"limits\":{\"cpu\":\"800m\"}}}]}}'\n\n# Alternative methods:\n# kubectl -n qos-example edit pod resize-demo --subresource resize\n# kubectl -n qos-example apply -f <updated-manifest> --subresource resize --server-side\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status again after patching:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13734"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml --namespace=qos-example\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | You should see:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13735"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"memory\":\"300Mi\"}, \"limits\":{\"memory\":\"300Mi\"}}}]}}'\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status shortly after patching:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13736"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | You should now observe:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13737"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | You'll see changes indicating the problem:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13738"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod resize-demo\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13739"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13740"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-pod.yaml\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13741"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-pod-demo\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13742"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-pod-demo -- powershell\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13743"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13744"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-container.yaml\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13745"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-container-demo\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13746"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-container-demo -- powershell\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username (the one set at the Container level):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13747"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of Guaranteed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13748"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13749"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13750"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also verifies that the Pod Container has a memory request that matches its memory limit, and it has a CPU request th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13751"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | A Pod is given a QoS class of Burstable if:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13752"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13753"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13754"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-2 --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13755"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-2 --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not have any memory or CPU limits or requests.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13756"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13757"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13758"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-3 --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of BestEffort:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13759"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-3 --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | Here is a manifest for a Pod that has two Containers. One container specifies a memory request of 200 MiB. The other Container does not specify any requests or limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13760"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n3.9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13761"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13762"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-4 --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13763"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\n3.9 - Configure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13764"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13765"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n3.10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13766"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml\n```\n\n3.10 - Assign Extended Resources to a Container | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13767"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo\n```\n\n3.10 - Assign Extended Resources to a Container | Describe the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13768"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo\n```\n\n3.10 - Assign Extended Resources to a Container | The output shows dongle requests:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13769"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n3.10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13770"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml\n```\n\n3.10 - Assign Extended Resources to a Container | Describe the Pod", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13771"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo-2\n```\n\n3.10 - Assign Extended Resources to a Container | The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13772"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo-2\n```\n\n3.10 - Assign Extended Resources to a Container | The output shows that the Pod was created, but not scheduled to run on a Node. It has a status of Pending:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13773"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod extended-resource-demo\nkubectl delete pod extended-resource-demo-2\n```\n\n3.10 - Assign Extended Resources to a Container | This page shows how to configure a Pod to use a Volume for storage.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13774"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13775"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | Verify that the Pod's Container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13776"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod redis --watch\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13777"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and then create a file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13778"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and verify that test-file is still there.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13779"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | See Volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13780"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13781"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | View information about the PersistentVolume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13782"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13783"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13784"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume wi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13785"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Now the output shows a STATUS of Bound.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13786"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc task-pv-claim\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, task-pv-volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13787"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13788"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13789"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod task-pv-pod\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Get a shell to the container running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13790"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it task-pv-pod -- /bin/bash\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13791"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod task-pv-pod\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13792"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13793"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13794"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test -- /bin/bash\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13795"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test\nkubectl delete pvc task-pv-claim\nkubectl delete pv task-pv-volume\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | If you don't already have a shell open to the Node in your cluster, open a new shell the same way that you did earlier.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13796"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13797"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13798"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/projected.yaml\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | Verify that the Pod's container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13799"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get --watch pod test-projected-volume\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13800"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test-projected-volume -- /bin/sh\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | In your shell, verify that the projected-volume directory contains your projected sources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13801"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test-projected-volume\nkubectl delete secret user pass\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | A security context defines privilege and access control settings for a Pod or Container. Security context settings include, but are not limited to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13802"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13803"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13804"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13805"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13806"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13807"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-5.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13808"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13809"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13810"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13811"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-6.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13812"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13813"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- id\n```\n\n3.14 - Configure a Security Context for a Pod or Container | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13814"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo -o yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | You can see that the status.containerStatuses[].user.linux field exposes the process identity attached to the first container process.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13815"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\n3.14 - Configure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13816"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\n3.14 - Configure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13817"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13818"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-2.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13819"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-2\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13820"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-2 -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13821"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13822"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-3.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13823"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-3\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13824"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-3 -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13825"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13826"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-4.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13827"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-4 -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, view the capabilities for process 1:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13828"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod security-context-demo\nkubectl delete pod security-context-demo-2\nkubectl delete pod security-context-demo-3\nkubectl delete pod security-context-demo-4\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Kubernetes offers two distinct ways for clients that run within your cluster, or that otherwise have a relationship to your cluster's control plane to authenticate to the API server.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13829"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/<podname> -o yaml\n```\n\n3.15 - Configure Service Accounts for Pods | In the output, you see a field spec.serviceAccountName. Kubernetes automatically sets that value if you don't specify it when you create a Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13830"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\n3.15 - Configure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13831"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\n3.15 - Configure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13832"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13833"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nEOF\n```\n\n3.15 - Configure Service Accounts for Pods | The name of a ServiceAccount object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13834"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts/build-robot -o yaml\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13835"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\n3.15 - Configure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13836"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete serviceaccount/build-robot\n```\n\n3.15 - Configure Service Accounts for Pods | Suppose you have an existing service account named \"build-robot\" as mentioned earlier.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13837"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot\n```\n\n3.15 - Configure Service Accounts for Pods | The output from that command is a token that you can use to authenticate as that ServiceAccount. You can request a specific token duration using the --duration command line argument to kubectl create", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13838"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot --bound-object-kind Node --bound-object-name node-001 --bound-object-uid 123...456\n```\n\n3.15 - Configure Service Accounts for Pods | The token will be valid until it expires or either the associated Node or service account are deleted.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13839"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n3.15 - Configure Service Accounts for Pods | If you view the Secret using:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13840"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret/build-robot-secret -o yaml\n```\n\n3.15 - Configure Service Accounts for Pods | you can see that the Secret now contains an API token for the \"build-robot\" ServiceAccount.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13841"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secrets/build-robot-secret\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13842"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry myregistrykey --docker-server=<registry name> \\\n        --docker-username=DUMMY_USERNAME --docker-password=DUMMY_DOCKER_PASSWORD \\\n        --docker-email=DUMMY_DOCKER_EMAIL\n```\n\n3.15 - Configure Service Accounts for Pods | Verify it has been created.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13843"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets myregistrykey\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13844"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch serviceaccount default -p '{\"imagePullSecrets\": [{\"name\": \"myregistrykey\"}]}'\n```\n\n3.15 - Configure Service Accounts for Pods | You can achieve the same outcome by editing the object manually:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13845"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit serviceaccount/default\n```\n\n3.15 - Configure Service Accounts for Pods | The output of the sa.yaml file is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13846"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\n3.15 - Configure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13847"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\n3.15 - Configure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13848"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=<registry name>/nginx --restart=Never\nkubectl get pod nginx -o=jsonpath='{.spec.imagePullSecrets[0].name}{\"\\n\"}'\n```\n\n3.15 - Configure Service Accounts for Pods | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13849"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n3.15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13850"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/pod-projected-svc-token.yaml\n```\n\n3.15 - Configure Service Accounts for Pods | The kubelet will: request and store the token on behalf of the Pod; make the token available to the Pod at a configurable file path; and refresh the token as it approaches expiration. The kubelet proa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13851"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic regcred \\\n    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \\\n    --type=kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it. Be sure to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13852"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13853"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>\n```\n\n3.16 - Pull an Image from a Private Registry | where:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13854"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=yaml\n```\n\n3.16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13855"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13856"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=\"jsonpath={.data.\\.dockerconfigjson}\" | base64 --decode\n```\n\n3.16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13857"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n3.16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13858"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-private-reg-pod.yaml\nkubectl get pod private-reg\n```\n\n3.16 - Pull an Image from a Private Registry | Also, in case the Pod fails to start with the status ImagePullBackOff, view the Pod events:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13859"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod private-reg\n```\n\n3.16 - Pull an Image from a Private Registry | If you then see an event with the reason set to FailedToRetrieveImagePullSecret, Kubernetes can't find a Secret with name (regcred, in this example).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13860"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13861"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | Within 30 seconds, view the Pod events:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13862"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | The output indicates that no liveness probes have failed yet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13863"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | At the bottom of the output, there are messages indicating that the liveness probes have failed, and the failed containers have been killed and recreated.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13864"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod liveness-exec\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | The output shows that RESTARTS has been incremented. Note that the RESTARTS counter increments as soon as a failed container comes back to the running state:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13865"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13866"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/http-liveness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | After 10 seconds, view Pod events to verify that liveness probes have failed and the container has been restarted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13867"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-http\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In releases after v1.13, local HTTP proxy environment variable settings do not affect the HTTP liveness probe.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13868"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13869"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that liveness probes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13870"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod goproxy\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | If your application implements the gRPC Health Checking Protocol, this example shows how to configure Kubernetes to use it for application liveness checks. Similarly you can configure readiness and st", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13871"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13872"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/grpc-liveness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that the liveness check has not failed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13873"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod etcd-with-grpc\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | When using a gRPC probe, there are some technical details to be aware of:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13874"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13875"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n3.18 - Assign Pods to Nodes | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13876"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13877"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13878"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml\n```\n\n3.18 - Assign Pods to Nodes | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13879"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n3.18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13880"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13881"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13882"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13883"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13884"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13885"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13886"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13887"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13888"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13889"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13890"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n3.20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13891"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/init-containers.yaml\n```\n\n3.20 - Configure Pod Initialization | Verify that the nginx container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13892"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod init-demo\n```\n\n3.20 - Configure Pod Initialization | The output shows that the nginx container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13893"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it init-demo -- /bin/bash\n```\n\n3.20 - Configure Pod Initialization | In your shell, send a GET request to the nginx server:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13894"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13895"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/lifecycle-events.yaml\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | Verify that the Container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13896"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod lifecycle-demo\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | Get a shell into the Container running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13897"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it lifecycle-demo -- /bin/bash\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | In your shell, verify that the postStart handler created the message file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13898"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap <map-name> <data-source>\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13899"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13900"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13901"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13902"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13903"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13904"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can display details of the game-config-2 ConfigMap using the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13905"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13906"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-env-file \\\n       --from-env-file=configure-pod-container/configmap/game-env-file.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce a ConfigMap. View the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13907"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap game-config-env-file -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13908"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13909"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap config-multi-env-files \\\n        --from-env-file=configure-pod-container/configmap/game-env-file.properties \\\n        --from-env-file=configure-pod-container/configmap/ui-env-file.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13910"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap config-multi-env-files -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13911"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13912"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=<my-key-name>=<path-to-file>\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where <my-key-name> is the key you want to use in the ConfigMap and <path-to-file> is the location of the data source file you want the key to represent.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13913"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13914"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config-3 -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13915"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13916"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13917"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps special-config -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13918"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13919"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | and also:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13920"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps/game-config-4-m9dm2f92bt\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Notice that the generated ConfigMap name has a suffix appended by hashing the contents. This ensures that a new ConfigMap is generated each time the content is modified.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13921"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13922"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Assign the special.how value defined in the ConfigMap to the SPECIAL_LEVEL_KEY environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13923"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13924"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-single-configmap-env-variable.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variable SPECIAL_LEVEL_KEY=very.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13925"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13926"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13927"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13928"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-multiple-configmap-env-variable.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL_KEY=very and LOG_LEVEL=INFO.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13929"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\nkubectl delete configmap special-config\nkubectl delete configmap env-config\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create a ConfigMap containing multiple key-value pairs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13930"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13931"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Use envFrom to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13932"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13933"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-envFrom.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL=very and SPECIAL_TYPE=charm.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13934"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use ConfigMap-defined environment variables in the command and args of a container using the $(VAR_NAME) Kubernetes substitution syntax.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13935"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13936"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valueFrom.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | That pod produces the following output from the test-container container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13937"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Once you're happy to move on, delete that Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13938"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | As explained in Create ConfigMaps from files, when you create a ConfigMap using --from-file, the filename becomes a key stored in the data section of the ConfigMap. The file contents become the key's", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13939"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13940"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Add the ConfigMap name under the volumes section of the Pod specification. This adds the ConfigMap data to the directory specified as volumeMounts.mountPath (in this case, /etc/config). The command se", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13941"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13942"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command ls /etc/config/ produces the output below:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13943"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Use the path field to specify the desired file path for specific ConfigMap items. In this case, the SPECIAL_LEVEL item will be mounted in the config-volume volume at /etc/config/keys.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13944"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13945"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume-specific-key.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command cat /etc/config/keys produces the output below:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13946"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can project keys to specific paths. Refer to the corresponding section in the Secrets guide for the syntax.You can set POSIX permissions for keys. Refer to the corresponding section in the Secrets", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13947"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13948"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13949"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13950"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13951"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13952"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | Attach to the shell container and run ps:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13953"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it nginx -c shell -- /bin/sh\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | If you don't see a command prompt, try pressing enter. In the container shell:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13954"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n3.24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13955"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/user-namespaces-stateless.yaml\n```\n\n3.24 - Use a User Namespace With a Pod | Exec into the pod and run readlink /proc/self/ns/user:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13956"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti userns -- bash\n```\n\n3.24 - Use a User Namespace With a Pod | Run this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13957"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13958"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml\n```\n\n3.25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13959"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n3.25 - Use an Image Volume With a Pod | Check the content of a file in the volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13960"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13961"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml\n```\n\n3.25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13962"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n3.25 - Use an Image Volume With a Pod | Check the content of the file from the dir sub path in the volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13963"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Run this command on the node where kubelet is running\nmkdir -p /etc/kubernetes/manifests/\ncat <<EOF >/etc/kubernetes/manifests/static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\n3.26 - Create static Pods | Configure the kubelet on that node to set a staticPodPath value in the kubelet configuration file.See Set Kubelet Parameters Via A Configuration File for more information.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13964"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\n3.26 - Create static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13965"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod static-web-my-node1\n```\n\n3.26 - Create static Pods | You can see that the Pod is still running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13966"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13967"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc web-tcp\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | If you're using a cloud provider, your IP will be listed next to LoadBalancer Ingress.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13968"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | Kompose has support for two providers: OpenShift and Kubernetes. You can choose a targeted provider using global option --provider. If no provider is specified, Kubernetes is set by default.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13969"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker-compose\n├── Chart.yaml\n├── README.md\n└── templates\n    ├── redis-deployment.yaml\n    ├── redis-svc.yaml\n    ├── web-deployment.yaml\n    └── web-svc.yaml\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | The chart structure is aimed at providing a skeleton for building your Helm charts.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13970"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\n3.28 - Enforce Pod Security Standards by Configuring the Built-in Admission Controller | Namespaces can be labeled to enforce the Pod Security Standards. The three policies privileged, baseline and restricted broadly cover the security spectrum and are implemented by the Pod Security admi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13971"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13972"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\n    pod-security.kubernetes.io/enforce=baseline\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | If you're just getting started with the Pod Security Standards, a suitable first step would be to configure all namespaces with audit annotations for a stricter level such as baseline:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13973"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns --all \\\n  pod-security.kubernetes.io/audit=baseline \\\n  pod-security.kubernetes.io/warn=baseline\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | Note that this is not setting an enforce level, so that namespaces that haven't been explicitly evaluated can be distinguished. You can list namespaces without an explicitly set enforce level using th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13974"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --selector='!pod-security.kubernetes.io/enforce'\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | You can update a specific namespace as well. This command adds the enforce=restricted policy to my-existing-namespace, pinning the restricted policy version to v1.34.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13975"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns my-existing-namespace \\\n  pod-security.kubernetes.io/enforce=restricted \\\n  pod-security.kubernetes.io/enforce-version=v1.34\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | This page describes the process of migrating from PodSecurityPolicies to the built-in PodSecurity admission controller. This can be done effectively using a combination of dry-run and audit and warn m", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13976"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n $NAMESPACE -o jsonpath=\"{.items[*].metadata.annotations.kubernetes\\.io\\/psp}\" | tr \" \" \"\\n\" | sort -u\n```\n\n3.30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Once you have selected a Pod Security level for the namespace (or if you're trying several), it's a good idea to test it out first (you can skip this step if using the Privileged level). Pod Security", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13977"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/audit=$LEVEL\n```\n\n3.30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | If either of these approaches yield unexpected violations, you will need to either update the violating workloads to meet the policy requirements, or relax the namespace Pod Security level.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13978"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/enforce=$LEVEL\n```\n\n3.30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Finally, you can effectively bypass PodSecurityPolicy at the namespace level by binding the fully privileged PSP to all service accounts in the namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13979"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods ${POD_NAME}\n```\n\n4.3.1 - Debug Pods | Look at the state of the containers in the pod. Are they all Running? Have there been recent restarts?", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13980"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=${SERVICE_NAME}\n```\n\n4.3.1 - Debug Pods | Make sure that the endpoints in the EndpointSlices match up with the number of pods that you expect to be members of your service. For example, if your Service is for an nginx container with 3 replica", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13981"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=name=nginx,type=frontend\n```\n\n4.3.1 - Debug Pods | to list pods that match this selector. Verify that the list matches the Pods that you expect to provide your Service. Verify that the pod's containerPort matches up with the Service's targetPort", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13982"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run -it --rm --restart=Never busybox --image=gcr.io/google-containers/busybox sh\n```\n\n4.3.2 - Debug Services | If you already have a running Pod that you prefer to use, you can run a command in it using:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13983"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec <POD-NAME> -c <CONTAINER-NAME> -- <COMMAND>\n```\n\n4.3.2 - Debug Services | For the purposes of this walk-through, let's run some Pods. Since you're probably debugging your own Service you can substitute your own details, or you can follow along and get a second data point.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13984"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hostnames --image=registry.k8s.io/serve_hostname\n```\n\n4.3.2 - Debug Services | kubectl commands will print the type and name of the resource created or mutated, which can then be used in subsequent commands.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13985"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment hostnames --replicas=3\n```\n\n4.3.2 - Debug Services | Note that this is the same as if you had started the Deployment with the following YAML:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13986"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    matchLabels:\n      app: hostnames\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hostnames\n    spec:\n      containers:\n      - name: hostnames\n        image: registry.k8s.io/serve_hostname\n```\n\n4.3.2 - Debug Services | The label \"app\" is automatically set by kubectl create deployment to the name of the Deployment.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13987"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\n4.3.2 - Debug Services | You can also confirm that your Pods are serving. You can get the list of Pod IP addresses and test them directly.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13988"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames \\\n    -o go-template='{{range .items}}{{.status.podIP}}{{\"\\n\"}}{{end}}'\n```\n\n4.3.2 - Debug Services | The example container used for this walk-through serves its own hostname via HTTP on port 9376, but if you are debugging your own app, you'll want to use whatever port number your Pods are listening o", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13989"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\n4.3.2 - Debug Services | Let's create the Service. As before, this is for the walk-through - you can use your own Service's details here.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13990"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hostnames --port=80 --target-port=9376\n```\n\n4.3.2 - Debug Services | And read it back:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13991"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\n4.3.2 - Debug Services | Now you know that the Service exists.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13992"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    app: hostnames\n  ports:\n  - name: default\n    protocol: TCP\n    port: 80\n    targetPort: 9376\n```\n\n4.3.2 - Debug Services | In order to highlight the full range of configuration, the Service you created here uses a different port number than the Pods. For many real-world Services, these values might be the same.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13993"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service hostnames -o json\n```\n\n4.3.2 - Debug Services | If you got this far, you have confirmed that your Service is correctly defined and is resolved by DNS. Now let's check that the Pods you ran are actually being selected by the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13994"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\n4.3.2 - Debug Services | The -l app=hostnames argument is a label selector configured on the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13995"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=hostnames\n\nNAME              ADDRESSTYPE   PORTS   ENDPOINTS\nhostnames-ytpni   IPv4          9376    10.244.0.5,10.244.0.6,10.244.0.7\n```\n\n4.3.2 - Debug Services | This confirms that the EndpointSlice controller has found the correct Pods for your Service. If the ENDPOINTS column is <none>, you should check that the spec.selector field of your Service actually s", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13996"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app.kubernetes.io/name=MyApp\n```\n\n4.3.3 - Debug a StatefulSet | If you find that any Pods listed are in Unknown or Terminating state for an extended period of time, refer to the Deleting StatefulSet Pods task for instructions on how to deal with them. You can debu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13997"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13998"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/termination.yaml\n```\n\n4.3.4 - Determine the Reason for Pod Failure | In the YAML file, in the command and args fields, you can see that the container sleeps for 10 seconds and then writes \"Sleep expired\" to the /dev/termination-log file. After the container writes the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_13999"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Repeat the preceding command until the Pod is no longer running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14000"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo --output=yaml\n```\n\n4.3.4 - Determine the Reason for Pod Failure | The output includes the \"Sleep expired\" message:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14001"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\n...\n    lastState:\n      terminated:\n        containerID: ...\n        exitCode: 0\n        finishedAt: ...\n        message: |\n          Sleep expired          \n        ...\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Use a Go template to filter the output so that it includes only the termination message:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14002"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo -o go-template=\"{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}\"\n```\n\n4.3.4 - Determine the Reason for Pod Failure | If you are running a multi-container Pod, you can use a Go template to include the container's name. By doing so, you can discover which of the containers is failing:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14003"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod multi-container-pod -o go-template='{{range .status.containerStatuses}}{{printf \"%s:\\n%s\\n\\n\" .name .lastState.terminated.message}}{{end}}'\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Kubernetes retrieves termination messages from the termination message file specified in the terminationMessagePath field of a Container, which has a default value of /dev/termination-log. By customiz", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14004"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: msg-path-demo\nspec:\n  containers:\n  - name: msg-path-demo-container\n    image: debian\n    terminationMessagePath: \"/tmp/my-log\"\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Moreover, users can set the terminationMessagePolicy field of a Container for further customization. This field defaults to \"File\" which means the termination messages are retrieved only from the term", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14005"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <pod-name>\n```\n\n4.3.5 - Debug Init Containers | For example, a status of Init:1/2 indicates that one of two Init Containers has completed successfully:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14006"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\n4.3.5 - Debug Init Containers | For example, a Pod with two Init Containers might show the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14007"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx --template '{{.status.initContainerStatuses}}'\n```\n\n4.3.5 - Debug Init Containers | This command will return the same information as above in raw JSON.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14008"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs <pod-name> -c <init-container-2>\n```\n\n4.3.5 - Debug Init Containers | Init Containers that run a shell script print commands as they're executed. For example, you can do this in Bash by running set -x at the beginning of the script.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14009"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\n4.3.6 - Debug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14010"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-with-request.yaml\n```\n\n4.3.6 - Debug Running Pods | Check pod status by following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14011"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-67d4bdd6f5-w6kd7\n```\n\n4.3.6 - Debug Running Pods | Here you can see configuration information about the container(s) and Pod (labels, resource requirements, etc.), as well as status information about the container(s) and Pod (state, readiness, restart", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14012"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-1370807587-fz9sd\n```\n\n4.3.6 - Debug Running Pods | Here you can see the event generated by the scheduler saying that the Pod failed to schedule for reason FailedScheduling (and possibly others). The message tells us that there were not enough resource", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14013"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get events --namespace=my-namespace\n```\n\n4.3.6 - Debug Running Pods | To see events from all namespaces, you can use the --all-namespaces argument.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14014"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx-deployment-1006230814-6winp -o yaml\n```\n\n4.3.6 - Debug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14015"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2022-02-17T21:51:01Z\"\n  generateName: nginx-deployment-67d4bdd6f5-\n  labels:\n    app: nginx\n    pod-template-hash: 67d4bdd6f5\n  name: nginx-deployment-67d4bdd6f5-w6kd7\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: nginx-deployment-67d4bdd6f5\n    uid: 7d41dfd4-84c0-4be4-88ab-cedbe626ad82\n  resourceVersion: \"1364\"\n  uid: a6501da1-0447-4262-98eb-c03d4002222e\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: nginx\n    ports:\n    - containerPort: 80\n      protocol: TCP\n    resources:\n      limits:\n        cpu: 500m\n        memory: 128Mi\n      requests:\n        cpu: 500m\n        memory: 128Mi\n    terminationMessagePath: /dev/termination-log\n    terminationMessagePolicy: File\n    volumeMounts:\n    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount\n      name: kube-api-access-bgsgp\n      readOnly: true\n  dnsPolicy: ClusterFirst\n  enableServiceLinks: true\n  nodeName: kube-worker-1\n  preemptionPolicy: PreemptLowerPriority\n  priority: 0\n  restartPolicy: Always\n  schedulerName: default-scheduler\n  securityContext: {}\n  serviceAccount: default\n  serviceAccountName: default\n  terminationGracePeriodSeconds: 30\n  tolerations:\n  - effect: NoExecute\n    key: node.kubernetes.io/not-ready\n    operator: Exists\n    tolerationSeconds: 300\n  - effect: NoExecute\n    key: node.kubernetes.io/unreachable\n    operator: Exists\n    tolerationSeconds: 300\n  volumes:\n  - name: kube-api-access-bgsgp\n    projected:\n      defaultMode: 420\n      sources:\n      - serviceAccountToken:\n          expirationSeconds: 3607\n          path: token\n      - configMap:\n          items:\n          - key: ca.crt\n            path: ca.crt\n          name: kube-root-ca.crt\n      - downwardAPI:\n          items:\n          - fieldRef:\n              apiVersion: v1\n              fieldPath: metadata.namespace\n            path: namespace\nstatus:\n  conditions:\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: Initialized\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: Ready\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: ContainersReady\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: PodScheduled\n  containerStatuses:\n  - containerID: containerd://5403af59a2b46ee5a23fb0ae4b1e077f7ca5c5fb7af16e1ab21c00e0e616462a\n    image: docker.io/library/nginx:latest\n    imageID: docker.io/library/nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767\n    lastState: {}\n    name: nginx\n    ready: true\n    restartCount: 0\n    started: true\n    state:\n      running:\n        startedAt: \"2022-02-17T21:51:05Z\"\n  hostIP: 192.168.0.113\n  phase: Running\n  podIP: 10.88.0.3\n  podIPs:\n  - ip: 10.88.0.3\n  - ip: 2001:db8::1\n  qosClass: Guaranteed\n  startTime: \"2022-02-17T21:51:01Z\"\n```\n\n4.3.6 - Debug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14016"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs ${POD_NAME} ${CONTAINER_NAME}\n```\n\n4.3.6 - Debug Running Pods | If your container has previously crashed, you can access the previous container's crash log with:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14017"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous ${POD_NAME} ${CONTAINER_NAME}\n```\n\n4.3.6 - Debug Running Pods | If the container image includes debugging utilities, as is the case with images built from Linux and Windows OS base images, you can run commands inside a specific container with kubectl exec:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14018"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec ${POD_NAME} -c ${CONTAINER_NAME} -- ${CMD} ${ARG1} ${ARG2} ... ${ARGN}\n```\n\n4.3.6 - Debug Running Pods | As an example, to look at the logs from a running Cassandra pod, you might run", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14019"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec cassandra -- cat /var/log/cassandra/system.log\n```\n\n4.3.6 - Debug Running Pods | You can run a shell that's connected to your terminal using the -i and -t arguments to kubectl exec, for example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14020"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra -- sh\n```\n\n4.3.6 - Debug Running Pods | For more details, see Get a Shell to a Running Container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14021"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run ephemeral-demo --image=registry.k8s.io/pause:3.1 --restart=Never\n```\n\n4.3.6 - Debug Running Pods | The examples in this section use the pause container image because it does not contain debugging utilities, but this method works with all container images.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14022"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it ephemeral-demo -- sh\n```\n\n4.3.6 - Debug Running Pods | You can instead add a debugging container using kubectl debug. If you specify the -i/--interactive argument, kubectl will automatically attach to the console of the Ephemeral Container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14023"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it ephemeral-demo --image=busybox:1.28 --target=ephemeral-demo\n```\n\n4.3.6 - Debug Running Pods | This command adds a new busybox container and attaches to it. The --target parameter targets the process namespace of another container. It's necessary here because kubectl run does not enable process", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14024"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod ephemeral-demo\n```\n\n4.3.6 - Debug Running Pods | Use kubectl delete to remove the Pod when you're finished:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14025"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod ephemeral-demo\n```\n\n4.3.6 - Debug Running Pods | Sometimes Pod configuration options make it difficult to troubleshoot in certain situations. For example, you can't run kubectl exec to troubleshoot your container if your container image does not inc", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14026"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Run this command to create a copy of myapp named myapp-debug that adds a new Ubuntu container for debugging:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14027"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --image=ubuntu --share-processes --copy-to=myapp-debug\n```\n\n4.3.6 - Debug Running Pods | Don't forget to clean up the debugging Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14028"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\n4.3.6 - Debug Running Pods | Sometimes it's useful to change the command for a container, for example to add a debugging flag or because the application is crashing.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14029"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run --image=busybox:1.28 myapp -- false\n```\n\n4.3.6 - Debug Running Pods | You can see using kubectl describe pod myapp that this container is crashing:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14030"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --copy-to=myapp-debug --container=myapp -- sh\n```\n\n4.3.6 - Debug Running Pods | Now you have an interactive shell that you can use to perform tasks like checking filesystem paths or running the container command manually.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14031"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\n4.3.6 - Debug Running Pods | In some situations you may want to change a misbehaving Pod from its normal production container images to an image containing a debugging build or additional utilities.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14032"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Now use kubectl debug to make a copy and change its container image to ubuntu:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14033"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp --copy-to=myapp-debug --set-image=*=ubuntu\n```\n\n4.3.6 - Debug Running Pods | The syntax of --set-image uses the same container_name=image syntax as kubectl set image. *=ubuntu means change the image of all containers to ubuntu.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14034"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\n4.3.6 - Debug Running Pods | If none of these approaches work, you can find the Node on which the Pod is running and create a Pod running on the Node. To create an interactive shell on a Node using kubectl debug, run:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14035"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\n4.3.6 - Debug Running Pods | When creating a debugging session on a node, keep in mind that:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14036"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod node-debugger-mynode-pdx84\n```\n\n4.3.6 - Debug Running Pods | When using kubectl debug to debug a node via a debugging Pod, a Pod via an ephemeral container, or a copied Pod, you can apply a profile to them. By applying a profile, specific properties such as sec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14037"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Then, debug the Pod using an ephemeral container. If the ephemeral container needs to have privilege, you can use the sysadmin profile:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14038"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=sysadmin\n```\n\n4.3.6 - Debug Running Pods | Check the capabilities of the ephemeral container process by running the following command inside the container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14039"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\n4.3.6 - Debug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14040"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\n4.3.6 - Debug Running Pods | You can define a partial container spec for debugging as a custom profile in either YAML or JSON format, and apply it using the --custom flag.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14041"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Create a custom profile in YAML or JSON format. Here, create a YAML format file named custom-profile.yaml:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14042"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=general --custom=custom-profile.yaml\n```\n\n4.3.6 - Debug Running Pods | You can check that the ephemeral container has been added to the target Pod with the custom profile applied:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14043"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].env}'\n```\n\n4.3.6 - Debug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14044"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\n4.3.6 - Debug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14045"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\n4.3.6 - Debug Running Pods | This page shows how to use kubectl exec to get a shell to a running container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14046"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\n4.3.7 - Get a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14047"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/shell-demo.yaml\n```\n\n4.3.7 - Get a Shell to a Running Container | Verify that the container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14048"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod shell-demo\n```\n\n4.3.7 - Get a Shell to a Running Container | Get a shell to the running container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14049"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec --stdin --tty shell-demo -- /bin/bash\n```\n\n4.3.7 - Get a Shell to a Running Container | In your shell, list the root directory:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14050"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- env\n```\n\n4.3.7 - Get a Shell to a Running Container | Experiment with running other commands. Here are some examples:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14051"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- ps aux\nkubectl exec shell-demo -- ls /\nkubectl exec shell-demo -- cat /proc/1/mounts\n```\n\n4.3.7 - Get a Shell to a Running Container | If a Pod has more than one container, use --container or -c to specify a container in the kubectl exec command. For example, suppose you have a Pod named my-pod, and the Pod has two containers named m", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14052"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t my-pod --container main-app -- /bin/bash\n```\n\n4.3.7 - Get a Shell to a Running Container | This doc is about cluster troubleshooting; we assume you have already ruled out your application as the root cause of the problem you are experiencing. See the application troubleshooting guide for ti", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14053"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n4.4 - Troubleshooting Clusters | Sometimes when debugging it can be useful to look at the status of a node -- for example, because you've noticed strange behavior of a Pod that's running on the node, or to find out why a Pod won't sc", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14054"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node kube-worker-1\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14055"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get node kube-worker-1 -o yaml\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14056"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\nmetadata:\n  annotations:\n    node.alpha.kubernetes.io/ttl: \"0\"\n    volumes.kubernetes.io/controller-managed-attach-detach: \"true\"\n  creationTimestamp: \"2022-02-17T21:46:30Z\"\n  labels:\n    beta.kubernetes.io/arch: amd64\n    beta.kubernetes.io/os: linux\n    kubernetes.io/arch: amd64\n    kubernetes.io/hostname: kube-worker-1\n    kubernetes.io/os: linux\n  name: kube-worker-1\n  resourceVersion: \"4026\"\n  uid: 98efe7cb-2978-4a0b-842a-1a7bf12c05f8\nspec: {}\nstatus:\n  addresses:\n  - address: 192.168.0.113\n    type: InternalIP\n  - address: kube-worker-1\n    type: Hostname\n  allocatable:\n    cpu: \"2\"\n    ephemeral-storage: \"14167048988\"\n    hugepages-2Mi: \"0\"\n    memory: 1922788Ki\n    pods: \"110\"\n  capacity:\n    cpu: \"2\"\n    ephemeral-storage: 15372232Ki\n    hugepages-2Mi: \"0\"\n    memory: 2025188Ki\n    pods: \"110\"\n  conditions:\n  - lastHeartbeatTime: \"2022-02-17T22:20:32Z\"\n    lastTransitionTime: \"2022-02-17T22:20:32Z\"\n    message: Weave pod has set this\n    reason: WeaveIsUp\n    status: \"False\"\n    type: NetworkUnavailable\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient memory available\n    reason: KubeletHasSufficientMemory\n    status: \"False\"\n    type: MemoryPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has no disk pressure\n    reason: KubeletHasNoDiskPressure\n    status: \"False\"\n    type: DiskPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient PID available\n    reason: KubeletHasSufficientPID\n    status: \"False\"\n    type: PIDPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:15:15Z\"\n    message: kubelet is posting ready status\n    reason: KubeletReady\n    status: \"True\"\n    type: Ready\n  daemonEndpoints:\n    kubeletEndpoint:\n      Port: 10250\n  nodeInfo:\n    architecture: amd64\n    bootID: 22333234-7a6b-44d4-9ce1-67e31dc7e369\n    containerRuntimeVersion: containerd://1.5.9\n    kernelVersion: 5.13.0-28-generic\n    kubeProxyVersion: v1.23.3\n    kubeletVersion: v1.23.3\n    machineID: 9384e2927f544209b5d7b67474bbf92b\n    operatingSystem: linux\n    osImage: Ubuntu 21.10\n    systemUUID: aa829ca9-73d7-064d-9019-df07404ad448\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14057"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\n4.4.1 - Troubleshooting kubectl | Switch to the appropriate context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14058"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context <context-name>\n```\n\n4.4.1 - Troubleshooting kubectl | The kube-apiserver server is the central component of a Kubernetes cluster. If the API server or the load balancer that runs in front of your API servers is not reachable or not responding, you won't", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14059"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.clusters[0].cluster.certificate-authority-data}' | base64 -d | openssl x509 -noout -dates\n```\n\n4.4.1 - Troubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14060"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.users[0].user.client-certificate-data}'| base64 -d | openssl x509 -noout -dates\n```\n\n4.4.1 - Troubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14061"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/nodes/minikube\" | jq '.'\n```\n\n4.4.2 - Resource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14062"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/namespaces/kube-system/pods/kube-scheduler-minikube\" | jq '.'\n```\n\n4.4.2 - Resource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14063"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\n4.4.4 - Monitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14064"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/node-problem-detector.yaml\n```\n\n4.4.4 - Monitor Node Health | If you are using a custom cluster bootstrap solution and don't need to overwrite the default configuration, you can leverage the Addon pod to further automate the deployment.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14065"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap node-problem-detector-config --from-file=config/\n```\n\n4.4.4 - Monitor Node Health | Change the node-problem-detector.yaml to use the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14066"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\n4.4.4 - Monitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14067"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\n4.4.6 - Auditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14068"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Log all requests at the Metadata level.\napiVersion: audit.k8s.io/v1\nkind: Policy\nrules:\n- level: Metadata\n```\n\n4.4.6 - Auditing | If you're crafting your own audit profile, you can use the audit profile for Google Container-Optimized OS as a starting point. You can check the configure-helper.sh script, which generates an audit p", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14069"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\n4.4.7 - Debugging Kubernetes Nodes With Kubectl | The debug command helps to gather information and troubleshoot issues. Commands that you might use include ip, ifconfig, nc, ping, and ps and so on. You can also install other tools, such as mtr, tcpd", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14070"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the obj", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14071"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14072"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | diff uses server-side dry-run, which needs to be enabled on kube-apiserver.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14073"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14074"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14075"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14076"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f <directory>\nkubectl apply -f <directory>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14077"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14078"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14079"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14080"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14081"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=2\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14082"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the replicas field has been set to 2, and the last-applied-configuration annotation does not contain a replicas field:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14083"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14084"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14085"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/update_deployment.yaml\nkubectl apply -f https://k8s.io/examples/application/update_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14086"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/update_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows the following changes to the live configuration:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14087"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14088"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14089"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune -l <labels> --prune-allowlist=<gvk-list>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14090"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | When kubectl apply updates the live configuration for an object, it does so by sending a patch request to the API server. The patch defines updates scoped to specific fields of the live object configu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14091"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14092"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14093"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14094"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14095"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14096"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the API server set several fields to default values in the live configuration. These fields were not specified in the configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14097"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14098"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14099"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14100"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14101"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <kustomization_directory>\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To apply those resources, run kubectl apply with --kustomize or -k flag:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14102"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization_directory>\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Install kubectl.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14103"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14104"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14105"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14106"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14107"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14108"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14109"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14110"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a password.txt file\ncat <<EOF >./password.txt\nusername=admin\npassword=secret\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: password\n          mountPath: /secrets\n      volumes:\n      - name: password\n        secret:\n          secretName: example-secret-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nsecretGenerator:\n- name: example-secret-1\n  files:\n  - password.txt\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | The generated ConfigMaps and Secrets have a content hash suffix appended. This ensures that a new ConfigMap or Secret is generated when the contents are changed. To disable the behavior of appending a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14111"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14112"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml\ncat <<EOF >./deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamespace: my-namespace\nnamePrefix: dev-\nnameSuffix: \"-001\"\nlabels:\n  - pairs:\n      app: bingo\n    includeSelectors: true \ncommonAnnotations:\n  oncallPager: 800-555-1212\nresources:\n- deployment.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view those fields are all set in the Deployment Resource:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14113"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14114"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\n# Create a kustomization.yaml composing them\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | The resources from kubectl kustomize ./ contain both the Deployment and the Service objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14115"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a patch increase_replicas.yaml\ncat <<EOF > increase_replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\nEOF\n\n# Create another patch set_memory.yaml\ncat <<EOF > set_memory.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  template:\n    spec:\n      containers:\n      - name: my-nginx\n        resources:\n          limits:\n            memory: 512Mi\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\npatches:\n  - path: increase_replicas.yaml\n  - path: set_memory.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14116"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14117"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a json patch\ncat <<EOF > patch.yaml\n- op: replace\n  path: /spec/replicas\n  value: 3\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n\npatches:\n- target:\n    group: apps\n    version: v1\n    kind: Deployment\n    name: my-nginx\n  path: patch.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see the replicas field is updated:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14118"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14119"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nimages:\n- name: nginx\n  newName: my.image.registry/nginx\n  newTag: \"1.4.0\"\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the image being used is updated:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14120"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14121"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file (quoting the here doc delimiter)\ncat <<'EOF' > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        command: [\"start\", \"--host\", \"MY_SERVICE_NAME_PLACEHOLDER\"]\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nnameSuffix: \"-001\"\n\nresources:\n- deployment.yaml\n- service.yaml\n\nreplacements:\n- source:\n    kind: Service\n    name: my-nginx\n    fieldPath: metadata.name\n  targets:\n  - select:\n      kind: Deployment\n      name: my-nginx\n    fieldPaths:\n    - spec.template.spec.containers.0.command.2\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the Service name injected into containers is dev-my-nginx-001:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14122"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14123"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a directory to hold the base\nmkdir base\n# Create a base/deployment.yaml\ncat <<EOF > base/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\nEOF\n\n# Create a base/service.yaml file\ncat <<EOF > base/service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n# Create a base/kustomization.yaml\ncat <<EOF > base/kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | This base can be used in multiple overlays. You can add different namePrefix or other cross-cutting fields in different overlays. Here are two overlays using the same base.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14124"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization directory>/\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Given the following kustomization.yaml,", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14125"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nlabels:\n  - pairs:\n      app: my-nginx\n    includeSelectors: true \nresources:\n- deployment.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to apply the Deployment object dev-my-nginx:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14126"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe -k ./\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to compare the Deployment object dev-my-nginx against the state that the cluster would be in if the manifest was applied:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14127"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport <myservicename>\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | In the preceding example, the create service nodeport command is called a subcommand of the create service command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14128"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport -h\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | The kubectl command supports verb-driven commands for some common update operations. These commands are named to enable users unfamiliar with Kubernetes objects to perform updates without knowing the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14129"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment/nginx\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | There are several commands for printing information about an object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14130"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14131"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client > /tmp/srv.yaml\nkubectl create --edit -f /tmp/srv.yaml\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14132"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete <type> <name>\nkubectl delete <type> -l <label>\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14133"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <url> --edit\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14134"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the object configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14135"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <kind>_<name>.yaml\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | The recommended approach is to define a single, immutable PodTemplate label used only by the controller selector with no other semantic meaning.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14136"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14137"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-patch.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14138"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14139"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has two Containers:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14140"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <your-pod-name> --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the Pod has two Containers: one running nginx and one running redis:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14141"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14142"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has only one Toleration:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14143"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --type merge --patch-file patch-file-2.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14144"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The containers list that you specified in the patch has only one Container. The output shows that your list of one Container replaced the existing containers list.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14145"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14146"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-retainkeys.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | At this point, the deployment is created and is using the RollingUpdate strategy.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14147"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-no-retainkeys.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In the output, you can see that it is not possible to set type as Recreate when a value is defined for spec.strategy.rollingUpdate:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14148"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-retainkeys.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Examine the content of the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14149"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment retainkeys-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the strategy object in the Deployment does not contain the rollingUpdate key anymore:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14150"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\nkubectl patch deployment patch-demo --patch 'spec:\\n template:\\n  spec:\\n   containers:\\n   - name: patch-demo-ctr-2\\n     image: redis'\n\nkubectl patch deployment patch-demo --patch-file patch-file.json\nkubectl patch deployment patch-demo --patch '{\"spec\": {\"template\": {\"spec\": {\"containers\": [{\"name\": \"patch-demo-ctr-2\",\"image\": \"redis\"}]}}}}'\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The flag --subresource=[subresource-name] is used with kubectl commands like get, patch, edit, apply and replace to fetch and update status, scale and resize subresource of the resources you specify.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14151"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14152"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14153"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In the output, you can see that Deployment has two Pods. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14154"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":3}}'\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14155"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In the output, you can see one new pod is created, so now you have 3 running pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14156"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14157"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14158"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the serialized data for that Secret object is prefixed with k8s:enc:aescbc:v1:key1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14159"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14160"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14161"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-secret.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of Secrets by checking the .status of the StorageVersionMigration. A successful migration should have its Succeeded condition set to true. Get the StorageVersionMigration object as f", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14162"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/secrets-migration -o yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14163"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14164"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14165"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create a manifest for an example testcrd. Name the manifest cr1.yaml and use these contents:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14166"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14167"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr1.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v1 by getting the object from etcd.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14168"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14169"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR resource file with name cr2.yaml as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14170"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14171"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr2.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14172"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14173"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-crd.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of secrets using status. Successful migration should have Succeeded condition set to \"True\" in the status field. Get the migration resource as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14174"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/crdsvm -o yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14175"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14176"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-literal=username=admin \\\n    --from-literal=password='S!B\\*d$zDsb='\n```\n\n6.1 - Managing Secrets using kubectl | You must use single quotes '' to escape special characters such as $, \\, *, =, and ! in your strings. If you don't, your shell will interpret these characters.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14177"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=./username.txt \\\n    --from-file=./password.txt\n```\n\n6.1 - Managing Secrets using kubectl | The default key name is the file name. You can optionally set the key name using --from-file=[key=]source. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14178"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=username=./username.txt \\\n    --from-file=password=./password.txt\n```\n\n6.1 - Managing Secrets using kubectl | With either method, the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14179"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret db-user-pass\n```\n\n6.1 - Managing Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14180"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data}'\n```\n\n6.1 - Managing Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14181"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data.password}' | base64 --decode\n```\n\n6.1 - Managing Secrets using kubectl | You can edit an existing Secret object unless it is immutable. To edit a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14182"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit secrets <secret-name>\n```\n\n6.1 - Managing Secrets using kubectl | This opens your default editor and allows you to update the base64 encoded Secret values in the data field, such as in the following example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14183"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file, it will be\n# reopened with the relevant failures.\n#\napiVersion: v1\ndata:\n  password: UyFCXCpkJHpEc2I9\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  creationTimestamp: \"2022-06-28T17:44:13Z\"\n  name: db-user-pass\n  namespace: default\n  resourceVersion: \"12708504\"\n  uid: 91becd59-78fa-4c85-823f-6d44436242ac\ntype: Opaque\n```\n\n6.1 - Managing Secrets using kubectl | To delete a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14184"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\n6.1 - Managing Secrets using kubectl | You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two node", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14185"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: MWYyZDFlMmU2N2Rm\n```\n\n6.2 - Managing Secrets using Configuration File | Note that the name of a Secret object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14186"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\n6.2 - Managing Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14187"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\nstringData:\n  config.yaml: |\n    apiUrl: \"https://my.api.com/api/v1\"\n    username: <user>\n    password: <password>\n```\n\n6.2 - Managing Secrets using Configuration File | When you retrieve the Secret data, the command returns the encoded values, and not the plaintext values you provided in stringData.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14188"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret mysecret -o yaml\n```\n\n6.2 - Managing Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14189"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:40:59Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7225\"\n  uid: c280ad2e-e916-11e8-98f2-025000000001\ntype: Opaque\n```\n\n6.2 - Managing Secrets using Configuration File | If you specify a field in both data and stringData, the value from stringData is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14190"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\nstringData:\n  username: administrator\n```\n\n6.2 - Managing Secrets using Configuration File | The Secret object is created as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14191"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  username: YWRtaW5pc3RyYXRvcg==\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:46:46Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7579\"\n  uid: 91460ecb-e917-11e8-98f2-025000000001\ntype: Opaque\n```\n\n6.2 - Managing Secrets using Configuration File | YWRtaW5pc3RyYXRvcg== decodes to administrator.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14192"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: YmlyZHNhcmVudHJlYWw=\n```\n\n6.2 - Managing Secrets using Configuration File | Apply the manifest to your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14193"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\n6.2 - Managing Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14194"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret mysecret\n```\n\n6.2 - Managing Secrets using Configuration File | kubectl supports using the Kustomize object management tool to manage Secrets and ConfigMaps. You create a resource generator using Kustomize, which generates a Secret that you can apply to the API se", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14195"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\n6.3 - Managing Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14196"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -k <directory-path> -o jsonpath='{.data}'\n```\n\n6.3 - Managing Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14197"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\n6.3 - Managing Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14198"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\n6.3 - Managing Secrets using Kustomize | This page shows how to define commands and arguments when you run a container in a Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14199"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\n7.1 - Define a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14200"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/commands.yaml\n```\n\n7.1 - Define a Command and Arguments for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14201"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs command-demo\n```\n\n7.1 - Define a Command and Arguments for a Container | The output shows the values of the HOSTNAME and KUBERNETES_PORT environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14202"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\n7.2 - Define Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14203"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dependent-envars.yaml\n```\n\n7.2 - Define Dependent Environment Variables | List the running Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14204"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dependent-envars-demo\n```\n\n7.2 - Define Dependent Environment Variables | Check the logs for the container running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14205"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/dependent-envars-demo\n```\n\n7.2 - Define Dependent Environment Variables | As shown above, you have defined the correct dependency reference of SERVICE_ADDRESS, bad dependency reference of UNCHANGED_REFERENCE and skip dependent references of ESCAPED_REFERENCE.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14206"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\n7.3 - Define Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14207"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml\n```\n\n7.3 - Define Environment Variables for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14208"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l purpose=demonstrate-envars\n```\n\n7.3 - Define Environment Variables for a Container | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14209"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec envar-demo -- printenv\n```\n\n7.3 - Define Environment Variables for a Container | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14210"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: print-greeting\nspec:\n  containers:\n  - name: env-print-demo\n    image: bash\n    env:\n    - name: GREETING\n      value: \"Warm greetings to\"\n    - name: HONORIFIC\n      value: \"The Most Honorable\"\n    - name: NAME\n      value: \"Kubernetes\"\n    - name: MESSAGE\n      value: \"$(GREETING) $(HONORIFIC) $(NAME)\"\n    command: [\"echo\"]\n    args: [\"$(MESSAGE)\"]\n```\n\n7.3 - Define Environment Variables for a Container | Upon creation, the command echo Warm greetings to The Most Honorable Kubernetes is run on the container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14211"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14212"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars-file-container.yaml\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14213"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod -c use-envfile | grep DB_ADDRESS\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14214"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14215"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-pod.yaml\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14216"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-fieldref\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14217"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dapi-envars-fieldref -- sh\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In your shell, view the environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14218"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14219"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-container.yaml\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14220"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-resourcefieldref\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14221"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14222"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume.yaml\n```\n\n7.6 - Expose Pod Information to Containers Through Files | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14223"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs kubernetes-downwardapi-volume-example\n```\n\n7.6 - Expose Pod Information to Containers Through Files | The output shows the contents of the labels file and the annotations file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14224"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example -- sh\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In your shell, view the labels file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14225"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14226"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume-resources.yaml\n```\n\n7.6 - Expose Pod Information to Containers Through Files | Get a shell into the container that is running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14227"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example-2 -- sh\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In your shell, view the cpu_limit file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14228"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14229"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | View information about the Secret:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14230"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14231"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14232"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal='username=my-app' --from-literal='password=39528$vdg7Jb'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | This is more convenient. The detailed approach shown earlier runs through each step explicitly to demonstrate what is happening.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14233"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14234"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret-pod.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Verify that your Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14235"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod secret-test-pod\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14236"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t secret-test-pod -- /bin/bash\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The secret data is exposed to the Container through a Volume mounted under /etc/secret-volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14237"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      items:\n      - key: username\n        path: my-group/my-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | When you deploy this Pod, the following happens:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14238"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      defaultMode: 0400\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The Secret is mounted on /etc/foo; all the files created by the secret volume mount have permission 0400.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14239"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Assign the backend-username value defined in the Secret to the SECRET_USERNAME environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14240"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14241"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-single-secret-env-variable.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | In your shell, display the content of SECRET_USERNAME container environment variable.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14242"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t env-single-secret -- /bin/sh -c 'echo $SECRET_USERNAME'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14243"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\nkubectl create secret generic db-user --from-literal=db-username='db-admin'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14244"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14245"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-multiple-secret-env-variable.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | In your shell, display the container environment variables.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14246"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envvars-multiple-secrets -- /bin/sh -c 'env | grep _USERNAME'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14247"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Use envFrom to define all of the Secret's data as container environment variables. The key from the Secret becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14248"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14249"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-secret-envFrom.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | In your shell, display username and password container environment variables.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14250"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envfrom-secret -- /bin/sh -c 'echo \"username: $username\\npassword: $password\\n\"'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14251"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic prod-db-secret --from-literal=username=produser --from-literal=password=Y4nys7f11\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14252"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-db-secret --from-literal=username=testuser --from-literal=password=iluvtests\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14253"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password='S!B\\*d$zDsb='\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | You do not need to escape special characters in passwords from files (--from-file).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14254"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: List\nitems:\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: prod-db-client-pod\n    labels:\n      name: prod-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: prod-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: test-db-client-pod\n    labels:\n      name: test-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\nEOF\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Apply all those objects on the API server by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14255"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Both containers will have the following files present on their filesystems with the values for each container's environment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14256"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: prod-db-client-pod\n  labels:\n    name: prod-db-client\nspec:\n  serviceAccount: prod-db-client\n  containers:\n  - name: db-client-container\n    image: myClientImage\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | This page shows how to run an application using a Kubernetes Deployment object.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14257"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14258"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Display information about the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14259"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14260"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14261"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\n8.1 - Run a Stateless Application Using a Deployment | where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14262"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14263"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-update.yaml\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Watch the deployment create pods with new names and delete the old pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14264"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n8.1 - Run a Stateless Application Using a Deployment | You can increase the number of Pods in your Deployment by applying a new YAML file. This YAML file sets replicas to 4, which specifies that the Deployment should have four Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14265"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14266"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-scale.yaml\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Verify that the Deployment has four Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14267"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14268"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The preferred way to create a replicated application is to use a Deployment, which in turn uses a ReplicaSet. Before the Deployment and ReplicaSet were added to Kubernetes, replicated applications wer", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14269"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14270"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14271"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the contents of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14272"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-deployment.yaml\n```\n\n8.2 - Run a Single-Instance Stateful Application | Display information about the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14273"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment mysql\n```\n\n8.2 - Run a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14274"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\n8.2 - Run a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14275"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc mysql-pv-claim\n```\n\n8.2 - Run a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14276"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run -it --rm --image=mysql:9 --restart=Never mysql-client -- mysql -h mysql -ppassword\n```\n\n8.2 - Run a Single-Instance Stateful Application | This command creates a new Pod in the cluster running a MySQL client and connects it to the server through the Service. If it connects, you know your stateful MySQL database is up and running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14277"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,svc mysql\nkubectl delete pvc mysql-pv-claim\nkubectl delete pv mysql-pv-volume\n```\n\n8.2 - Run a Single-Instance Stateful Application | If you manually provisioned a PersistentVolume, you also need to manually delete it, as well as release the underlying resource. If you used a dynamic provisioner, it automatically deletes the Persist", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14278"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\n8.3 - Run a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14279"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-configmap.yaml\n```\n\n8.3 - Run a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14280"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\n8.3 - Run a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14281"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-services.yaml\n```\n\n8.3 - Run a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14282"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n8.3 - Run a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14283"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-statefulset.yaml\n```\n\n8.3 - Run a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14284"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\n8.3 - Run a Replicated Stateful Application | After a while, you should see all 3 Pods become Running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14285"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i --rm --restart=Never --\\\n  mysql -h mysql-0.mysql <<EOF\nCREATE DATABASE test;\nCREATE TABLE test.messages (message VARCHAR(250));\nINSERT INTO test.messages VALUES ('hello');\nEOF\n```\n\n8.3 - Run a Replicated Stateful Application | Use the hostname mysql-read to send test queries to any server that reports being Ready:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14286"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-read -e \"SELECT * FROM test.messages\"\n```\n\n8.3 - Run a Replicated Stateful Application | You should get output like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14287"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client-loop --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  bash -ic \"while sleep 1; do mysql -h mysql-read -e 'SELECT @@server_id,NOW()'; done\"\n```\n\n8.3 - Run a Replicated Stateful Application | You should see the reported @@server_id change randomly, because a different endpoint might be selected upon each connection attempt:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14288"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql /usr/bin/mysql.off\n```\n\n8.3 - Run a Replicated Stateful Application | This reaches into the actual container's filesystem for Pod mysql-2 and renames the mysql command so the readiness probe can't find it. After a few seconds, the Pod should report one of its containers", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14289"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2\n```\n\n8.3 - Run a Replicated Stateful Application | Look for 1/2 in the READY column:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14290"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql.off /usr/bin/mysql\n```\n\n8.3 - Run a Replicated Stateful Application | The StatefulSet also recreates Pods if they're deleted, similar to what a ReplicaSet does for stateless Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14291"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-2\n```\n\n8.3 - Run a Replicated Stateful Application | The StatefulSet controller notices that no mysql-2 Pod exists anymore, and creates a new one with the same name and linked to the same PersistentVolumeClaim. You should see server ID 102 disappear fro", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14292"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide\n```\n\n8.3 - Run a Replicated Stateful Application | The Node name should show up in the last column:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14293"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide --watch\n```\n\n8.3 - Run a Replicated Stateful Application | It should look something like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14294"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-name>\n```\n\n8.3 - Run a Replicated Stateful Application | When you use MySQL replication, you can scale your read query capacity by adding replicas. For a StatefulSet, you can achieve this with a single command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14295"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql  --replicas=5\n```\n\n8.3 - Run a Replicated Stateful Application | Watch the new Pods come up by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14296"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\n8.3 - Run a Replicated Stateful Application | Once they're up, you should see server IDs 103 and 104 start appearing in the SELECT @@server_id loop output.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14297"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-3.mysql -e \"SELECT * FROM test.messages\"\n```\n\n8.3 - Run a Replicated Stateful Application | Scaling back down is also seamless:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14298"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql --replicas=3\n```\n\n8.3 - Run a Replicated Stateful Application | Although scaling up creates new PersistentVolumeClaims automatically, scaling down does not automatically delete these PVCs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14299"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=mysql\n```\n\n8.3 - Run a Replicated Stateful Application | Which shows that all 5 PVCs still exist, despite having scaled the StatefulSet down to 3:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14300"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc data-mysql-3\nkubectl delete pvc data-mysql-4\n```\n\n8.3 - Run a Replicated Stateful Application | Cancel the SELECT @@server_id loop by pressing Ctrl+C in its terminal, or running the following from another terminal:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14301"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-client-loop --now\n```\n\n8.3 - Run a Replicated Stateful Application | Delete the StatefulSet. This also begins terminating the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14302"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset mysql\n```\n\n8.3 - Run a Replicated Stateful Application | Verify that the Pods disappear. They might take some time to finish terminating.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14303"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\n8.3 - Run a Replicated Stateful Application | You'll know the Pods have terminated when the above returns:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14304"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap,service,pvc -l app=mysql\n```\n\n8.3 - Run a Replicated Stateful Application | If you manually provisioned PersistentVolumes, you also need to manually delete them, as well as release the underlying resources. If you used a dynamic provisioner, it automatically deletes the Persi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14305"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets <stateful-set-name>\n```\n\n8.4 - Scale a StatefulSet | Change the number of replicas of your StatefulSet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14306"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>\n```\n\n8.4 - Scale a StatefulSet | Alternatively, you can do in-place updates on your StatefulSets.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14307"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <stateful-set-file-updated>\n```\n\n8.4 - Scale a StatefulSet | Otherwise, edit that field with kubectl edit:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14308"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulsets <stateful-set-name>\n```\n\n8.4 - Scale a StatefulSet | Or use kubectl patch:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14309"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulsets <stateful-set-name> -p '{\"spec\":{\"replicas\":<new-replicas>}}'\n```\n\n8.4 - Scale a StatefulSet | You cannot scale down a StatefulSet when any of the stateful Pods it manages is unhealthy. Scaling down only takes place after those stateful Pods become running and ready.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14310"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml>\n```\n\n8.5 - Delete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14311"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulsets <statefulset-name>\n```\n\n8.5 - Delete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14312"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete service <service-name>\n```\n\n8.5 - Delete a StatefulSet | When deleting a StatefulSet through kubectl, the StatefulSet scales down to 0. All Pods that are part of this workload are also deleted. If you want to delete only the StatefulSet and not the Pods, us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14313"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml> --cascade=orphan\n```\n\n8.5 - Delete a StatefulSet | By passing --cascade=orphan to kubectl delete, the Pods managed by the StatefulSet are left behind even after the StatefulSet object itself is deleted. If the pods have a label app.kubernetes.io/name=", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14314"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods -l app.kubernetes.io/name=MyApp\n```\n\n8.5 - Delete a StatefulSet | Deleting the Pods in a StatefulSet will not delete the associated volumes. This is to ensure that you have the chance to copy data off the volume before deleting it. Deleting the PVC after the pods ha", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14315"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod>\n```\n\n8.6 - Force Delete StatefulSet Pods | For the above to lead to graceful termination, the Pod must not specify a pod.Spec.TerminationGracePeriodSeconds of 0. The practice of setting a pod.Spec.TerminationGracePeriodSeconds of 0 seconds is", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14316"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0 --force\n```\n\n8.6 - Force Delete StatefulSet Pods | If you're using any version of kubectl <= 1.4, you should omit the --force option and use:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14317"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0\n```\n\n8.6 - Force Delete StatefulSet Pods | If even after these commands the pod is stuck on Unknown state, use the following command to remove the pod from the cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14318"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod <pod> -p '{\"metadata\":{\"finalizers\":null}}'\n```\n\n8.6 - Force Delete StatefulSet Pods | Always perform force deletion of StatefulSet Pods carefully and with complete knowledge of the risks involved.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14319"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14320"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/php-apache.yaml\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Now that the server is running, create the autoscaler using kubectl. The kubectl autoscale subcommand, part of kubectl, helps you do this.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14321"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment php-apache --cpu=50% --min=1 --max=10\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | You can check the current status of the newly-made HorizontalPodAutoscaler, by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14322"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | You should see the replica count matching the figure from the HorizontalPodAutoscaler", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14323"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Once CPU utilization dropped to 0, the HPA automatically scaled the number of replicas back down to 1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14324"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get hpa php-apache -o yaml > /tmp/hpa-v2.yaml\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Open the /tmp/hpa-v2.yaml file in an editor, and you should see YAML which looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14325"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n      current:\n        averageUtilization: 0\n        averageValue: 0\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Notice that the targetCPUUtilizationPercentage field has been replaced with an array called metrics. The CPU utilization metric is a resource metric, since it is represented as a percentage of a resou", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14326"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: requests-per-second\n  describedObject:\n    apiVersion: networking.k8s.io/v1\n    kind: Ingress\n    name: main-route\n  target:\n    type: Value\n    value: 2k\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | If you provide multiple such metric blocks, the HorizontalPodAutoscaler will consider each metric in turn. The HorizontalPodAutoscaler will calculate proposed replica counts for each metric, and then", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14327"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n  - type: Pods\n    pods:\n      metric:\n        name: packets-per-second\n      target:\n        type: AverageValue\n        averageValue: 1k\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      target:\n        type: Value\n        value: 10k\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n    current:\n      averageUtilization: 0\n      averageValue: 0\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      current:\n        value: 10k\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Then, your HorizontalPodAutoscaler would attempt to ensure that each pod was consuming roughly 50% of its requested CPU, serving 1000 packets per second, and that all pods behind the main-route Ingres", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14328"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe hpa cm-test\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | For this HorizontalPodAutoscaler, you can see several conditions in a healthy state. The first, AbleToScale, indicates whether or not the HPA is able to fetch and update scales, as well as whether or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14329"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14330"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/hpa/php-apache.yaml\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | This page shows how to limit the number of concurrent disruptions that your application experiences, allowing for higher availability while permitting the cluster administrator to manage the clusters", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14331"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14332"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14333"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f mypdb.yaml\n```\n\n8.9 - Specifying a Disruption Budget for your Application | Use kubectl to check that your PDB is created.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14334"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\n8.9 - Specifying a Disruption Budget for your Application | If there are matching pods (say, 3), then you would see something like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14335"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\n8.9 - Specifying a Disruption Budget for your Application | The non-zero value for ALLOWED DISRUPTIONS means that the disruption controller has seen the pods, counted the matching pods, and updated the status of the PDB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14336"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets zk-pdb -o yaml\n```\n\n8.9 - Specifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14337"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  annotations:\n…\n  creationTimestamp: \"2020-03-04T04:22:56Z\"\n  generation: 1\n  name: zk-pdb\n…\nstatus:\n  currentHealthy: 3\n  desiredHealthy: 2\n  disruptionsAllowed: 1\n  expectedPods: 3\n  observedGeneration: 1\n```\n\n8.9 - Specifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14338"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n9.1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14339"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/job/cronjob.yaml\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14340"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14341"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs --watch\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14342"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14343"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob hello\n```\n\n9.1 - Running Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14344"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-statefulset.yaml\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | Now, we can experiment with accessing the message queue. We will create a temporary interactive pod, install some tools on it, and experiment with queues.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14345"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-1 .\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14346"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-1 <username>/job-wq-1\ndocker push <username>/job-wq-1\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | If you are using an alternative container image registry, tag the image and push it there instead.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14347"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14348"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-1\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | All the pods for that Job succeeded! You're done.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14349"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-pod.yaml\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-service.yaml\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | Now let's fill the queue with some \"tasks\". In this example, the tasks are strings to be printed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14350"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty temp --image redis --command \"/bin/sh\"\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | Now hit enter, start the Redis CLI, and create a list with some work items in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14351"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-2 .\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14352"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-2 <username>/job-wq-2\ndocker push <username>/job-wq-2\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | You need to push to a public repository or configure your cluster to be able to access your private repository.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14353"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14354"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-2\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | You can wait for the Job to succeed, with a timeout:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14355"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs pods/job-wq-2-7r7b2\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | As you can see, one of the pods for this Job worked on several work units.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14356"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14357"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14358"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/indexed-job\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14359"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs indexed-job-fdhq5 # Change this to match the name of a Pod from that Job\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14360"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\n9.5 - Job with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14361"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs example-job-0-qws42\n```\n\n9.5 - Job with Pod-to-Pod Communication | This task demonstrates running multiple Jobs based on a common template. You can use this approach to process batches of work in parallel.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14362"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n9.6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14363"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./jobs\n```\n\n9.6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14364"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l jobgroup=jobexample\n```\n\n9.6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14365"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l jobgroup=jobexample\n```\n\n9.6 - Parallel Processing using Expansions | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14366"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l jobgroup=jobexample\n```\n\n9.6 - Parallel Processing using Expansions | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14367"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{% set params = [{ \"name\": \"apple\", \"url\": \"http://dbpedia.org/resource/Apple\", },\n                  { \"name\": \"banana\", \"url\": \"http://dbpedia.org/resource/Banana\", },\n                  { \"name\": \"cherry\", \"url\": \"http://dbpedia.org/resource/Cherry\" }]\n%}\n{% for p in params %}\n{% set name = p[\"name\"] %}\n{% set url = p[\"url\"] %}\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: jobexample-{{ name }}\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing URL {{ url }} && sleep 5\"]\n      restartPolicy: Never\n{% endfor %}\n```\n\n9.6 - Parallel Processing using Expansions | The above template defines two parameters for each Job object using a list of python dicts (lines 1-4). A for loop emits one Job manifest for each set of parameters (remaining lines).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14368"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14369"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-failjob.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 30 seconds the entire Job should be terminated. Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14370"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, the following conditions display:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14371"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-failjob\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14372"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14373"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-ignore.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Run this command to check the nodeName the Pod is scheduled to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14374"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl drain nodes/$nodeName --ignore-daemonsets --grace-period=0\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the .status.failed to check the counter for the Job is not incremented:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14375"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-ignore -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Uncordon the node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14376"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon nodes/$nodeName\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The Job resumes and succeeds.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14377"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-ignore\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14378"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14379"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-config-issue.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Note that, the image is misconfigured, as it does not exist.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14380"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14381"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod $podName --subresource=status --patch-file=patch.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | If applied successfully, you will get a notification like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14382"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods/$podName\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14383"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see a job Failed condition with the field reason equal PodFailurePolicy. Additionally, the message field contains a more detailed information about the Job termination, such as: Pod", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14384"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-config-issue\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14385"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14386"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-backoff-limit-per-index-failindex.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 15 seconds, inspect the status of the Pods for the Job. You can do that by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14387"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14388"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see that the failedIndexes field shows \"0,1\", because both indexes failed. Because the index 1 was not retried the number of failed Pods, indicated by the status field \"failed\" equa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14389"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-backoff-limit-per-index-failindex\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14390"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443\n```\n\n10.1 - Deploy and Access the Kubernetes Dashboard | Kubectl will make Dashboard available at https://localhost:8443.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14391"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n10.2 - Accessing Clusters | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14392"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n10.2 - Accessing Clusters | Next, wait for the token controller to populate the Secret with a token:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14393"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\n10.3 - Configure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14394"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file\nkubectl config --kubeconfig=config-demo set-cluster test --server=https://5.6.7.8 --insecure-skip-tls-verify\n```\n\n10.3 - Configure Access to Multiple Clusters | Add user details to your configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14395"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile\nkubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password\n```\n\n10.3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14396"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer\nkubectl config --kubeconfig=config-demo set-context dev-storage --cluster=development --namespace=storage --user=developer\nkubectl config --kubeconfig=config-demo set-context exp-test --cluster=test --namespace=default --user=experimenter\n```\n\n10.3 - Configure Access to Multiple Clusters | Open your config-demo file to see the added details. As an alternative to opening the config-demo file, you can use the config view command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14397"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view\n```\n\n10.3 - Configure Access to Multiple Clusters | The output shows the two clusters, two users, and three contexts:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14398"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\n10.3 - Configure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14399"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-frontend\n```\n\n10.3 - Configure Access to Multiple Clusters | Now whenever you enter a kubectl command, the action will apply to the cluster, and namespace listed in the dev-frontend context. And the command will use the credentials of the user listed in the dev", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14400"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n10.3 - Configure Access to Multiple Clusters | The output shows configuration information associated with the dev-frontend context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14401"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\n10.3 - Configure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14402"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context exp-test\n```\n\n10.3 - Configure Access to Multiple Clusters | Now any kubectl command you give will apply to the default namespace of the test cluster. And the command will use the credentials of the user listed in the exp-test context.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14403"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n10.3 - Configure Access to Multiple Clusters | Finally, suppose you want to work for a while in the storage namespace of the development cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14404"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-storage\n```\n\n10.3 - Configure Access to Multiple Clusters | View configuration associated with the new current context, dev-storage.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14405"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n10.3 - Configure Access to Multiple Clusters | In your config-exercise directory, create a file named config-demo-2 with this content:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14406"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\n10.3 - Configure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14407"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-deployment.yaml\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the deployment was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14408"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the Deployment was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14409"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get replicaset\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the ReplicaSet was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14410"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-service.yaml\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the Service was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14411"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service mongo\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output displays the service created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14412"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pods/mongo-75f59d57f4-4nd6q 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14413"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14414"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward replicaset/mongo-75f59d57f4 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14415"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/mongo 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | Any of the above commands works. The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14416"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo :27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The kubectl tool finds a local port number that is not in use (avoiding low ports numbers, because these might be used by other applications). The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14417"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14418"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has two Pods each of which runs the Hello World application.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14419"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14420"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14421"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=NodePort --name=example-service\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Display information about the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14422"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14423"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=\"run=load-balancer-example\" --output=wide\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14424"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete services example-service\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14425"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Follow the Connecting Applications with Services tutorial.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14426"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14427"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-deployment.yaml\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | View information about the backend Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14428"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment backend\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14429"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14430"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-service.yaml\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | At this point, you have a backend Deployment running three replicas of your hello application, and you have a Service that can route traffic to them. However, this service is neither available nor res", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14431"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14432"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14433"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/frontend-deployment.yaml\nkubectl apply -f https://k8s.io/examples/service/access/frontend-service.yaml\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | The output verifies that both resources were created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14434"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend --watch\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | This displays the configuration for the frontend Service and watches for changes. Initially, the external IP is listed as <pending>:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14435"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete services frontend backend\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | To delete the Deployments, the ReplicaSets and the Pods that are running the backend and frontend applications, enter this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14436"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment frontend backend\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | This page shows how to create an external load balancer.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14437"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14438"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14439"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n10.7 - Create an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14440"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14441"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec['initContainers', 'containers'][*].image}\" |\\\ntr -s '[[:space:]]' '\\n' |\\\nsort |\\\nuniq -c\n```\n\n10.8 - List All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14442"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{\"\\n\"}{.metadata.name}{\":\\t\"}{range .spec.containers[*]}{.image}{\", \"}{end}{end}' |\\\nsort\n```\n\n10.8 - List All Container Images Running in a Cluster | To target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching app=nginx.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14443"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec.containers[*].image}\" -l app=nginx\n```\n\n10.8 - List All Container Images Running in a Cluster | To target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the kube-system namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14444"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace kube-system -o jsonpath=\"{.items[*].spec.containers[*].image}\"\n```\n\n10.8 - List All Container Images Running in a Cluster | As an alternative to jsonpath, Kubectl supports using go-templates for formatting the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14445"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o go-template --template=\"{{range .items}}{{range .spec.containers}}{{.image}} {{end}}{{end}}\"\n```\n\n10.8 - List All Container Images Running in a Cluster | An Ingress is an API object that defines rules which allow external access to services in a cluster. An Ingress controller fulfills the rules set in the Ingress.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14446"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n ingress-nginx\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14447"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14448"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14449"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web --type=NodePort --port=8080\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14450"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service web\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14451"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14452"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14453"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14454"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web2\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14455"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web2 --port=8080 --type=NodePort\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14456"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-ingress.yaml\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | You should see:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14457"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14458"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/two-container-pod.yaml\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | View information about the Pod and the Containers:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14459"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod two-containers --output=yaml\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | Here is a portion of the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14460"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  ...\n  name: two-containers\n  namespace: default\n  ...\nspec:\n  ...\n  containerStatuses:\n\n  - containerID: docker://c1d8abd1 ...\n    image: debian\n    ...\n    lastState:\n      terminated:\n        ...\n    name: debian-container\n    ...\n\n  - containerID: docker://96c1ff2c5bb ...\n    image: nginx\n    ...\n    name: nginx-container\n    ...\n    state:\n      running:\n    ...\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | You can see that the debian Container has terminated, and the nginx Container is still running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14461"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it two-containers -c nginx-container -- /bin/bash\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In your shell, verify that nginx is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14462"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\nmetadata:\n  name: <name of the registration object>\nspec:\n  group: <API group name this extension apiserver hosts>\n  version: <API version this extension apiserver hosts>\n  groupPriorityMinimum: <priority this APIService for this group, see API documentation>\n  versionPriority: <prioritizes ordering of this version within a group, see API documentation>\n  service:\n    namespace: <namespace of the extension apiserver service>\n    name: <name of the extension apiserver service>\n  caBundle: <pem encoded ca cert that signs the server cert used by the webhook>\n```\n\n11.1 - Configure the Aggregation Layer | The name of an APIService object must be a valid path segment name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14463"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\n...\nspec:\n  ...\n  service:\n    namespace: my-service-namespace\n    name: my-service-name\n    port: 1234\n  caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.1 - Configure the Aggregation Layer | This page shows how to install a custom resource into the Kubernetes API by creating a CustomResourceDefinition.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14464"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.stable.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: stable.example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n    - name: v1\n      # Each version can be enabled/disabled by Served flag.\n      served: true\n      # One and only one version must be marked as the storage version.\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14465"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Then a new namespaced RESTful API endpoint is created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14466"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14467"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You can then manage your CronTab objects using kubectl. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14468"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get ct -o yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You should see that it contains the custom cronSpec and image fields from the YAML you used to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14469"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nitems:\n- apiVersion: stable.example.com/v1\n  kind: CronTab\n  metadata:\n    annotations:\n      kubectl.kubernetes.io/last-applied-configuration: |\n        {\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"CronTab\",\"metadata\":{\"annotations\":{},\"name\":\"my-new-cron-object\",\"namespace\":\"default\"},\"spec\":{\"cronSpec\":\"* * * * */5\",\"image\":\"my-awesome-cron-image\"}}        \n    creationTimestamp: \"2021-06-20T07:35:27Z\"\n    generation: 1\n    name: my-new-cron-object\n    namespace: default\n    resourceVersion: \"1326\"\n    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9\n  spec:\n    cronSpec: '* * * * */5'\n    image: my-awesome-cron-image\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14470"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f resourcedefinition.yaml\nkubectl get crontabs\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14471"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  someRandomField: 42\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14472"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create --validate=false -f my-crontab.yaml -o yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14473"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: CronTab\nmetadata:\n  creationTimestamp: 2017-05-31T12:56:35Z\n  generation: 1\n  name: my-new-cron-object\n  namespace: default\n  resourceVersion: \"285\"\n  uid: 9423255b-4600-11e7-af6a-28d2447dc82b\nspec:\n  cronSpec: '* * * * */5'\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14474"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nfoo:\n  apiVersion: v1\n  kind: Pod\n  spec:\n    # ...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14475"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  finalizers:\n  - stable.example.com/finalizer\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14476"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14477"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | A request to create a custom object of kind CronTab is rejected if there are invalid values in its fields. In the following example, the custom object contains fields with invalid values:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14478"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * *\"\n  image: my-awesome-cron-image\n  replicas: 15\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14479"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | then you get an error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14480"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 5\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14481"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\ncrontab \"my-new-cron-object\" created\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14482"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  minReplicas: 0\n  replicas: 20\n  maxReplicas: 10\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | with the response:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14483"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                  default: \"5 0 * * *\"\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n                  default: 1\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14484"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14485"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"5 0 * * *\"\n  image: my-awesome-cron-image\n  replicas: 1\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14486"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              cronSpec:\n                type: string\n              image:\n                type: string\n              replicas:\n                type: integer\n    additionalPrinterColumns:\n    - name: Spec\n      type: string\n      description: The cron spec defining the interval a CronJob is run\n      jsonPath: .spec.cronSpec\n    - name: Replicas\n      type: integer\n      description: The number of jobs launched by the CronJob\n      jsonPath: .spec.replicas\n    - name: Age\n      type: date\n      jsonPath: .metadata.creationTimestamp\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14487"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create an instance using the my-crontab.yaml from the previous section.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14488"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get crontab my-new-cron-object\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Notice the NAME, SPEC, REPLICAS, and AGE columns in the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14489"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14490"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resource-definition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Define some Shirts by editing shirt-resources.yaml; for example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14491"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14492"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resources.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Get all the resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14493"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14494"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14495"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=green,spec.size=M\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14496"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n            status:\n              type: object\n              properties:\n                replicas:\n                  type: integer\n                labelSelector:\n                  type: string\n      # subresources describes the subresources for custom resources.\n      subresources:\n        # status enables the status subresource.\n        status: {}\n        # scale enables the scale subresource.\n        scale:\n          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.\n          specReplicasPath: .spec.replicas\n          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.\n          statusReplicasPath: .status.replicas\n          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.\n          labelSelectorPath: .status.labelSelector\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14497"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14498"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 3\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14499"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Then new namespaced RESTful API endpoints are created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14500"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 crontabs/my-new-cron-object\ncrontabs \"my-new-cron-object\" scaled\n\nkubectl get crontabs my-new-cron-object -o jsonpath='{.spec.replicas}'\n5\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You can use a PodDisruptionBudget to protect custom resources that have the scale subresource enabled.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14501"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n    # categories is a list of grouped resources the custom resource belongs to.\n    categories:\n    - all\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14502"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14503"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14504"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You can specify the category when using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14505"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # A schema is required\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14506"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n  - name: v1\n    served: true\n    storage: false\n  validation:\n    openAPIV3Schema:\n      type: object\n      properties:\n        host:\n          type: string\n        port:\n          type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the PascalCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to create it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14507"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab.yaml\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | After creation, the API server starts to serve each enabled version at an HTTP REST endpoint. In the above example, the API versions are available at /apis/example.com/v1beta1 and /apis/example.com/v1", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14508"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n    \n    schema: ...\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n    schema: ...\n  - name: v1\n    served: true\n    storage: true\n    schema: ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: crontabs.example.com spec: group: example.com na", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14509"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  validation: ...\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n  - name: v1\n    served: true\n    storage: true\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | An older API version cannot be dropped from a CustomResourceDefinition manifest until existing stored data has been migrated to the newer API version for all clusters that served the older version of", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14510"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1beta1\n    # This indicates the v1beta1 version of the custom resource is no longer served.\n    # API requests to this version receive a not found error in the server response.\n    served: false\n    schema: ...\n  - name: v1\n    served: true\n    # The new served version should be set as the storage version\n    storage: true\n    schema: ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | The above example has a None conversion between versions which only sets the apiVersion field on conversion and does not change the rest of the object. The API server also supports webhook conversions", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14511"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhook is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhook:\n      # conversionReviewVersions indicates what ConversionReview versions are understood/preferred by the webhook.\n      # The first version in the list understood by the API server is sent to the webhook.\n      # The webhook must respond with a ConversionReview object in the same version it received.\n      conversionReviewVersions: [\"v1\",\"v1beta1\"]\n      clientConfig:\n        service:\n          namespace: default\n          name: example-conversion-webhook-server\n          path: /crdconvert\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14512"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # prunes object fields that are not specified in OpenAPI schemas below.\n  preserveUnknownFields: false\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhookClientConfig is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhookClientConfig:\n      service:\n        namespace: default\n        name: example-conversion-webhook-server\n        path: /crdconvert\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to apply it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14513"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab-with-conversion.yaml\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Make sure the conversion service is up and running before applying new changes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14514"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14515"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | The service stanza inside webhookClientConfig is a reference to the service for a conversion webhook. If the webhook is running within the cluster, then you should use service instead of url. The serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14516"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        service:\n          namespace: my-service-namespace\n          name: my-service-name\n          path: /my-path\n          port: 1234\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14517"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      service:\n        namespace: my-service-namespace\n        name: my-service-name\n        path: /my-path\n        port: 1234\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Webhooks are sent a POST request, with Content-Type: application/json, with a ConversionReview API object in the apiextensions.k8s.io API group serialized to JSON as the body.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14518"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      conversionReviewVersions: [\"v1\", \"v1beta1\"]\n      ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | conversionReviewVersions is a required field when creating apiextensions.k8s.io/v1 custom resource definitions. Webhooks are required to support at least one ConversionReview version understood by the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14519"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    conversionReviewVersions: [\"v1\", \"v1beta1\"]\n    ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | If no conversionReviewVersions are specified, the default when creating apiextensions.k8s.io/v1beta1 custom resource definitions is v1beta1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14520"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch customresourcedefinitions <CRD_Name> --subresource='status' --type='merge' -p '{\"status\":{\"storedVersions\":[\"v1\"]}}'\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Setting up an extension API server to work with the aggregation layer allows the Kubernetes apiserver to be extended with additional APIs, which are not part of the core Kubernetes APIs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14521"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker build -t gcr.io/my-gcp-project/my-kube-scheduler:1.0 .     # The image name and the repository\ngcloud docker -- push gcr.io/my-gcp-project/my-kube-scheduler:1.0 # used in here is just an example\n```\n\n11.4 - Configure Multiple Schedulers | Now that you have your scheduler in a container image, create a pod configuration for it and run it in your Kubernetes cluster. But instead of creating a pod directly in the cluster, you can use a Dep", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14522"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\n11.4 - Configure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14523"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f my-scheduler.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Verify that the scheduler pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14524"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\n11.4 - Configure Multiple Schedulers | You should see a \"Running\" my-scheduler pod, in addition to the default kube-scheduler pod in this list.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14525"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:kube-scheduler\n```\n\n11.4 - Configure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14526"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\n11.4 - Configure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14527"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14528"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod1.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Pod spec with default-scheduler", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14529"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14530"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod2.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Pod spec with my-scheduler", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14531"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14532"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod3.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Verify that all three pods are running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14533"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0 --port=8080\n```\n\n11.5 - Use an HTTP Proxy to Access the Kubernetes API | This command starts a proxy to the Kubernetes API server:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14534"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n11.5 - Use an HTTP Proxy to Access the Kubernetes API | When the proxy server is running, you can explore the API using curl, wget, or a browser.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14535"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: LRMEMMW2 # shortened for readability \n    server: https://<API_SERVER_IP_ADDRESS>:6443  # the \"Kubernetes API\" server, in other words the IP address of kubernetes-remote-server.example\n    proxy-url: socks5://localhost:1080   # the \"SSH SOCKS5 proxy\" in the diagram above\n  name: default\ncontexts:\n- context:\n    cluster: default\n    user: default\n  name: default\ncurrent-context: default\nkind: Config\npreferences: {}\nusers:\n- name: default\n  user:\n    client-certificate-data: LS0tLS1CR== # shortened for readability\n    client-key-data: LS0tLS1CRUdJT=      # shortened for readability\n```\n\n11.6 - Use a SOCKS5 Proxy to Access the Kubernetes API | Once you have created the tunnel via the ssh command mentioned earlier, and defined either the environment variable or the proxy-url attribute, you can interact with your cluster through that proxy. F", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14536"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\n11.7 - Set up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14537"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\n11.7 - Set up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14538"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\n11.7 - Set up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14539"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\n11.7 - Set up Konnectivity service | Kubernetes lets you use a public key infrastructure (PKI) to authenticate to your cluster as a client.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14540"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: myuser # example\nspec:\n  # This is an encoded CSR. Change this to the base64-encoded contents of myuser.csr\n  request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZqQ0NBVDRDQVFBd0VURVBNQTBHQTFVRUF3d0dZVzVuWld4aE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRgpBQU9DQVE4QU1JSUJDZ0tDQVFFQTByczhJTHRHdTYxakx2dHhWTTJSVlRWMDNHWlJTWWw0dWluVWo4RElaWjBOCnR2MUZtRVFSd3VoaUZsOFEzcWl0Qm0wMUFSMkNJVXBGd2ZzSjZ4MXF3ckJzVkhZbGlBNVhwRVpZM3ExcGswSDQKM3Z3aGJlK1o2MVNrVHF5SVBYUUwrTWM5T1Nsbm0xb0R2N0NtSkZNMUlMRVI3QTVGZnZKOEdFRjJ6dHBoaUlFMwpub1dtdHNZb3JuT2wzc2lHQ2ZGZzR4Zmd4eW8ybmlneFNVekl1bXNnVm9PM2ttT0x1RVF6cXpkakJ3TFJXbWlECklmMXBMWnoyalVnald4UkhCM1gyWnVVV1d1T09PZnpXM01LaE8ybHEvZi9DdS8wYk83c0x0MCt3U2ZMSU91TFcKcW90blZtRmxMMytqTy82WDNDKzBERHk5aUtwbXJjVDBnWGZLemE1dHJRSURBUUFCb0FBd0RRWUpLb1pJaHZjTgpBUUVMQlFBRGdnRUJBR05WdmVIOGR4ZzNvK21VeVRkbmFjVmQ1N24zSkExdnZEU1JWREkyQTZ1eXN3ZFp1L1BVCkkwZXpZWFV0RVNnSk1IRmQycVVNMjNuNVJsSXJ3R0xuUXFISUh5VStWWHhsdnZsRnpNOVpEWllSTmU3QlJvYXgKQVlEdUI5STZXT3FYbkFvczFqRmxNUG5NbFpqdU5kSGxpT1BjTU1oNndLaTZzZFhpVStHYTJ2RUVLY01jSVUyRgpvU2djUWdMYTk0aEpacGk3ZnNMdm1OQUxoT045UHdNMGM1dVJVejV4T0dGMUtCbWRSeEgvbUNOS2JKYjFRQm1HCkkwYitEUEdaTktXTU0xMzhIQXdoV0tkNjVoVHdYOWl4V3ZHMkh4TG1WQzg0L1BHT0tWQW9FNkpsYWFHdTlQVmkKdjlOSjVaZlZrcXdCd0hKbzZXdk9xVlA3SVFjZmg3d0drWm89Ci0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo=\n  signerName: kubernetes.io/kube-apiserver-client\n  expirationSeconds: 86400  # one day\n  usages:\n  - client auth\nEOF\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Some points to note:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14541"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve myuser\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Retrieve the certificate from the CSR, to check it looks OK.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14542"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr/myuser -o yaml\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The certificate value is in Base64-encoded format under .status.certificate.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14543"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr myuser -o jsonpath='{.status.certificate}'| base64 -d > myuser.crt\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The next step is to add this user into the kubeconfig file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14544"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials myuser --client-key=myuser.key --client-certificate=myuser.crt --embed-certs=true\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Then, you need to add the context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14545"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context myuser --cluster=kubernetes --user=myuser\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | To test it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14546"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --context myuser auth whoami\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | You should see output confirming that you are “myuser“.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14547"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create role developer --verb=create --verb=get --verb=list --verb=update --verb=delete --resource=pods\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | This is a sample command to create a RoleBinding for this new user:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14548"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding developer-binding-myuser --role=developer --user=myuser\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | This page shows how to enable and configure certificate rotation for the kubelet.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14549"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: my-svc.my-namespace\nspec:\n  request: $(cat server.csr | base64 | tr -d '\\n')\n  signerName: example.com/serving\n  usages:\n  - digital signature\n  - key encipherment\n  - server auth\nEOF\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Notice that the server.csr file created in step 1 is base64 encoded and stashed in the .spec.request field. You are also requesting a certificate with the \"digital signature\", \"key encipherment\", and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14550"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe csr my-svc.my-namespace\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Approving the certificate signing request is either done by an automated approval process or on a one off basis by a cluster administrator. If you're authorized to approve a certificate request, you c", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14551"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve my-svc.my-namespace\n```\n\n12.3 - Manage TLS Certificates in a Cluster | You should now see the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14552"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.spec.request}' | \\\n  base64 --decode | \\\n  cfssl sign -ca ca.pem -ca-key ca-key.pem -config server-signing-config.json - | \\\n  cfssljson -bare ca-signed-server\n```\n\n12.3 - Manage TLS Certificates in a Cluster | You should see the output similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14553"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o json | \\\n  jq '.status.certificate = \"'$(base64 ca-signed-server.pem | tr -d '\\n')'\"' | \\\n  kubectl replace --raw /apis/certificates.k8s.io/v1/certificatesigningrequests/my-svc.my-namespace/status -f -\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Once the CSR is approved and the signed certificate is uploaded, run:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14554"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.status.certificate}' \\\n    | base64 --decode > server.crt\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Now you can populate server.crt and server-key.pem in a Secret that you could later mount into a Pod (for example, to use with a webserver that serves HTTPS).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14555"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls server --cert server.crt --key server-key.pem\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Finally, you can populate ca.pem into a ConfigMap and use it as the trust root to verify the serving certificate:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14556"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap example-serving-ca --from-file ca.crt=ca.pem\n```\n\n12.3 - Manage TLS Certificates in a Cluster | A Kubernetes administrator (with appropriate permissions) can manually approve (or deny) CertificateSigningRequests by using the kubectl certificate approve and kubectl certificate deny commands. Howe", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14557"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\n13.1 - Building a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14558"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/basic-daemonset.yaml\n```\n\n13.1 - Building a Basic DaemonSet | Once applied, you can verify that the DaemonSet is running a Pod on every node in the cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14559"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n13.1 - Building a Basic DaemonSet | The output will list one Pod per node, similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14560"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod-name> -- cat /var/log/machine-id.log\n```\n\n13.1 - Building a Basic DaemonSet | Where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14561"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete --cascade=foreground --ignore-not-found --now daemonsets/example-daemonset\n```\n\n13.1 - Building a Basic DaemonSet | This simple DaemonSet example introduces key components like init containers and host path volumes, which can be expanded upon for more advanced use cases. For more details refer to DaemonSet.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14562"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14563"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Alternatively, use kubectl apply to create the same DaemonSet if you plan to update the DaemonSet with kubectl apply.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14564"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Check the update strategy of your DaemonSet, and make sure it's set to RollingUpdate:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14565"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get ds/fluentd-elasticsearch -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}' -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you haven't created the DaemonSet in the system, check your DaemonSet manifest with the following command instead:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14566"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml --dry-run=client -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}'\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | The output from both commands should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14567"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14568"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset-update.yaml\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you update DaemonSets using imperative commands, use kubectl edit :", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14569"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit ds/fluentd-elasticsearch -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you only need to update the container image in the DaemonSet template, i.e. .spec.template.spec.containers[*].image, use kubectl set image:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14570"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl set image ds/fluentd-elasticsearch fluentd-elasticsearch=quay.io/fluentd_elasticsearch/fluentd:v2.6.0 -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Finally, watch the rollout status of the latest DaemonSet rolling update:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14571"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/fluentd-elasticsearch -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | When the rollout is complete, the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14572"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l name=fluentd-elasticsearch -o wide -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Once you've found those nodes, delete some non-DaemonSet pods from the node to make room for new DaemonSet pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14573"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete ds fluentd-elasticsearch -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | This page shows how to perform a rollback on a DaemonSet.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14574"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name>\n```\n\n13.3 - Perform a Rollback on a DaemonSet | This returns a list of DaemonSet revisions:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14575"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name> --revision=1\n```\n\n13.3 - Perform a Rollback on a DaemonSet | This returns the details of that revision:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14576"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/<daemonset-name>\n```\n\n13.3 - Perform a Rollback on a DaemonSet | When the rollback is complete, the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14577"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevision -l <daemonset-selector-key>=<daemonset-selector-value>\n```\n\n13.3 - Perform a Rollback on a DaemonSet | This returns a list of ControllerRevisions:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14578"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-1 example-node-2 ssd=true\n```\n\n13.4 - Running Pods on Only Some Nodes | Let's create a DaemonSet which will provision the daemon pods on the SSD labeled nodes only.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14579"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\n13.4 - Running Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14580"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-3 ssd=true\n```\n\n13.4 - Running Pods on Only Some Nodes | Labelling the node automatically triggers the control plane (specifically, the DaemonSet controller) to run a new daemon pod on that node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14581"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n13.4 - Running Pods on Only Some Nodes | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14582"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image nginx\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | Examine a Pod IP:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14583"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | The hosts file content would look like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14584"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx -- cat /etc/hosts\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14585"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14586"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | Examine a Pod's details to see its IPv4 address and its status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14587"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod --output=wide\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | The hosts file content looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14588"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs hostaliases-pod\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | with the additional entries specified at the bottom.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14589"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr\n```\n\n14.2 - Extend Service IP Ranges | The well-known kubernetes Service, that exposes the kube-apiserver endpoint to the Pods, calculates the first IP address from the default ServiceCIDR range and uses that IP address as its cluster IP a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14590"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service kubernetes\n```\n\n14.2 - Extend Service IP Ranges | The default Service, in this case, uses the ClusterIP 10.96.0.1, that has the corresponding IPAddress object.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14591"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddress 10.96.0.1\n```\n\n14.2 - Extend Service IP Ranges | The ServiceCIDRs are protected with finalizers, to avoid leaving Service ClusterIPs orphans; the finalizer is only removed if there is another subnet that contains the existing IPAddresses or there ar", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14592"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <EOF | kubectl apply -f -\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  name: newcidr1\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\n14.2 - Extend Service IP Ranges | and this will allow you to create new Services with ClusterIPs that will be picked from this new range.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14593"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete servicecidr newcidr1\n```\n\n14.2 - Extend Service IP Ranges | Kubernetes uses a finalizer on the ServiceCIDR to track this dependent relationship.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14594"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1 -o yaml\n```\n\n14.2 - Extend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14595"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  creationTimestamp: \"2023-10-12T15:11:07Z\"\n  deletionGracePeriodSeconds: 0\n  deletionTimestamp: \"2023-10-12T15:12:45Z\"\n  finalizers:\n  - networking.k8s.io/service-cidr-finalizer\n  name: newcidr1\n  resourceVersion: \"1133\"\n  uid: 5ffd8afe-c78f-4e60-ae76-cec448a8af40\nspec:\n  cidrs:\n  - 10.96.0.0/24\nstatus:\n  conditions:\n  - lastTransitionTime: \"2023-10-12T15:12:45Z\"\n    message: There are still IPAddresses referencing the ServiceCIDR, please remove\n      them or create a new ServiceCIDR\n    reason: OrphanIPAddress\n    status: \"False\"\n    type: Ready\n```\n\n14.2 - Extend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14596"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1\n```\n\n14.2 - Extend Service IP Ranges | Cluster administrators can implement policies to control the creation and modification of ServiceCIDR resources within the cluster. This allows for centralized management of the IP address ranges used", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14597"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(newCIDR, variables.allowed.exists(allowedCIDR, cidr(allowedCIDR).containsCIDR(newCIDR)))\"\n  # For all CIDRs (newCIDR) listed in the spec.cidrs of the submitted ServiceCIDR\n  # object, check if there exists at least one CIDR (allowedCIDR) in the `allowed`\n  # list of the VAP such that the allowedCIDR fully contains the newCIDR.\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs.default\"\n  validationActions: [Deny,Audit]\n```\n\n14.2 - Extend Service IP Ranges | Consult the CEL documentation to learn more about CEL if you want to write your own validation expression.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14598"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.deny\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  validations:\n  - expression: \"object.metadata.name == 'kubernetes'\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-deny-binding\"\nspec:\n  policyName: \"servicecidrs.deny\"\n  validationActions: [Deny,Audit]\n```\n\n14.2 - Extend Service IP Ranges | This document shares how to reconfigure the default Service IP range(s) assigned to a cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14599"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .spec.podCIDRs}}{{printf \"%s\\n\" .}}{{end}}'\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | There should be one IPv4 block and one IPv6 block allocated.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14600"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .status.addresses}}{{printf \"%s: %s\\n\" .type .address}}{{end}}'\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Validate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with a valid Pod in your cluster. In this example the Pod name is pod01:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14601"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods pod01 -o go-template --template='{{range .status.podIPs}}{{printf \"%s\\n\" .ip}}{{end}}'\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | You can also validate Pod IPs using the Downward API via the status.podIPs fieldPath. The following snippet demonstrates how you can expose the Pod IPs via an environment variable called MY_POD_IPS wi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14602"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- set | grep MY_POD_IPS\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The Pod's IP addresses will also be written to /etc/hosts within a container. The following command executes a cat on /etc/hosts on a dual stack Pod. From the output you can verify both the IPv4 and I", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14603"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- cat /etc/hosts\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that does not explicitly define .spec.ipFamilyPolicy. Kubernetes will assign a cluster IP for the Service from the first configured service-cluster-ip-range and set the .s", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14604"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14605"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv4 address from the first configured range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14606"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: default\nspec:\n  clusterIP: 10.0.217.164\n  clusterIPs:\n  - 10.0.217.164\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 9376\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines IPv6 as the first array element in .spec.ipFamilies. Kubernetes will assign a cluster IP for the Service from the IPv6 range configured service-clu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14607"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14608"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv6 address from the IPv6 range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14609"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 2001:db8:fd00::5118\n  clusterIPs:\n  - 2001:db8:fd00::5118\n  ipFamilies:\n  - IPv6\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines PreferDualStack in .spec.ipFamilyPolicy. Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and select th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14610"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14611"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using kubectl describe. You may then validate access to the service via the IPs and ports.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14612"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc -l app.kubernetes.io/name=MyApp\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | If the cloud provider supports the provisioning of IPv6 enabled external load balancers, create the following Service with PreferDualStack in .spec.ipFamilyPolicy, IPv6 as the first element of the .sp", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14613"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14614"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Validate that the Service receives a CLUSTER-IP address from the IPv6 address block along with an EXTERNAL-IP. You may then validate access to the service via the IP and port.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14615"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz buz\n```\n\n15 - Extend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14616"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-parent\nkubectl-parent-subcommand\nkubectl-parent-subcommand-subsubcommand\n```\n\n15 - Extend kubectl with plugins | You can use the aforementioned kubectl plugin list command to ensure that your plugin is visible by kubectl, and verify that there are no warnings preventing it from being called as a kubectl command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14617"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages-2Mi\n      name: hugepage-2mi\n    - mountPath: /hugepages-1Gi\n      name: hugepage-1gi\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        hugepages-1Gi: 2Gi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage-2mi\n    emptyDir:\n      medium: HugePages-2Mi\n  - name: hugepage-1gi\n    emptyDir:\n      medium: HugePages-1Gi\n```\n\n16 - Manage HugePages | A pod may use medium: HugePages only if it requests huge pages of one size.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14618"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages\n      name: hugepage\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage\n    emptyDir:\n      medium: HugePages\n```\n\n16 - Manage HugePages | Kubernetes includes stable support for managing AMD and NVIDIA GPUs (graphical processing units) across different nodes in your cluster, using device plugins.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14619"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\n17 - Schedule GPUs | If different nodes in your cluster have different types of GPUs, then you can use Node Labels and Node Selectors to schedule pods to appropriate nodes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14620"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  # You can use Kubernetes node affinity to schedule this Pod onto a node\n  # that provides the kind of GPU that its container needs in order to work\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: \"gpu.gpu-vendor.example/installed-memory\"\n            operator: Gt # (greater than)\n            values: [\"40535\"]\n          - key: \"feature.node.kubernetes.io/pci-10.present\" # NFD Feature label\n            values: [\"true\"] # (optional) only schedule on nodes with PCI device 10\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\n17 - Schedule GPUs | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14621"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14622"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | To download a specific version, replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) portion of the command with the specific version.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14623"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO https://dl.k8s.io/release/v1.34.0/bin/linux/amd64/kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | And for Linux ARM64, type:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14624"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO https://dl.k8s.io/release/v1.34.0/bin/linux/arm64/kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | Validate the binary (optional)", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14625"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl.sha256\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14626"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl.sha256\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | Validate the kubectl binary against the checksum file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14627"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl.sha256)  kubectl\" | sha256sum --check\n```\n\n1.1 - Install and Set Up kubectl on Linux | If valid, the output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14628"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | If you do not have root access on the target system, you can still install kubectl to the ~/.local/bin directory:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14629"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nchmod +x kubectl\nmkdir -p ~/.local/bin\nmv ./kubectl ~/.local/bin/kubectl\n# and then append (or prepend) ~/.local/bin to $PATH\n```\n\n1.1 - Install and Set Up kubectl on Linux | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14630"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.1 - Install and Set Up kubectl on Linux | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14631"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo\ncat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo\n[kubernetes]\nname=Kubernetes\nbaseurl=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/\nenabled=1\ngpgcheck=1\ngpgkey=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/repodata/repomd.xml.key\nEOF\n```\n\n1.1 - Install and Set Up kubectl on Linux | Install kubectl using yum:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14632"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo yum install -y kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | Add the Kubernetes zypper repository. If you want to use Kubernetes version different than v1.34, replace v1.34 with the desired minor version in the command below.# This overwrites any existing confi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14633"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# This overwrites any existing configuration in /etc/zypp/repos.d/kubernetes.repo\ncat <<EOF | sudo tee /etc/zypp/repos.d/kubernetes.repo\n[kubernetes]\nname=Kubernetes\nbaseurl=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/\nenabled=1\ngpgcheck=1\ngpgkey=https://pkgs.k8s.io/core:/stable:/v1.34/rpm/repodata/repomd.xml.key\nEOF\n```\n\n1.1 - Install and Set Up kubectl on Linux | Update zypper and confirm the new repo addition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14634"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo zypper install -y kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | If you are on Ubuntu or another Linux distribution that supports the snap package manager, kubectl is available as a snap application.snap install kubectl --classic kubectl version --client", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14635"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash\n```\n\n1.1 - Install and Set Up kubectl on Linux | However, the completion script depends on bash-completion, which means that you have to install this software first (you can test if you have bash-completion already installed by running type _init_co", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14636"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsource /usr/share/bash-completion/bash_completion\n```\n\n1.1 - Install and Set Up kubectl on Linux | Reload your shell and verify that bash-completion is correctly installed by typing type _init_completion.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14637"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho 'source <(kubectl completion bash)' >>~/.bashrc\n```\n\n1.1 - Install and Set Up kubectl on Linux | kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null sudo chmod a+r /etc/bash_completion.d/kubectl", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14638"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null\nsudo chmod a+r /etc/bash_completion.d/kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14639"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho 'alias k=kubectl' >>~/.bashrc\necho 'complete -o default -F __start_kubectl k' >>~/.bashrc\n```\n\n1.1 - Install and Set Up kubectl on Linux | Both approaches are equivalent. After reloading your shell, kubectl autocompletion should be working. To enable bash autocompletion in current session of shell, source the ~/.bashrc file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14640"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish\n```\n\n1.1 - Install and Set Up kubectl on Linux | To do so in all your shell sessions, add the following line to your ~/.config/fish/config.fish file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14641"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh\n```\n\n1.1 - Install and Set Up kubectl on Linux | To do so in all your shell sessions, add the following to your ~/.zshrc file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14642"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14643"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | Validate the binary (optional)", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14644"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl-convert.sha256\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert.sha256\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14645"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl-convert.sha256\"\n```\n\n1.1 - Install and Set Up kubectl on Linux | Validate the kubectl-convert binary against the checksum file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14646"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl-convert.sha256) kubectl-convert\" | sha256sum --check\n```\n\n1.1 - Install and Set Up kubectl on Linux | If valid, the output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14647"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert\n```\n\n1.1 - Install and Set Up kubectl on Linux | Verify plugin is successfully installed", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14648"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nrm kubectl-convert kubectl-convert.sha256\n```\n\n1.1 - Install and Set Up kubectl on Linux | You must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.34 client can communicate with v1.33, v1.34, and v1.35 control planes. Using the latest co", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14649"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14650"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | To download a specific version, replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) portion of the command with the specific version.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14651"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/v1.34.0/bin/darwin/amd64/kubectl\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | And for macOS on Apple Silicon, type:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14652"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/v1.34.0/bin/darwin/arm64/kubectl\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | Validate the binary (optional)", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14653"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl.sha256\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14654"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | Validate the kubectl binary against the checksum file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14655"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl.sha256)  kubectl\" | shasum -a 256 --check\n```\n\n1.2 - Install and Set Up kubectl on macOS | If valid, the output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14656"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo mv ./kubectl /usr/local/bin/kubectl\nsudo chown root: /usr/local/bin/kubectl\n```\n\n1.2 - Install and Set Up kubectl on macOS | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14657"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14658"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nbrew install kubernetes-cli\n```\n\n1.2 - Install and Set Up kubectl on macOS | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14659"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you are on macOS and using Macports package manager, you can install kubectl with Macports.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14660"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo port selfupdate\nsudo port install kubectl\n```\n\n1.2 - Install and Set Up kubectl on macOS | Test to ensure the version you installed is up-to-date:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14661"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | In order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cl", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14662"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash\n```\n\n1.2 - Install and Set Up kubectl on macOS | However, the kubectl completion script depends on bash-completion which you thus have to previously install.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14663"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho $BASH_VERSION $SHELL\n```\n\n1.2 - Install and Set Up kubectl on macOS | Homebrew usually installs it at /usr/local/bin/bash.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14664"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nbrew install bash-completion@2\n```\n\n1.2 - Install and Set Up kubectl on macOS | As stated in the output of this command, add the following to your ~/.bash_profile file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14665"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nbrew_etc=\"$(brew --prefix)/etc\" && [[ -r \"${brew_etc}/profile.d/bash_completion.sh\" ]] && . \"${brew_etc}/profile.d/bash_completion.sh\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | Reload your shell and verify that bash-completion v2 is correctly installed with type _init_completion.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14666"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho 'source <(kubectl completion bash)' >>~/.bash_profile\n```\n\n1.2 - Install and Set Up kubectl on macOS | Add the completion script to the /usr/local/etc/bash_completion.d directory:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14667"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash >/usr/local/etc/bash_completion.d/kubectl\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14668"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho 'alias k=kubectl' >>~/.bash_profile\necho 'complete -o default -F __start_kubectl k' >>~/.bash_profile\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you installed kubectl with Homebrew (as explained here), then the kubectl completion script should already be in /usr/local/etc/bash_completion.d/kubectl. In that case, you don't need to do anythin", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14669"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish\n```\n\n1.2 - Install and Set Up kubectl on macOS | To do so in all your shell sessions, add the following line to your ~/.config/fish/config.fish file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14670"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion zsh\n```\n\n1.2 - Install and Set Up kubectl on macOS | To do so in all your shell sessions, add the following to your ~/.zshrc file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14671"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14672"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | Validate the binary (optional)", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14673"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert.sha256\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | curl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256\"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14674"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -LO \"https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256\"\n```\n\n1.2 - Install and Set Up kubectl on macOS | Validate the kubectl-convert binary against the checksum file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14675"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\necho \"$(cat kubectl-convert.sha256)  kubectl-convert\" | shasum -a 256 --check\n```\n\n1.2 - Install and Set Up kubectl on macOS | If valid, the output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14676"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nchmod +x ./kubectl-convert\n```\n\n1.2 - Install and Set Up kubectl on macOS | Move the kubectl-convert binary to a file location on your system PATH.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14677"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo mv ./kubectl-convert /usr/local/bin/kubectl-convert\nsudo chown root: /usr/local/bin/kubectl-convert\n```\n\n1.2 - Install and Set Up kubectl on macOS | Verify plugin is successfully installed", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14678"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nrm kubectl-convert kubectl-convert.sha256\n```\n\n1.2 - Install and Set Up kubectl on macOS | Depending on how you installed kubectl, use one of the following methods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14679"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell\n```\n\n1.3 - Install and Set Up kubectl on Windows | To do so in all your shell sessions, add the following line to your $PROFILE file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14680"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo kubeadm join --token <token> <control-plane-host>:<control-plane-port> --discovery-token-ca-cert-hash sha256:<hash>\n```\n\n2.1.1 - Adding Linux worker nodes | If you do not have the token, you can get it by running the following command on the control plane node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14681"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token list\n```\n\n2.1.1 - Adding Linux worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14682"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token create\n```\n\n2.1.1 - Adding Linux worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14683"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo kubeadm token create --print-join-command\n```\n\n2.1.1 - Adding Linux worker nodes | If you don't have the value of --discovery-token-ca-cert-hash, you can get it by running the following commands on the control plane node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14684"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo cat /etc/kubernetes/pki/ca.crt | openssl x509 -pubkey  | openssl rsa -pubin -outform der 2>/dev/null | \\\n   openssl dgst -sha256 -hex | sed 's/^.* //'\n```\n\n2.1.1 - Adding Linux worker nodes | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14685"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system rollout restart deployment coredns\n```\n\n2.1.1 - Adding Linux worker nodes | This page explains how to add Windows worker nodes to a kubeadm cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14686"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubeadm join --token <token> <control-plane-host>:<control-plane-port> --discovery-token-ca-cert-hash sha256:<hash>\n```\n\n2.1.2 - Adding Windows worker nodes | If you do not have the token, you can get it by running the following command on the control plane node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14687"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token list\n```\n\n2.1.2 - Adding Windows worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14688"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# Run this on a control plane node\nsudo kubeadm token create\n```\n\n2.1.2 - Adding Windows worker nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14689"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsudo cat /etc/kubernetes/pki/ca.crt | openssl x509 -pubkey  | openssl rsa -pubin -outform der 2>/dev/null | \\\n   openssl dgst -sha256 -hex | sed 's/^.* //'\n```\n\n2.1.2 - Adding Windows worker nodes | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14690"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# kubeadm-config.yaml\nkind: ClusterConfiguration\napiVersion: kubeadm.k8s.io/v1beta4\nkubernetesVersion: v1.21.0\n---\nkind: KubeletConfiguration\napiVersion: kubelet.config.k8s.io/v1beta1\ncgroupDriver: systemd\n```\n\n2.1.6 - Configuring a cgroup driver | Such a configuration file can then be passed to the kubeadm command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14691"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm kubelet-config -n kube-system\n```\n\n2.1.6 - Configuring a cgroup driver | Either modify the existing cgroupDriver value or add a new field that looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14692"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncgroupDriver: systemd\n```\n\n2.1.6 - Configuring a cgroup driver | This field must be present under the kubelet: section of the ConfigMap.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14693"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node-name> --ignore-daemonsets\n```\n\n2.1.6 - Configuring a cgroup driver | Execute these steps on nodes one at a time to ensure workloads have sufficient time to schedule on different nodes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14694"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-name>\n```\n\n2.1.6 - Configuring a cgroup driver | Execute these steps on nodes one at a time to ensure workloads have sufficient time to schedule on different nodes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14695"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nencryptionAlgorithm: <ALGORITHM>\n```\n\n2.1.7 - Certificate Management with kubeadm | <ALGORITHM> can be one of RSA-2048 (default), RSA-3072, RSA-4096 or ECDSA-P256.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14696"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncertificateValidityPeriod: 8760h # Default: 365 days × 24 hours = 1 year\ncaCertificateValidityPeriod: 87600h # Default: 365 days × 24 hours * 10 = 10 years\n```\n\n2.1.7 - Certificate Management with kubeadm | The values of the fields follow the accepted format for Go's time.Duration values, with the longest supported unit being h (hours).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14697"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nclient-certificate: /var/lib/kubelet/pki/kubelet-client-current.pem\nclient-key: /var/lib/kubelet/pki/kubelet-client-current.pem\n```\n\n2.1.7 - Certificate Management with kubeadm | kubeadm renews all the certificates during control plane upgrade.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14698"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-cert-file\"\n    value: \"/etc/kubernetes/pki/ca.crt\"\n  - name: \"cluster-signing-key-file\"\n    value: \"/etc/kubernetes/pki/ca.key\"\n```\n\n2.1.7 - Certificate Management with kubeadm | See Create CertificateSigningRequest for creating CSRs with the Kubernetes API.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14699"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nserverTLSBootstrap: true\n```\n\n2.1.7 - Certificate Management with kubeadm | If you have already created the cluster you must adapt it by doing the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14700"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# example.yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n# Will be used as the target \"cluster\" in the kubeconfig\nclusterName: \"kubernetes\"\n# Will be used as the \"server\" (IP or DNS name) of this cluster in the kubeconfig\ncontrolPlaneEndpoint: \"some-dns-address:6443\"\n# The cluster CA key and certificate will be loaded from this local directory\ncertificatesDir: \"/etc/kubernetes/pki\"\n```\n\n2.1.7 - Certificate Management with kubeadm | Make sure that these settings match the desired target cluster settings. To see the settings of an existing cluster use:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14701"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\n# Set certificate expiration time in days\nDAYS=365\n\n# Process all CSR files except those for front-proxy and etcd\nfind ./ -name \"*.csr\" | grep -v \"pki/etcd\" | grep -v \"front-proxy\" | while read -r FILE;\ndo\n    echo \"* Processing ${FILE} ...\"\n    FILE=${FILE%.*} # Trim the extension\n    if [ -f \"./pki/ca.srl\" ]; then\n        SERIAL_FLAG=\"-CAserial ./pki/ca.srl\"\n    else\n        SERIAL_FLAG=\"-CAcreateserial\"\n    fi\n    openssl x509 -req -days \"${DAYS}\" -CA ./pki/ca.crt -CAkey ./pki/ca.key ${SERIAL_FLAG} \\\n        -in \"${FILE}.csr\" -out \"${FILE}.crt\"\n    sleep 2\ndone\n\n# Process all etcd CSRs\nfind ./pki/etcd -name \"*.csr\" | while read -r FILE;\ndo\n    echo \"* Processing ${FILE} ...\"\n    FILE=${FILE%.*} # Trim the extension\n    if [ -f \"./pki/etcd/ca.srl\" ]; then\n        SERIAL_FLAG=-CAserial ./pki/etcd/ca.srl\n    else\n        SERIAL_FLAG=-CAcreateserial\n    fi\n    openssl x509 -req -days \"${DAYS}\" -CA ./pki/etcd/ca.crt -CAkey ./pki/etcd/ca.key ${SERIAL_FLAG} \\\n        -in \"${FILE}.csr\" -out \"${FILE}.crt\"\ndone\n\n# Process front-proxy CSRs\necho \"* Processing ./pki/front-proxy-client.csr ...\"\nopenssl x509 -req -days \"${DAYS}\" -CA ./pki/front-proxy-ca.crt -CAkey ./pki/front-proxy-ca.key -CAcreateserial \\\n    -in ./pki/front-proxy-client.csr -out ./pki/front-proxy-client.crt\n```\n\n2.1.7 - Certificate Management with kubeadm | Repeat this step for all nodes that have CSR files.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14702"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\nCLUSTER=kubernetes\nfind ./ -name \"*.conf\" | while read -r FILE;\ndo\n    echo \"* Processing ${FILE} ...\"\n    KUBECONFIG=\"${FILE}\" kubectl config set-cluster \"${CLUSTER}\" --certificate-authority ./pki/ca.crt --embed-certs\n    USER=$(KUBECONFIG=\"${FILE}\" kubectl config view -o jsonpath='{.users[0].name}')\n    KUBECONFIG=\"${FILE}\" kubectl config set-credentials \"${USER}\" --client-certificate \"${FILE}.crt\" --embed-certs\ndone\n```\n\n2.1.7 - Certificate Management with kubeadm | Perform this step on all nodes that have CSR files.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14703"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\n# Cleanup CSR files\nrm -f ./*.csr ./pki/*.csr ./pki/etcd/*.csr # Clean all CSR files\n\n# Cleanup CRT files that were already embedded in kubeconfig files\nrm -f ./*.crt\n```\n\n2.1.7 - Certificate Management with kubeadm | Optionally, move .srl files to the next node to be processed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14704"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14705"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14706"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nresources:\n    requests:\n      cpu: \"100m\"\n      memory: \"200Mi\"\n    limits:\n      cpu: \"100m\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory:Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity 500m)Total memory reserved: 5 × 200MiB =", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14707"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o wide\n```\n\n2.3.1 - Changing the Container Runtime on a Node from Docker Engine to containerd | If the node appears healthy, remove Docker.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14708"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <nodename>\n```\n\n2.3.3 - Troubleshooting CNI plugin-related errors | The following example shows a configuration for containerd runtime v1.6.x, which supports a recent version of the CNI specification (v1.0.0).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14709"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncat << EOF | tee /etc/cni/net.d/10-containerd-net.conflist\n{\n \"cniVersion\": \"1.0.0\",\n \"name\": \"containerd-net\",\n \"plugins\": [\n   {\n     \"type\": \"bridge\",\n     \"bridge\": \"cni0\",\n     \"isGateway\": true,\n     \"ipMasq\": true,\n     \"promiscMode\": true,\n     \"ipam\": {\n       \"type\": \"host-local\",\n       \"ranges\": [\n         [{\n           \"subnet\": \"10.88.0.0/16\"\n         }],\n         [{\n           \"subnet\": \"2001:db8:4860::/64\"\n         }]\n       ],\n       \"routes\": [\n         { \"dst\": \"0.0.0.0/0\" },\n         { \"dst\": \"::/0\" }\n       ]\n     }\n   },\n   {\n     \"type\": \"portmap\",\n     \"capabilities\": {\"portMappings\": true},\n     \"externalSetMarkChain\": \"KUBE-MARK-MASQ\"\n   }\n ]\n}\nEOF\n```\n\n2.3.3 - Troubleshooting CNI plugin-related errors | Update the IP address ranges in the preceding example with ones that are based on your use case and network addressing plan.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14710"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces \\\n-o=jsonpath='{range .items[*]}{\"\\n\"}{.metadata.namespace}{\":\\t\"}{.metadata.name}{\":\\t\"}{range .spec.volumes[*]}{.hostPath.path}{\", \"}{end}{end}' \\\n| sort \\\n| grep '/var/run/docker.sock'\n```\n\n2.3.5 - Migrating telemetry and security agents from dockershim | If your cluster nodes are customized and install additional security and telemetry agents on the node, check with the agent vendor to verify whether it has any dependency on Docker.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14711"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\n2.3.5 - Migrating telemetry and security agents from dockershim | How to migrate from dockershim-dependent agent:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14712"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\n2.3.5 - Migrating telemetry and security agents from dockershim | How to migrate from dockershim-dependent agent:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14713"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\n2.3.5 - Migrating telemetry and security agents from dockershim | How to migrate from dockershim-dependent agent:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14714"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker-container-stats\n```\n\n2.3.5 - Migrating telemetry and security agents from dockershim | The Pod accessing Docker may be named something like:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14715"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14716"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14717"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14718"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14719"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14720"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14721"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14722"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-2 --output=yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to match its CPU limit. Notice that the container was not assigned the default CPU request value of 0.5 cpu:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14723"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14724"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo-3 --output=yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | The output shows that the container's CPU request is set to the value you specified at the time you created the Pod (in other words: it matches the manifest). However, the same container's CPU limit i", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14725"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14726"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14727"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n     memory: 800Mi\n  requests:\n    memory: 600Mi\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Delete your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14728"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14729"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14730"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14731"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14732"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nlimits:\n- default:\n    cpu: 800m\n  defaultRequest:\n    cpu: 800m\n  max:\n    cpu: 800m\n  min:\n    cpu: 200m\n  type: Container\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Now whenever you create a Pod in the constraints-cpu-example namespace (or some other client of the Kubernetes API creates an equivalent Pod), Kubernetes performs these steps:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14733"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14734"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n    cpu: 800m\n  requests:\n    cpu: 500m\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a CPU request of 500 millicpu and a cpu limit of 1.5 cpu.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14735"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14736"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14737"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14738"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo-4 --namespace=constraints-cpu-example --output=yaml\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's single container has a CPU request of 800 millicpu and a CPU limit of 800 millicpu. How did that container get those values?", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14739"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n    cpu: 800m\n  requests:\n    cpu: 800m\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Because that container did not specify its own CPU request and limit, the control plane applied the default CPU request and limit from the LimitRange for this namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14740"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo-4 --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The maximum and minimum CPU constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were creat", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14741"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14742"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14743"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14744"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14745"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  hard:\n    pods: \"2\"\nstatus:\n  hard:\n    pods: \"2\"\n  used:\n    pods: \"0\"\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Here is an example manifest for a Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14746"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14747"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  ...\n  replicas: 3\n...\nstatus:\n  availableReplicas: 2\n...\nlastUpdateTime: 2021-04-02T20:57:05Z\n    message: 'unable to create pods: pods \"pod-quota-demo-1650323038-\" is forbidden:\n      exceeded quota: pod-demo, requested: pods=1, used: pods=2, limited: pods=2'\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | In this task you have defined a ResourceQuota that limited the total number of Pods, but you could also limit the total number of other kinds of object. For example, you might decide to limit how many", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14748"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name>\n```\n\n2.8 - Advertise Extended Resources for a Node | Once again, the output shows the dongle resource:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14749"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nCapacity:\n  cpu: 2\n  memory: 2049008Ki\n  example.com/dongle: 4\n```\n\n2.8 - Advertise Extended Resources for a Node | Now, application developers can create Pods that request a certain number of dongles. See Assign Extended Resources to a Container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14750"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nCapacity:\n ...\n example.com/special-storage: 8\n```\n\n2.8 - Advertise Extended Resources for a Node | If you want to allow arbitrary requests for special storage, you could advertise special storage in chunks of size 1 byte. In that case, you would advertise 800Gi resources of type example.com/special", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14751"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nCapacity:\n ...\n example.com/special-storage:  800Gi\n```\n\n2.8 - Advertise Extended Resources for a Node | Then a Container could request any number of bytes of special storage, up to 800Gi.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14752"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <your-node-name> | grep dongle\n```\n\n2.8 - Advertise Extended Resources for a Node | (you should not see any output)", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14753"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14754"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nlinear: '{\"coresPerReplica\":256,\"min\":1,\"nodesPerReplica\":16}'\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | Modify the fields according to your needs. The \"min\" field indicates the minimal number of DNS backends. The actual number of backends is calculated using this equation:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14755"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc <name-of-pvc> -o yaml\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14756"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-pvc.yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: cat-pictures-pvc\nspec:\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14757"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-writer-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: cat-pictures-writer\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cat-pictures-writer\n  template:\n    metadata:\n      labels:\n        app: cat-pictures-writer\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n        volumeMounts:\n        - name: cat-pictures\n          mountPath: /mnt\n      volumes:\n      - name: cat-pictures\n        persistentVolumeClaim:\n          claimName: cat-pictures-pvc\n          readOnly: false\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | As a first step, you need to edit your PersistentVolume's spec.persistentVolumeReclaimPolicy and set it to Retain. This ensures your PersistentVolume will not be deleted when you delete the correspond", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14758"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\n2.11 - Change the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14759"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nNAME                 PROVISIONER               AGE\nstandard (default)   kubernetes.io/gce-pd      1d\ngold                 kubernetes.io/gce-pd      1d\n```\n\n2.11 - Change the default StorageClass | The default StorageClass is marked by (default).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14760"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass standard -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"false\"}}}'\n```\n\n2.11 - Change the default StorageClass | where standard is the name of your chosen StorageClass.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14761"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass gold -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}'\n```\n\n2.11 - Change the default StorageClass | Please note you can have multiple StorageClass marked as default. If more than one StorageClass is marked as default, a PersistentVolumeClaim without an explicitly defined storageClassName will be cre", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14762"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\n2.11 - Change the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14763"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nNAME             PROVISIONER               AGE\nstandard         kubernetes.io/gce-pd      1d\ngold (default)   kubernetes.io/gce-pd      1d\n```\n\n2.11 - Change the default StorageClass | This page shows how to migrate nodes to use event based updates for container status. The event-based implementation reduces node resource consumption by the kubelet, compared to the legacy approach t", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14764"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\n2.14 - Cloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14765"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1\nkind: CredentialProviderConfig\n# providers is a list of credential provider helper plugins that will be enabled by the kubelet.\n# Multiple providers may match against a single image, in which case credentials\n# from all providers will be returned to the kubelet. If multiple providers are called\n# for a single image, the results are combined. If providers return overlapping\n# auth keys, the value from the provider earlier in this list is used.\nproviders:\n  # name is the required name of the credential provider. It must match the name of the\n  # provider executable as seen by the kubelet. The executable must be in the kubelet's\n  # bin directory (set by the --image-credential-provider-bin-dir flag).\n  - name: ecr-credential-provider\n    # matchImages is a required list of strings used to match against images in order to\n    # determine if this provider should be invoked. If one of the strings matches the\n    # requested image from the kubelet, the plugin will be invoked and given a chance\n    # to provide credentials. Images are expected to contain the registry domain\n    # and URL path.\n    #\n    # Each entry in matchImages is a pattern which can optionally contain a port and a path.\n    # Globs can be used in the domain, but not in the port or the path. Globs are supported\n    # as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'.\n    # Matching partial subdomains like 'app*.k8s.io' is also supported. Each glob can only match\n    # a single subdomain segment, so `*.io` does **not** match `*.k8s.io`.\n    #\n    # A match exists between an image and a matchImage when all of the below are true:\n    # - Both contain the same number of domain parts and each part matches.\n    # - The URL path of an matchImages must be a prefix of the target image URL path.\n    # - If the matchImages contains a port, then the port must match in the image as well.\n    #\n    # Example values of matchImages:\n    # - 123456789.dkr.ecr.us-east-1.amazonaws.com\n    # - *.azurecr.io\n    # - gcr.io\n    # - *.*.registry.io\n    # - registry.io:8080/path\n    matchImages:\n      - \"*.dkr.ecr.*.amazonaws.com\"\n      - \"*.dkr.ecr.*.amazonaws.com.cn\"\n      - \"*.dkr.ecr-fips.*.amazonaws.com\"\n      - \"*.dkr.ecr.us-iso-east-1.c2s.ic.gov\"\n      - \"*.dkr.ecr.us-isob-east-1.sc2s.sgov.gov\"\n    # defaultCacheDuration is the default duration the plugin will cache credentials in-memory\n    # if a cache duration is not provided in the plugin response. This field is required.\n    defaultCacheDuration: \"12h\"\n    # Required input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse\n    # MUST use the same encoding version as the input. Current supported values are:\n    # - credentialprovider.kubelet.k8s.io/v1\n    apiVersion: credentialprovider.kubelet.k8s.io/v1\n    # Arguments to pass to the command when executing it.\n    # +optional\n    # args:\n    #   - --example-argument\n    # Env defines additional environment variables to expose to the process. These\n    # are unioned with the host's environment, as well as variables client-go uses\n    # to pass argument to the plugin.\n    # +optional\n    env:\n      - name: AWS_PROFILE\n        value: example_profile\n\n    # tokenAttributes is the configuration for the service account token that will be passed to the plugin.\n    # The credential provider opts in to using service account tokens for image pull by setting this field.\n    # if this field is set without the `KubeletServiceAccountTokenForCredentialProviders` feature gate enabled, \n    # kubelet will fail to start with invalid configuration error.\n    # +optional\n    tokenAttributes:\n      # serviceAccountTokenAudience is the intended audience for the projected service account token.\n      # +required\n      serviceAccountTokenAudience: \"<audience for the token>\"\n      # cacheType indicates the type of cache key use for caching the credentials returned by the plugin\n      # when the service account token is used.\n      # The most conservative option is to set this to \"Token\", which means the kubelet will cache\n      # returned credentials on a per-token basis. This should be set if the returned credential's\n      # lifetime is limited to the service account token's lifetime.\n      # If the plugin's credential retrieval logic depends only on the service account and not on\n      # pod-specific claims, then the plugin can set this to \"ServiceAccount\". In this case, the\n      # kubelet will cache returned credentials on a per-serviceaccount basis. Use this when the\n      # returned credential is valid for all pods using the same service account.\n      # +required\n      cacheType: \"<Token or ServiceAccount>\"\n      # requireServiceAccount indicates whether the plugin requires the pod to have a service account.\n      # If set to true, kubelet will only invoke the plugin if the pod has a service account.\n      # If set to false, kubelet will invoke the plugin even if the pod does not have a service account\n      # and will not include a token in the CredentialProviderRequest. This is useful for plugins\n      # that are used to pull images for pods without service accounts (e.g., static pods).\n      # +required\n      requireServiceAccount: true\n      # requiredServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are required to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. If any of the keys defined in this list\n      # are not present in the service account, kubelet will not invoke the plugin and will return an error.\n      # This field is optional and may be empty. Plugins may use this field to extract additional information\n      # required to fetch credentials or allow workloads to opt in to using service account tokens for image pull.\n      # If non-empty, requireServiceAccount must be set to true.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # optionalServiceAccountAnnotationKeys list.\n      # +optional\n      requiredServiceAccountAnnotationKeys:\n      - \"example.com/required-annotation-key-1\"\n      - \"example.com/required-annotation-key-2\"\n      # optionalServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are optional to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. The plugin is responsible for validating the\n      # existence of annotations and their values. This field is optional and may be empty.\n      # Plugins may use this field to extract additional information required to fetch credentials.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # requiredServiceAccountAnnotationKeys list.\n      # +optional\n      optionalServiceAccountAnnotationKeys:\n      - \"example.com/optional-annotation-key-1\"\n      - \"example.com/optional-annotation-key-2\"\n```\n\n2.15 - Configure a kubelet image credential provider | The providers field is a list of enabled plugins used by the kubelet. Each entry has a few required fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14766"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\n2.16 - Configure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14767"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n  used:\n    persistentvolumeclaims: \"0\"\n    services.loadbalancers: \"0\"\n    services.nodeports: \"0\"\n```\n\n2.16 - Configure Quotas for API Objects | Here is the configuration file for a PersistentVolumeClaim object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14768"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n2.16 - Configure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14769"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\n2.16 - Configure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14770"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n```\n\n2.18 - Control Topology Management Policies on a node | This pod runs in the BestEffort QoS class because no resource requests or limits are specified.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14771"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n2.18 - Control Topology Management Policies on a node | This pod runs in the Burstable QoS class because requests are less than limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14772"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n```\n\n2.18 - Control Topology Management Policies on a node | This pod with integer CPU request runs in the Guaranteed QoS class because requests are equal to limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14773"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n```\n\n2.18 - Control Topology Management Policies on a node | This pod with sharing CPU request runs in the Guaranteed QoS class because requests are equal to limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14774"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        example.com/deviceA: \"1\"\n        example.com/deviceB: \"1\"\n      requests:\n        example.com/deviceA: \"1\"\n        example.com/deviceB: \"1\"\n```\n\n2.18 - Control Topology Management Policies on a node | This pod runs in the BestEffort QoS class because there are no CPU and memory requests.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14775"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health {\n            lameduck 5s\n        }\n        ready\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n            pods insecure\n            fallthrough in-addr.arpa ip6.arpa\n            ttl 30\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\n2.19 - Customizing DNS Service | The Corefile configuration includes the following plugins of CoreDNS:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14776"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n           pods insecure\n           fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . 172.16.0.1\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n    consul.local:53 {\n        errors\n        cache 30\n        forward . 10.150.0.1\n    }\n```\n\n2.19 - Customizing DNS Service | This page provides hints on diagnosing DNS problems.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14777"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\n2.20 - Debugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14778"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslice\n```\n\n2.20 - Debugging DNS Resolution | If you do not see the endpoints, see the endpoints section in the debugging Services documentation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14779"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system edit configmap coredns\n```\n\n2.20 - Debugging DNS Resolution | Then add log in the Corefile section per the example below:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14780"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        log\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n          pods insecure\n          upstream\n          fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\n2.20 - Debugging DNS Resolution | After saving the changes, it may take up to minute or two for Kubernetes to propagate these changes to the CoreDNS pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14781"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\n2.21 - Declare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14782"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example # a custom resource API\n    providers:\n      # This configuration does not provide data confidentiality. The first\n      # configured provider is specifying the \"identity\" mechanism, which\n      # stores resources as plain text.\n      #\n      - identity: {} # plain text, in other words NO encryption\n      - aesgcm:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - secretbox:\n          keys:\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n  - resources:\n      - events\n    providers:\n      - identity: {} # do not encrypt Events even though *.* is specified below\n  - resources:\n      - '*.apps' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key2\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n  - resources:\n      - '*.*' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key3\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\n2.24 - Encrypting Confidential Data at Rest | Each resources array item is a separate config and contains a complete configuration. The resources.resources field is an array of Kubernetes resource names (resource or resource.group) that should be", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14783"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\n  - resources:\n      - configmaps. # specifically from the core API group,\n                    # because of trailing \".\"\n      - events\n    providers:\n      - identity: {}\n  # and then other entries in resources\n```\n\n2.24 - Encrypting Confidential Data at Rest | Ensure that the exemption is listed before the wildcard '*.*' item in the resources array to give it precedence.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14784"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              # See the following text for more details about the secret value\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # this fallback allows reading unencrypted secrets;\n                     # for example, during initial migration\n```\n\n2.24 - Encrypting Confidential Data at Rest | To create a new encryption key (that does not use KMS), see Generate the encryption key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14785"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# This is a fragment of a manifest for a static Pod.\n# Check whether this is correct for your cluster and for your API server.\n#\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.20.30.40:443\n  creationTimestamp: null\n  labels:\n    app.kubernetes.io/component: kube-apiserver\n    tier: control-plane\n  name: kube-apiserver\n  namespace: kube-system\nspec:\n  containers:\n  - command:\n    - kube-apiserver\n    ...\n    - --encryption-provider-config=/etc/kubernetes/enc/enc.yaml  # add this line\n    volumeMounts:\n    ...\n    - name: enc                           # add this line\n      mountPath: /etc/kubernetes/enc      # add this line\n      readOnly: true                      # add this line\n    ...\n  volumes:\n  ...\n  - name: enc                             # add this line\n    hostPath:                             # add this line\n      path: /etc/kubernetes/enc           # add this line\n      type: DirectoryOrCreate             # add this line\n  ...\n```\n\n2.24 - Encrypting Confidential Data at Rest | Restart your API server.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14786"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # REMOVE THIS LINE\n```\n\n2.24 - Encrypting Confidential Data at Rest | …and then restart each API server in turn. This change prevents the API server from accessing a plain-text Secret, even by accident.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14787"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\n2.24 - Encrypting Confidential Data at Rest | This example shows how to stop encrypting the Secret API at rest. If you are encrypting other API kinds, adjust the steps to match.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14788"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      # list any other resources here that you previously were\n      # encrypting at rest\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET> # keep this in place\n                                               # make sure it comes after \"identity\"\n```\n\n2.24 - Encrypting Confidential Data at Rest | Then run the following command to force decryption of all Secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14789"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            # Do not use this (invalid) example key for encryption\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\n2.25 - Decrypt Confidential Data that is Already Encrypted at Rest | then change it to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14790"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\n2.25 - Decrypt Confidential Data that is Already Encrypted at Rest | and restart the kube-apiserver Pod on this node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14791"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nnonMasqueradeCIDRs:\n  - 10.0.0.0/8\nresyncInterval: 60s\n```\n\n2.27 - IP Masquerade Agent User Guide | Run the following command to add the configmap to your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14792"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nnonMasqueradeCIDRs:\n  - 10.0.0.0/8\nresyncInterval: 60s\nmasqLinkLocal: true\n```\n\n2.27 - IP Masquerade Agent User Guide | This example demonstrates how to limit the amount of storage consumed in a namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14793"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: storagelimits\nspec:\n  limits:\n  - type: PersistentVolumeClaim\n    max:\n      storage: 2Gi\n    min:\n      storage: 1Gi\n```\n\n2.28 - Limit Storage Consumption | Minimum storage requests are used when the underlying storage provider requires certain minimums. For example, AWS EBS volumes have a 1Gi minimum requirement.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14794"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: storagequota\nspec:\n  hard:\n    persistentvolumeclaims: \"5\"\n    requests.storage: \"5Gi\"\n```\n\n2.28 - Limit Storage Consumption | A limit range can put a ceiling on how much storage is requested while a resource quota can effectively cap the storage consumed by a namespace through claim counts and cumulative storage capacity. Th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14795"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: kube-controller-manager\n  - name: service\n    component: kube-controller-manager\n  - name: cloud-node-lifecycle\n    component: kube-controller-manager\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | Alternatively, because the controllers can run under either controller managers, setting component to * for both sides makes the configuration file consistent between both parties of the migration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14796"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | On each control plane node, save the content to /etc/leadermigration.conf, and update the manifest of kube-controller-manager so that the file is mounted inside the container at the same location. Als", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14797"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: cloud-controller-manager\n  - name: service\n    component: cloud-controller-manager\n  - name: cloud-node-lifecycle\n    component: cloud-controller-manager\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | When creating control plane nodes of version N + 1, the content should be deployed to /etc/leadermigration.conf. The manifest of cloud-controller-manager should be updated to mount the configuration f", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14798"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version, with nodeipam\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n  - name: nodeipam\n-   component: *\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | etcd is a consistent and highly-available key value store used as Kubernetes' backing store for all cluster data.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14799"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-system delete pod <name-of-etcd-pod>\n```\n\n2.30 - Operating etcd clusters for Kubernetes | For more information and examples on restoring a cluster from a snapshot file, see etcd disaster recovery documentation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14800"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node\n```\n\n2.31 - Reserve Compute Resources for System Daemons | Resources can be reserved for two categories of system daemons in the kubelet.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14801"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  KubeletInUserNamespace: true\n# We use cgroupfs that is delegated by systemd, so we do not use \"systemd\" driver\n# (unless you run another systemd in the namespace)\ncgroupDriver: \"cgroupfs\"\n```\n\n2.32 - Running Kubernetes Node Components as a Non-root User | When the KubeletInUserNamespace feature gate is enabled, the kubelet ignores errors that may happen during setting the following sysctl values on the node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14802"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\nmode: \"iptables\" # or \"userspace\"\nconntrack:\n# Skip setting sysctl value \"net.netfilter.nf_conntrack_max\"\n  maxPerCore: 0\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_established\"\n  tcpEstablishedTimeout: 0s\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_close\"\n  tcpCloseWaitTimeout: 0s\n```\n\n2.32 - Running Kubernetes Node Components as a Non-root User | Most of \"non-local\" volume drivers such as nfs and iscsi do not work. Local volumes like local, hostPath, emptyDir, configMap, secret, and downwardAPI are known to work.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14803"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\naddress: \"192.168.0.8\"\nport: 20250\nserializeImagePulls: false\nevictionHard:\n    memory.available:  \"100Mi\"\n    nodefs.available:  \"10%\"\n    nodefs.inodesFree: \"5%\"\n    imagefs.available: \"15%\"\n    imagefs.inodesFree: \"5%\"\n```\n\n2.35 - Set Kubelet Parameters Via A Configuration File | In this example, the kubelet is configured with the following settings:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14804"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ncurl -X GET http://127.0.0.1:8001/api/v1/nodes/<node-name>/proxy/configz | jq .\n```\n\n2.35 - Set Kubelet Parameters Via A Configuration File | This page shows how to view, work in, and delete namespaces. The page also shows how to use Kubernetes namespaces to subdivide your cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14805"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: <insert-namespace-name-here>\n```\n\n2.36 - Share a Cluster with Namespaces | Then run:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14806"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n    ...\n    ownerReferences:\n    - apiVersion: apps/v1\n      blockOwnerDeletion: true\n      controller: true\n      kind: ReplicaSet\n      name: nginx-deployment-6b474476c4\n      uid: 4fdcd81c-bd5d-41f7-97af-3a3b759af9a7\n    ...\n```\n\n2.38 - Use Cascading Deletion in a Cluster | By default, Kubernetes uses background cascading deletion to delete dependents of an object. You can switch to foreground cascading deletion using either kubectl or the Kubernetes API, depending on th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14807"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          cachesize: 100\n          timeout: 3s\n      - kms:\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          cachesize: 100\n          timeout: 3s\n```\n\n2.39 - Using a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14808"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          timeout: 3s\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          timeout: 3s\n```\n\n2.39 - Using a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14809"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - kms:\n          apiVersion: v2\n          name : myKmsPlugin\n          endpoint: unix:///tmp/socketfile.sock\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n```\n\n2.39 - Using a KMS provider for data encryption | Restart all kube-apiserver processes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14810"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsed -i \"s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/__PILLAR__DNS__SERVER__/$kubedns/g\" nodelocaldns.yaml\n```\n\n2.41 - Using NodeLocal DNSCache in Kubernetes Clusters | __PILLAR__CLUSTER__DNS__ and __PILLAR__UPSTREAM__SERVERS__ will be populated by the node-local-dns pods. In this mode, the node-local-dns pods listen on both the kube-dns service IP as well as <node-l", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14811"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nsed -i \"s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/,__PILLAR__DNS__SERVER__//g; s/__PILLAR__CLUSTER__DNS__/$kubedns/g\" nodelocaldns.yaml\n```\n\n2.41 - Using NodeLocal DNSCache in Kubernetes Clusters | In this mode, the node-local-dns pods listen only on <node-local-address>. The node-local-dns interface cannot bind the kube-dns cluster IP since the interface used for IPVS loadbalancing already uses", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14812"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f nodelocaldns.yaml\n```\n\n2.41 - Using NodeLocal DNSCache in Kubernetes Clusters | If using kube-proxy in IPVS mode, --cluster-dns flag to kubelet needs to be modified to use <node-local-address> that NodeLocal DNSCache is listening on. Otherwise, there is no need to modify the valu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14813"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <manifest>\n```\n\n2.41 - Using NodeLocal DNSCache in Kubernetes Clusters | StubDomains and upstream servers specified in the kube-dns ConfigMap in the kube-system namespace are automatically picked up by node-local-dns pods. The ConfigMap contents need to follow the format s", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14814"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sysctl-example\nspec:\n  securityContext:\n    sysctls:\n    - name: kernel.shm_rmid_forced\n      value: \"0\"\n    - name: net.core.somaxconn\n      value: \"1024\"\n    - name: kernel.msgmax\n      value: \"65536\"\n  ...\n```\n\n2.42 - Using sysctls in a Kubernetes Cluster | It is good practice to consider nodes with special sysctl settings as tainted within a cluster, and only schedule pods onto them which need those sysctl settings. It is suggested to use the Kubernetes", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14815"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"2\"\n        example.com/device: \"1\"\n```\n\n2.43 - Utilizing the NUMA-aware Memory Manager | Also, a pod sharing CPU(s) runs in the Guaranteed QoS class, when requests are equal to limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14816"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"300m\"\n        example.com/device: \"1\"\n```\n\n2.43 - Utilizing the NUMA-aware Memory Manager | Notice that both CPU and memory requests must be specified for a Pod to lend it to Guaranteed QoS class.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14817"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <id>\n```\n\n2.43 - Utilizing the NUMA-aware Memory Manager | Search system logs with respect to a particular pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14818"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: guaranteed\nspec:\n  containers:\n  - name: guaranteed\n    image: consumer\n    imagePullPolicy: Never\n    resources:\n      limits:\n        cpu: \"2\"\n        memory: 150Gi\n      requests:\n        cpu: \"2\"\n        memory: 150Gi\n    command: [\"sleep\",\"infinity\"]\n```\n\n2.43 - Utilizing the NUMA-aware Memory Manager | Next, let us log into the node where it was deployed and examine the state file in /var/lib/kubelet/memory_manager_state:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14819"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nURL=https://dl.k8s.io/release/v1.34.0/bin/linux/amd64\nBINARY=kubectl\n\nFILES=(\n    \"$BINARY\"\n    \"$BINARY.sig\"\n    \"$BINARY.cert\"\n)\n\nfor FILE in \"${FILES[@]}\"; do\n    curl -sSfL --retry 3 --retry-delay 3 \"$URL/$FILE\" -o \"$FILE\"\ndone\n```\n\n2.44 - Verify Signed Kubernetes Artifacts | Then verify the blob by using cosign verify-blob:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14820"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14821"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nresources:\n  requests:\n    memory: 100Mi\n  limits:\n    memory: 200Mi\n...\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Run kubectl top to fetch the metrics for the pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14822"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14823"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nlastState:\n   terminated:\n     containerID: 65183c1877aaec2e8427bc95609cc52677a454b56fcb24340dbd22917c23b10f\n     exitCode: 137\n     finishedAt: 2017-06-20T20:52:19Z\n     reason: OOMKilled\n     startedAt: null\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The Container in this exercise can be restarted, so the kubelet restarts it. Repeat this command several times to see that the Container is repeatedly killed and restarted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14824"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS      RESTARTS   AGE\nmemory-demo-2   0/1       OOMKilled   1          37s\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14825"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-2   1/1       Running   2          40s\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14826"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container starts and fails repeatedly:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14827"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output includes a record of the Container being killed because of an out-of-memory condition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14828"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14829"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-3   0/1       Pending   0          25s\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod, including events:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14830"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14831"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n    cpu: \"1\"\n  requests:\n    cpu: 500m\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Use kubectl top to fetch the metrics for the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14832"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14833"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\n3.3.1 - Set Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14834"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14835"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14836"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14837"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14838"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14839"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nspec: \n  containers:    \n  ...\n  resources:\n    requests:\n      memory: 100Mi\n    limits:\n      memory: 200Mi\n...\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Run kubectl top to fetch the metrics for the pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14840"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14841"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  ...\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: 500m\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Use kubectl top to fetch the metrics for the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14842"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14843"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n  name: pod-resources-demo-ctr-1\n  resources:\n      requests:\n        cpu: 500m\n        memory: 50Mi\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  ...\n  name: pod-resources-demo-ctr-2\n  resources: {}  \nresources:\n  limits:\n      cpu: 1\n      memory: 200Mi\n    requests:\n      cpu: 1\n      memory: 100Mi\n...\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Since pod-level requests and limits are specified, the request guarantees for both containers in the pod will be equal 1 core or CPU and 100Mi of memory. Additionally, both containers together won't b", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14844"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-crd.yaml\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | Two webhooks need to be configured on the Kubernetes cluster to populate and validate GMSA credential spec references at the Pod or container level:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14845"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14846"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-Webapp1-credspec.yml\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | A cluster role needs to be defined for each GMSA credential spec resource. This authorizes the use verb on a specific GMSA resource by a subject which is typically a service account. The following exa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14847"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-webapp1-role.yaml\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14848"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14849"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14850"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14851"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14852"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nimage: registry.domain.example/iis-auth:1809v1\n        lifecycle:\n          postStart:\n            exec:\n              command: [\"powershell.exe\",\"-command\",\"do { Restart-Service -Name netlogon } while ( $($Result = (nltest.exe /query); if ($Result -like '*0x0 NERR_Success*') {return $true} else {return $false}) -eq $false)\"]\n        imagePullPolicy: IfNotPresent\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | If you add the lifecycle section show above to your Pod spec, the Pod will execute the commands listed to restart the netlogon service until the nltest.exe /query command exits without error.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14853"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nresizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired\n    - resourceName: memory\n      restartPolicy: RestartContainer\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | If resizePolicy[*].restartPolicy is not specified for a resource, it defaults to NotRequired.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14854"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14855"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14856"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14857"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  securityContext:\n    windowsOptions:\n      hostProcess: true\n      runAsUserName: \"NT AUTHORITY\\\\Local service\"\n  hostNetwork: true\n  containers:\n  - name: test\n    image: image1:latest\n    command:\n      - ping\n      - -t\n      - 127.0.0.1\n  nodeSelector:\n    \"kubernetes.io/os\": windows\n```\n\n3.8 - Create a Windows HostProcess Pod | HostProcess containers support the ability to mount volumes within the container volume space. Volume mount behavior differs depending on the version of containerd runtime used by on the node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14858"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  windowsOptions:\n    hostProcess: true\n    runAsUserName: hpc-localgroup\n```\n\n3.8 - Create a Windows HostProcess Pod | Schedule the pod!", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14859"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14860"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    resources:\n      limits:\n        cpu: 700m\n        memory: 200Mi\n      requests:\n        cpu: 700m\n        memory: 200Mi\n    ...\nstatus:\n  qosClass: Guaranteed\n```\n\n3.9 - Configure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14861"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14862"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: qos-demo-2-ctr\n    resources:\n      limits:\n        memory: 200Mi\n      requests:\n        memory: 100Mi\n  ...\nstatus:\n  qosClass: Burstable\n```\n\n3.9 - Configure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14863"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14864"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    resources: {}\n  ...\nstatus:\n  qosClass: BestEffort\n```\n\n3.9 - Configure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14865"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n3.9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14866"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    name: qos-demo-4-ctr-1\n    resources:\n      requests:\n        memory: 200Mi\n    ...\n    name: qos-demo-4-ctr-2\n    resources: {}\n    ...\nstatus:\n  qosClass: Burstable\n```\n\n3.9 - Configure Quality of Service for Pods | Rather than see all the fields, you can view just the field you need:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14867"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\n3.9 - Configure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14868"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n3.10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14869"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nLimits:\n  example.com/dongle: 3\nRequests:\n  example.com/dongle: 3\n```\n\n3.10 - Assign Extended Resources to a Container | Here is the configuration file for a Pod that has one Container. The Container requests two dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14870"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n3.10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14871"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nNAME                       READY     STATUS    RESTARTS   AGE\nextended-resource-demo-2   0/1       Pending   0          6m\n```\n\n3.10 - Assign Extended Resources to a Container | Delete the Pods that you created for this exercise:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14872"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14873"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14874"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14875"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14876"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14877"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14878"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14879"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14880"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14881"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14882"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\n3.14 - Configure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14883"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\n3.14 - Configure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14884"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  runAsUser: 1000\n  runAsGroup: 3000\n  fsGroup: 2000\n  fsGroupChangePolicy: \"OnRootMismatch\"\n```\n\n3.14 - Configure a Security Context for a Pod or Container | If you deploy a Container Storage Interface (CSI) driver which supports the VOLUME_MOUNT_GROUP NodeServiceCapability, the process of setting file ownership and permissions based on the fsGroup specifi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14885"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14886"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14887"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14888"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seccompProfile:\n    type: RuntimeDefault\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Here is an example that sets the Seccomp profile to a pre-configured file at <kubelet-root-dir>/seccomp/my-profiles/profile-allow.json:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14889"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seccompProfile:\n    type: Localhost\n    localhostProfile: my-profiles/profile-allow.json\n```\n\n3.14 - Configure a Security Context for a Pod or Container | To set the AppArmor profile for a Container, include the appArmorProfile field in the securityContext section of your Container. The appArmorProfile field is a AppArmorProfile object consisting of typ", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14890"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n- name: container-1\n  securityContext:\n    appArmorProfile:\n      type: RuntimeDefault\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Here is an example that sets the AppArmor profile to a pre-configured profile named k8s-apparmor-example-deny-write:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14891"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n- name: container-1\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n```\n\n3.14 - Configure a Security Context for a Pod or Container | For more details please see, Restrict a Container's Access to Resources with AppArmor.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14892"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seLinuxOptions:\n    level: \"s0:c123,c456\"\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Kubernetes v1.27 introduced an early limited form of this behavior that was only applicable to volumes (and PersistentVolumeClaims) using the ReadWriteOncePod access mode.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14893"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\n3.14 - Configure a Security Context for a Pod or Container | A cluster admin can use this information to identify pods affected by the planning change and proactively opt-out Pods from the optimization (i.e. set spec.securityContext.seLinuxChangePolicy: Recursi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14894"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  procMount: Unmasked\n```\n\n3.14 - Configure a Security Context for a Pod or Container | The security context for a Pod applies to the Pod's Containers and also to the Pod's Volumes when applicable. Specifically fsGroup and seLinuxOptions are applied to Volumes as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14895"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\n3.15 - Configure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14896"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\n3.15 - Configure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14897"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\n3.15 - Configure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14898"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccount build-robot -o yaml\n```\n\n3.15 - Configure Service Accounts for Pods | You can't see the build-robot-secret Secret in the ServiceAccount API objects .secrets field because that field is only populated with auto-generated Secrets.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14899"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\n3.15 - Configure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14900"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\n3.15 - Configure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14901"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"aud\": [  # matches the requested audiences, or the API server's default audiences when none are explicitly requested\n    \"https://kubernetes.default.svc\"\n  ],\n  \"exp\": 1731613413,\n  \"iat\": 1700077413,\n  \"iss\": \"https://kubernetes.default.svc\",  # matches the first value passed to the --service-account-issuer flag\n  \"jti\": \"ea28ed49-2e11-4280-9ec5-bc3d1d84661a\", \n  \"kubernetes.io\": {\n    \"namespace\": \"kube-system\",\n    \"node\": {\n      \"name\": \"127.0.0.1\",\n      \"uid\": \"58456cb0-dd00-45ed-b797-5578fdceaced\"\n    },\n    \"pod\": {\n      \"name\": \"coredns-69cbfb9798-jv9gn\",\n      \"uid\": \"778a530c-b3f4-47c0-9cd5-ab018fb64f33\"\n    },\n    \"serviceaccount\": {\n      \"name\": \"coredns\",\n      \"uid\": \"a087d5a0-e1dd-43ec-93ac-f13d89cd13af\"\n    },\n    \"warnafter\": 1700081020\n  },\n  \"nbf\": 1700077413,\n  \"sub\": \"system:serviceaccount:kube-system:coredns\"\n}\n```\n\n3.15 - Configure Service Accounts for Pods | To provide a Pod with a token with an audience of vault and a validity duration of two hours, you could define a Pod manifest that is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14902"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n3.15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14903"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14904"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14905"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n3.16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14906"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14907"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14908"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14909"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14910"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nports:\n- name: liveness-port\n  containerPort: 8080\n\nlivenessProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | Sometimes, you have to deal with applications that require additional startup time on their first initialization. In such cases, it can be tricky to set up liveness probe parameters without compromisi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14911"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nports:\n- name: liveness-port\n  containerPort: 8080\n\nlivenessProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n  failureThreshold: 1\n  periodSeconds: 10\n\nstartupProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n  failureThreshold: 30\n  periodSeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | Thanks to the startup probe, the application will have a maximum of 5 minutes (30 * 10 = 300s) to finish its startup. Once the startup probe has succeeded once, the liveness probe takes over to provid", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14912"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nreadinessProbe:\n  exec:\n    command:\n    - cat\n    - /tmp/healthy\n  initialDelaySeconds: 5\n  periodSeconds: 5\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | Configuration for HTTP and TCP readiness probes also remains identical to liveness probes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14913"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n  httpGet:\n    httpHeaders:\n      - name: Accept\n        value: application/json\n\nstartupProbe:\n  httpGet:\n    httpHeaders:\n      - name: User-Agent\n        value: MyUserAgent\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | You can also remove these two headers by defining them with an empty value.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14914"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n  httpGet:\n    httpHeaders:\n      - name: Accept\n        value: \"\"\n\nstartupProbe:\n  httpGet:\n    httpHeaders:\n      - name: User-Agent\n        value: \"\"\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | When the kubelet probes a Pod using HTTP, it only follows redirects if the redirect is to the same host. If the kubelet receives 11 or more redirects during probing, the probe is considered successful", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14915"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  terminationGracePeriodSeconds: 3600  # pod-level\n  containers:\n  - name: test\n    image: ...\n\n    ports:\n    - name: liveness-port\n      containerPort: 8080\n\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: liveness-port\n      failureThreshold: 1\n      periodSeconds: 60\n      # Override pod-level terminationGracePeriodSeconds #\n      terminationGracePeriodSeconds: 60\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | Probe-level terminationGracePeriodSeconds cannot be set for readiness probes. It will be rejected by the API server.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14916"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14917"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14918"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14919"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14920"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n3.20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14921"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14922"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/lifecycle-events.yaml\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | Verify that the Container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14923"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod lifecycle-demo\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | Get a shell into the Container running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14924"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it lifecycle-demo -- /bin/bash\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | In your shell, verify that the postStart handler created the message file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14925"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Use the kubectl create configmap command to create ConfigMaps from directories, files, or literal values:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14926"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Use the kubectl create configmap command to create ConfigMaps from directories, files, or literal values:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14927"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14928"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Each filename being used for ConfigMap creation must consist of only acceptable characters, which are: letters (A to Z and a to z), digits (0 to 9), '-', '_', or '.'. If you use kubectl create configm", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14929"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The kubectl command does not print an error when it encounters an invalid filename.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14930"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14931"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | For example,", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14932"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14933"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14934"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config-3 -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14935"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14936"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14937"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14938"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\n# kustomization.yaml contents for creating a ConfigMap from literals\nconfigMapGenerator:\n- name: special-config-2\n  literals:\n  - special.how=very\n  - special.type=charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Apply the kustomization directory to create the ConfigMap object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14939"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14940"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14941"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14942"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14943"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14944"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14945"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14946"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14947"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14948"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14949"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14950"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap -o jsonpath='{.binaryData}' <name>\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Pods can load data from a ConfigMap that uses either data or binaryData.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14951"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14952"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14953"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14954"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nrm kustomization.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | If you created a directory configure-pod-container and no longer need it, you should remove that too, or move it into the trash can / deleted files location.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14955"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nrm -r configure-pod-container\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | This page shows how to configure process namespace sharing for a pod. When process namespace sharing is enabled, processes in a container are visible to all other containers in the same pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14956"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14957"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n3.24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14958"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14959"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14960"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\n3.26 - Create static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14961"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker.io/library/nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31\n```\n\n3.26 - Create static Pods | You can see the mirror Pod on the API server:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14962"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservices:\n\n  redis-leader:\n    container_name: redis-leader\n    image: redis\n    ports:\n      - \"6379\"\n\n  redis-replica:\n    container_name: redis-replica\n    image: redis\n    ports:\n      - \"6379\"\n    command: redis-server --replicaof redis-leader 6379 --dir /tmp\n\n  web:\n    container_name: web\n    image: quay.io/kompose/web\n    ports:\n      - \"8080:8080\"\n    environment:\n      - GET_HOSTS_FROM=dns\n    labels:\n      kompose.service.type: LoadBalancer\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | To convert the docker-compose.yml file to files that you can use with kubectl, run kompose convert and then kubectl apply -f <output file>.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14963"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <output file>\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14964"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14965"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nminikube service web-tcp\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | Otherwise, let's look up what IP your service is using!", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14966"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nversion: \"2\"\nservices:\n  nginx:\n    image: nginx\n    dockerfile: foobar\n    build: ./foobar\n    cap_add:\n      - ALL\n    container_name: foobar\n    labels:\n      kompose.service.type: nodeport\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | kompose.service.expose defines if the service needs to be made accessible from outside the cluster or not. If the value is set to \"true\", the provider sets the endpoint automatically, and for any othe", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14967"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nversion: \"2\"\nservices:\n  web:\n    image: tuna/docker-counter23\n    ports:\n    - \"5000:5000\"\n    links:\n    - redis\n    labels:\n      kompose.service.expose: \"counter.example.com\"\n  redis:\n    image: redis:3.0\n    ports:\n    - \"6379\"\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | The currently supported options are:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14968"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nversion: '2'\n\nservices:\n  pival:\n    image: perl\n    command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n    restart: \"on-failure\"\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | If the Docker Compose file has a volume specified for a service, the Deployment (Kubernetes) or DeploymentConfig (OpenShift) strategy is changed to \"Recreate\" instead of \"RollingUpdate\" (default). Thi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14969"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\n3.28 - Enforce Pod Security Standards by Configuring the Built-in Admission Controller | Namespaces can be labeled to enforce the Pod Security Standards. The three policies privileged, baseline and restricted broadly cover the security spectrum and are implemented by the Pod Security admi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14970"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14971"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply --validate -f mypod.yaml\n```\n\n4.3.1 - Debug Pods | The next thing to check is whether the pod on the apiserver matches the pod you meant to create (e.g. in a yaml file on your local machine). For example, run kubectl get pods/mypod -o yaml > mypod-on-", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14972"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/mypod -o yaml > mypod-on-apiserver.yaml\n```\n\n4.3.1 - Debug Pods | Replication controllers are fairly straightforward. They can either create Pods or they can't. If they can't create pods, then please refer to the instructions above to debug your pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14973"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe rc ${CONTROLLER_NAME}\n```\n\n4.3.1 - Debug Pods | Services provide load balancing across a set of pods. There are several common problems that can make Services not work properly. The following instructions should help debug Service problems.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14974"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nspec:\n  - selector:\n     name: nginx\n     type: frontend\n```\n\n4.3.1 - Debug Pods | You can use:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14975"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    matchLabels:\n      app: hostnames\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hostnames\n    spec:\n      containers:\n      - name: hostnames\n        image: registry.k8s.io/serve_hostname\n```\n\n4.3.2 - Debug Services | The label \"app\" is automatically set by kubectl create deployment to the name of the Deployment.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14976"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment\n```\n\n4.3.2 - Debug Services | You can confirm your Pods are running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14977"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    app: hostnames\n  ports:\n  - name: default\n    protocol: TCP\n    port: 80\n    targetPort: 9376\n```\n\n4.3.2 - Debug Services | In order to highlight the full range of configuration, the Service you created here uses a different port number than the Pods. For many real-world Services, these values might be the same.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14978"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14979"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\n...\n    lastState:\n      terminated:\n        containerID: ...\n        exitCode: 0\n        finishedAt: ...\n        message: |\n          Sleep expired          \n        ...\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Use a Go template to filter the output so that it includes only the termination message:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14980"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: msg-path-demo\nspec:\n  containers:\n  - name: msg-path-demo-container\n    image: debian\n    terminationMessagePath: \"/tmp/my-log\"\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Moreover, users can set the terminationMessagePolicy field of a Container for further customization. This field defaults to \"File\" which means the termination messages are retrieved only from the term", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14981"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\n4.3.6 - Debug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14982"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2022-02-17T21:51:01Z\"\n  generateName: nginx-deployment-67d4bdd6f5-\n  labels:\n    app: nginx\n    pod-template-hash: 67d4bdd6f5\n  name: nginx-deployment-67d4bdd6f5-w6kd7\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: nginx-deployment-67d4bdd6f5\n    uid: 7d41dfd4-84c0-4be4-88ab-cedbe626ad82\n  resourceVersion: \"1364\"\n  uid: a6501da1-0447-4262-98eb-c03d4002222e\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: nginx\n    ports:\n    - containerPort: 80\n      protocol: TCP\n    resources:\n      limits:\n        cpu: 500m\n        memory: 128Mi\n      requests:\n        cpu: 500m\n        memory: 128Mi\n    terminationMessagePath: /dev/termination-log\n    terminationMessagePolicy: File\n    volumeMounts:\n    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount\n      name: kube-api-access-bgsgp\n      readOnly: true\n  dnsPolicy: ClusterFirst\n  enableServiceLinks: true\n  nodeName: kube-worker-1\n  preemptionPolicy: PreemptLowerPriority\n  priority: 0\n  restartPolicy: Always\n  schedulerName: default-scheduler\n  securityContext: {}\n  serviceAccount: default\n  serviceAccountName: default\n  terminationGracePeriodSeconds: 30\n  tolerations:\n  - effect: NoExecute\n    key: node.kubernetes.io/not-ready\n    operator: Exists\n    tolerationSeconds: 300\n  - effect: NoExecute\n    key: node.kubernetes.io/unreachable\n    operator: Exists\n    tolerationSeconds: 300\n  volumes:\n  - name: kube-api-access-bgsgp\n    projected:\n      defaultMode: 420\n      sources:\n      - serviceAccountToken:\n          expirationSeconds: 3607\n          path: token\n      - configMap:\n          items:\n          - key: ca.crt\n            path: ca.crt\n          name: kube-root-ca.crt\n      - downwardAPI:\n          items:\n          - fieldRef:\n              apiVersion: v1\n              fieldPath: metadata.namespace\n            path: namespace\nstatus:\n  conditions:\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: Initialized\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: Ready\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: ContainersReady\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: PodScheduled\n  containerStatuses:\n  - containerID: containerd://5403af59a2b46ee5a23fb0ae4b1e077f7ca5c5fb7af16e1ab21c00e0e616462a\n    image: docker.io/library/nginx:latest\n    imageID: docker.io/library/nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767\n    lastState: {}\n    name: nginx\n    ready: true\n    restartCount: 0\n    started: true\n    state:\n      running:\n        startedAt: \"2022-02-17T21:51:05Z\"\n  hostIP: 192.168.0.113\n  phase: Running\n  podIP: 10.88.0.3\n  podIPs:\n  - ip: 10.88.0.3\n  - ip: 2001:db8::1\n  qosClass: Guaranteed\n  startTime: \"2022-02-17T21:51:01Z\"\n```\n\n4.3.6 - Debug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14983"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run --image=busybox:1.28 myapp -- false\n```\n\n4.3.6 - Debug Running Pods | You can see using kubectl describe pod myapp that this container is crashing:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14984"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod myapp\n```\n\n4.3.6 - Debug Running Pods | You can use kubectl debug to create a copy of this Pod with the command changed to an interactive shell:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14985"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --copy-to=myapp-debug --container=myapp -- sh\n```\n\n4.3.6 - Debug Running Pods | Now you have an interactive shell that you can use to perform tasks like checking filesystem paths or running the container command manually.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14986"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Now use kubectl debug to make a copy and change its container image to ubuntu:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14987"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp --copy-to=myapp-debug --set-image=*=ubuntu\n```\n\n4.3.6 - Debug Running Pods | The syntax of --set-image uses the same container_name=image syntax as kubectl set image. *=ubuntu means change the image of all containers to ubuntu.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14988"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nenv:\n- name: ENV_VAR_1\n  value: value_1\n- name: ENV_VAR_2\n  value: value_2\nsecurityContext:\n  capabilities:\n    add:\n    - NET_ADMIN\n    - SYS_TIME\n```\n\n4.3.6 - Debug Running Pods | Run this command to debug the Pod using an ephemeral container with the custom profile:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14989"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\n4.3.7 - Get a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14990"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14991"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get node -o yaml\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14992"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\nmetadata:\n  annotations:\n    node.alpha.kubernetes.io/ttl: \"0\"\n    volumes.kubernetes.io/controller-managed-attach-detach: \"true\"\n  creationTimestamp: \"2022-02-17T21:46:30Z\"\n  labels:\n    beta.kubernetes.io/arch: amd64\n    beta.kubernetes.io/os: linux\n    kubernetes.io/arch: amd64\n    kubernetes.io/hostname: kube-worker-1\n    kubernetes.io/os: linux\n  name: kube-worker-1\n  resourceVersion: \"4026\"\n  uid: 98efe7cb-2978-4a0b-842a-1a7bf12c05f8\nspec: {}\nstatus:\n  addresses:\n  - address: 192.168.0.113\n    type: InternalIP\n  - address: kube-worker-1\n    type: Hostname\n  allocatable:\n    cpu: \"2\"\n    ephemeral-storage: \"14167048988\"\n    hugepages-2Mi: \"0\"\n    memory: 1922788Ki\n    pods: \"110\"\n  capacity:\n    cpu: \"2\"\n    ephemeral-storage: 15372232Ki\n    hugepages-2Mi: \"0\"\n    memory: 2025188Ki\n    pods: \"110\"\n  conditions:\n  - lastHeartbeatTime: \"2022-02-17T22:20:32Z\"\n    lastTransitionTime: \"2022-02-17T22:20:32Z\"\n    message: Weave pod has set this\n    reason: WeaveIsUp\n    status: \"False\"\n    type: NetworkUnavailable\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient memory available\n    reason: KubeletHasSufficientMemory\n    status: \"False\"\n    type: MemoryPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has no disk pressure\n    reason: KubeletHasNoDiskPressure\n    status: \"False\"\n    type: DiskPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient PID available\n    reason: KubeletHasSufficientPID\n    status: \"False\"\n    type: PIDPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:15:15Z\"\n    message: kubelet is posting ready status\n    reason: KubeletReady\n    status: \"True\"\n    type: Ready\n  daemonEndpoints:\n    kubeletEndpoint:\n      Port: 10250\n  nodeInfo:\n    architecture: amd64\n    bootID: 22333234-7a6b-44d4-9ce1-67e31dc7e369\n    containerRuntimeVersion: containerd://1.5.9\n    kernelVersion: 5.13.0-28-generic\n    kubeProxyVersion: v1.23.3\n    kubeletVersion: v1.23.3\n    machineID: 9384e2927f544209b5d7b67474bbf92b\n    operatingSystem: linux\n    osImage: Ubuntu 21.10\n    systemUUID: aa829ca9-73d7-064d-9019-df07404ad448\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14993"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\n4.4.4 - Monitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14994"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\n4.4.4 - Monitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14995"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\n4.4.6 - Auditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14996"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Log all requests at the Metadata level.\napiVersion: audit.k8s.io/v1\nkind: Policy\nrules:\n- level: Metadata\n```\n\n4.4.6 - Auditing | If you're crafting your own audit profile, you can use the audit profile for Google Container-Optimized OS as a starting point. You can check the configure-helper.sh script, which generates an audit p", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14997"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n- --audit-policy-file=/etc/kubernetes/audit-policy.yaml\n  - --audit-log-path=/var/log/kubernetes/audit/audit.log\n```\n\n4.4.6 - Auditing | then mount the volumes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14998"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nvolumeMounts:\n  - mountPath: /etc/kubernetes/audit-policy.yaml\n    name: audit\n    readOnly: true\n  - mountPath: /var/log/kubernetes/audit/\n    name: audit-log\n    readOnly: false\n```\n\n4.4.6 - Auditing | and finally configure the hostPath:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_14999"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nvolumes:\n- name: audit\n  hostPath:\n    path: /etc/kubernetes/audit-policy.yaml\n    type: File\n\n- name: audit-log\n  hostPath:\n    path: /var/log/kubernetes/audit/\n    type: DirectoryOrCreate\n```\n\n4.4.6 - Auditing | The webhook audit backend sends audit events to a remote web API, which is assumed to be a form of the Kubernetes API, including means of authentication. You can configure a webhook audit backend usin", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15000"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration: '{...}'\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example of an object configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15001"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15002"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15003"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15004"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15005"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15006"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15007"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15008"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15009"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15010"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15011"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Manually deleting objects using the imperative command is the recommended approach, as it is more explicit about what is being deleted, and less likely to result in the user deleting something uninten", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15012"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15013"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15014"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply --prune --applyset\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | To use ApplySet-based pruning, set the KUBECTL_APPLYSET=true environment variable, and add the following flags to your kubectl apply invocation:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15015"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example. Suppose this is the configuration file for a Deployment object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15016"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15017"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15018"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15019"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration value\n    args: [\"a\", \"b\"]\n\n# configuration file value\n    args: [\"a\", \"c\"]\n\n# live configuration\n    args: [\"a\", \"b\", \"d\"]\n\n# result after merge\n    args: [\"a\", \"c\"]\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Explanation: The merge used the configuration file value as the new list value.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15020"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration value\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-a # key: nginx-helper-a; will be deleted in result\n      image: helper:1.3\n    - name: nginx-helper-b # key: nginx-helper-b; will be retained\n      image: helper:1.3\n\n# configuration file value\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-b\n      image: helper:1.3\n    - name: nginx-helper-c # key: nginx-helper-c; will be added in result\n      image: helper:1.3\n\n# live configuration\n    containers:\n    - name: nginx\n      image: nginx:1.16\n    - name: nginx-helper-a\n      image: helper:1.3\n    - name: nginx-helper-b\n      image: helper:1.3\n      args: [\"run\"] # Field will be retained\n    - name: nginx-helper-d # key: nginx-helper-d; will be retained\n      image: helper:1.3\n\n# result after merge\n    containers:\n    - name: nginx\n      image: nginx:1.16\n      # Element nginx-helper-a was deleted\n    - name: nginx-helper-b\n      image: helper:1.3\n      args: [\"run\"] # Field was retained\n    - name: nginx-helper-c # Element was added\n      image: helper:1.3\n    - name: nginx-helper-d # Element was ignored\n      image: helper:1.3\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Explanation:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15021"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15022"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15023"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# last-applied-configuration\nspec:\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# configuration file\nspec:\n  strategy:\n    type: Recreate # updated value\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# live configuration\nspec:\n  strategy:\n    type: RollingUpdate # defaulted value\n    rollingUpdate: # defaulted value derived from type\n      maxSurge : 1\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n\n# result after merge - ERROR!\nspec:\n  strategy:\n    type: Recreate # updated value: incompatible with rollingUpdate\n    rollingUpdate: # defaulted value: incompatible with \"type: Recreate\"\n      maxSurge : 1\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Explanation:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15024"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Kubernetes objects should be managed using only one method at a time. Switching from one method to another is possible, but is a manual process.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15025"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15026"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15027"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n      controller-selector: \"apps/v1/deployment/nginx\"\ntemplate:\n  metadata:\n    labels:\n      controller-selector: \"apps/v1/deployment/nginx\"\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Kustomize is a standalone tool to customize Kubernetes objects through a kustomization file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15028"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15029"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15030"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15031"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15032"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15033"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15034"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15035"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15036"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15037"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15038"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15039"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15040"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15041"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service -o yaml --dry-run=client\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15042"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl set selector --local -f - -o yaml\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15043"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15044"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15045"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15046"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <filename|url>\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl replace -f to update a live object according to a configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15047"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <filename|url>\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl delete -f to delete an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15048"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename|url>\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | If configuration file has specified the generateName field in the metadata section instead of the name field, you cannot delete the object using kubectl delete -f <filename|url>. You will have to use", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15049"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename|url>\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15050"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | The -o yaml flag specifies that the full object configuration is printed. Use kubectl get -h to see a list of options.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15051"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create --edit\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15052"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n      controller-selector: \"apps/v1/deployment/nginx\"\ntemplate:\n  metadata:\n    labels:\n      controller-selector: \"apps/v1/deployment/nginx\"\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | This task shows how to use kubectl patch to update an API object in place. The exercises in this task demonstrate a strategic merge patch and a JSON merge patch.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15053"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15054"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      containers:\n      - name: patch-demo-ctr-2\n        image: redis\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15055"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncontainers:\n- image: redis\n  imagePullPolicy: Always\n  name: patch-demo-ctr-2\n  ...\n- image: nginx\n  imagePullPolicy: Always\n  name: patch-demo-ctr\n  ...\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your patched Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15056"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n\"io.k8s.api.core.v1.PodSpec\": {\n    ...,\n    \"containers\": {\n        \"description\": \"List of containers belonging to the pod.  ....\"\n    },\n    \"x-kubernetes-patch-merge-key\": \"name\",\n    \"x-kubernetes-patch-strategy\": \"merge\"\n}\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | And you can see the patch strategy in the Kubernetes API documentation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15057"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      tolerations:\n      - effect: NoSchedule\n        key: disktype\n        value: ssd\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15058"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntolerations:\n- effect: NoSchedule\n  key: disktype\n  value: ssd\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Notice that the tolerations list in the PodSpec was replaced, not merged. This is because the Tolerations field of PodSpec does not have a patchStrategy key in its field tag. So the strategic merge pa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15059"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  template:\n    spec:\n      containers:\n      - name: patch-demo-ctr-3\n        image: gcr.io/google-samples/hello-app:2.0\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In your patch command, set type to merge:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15060"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - image: gcr.io/google-samples/hello-app:2.0\n    ...\n    name: patch-demo-ctr-3\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | List the running Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15061"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15062"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    type: Recreate\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Patch your Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15063"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    $retainKeys:\n    - type\n    type: Recreate\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | With this patch, we indicate that we want to retain only the type key of the strategy object. Thus, the rollingUpdate will be removed during the patch operation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15064"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  strategy:\n    type: Recreate\n  template:\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The patch you did in the preceding exercise is called a strategic merge patch with retainKeys strategy. This method introduces a new directive $retainKeys that has the following strategies:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15065"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n\"io.k8s.api.apps.v1.DeploymentSpec\": {\n    ...,\n    \"strategy\": {\n        \"$ref\": \"#/definitions/io.k8s.api.apps.v1.DeploymentStrategy\",\n        \"description\": \"The deployment strategy to use to replace existing pods with new ones.\",\n        \"x-kubernetes-patch-strategy\": \"retainKeys\"\n    },\n    ....\n}\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | And you can see the retainKeys strategy in the Kubernetes API documentation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15066"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15067"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n...\nspec:\n  replicas: 3\n  ...\nstatus:\n  ...\n  availableReplicas: 3\n  readyReplicas: 3\n  replicas: 3\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15068"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15069"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15070"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15071"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15072"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15073"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15074"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15075"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15076"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15077"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15078"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file, it will be\n# reopened with the relevant failures.\n#\napiVersion: v1\ndata:\n  password: UyFCXCpkJHpEc2I9\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  creationTimestamp: \"2022-06-28T17:44:13Z\"\n  name: db-user-pass\n  namespace: default\n  resourceVersion: \"12708504\"\n  uid: 91becd59-78fa-4c85-823f-6d44436242ac\ntype: Opaque\n```\n\n6.1 - Managing Secrets using kubectl | To delete a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15079"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: MWYyZDFlMmU2N2Rm\n```\n\n6.2 - Managing Secrets using Configuration File | Note that the name of a Secret object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15080"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiUrl: \"https://my.api.com/api/v1\"\nusername: \"<user>\"\npassword: \"<password>\"\n```\n\n6.2 - Managing Secrets using Configuration File | You could store this in a Secret using the following definition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15081"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\nstringData:\n  config.yaml: |\n    apiUrl: \"https://my.api.com/api/v1\"\n    username: <user>\n    password: <password>\n```\n\n6.2 - Managing Secrets using Configuration File | When you retrieve the Secret data, the command returns the encoded values, and not the plaintext values you provided in stringData.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15082"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:40:59Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7225\"\n  uid: c280ad2e-e916-11e8-98f2-025000000001\ntype: Opaque\n```\n\n6.2 - Managing Secrets using Configuration File | If you specify a field in both data and stringData, the value from stringData is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15083"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\nstringData:\n  username: administrator\n```\n\n6.2 - Managing Secrets using Configuration File | The Secret object is created as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15084"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  username: YWRtaW5pc3RyYXRvcg==\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:46:46Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7579\"\n  uid: 91460ecb-e917-11e8-98f2-025000000001\ntype: Opaque\n```\n\n6.2 - Managing Secrets using Configuration File | YWRtaW5pc3RyYXRvcg== decodes to administrator.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15085"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: YmlyZHNhcmVudHJlYWw=\n```\n\n6.2 - Managing Secrets using Configuration File | Apply the manifest to your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15086"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side\n```\n\n6.2 - Managing Secrets using Configuration File | To delete the Secret you have created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15087"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nsecretGenerator:\n- name: database-creds\n  literals:\n  - username=admin\n  - password=1f2d1e2e67df\n```\n\n6.3 - Managing Secrets using Kustomize | Store the credentials in files. The filenames are the keys of the secret:echo -n 'admin' > ./username.txt echo -n '1f2d1e2e67df' > ./password.txt The -n flag ensures that there's no newline character", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15088"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nsecretGenerator:\n- name: database-creds\n  files:\n  - username.txt\n  - password.txt\n```\n\n6.3 - Managing Secrets using Kustomize | You can also define the secretGenerator in the kustomization.yaml file by providing .env files. For example, the following kustomization.yaml file pulls in data from an .env.secret file:secretGenerato", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15089"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nsecretGenerator:\n- name: db-user-pass\n  envs:\n  - .env.secret\n```\n\n6.3 - Managing Secrets using Kustomize | In all cases, you don't need to encode the values in base64. The name of the YAML file must be kustomization.yaml or kustomization.yml.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15090"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\n7.1 - Define a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15091"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nenv:\n- name: MESSAGE\n  value: \"hello world\"\ncommand: [\"/bin/echo\"]\nargs: [\"$(MESSAGE)\"]\n```\n\n7.1 - Define a Command and Arguments for a Container | This means you can define an argument for a Pod using any of the techniques available for defining environment variables, including ConfigMaps and Secrets.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15092"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\n7.2 - Define Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15093"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\n7.3 - Define Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15094"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: print-greeting\nspec:\n  containers:\n  - name: env-print-demo\n    image: bash\n    env:\n    - name: GREETING\n      value: \"Warm greetings to\"\n    - name: HONORIFIC\n      value: \"The Most Honorable\"\n    - name: NAME\n      value: \"Kubernetes\"\n    - name: MESSAGE\n      value: \"$(GREETING) $(HONORIFIC) $(NAME)\"\n    command: [\"echo\"]\n    args: [\"$(MESSAGE)\"]\n```\n\n7.3 - Define Environment Variables for a Container | Upon creation, the command echo Warm greetings to The Most Honorable Kubernetes is run on the container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15095"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15096"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15097"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15098"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15099"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15100"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15101"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | This is more convenient. The detailed approach shown earlier runs through each step explicitly to demonstrate what is happening.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15102"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15103"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      items:\n      - key: username\n        path: my-group/my-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | When you deploy this Pod, the following happens:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15104"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      defaultMode: 0400\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The Secret is mounted on /etc/foo; all the files created by the secret volume mount have permission 0400.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15105"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15106"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15107"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15108"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: prod-db-client-pod\n  labels:\n    name: prod-db-client\nspec:\n  serviceAccount: prod-db-client\n  containers:\n  - name: db-client-container\n    image: myClientImage\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | This page shows how to run an application using a Kubernetes Deployment object.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15109"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15110"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15111"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15112"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15113"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15114"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\n8.3 - Run a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15115"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\n8.3 - Run a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15116"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n8.3 - Run a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15117"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: Resource\nresource:\n  name: cpu\n  target:\n    type: Utilization\n    averageUtilization: 60\n```\n\n8.7 - Horizontal Pod Autoscaling | With this metric the HPA controller will keep the average utilization of the pods in the scaling target at 60%. Utilization is the ratio between the current usage of resource to the requested resource", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15118"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: ContainerResource\ncontainerResource:\n  name: cpu\n  container: application\n  target:\n    type: Utilization\n    averageUtilization: 60\n```\n\n8.7 - Horizontal Pod Autoscaling | In the above example the HPA controller scales the target such that the average utilization of the cpu in the application container of all the pods is 60%.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15119"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    policies:\n    - type: Pods\n      value: 4\n      periodSeconds: 60\n    - type: Percent\n      value: 10\n      periodSeconds: 60\n```\n\n8.7 - Horizontal Pod Autoscaling | periodSeconds indicates the length of time in the past for which the policy must hold true. The maximum value that you can set for periodSeconds is 1800 (half an hour). The first policy (Pods) allows", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15120"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    stabilizationWindowSeconds: 300\n```\n\n8.7 - Horizontal Pod Autoscaling | When the metrics indicate that the target should be scaled down the algorithm looks into previously computed desired states, and uses the highest value from the specified interval. In the above exampl", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15121"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleUp:\n    tolerance: 0.05 # 5% tolerance for scale up\n```\n\n8.7 - Horizontal Pod Autoscaling | With this configuration, the HPA algorithm will only consider scaling up if the memory consumption is higher than 105MiB (that is: 5% above the target).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15122"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    stabilizationWindowSeconds: 300\n    policies:\n    - type: Percent\n      value: 100\n      periodSeconds: 15\n  scaleUp:\n    stabilizationWindowSeconds: 0\n    policies:\n    - type: Percent\n      value: 100\n      periodSeconds: 15\n    - type: Pods\n      value: 4\n      periodSeconds: 15\n    selectPolicy: Max\n```\n\n8.7 - Horizontal Pod Autoscaling | For scaling down the stabilization window is 300 seconds (or the value of the --horizontal-pod-autoscaler-downscale-stabilization flag if provided). There is only a single policy for scaling down whic", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15123"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    stabilizationWindowSeconds: 60\n```\n\n8.7 - Horizontal Pod Autoscaling | To limit the rate at which pods are removed by the HPA to 10% per minute, the following behavior would be added to the HPA:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15124"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    policies:\n    - type: Percent\n      value: 10\n      periodSeconds: 60\n```\n\n8.7 - Horizontal Pod Autoscaling | To ensure that no more than 5 Pods are removed per minute, you can add a second scale-down policy with a fixed size of 5, and set selectPolicy to minimum. Setting selectPolicy to Min means that the au", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15125"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    policies:\n    - type: Percent\n      value: 10\n      periodSeconds: 60\n    - type: Pods\n      value: 5\n      periodSeconds: 60\n    selectPolicy: Min\n```\n\n8.7 - Horizontal Pod Autoscaling | The selectPolicy value of Disabled turns off scaling the given direction. So to prevent downscaling the following policy would be used:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15126"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nbehavior:\n  scaleDown:\n    selectPolicy: Disabled\n```\n\n8.7 - Horizontal Pod Autoscaling | HorizontalPodAutoscaler, like every API resource, is supported in a standard way by kubectl. You can create a new autoscaler using kubectl create command. You can list autoscalers by kubectl get hpa o", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15127"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale rs foo --min=2 --max=5 --cpu-percent=80\n```\n\n8.7 - Horizontal Pod Autoscaling | You can implicitly deactivate the HPA for a target without the need to change the HPA configuration itself. If the target's desired replica count is set to 0, and the HPA's minimum replica count is gr", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15128"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f deployment.yaml\n```\n\n8.7 - Horizontal Pod Autoscaling | Keep in mind that the removal of spec.replicas may incur a one-time degradation of Pod counts as the default value of this key is 1 (reference Deployment Replicas). Upon the update, all Pods except 1", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15129"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied deployment/<deployment_name>\n```\n\n8.7 - Horizontal Pod Autoscaling | When using the Server-Side Apply you can follow the transferring ownership guidelines, which cover this exact use case.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15130"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f deployment.yaml\n```\n\n8.7 - Horizontal Pod Autoscaling | When using the Server-Side Apply you can follow the transferring ownership guidelines, which cover this exact use case.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15131"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15132"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n      current:\n        averageUtilization: 0\n        averageValue: 0\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Notice that the targetCPUUtilizationPercentage field has been replaced with an array called metrics. The CPU utilization metric is a resource metric, since it is represented as a percentage of a resou", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15133"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: Pods\npods:\n  metric:\n    name: packets-per-second\n  target:\n    type: AverageValue\n    averageValue: 1k\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | The second alternative metric type is object metrics. These metrics describe a different object in the same namespace, instead of describing Pods. The metrics are not necessarily fetched from the obje", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15134"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: requests-per-second\n  describedObject:\n    apiVersion: networking.k8s.io/v1\n    kind: Ingress\n    name: main-route\n  target:\n    type: Value\n    value: 2k\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | If you provide multiple such metric blocks, the HorizontalPodAutoscaler will consider each metric in turn. The HorizontalPodAutoscaler will calculate proposed replica counts for each metric, and then", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15135"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n  - type: Pods\n    pods:\n      metric:\n        name: packets-per-second\n      target:\n        type: AverageValue\n        averageValue: 1k\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      target:\n        type: Value\n        value: 10k\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n    current:\n      averageUtilization: 0\n      averageValue: 0\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      current:\n        value: 10k\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Then, your HorizontalPodAutoscaler would attempt to ensure that each pod was consuming roughly 50% of its requested CPU, serving 1000 packets per second, and that all pods behind the main-route Ingres", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15136"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: http_requests\n    selector: {matchLabels: {verb: GET}}\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | This selector uses the same syntax as the full Kubernetes label selectors. The monitoring pipeline determines how to collapse multiple series into a single value, if the name and selector match multip", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15137"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n- type: External\n  external:\n    metric:\n      name: queue_messages_ready\n      selector:\n        matchLabels:\n          queue: \"worker_tasks\"\n    target:\n      type: AverageValue\n      averageValue: 30\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | When possible, it's preferable to use the custom metric target types instead of external metrics, since it's easier for cluster administrators to secure the custom metrics API. The external metrics AP", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15138"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15139"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15140"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15141"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  annotations:\n…\n  creationTimestamp: \"2020-03-04T04:22:56Z\"\n  generation: 1\n  name: zk-pdb\n…\nstatus:\n  currentHealthy: 3\n  desiredHealthy: 2\n  disruptionsAllowed: 1\n  expectedPods: 3\n  observedGeneration: 1\n```\n\n8.9 - Specifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15142"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n9.1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15143"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob <cronjob name>\n```\n\n9.1 - Running Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15144"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15145"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15146"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15147"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15148"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nsubdomain: <headless-svc-name>\n```\n\n9.5 - Job with Pod-to-Pod Communication | Below is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15149"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\n9.5 - Job with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15150"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n9.6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15151"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15152"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15153"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15154"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncontainerStatuses:\n- image: non-existing-repo/non-existing-image:example\n   ...\n   state:\n   waiting:\n      message: Back-off pulling image \"non-existing-repo/non-existing-image:example\"\n      reason: ImagePullBackOff\n      ...\nphase: Pending\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Note that the pod remains in the Pending phase as it fails to pull the misconfigured image. This, in principle, could be a transient issue and the image could get pulled. However, in this case, the im", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15155"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15156"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443\n```\n\n10.1 - Deploy and Access the Kubernetes Dashboard | Kubectl will make Dashboard available at https://localhost:8443.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15157"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --help\n```\n\n10.1 - Deploy and Access the Kubernetes Dashboard | When you access Dashboard on an empty cluster, you'll see the welcome page. This page contains a link to this document as well as a button to deploy your first application. In addition, you can view w", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15158"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret...\n```\n\n10.2 - Accessing Clusters | First, create the Secret, requesting a token for the default ServiceAccount:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15159"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\n10.3 - Configure Access to Multiple Clusters | You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two node", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15160"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n10.3 - Configure Access to Multiple Clusters | Suppose you have two clusters, one for development work and one for test work. In the development cluster, your frontend developers work in a namespace called frontend, and your storage developers wor", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15161"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\n10.3 - Configure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15162"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset users.<name>\n```\n\n10.3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15163"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset clusters.<name>\n```\n\n10.3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15164"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset contexts.<name>\n```\n\n10.3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15165"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\n10.3 - Configure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15166"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\n10.3 - Configure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15167"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\n10.3 - Configure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15168"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\n```\n\n10.3 - Configure Access to Multiple Clusters | For more information about how kubeconfig files are merged, see Organizing Cluster Access Using kubeconfig Files", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15169"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15170"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete services example-service\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15171"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Follow the Connecting Applications with Services tutorial.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15172"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15173"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15174"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15175"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15176"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15177"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15178"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n10.7 - Create an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15179"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nminikube service example-service --url\n```\n\n10.7 - Create an External Load Balancer | By default, the source IP seen in the target container is not the original source IP of the client. To enable preservation of the client IP, the following fields can be configured in the .spec of the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15180"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15181"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces\n```\n\n10.8 - List All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15182"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx\n```\n\n10.8 - List All Container Images Running in a Cluster | The formatting can be controlled further by using the range operation to iterate over elements individually.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15183"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15184"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n- path: /v2\n  pathType: Prefix\n  backend:\n    service:\n      name: web2\n      port:\n        number: 8080\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Apply the changes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15185"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15186"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/two-container-pod.yaml\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | View information about the Pod and the Containers:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15187"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod two-containers --output=yaml\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | Here is a portion of the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15188"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  ...\n  name: two-containers\n  namespace: default\n  ...\nspec:\n  ...\n  containerStatuses:\n\n  - containerID: docker://c1d8abd1 ...\n    image: debian\n    ...\n    lastState:\n      terminated:\n        ...\n    name: debian-container\n    ...\n\n  - containerID: docker://96c1ff2c5bb ...\n    image: nginx\n    ...\n    name: nginx-container\n    ...\n    state:\n      running:\n    ...\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | You can see that the debian Container has terminated, and the nginx Container is still running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15189"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it two-containers -c nginx-container -- /bin/bash\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In your shell, verify that nginx is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15190"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\nmetadata:\n  name: <name of the registration object>\nspec:\n  group: <API group name this extension apiserver hosts>\n  version: <API version this extension apiserver hosts>\n  groupPriorityMinimum: <priority this APIService for this group, see API documentation>\n  versionPriority: <prioritizes ordering of this version within a group, see API documentation>\n  service:\n    namespace: <namespace of the extension apiserver service>\n    name: <name of the extension apiserver service>\n  caBundle: <pem encoded ca cert that signs the server cert used by the webhook>\n```\n\n11.1 - Configure the Aggregation Layer | The name of an APIService object must be a valid path segment name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15191"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\n...\nspec:\n  ...\n  service:\n    namespace: my-service-namespace\n    name: my-service-name\n    port: 1234\n  caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.1 - Configure the Aggregation Layer | This page shows how to install a custom resource into the Kubernetes API by creating a CustomResourceDefinition.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15192"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.stable.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: stable.example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n    - name: v1\n      # Each version can be enabled/disabled by Served flag.\n      served: true\n      # One and only one version must be marked as the storage version.\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15193"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15194"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nitems:\n- apiVersion: stable.example.com/v1\n  kind: CronTab\n  metadata:\n    annotations:\n      kubectl.kubernetes.io/last-applied-configuration: |\n        {\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"CronTab\",\"metadata\":{\"annotations\":{},\"name\":\"my-new-cron-object\",\"namespace\":\"default\"},\"spec\":{\"cronSpec\":\"* * * * */5\",\"image\":\"my-awesome-cron-image\"}}        \n    creationTimestamp: \"2021-06-20T07:35:27Z\"\n    generation: 1\n    name: my-new-cron-object\n    namespace: default\n    resourceVersion: \"1326\"\n    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9\n  spec:\n    cronSpec: '* * * * */5'\n    image: my-awesome-cron-image\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15195"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nallOf:\n- properties:\n    foo:\n      # ...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15196"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nproperties:\n  foo:\n    # ...\nallOf:\n- properties:\n    foo:\n      # ...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 2:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15197"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nallOf:\n- items:\n    properties:\n      foo:\n        # ...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15198"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nitems:\n  properties:\n    foo:\n      # ...\nallOf:\n- items:\n    properties:\n      foo:\n        # ...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 3:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15199"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nproperties:\n  foo:\n    pattern: \"abc\"\n  metadata:\n    type: object\n    properties:\n      name:\n        type: string\n        pattern: \"^a\"\n      finalizers:\n        type: array\n        items:\n          type: string\n          pattern: \"my-finalizer\"\nanyOf:\n- properties:\n    bar:\n      type: integer\n      minimum: 42\n  required: [\"bar\"]\n  description: \"foo bar object\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | is not a structural schema because of the following violations:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15200"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: object\ndescription: \"foo bar object\"\nproperties:\n  foo:\n    type: string\n    pattern: \"abc\"\n  bar:\n    type: integer\n  metadata:\n    type: object\n    properties:\n      name:\n        type: string\n        pattern: \"^a\"\nanyOf:\n- properties:\n    bar:\n      minimum: 42\n  required: [\"bar\"]\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Violations of the structural schema rules are reported in the NonStructural condition in the CustomResourceDefinition.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15201"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  someRandomField: 42\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15202"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: CronTab\nmetadata:\n  creationTimestamp: 2017-05-31T12:56:35Z\n  generation: 1\n  name: my-new-cron-object\n  namespace: default\n  resourceVersion: \"285\"\n  uid: 9423255b-4600-11e7-af6a-28d2447dc82b\nspec:\n  cronSpec: '* * * * */5'\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15203"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  json:\n    x-kubernetes-preserve-unknown-fields: true\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | The field json can store any JSON value, without anything being pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15204"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  json:\n    x-kubernetes-preserve-unknown-fields: true\n    type: object\n    description: this is arbitrary JSON\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | With this, only object type values are allowed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15205"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  json:\n    x-kubernetes-preserve-unknown-fields: true\n    type: object\n    properties:\n      spec:\n        type: object\n        properties:\n          foo:\n            type: string\n          bar:\n            type: string\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | With this, the value:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15206"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\njson:\n  spec:\n    foo: abc\n    bar: def\n    something: x\n  status:\n    something: x\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | is pruned to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15207"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\njson:\n  spec:\n    foo: abc\n    bar: def\n  status:\n    something: x\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | This means that the something field in the specified spec object is pruned, but everything outside is not.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15208"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  foo:\n    x-kubernetes-int-or-string: true\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Also those nodes are partially excluded from rule 3 in the sense that the following two patterns are allowed (exactly those, without variations in order to additional fields):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15209"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-int-or-string: true\nanyOf:\n  - type: integer\n  - type: string\n...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15210"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-int-or-string: true\nallOf:\n  - anyOf:\n      - type: integer\n      - type: string\n  - # ... zero or more\n...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | With one of those specification, both an integer and a string validate.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15211"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  foo:\n    x-kubernetes-embedded-resource: true\n    x-kubernetes-preserve-unknown-fields: true\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Here, the field foo holds a complete object, e.g.:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15212"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nfoo:\n  apiVersion: v1\n  kind: Pod\n  spec:\n    # ...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15213"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  finalizers:\n  - stable.example.com/finalizer\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15214"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15215"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * *\"\n  image: my-awesome-cron-image\n  replicas: 15\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15216"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 5\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15217"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        x-kubernetes-validations:\n          - rule: \"self.minReplicas <= self.replicas\"\n            message: \"replicas should be greater than or equal to minReplicas.\"\n          - rule: \"self.replicas <= self.maxReplicas\"\n            message: \"replicas should be smaller than or equal to maxReplicas.\"\n        properties:\n          # ...\n          minReplicas:\n            type: integer\n          replicas:\n            type: integer\n          maxReplicas:\n            type: integer\n        required:\n          - minReplicas\n          - replicas\n          - maxReplicas\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | will reject a request to create this custom resource:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15218"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  minReplicas: 0\n  replicas: 20\n  maxReplicas: 10\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | with the response:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15219"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    x-kubernetes-validations:\n      - rule: \"self.status.availableReplicas >= self.spec.minReplicas\"\n    properties:\n        spec:\n          type: object\n          properties:\n            minReplicas:\n              type: integer\n            # ...\n        status:\n          type: object\n          properties:\n            availableReplicas:\n              type: integer\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable via self.field and field presence can be checked via has(self.field). Null valued field", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15220"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        x-kubernetes-validations:\n          - rule: \"has(self.foo)\"\n        properties:\n          # ...\n          foo:\n            type: integer\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map are accessible via self[mapKey], map containment can be checked via mapKey in self and all entries of the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15221"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        x-kubernetes-validations:\n          - rule: \"self['xyz'].foo > 0\"\n        additionalProperties:\n          # ...\n          type: object\n          properties:\n            foo:\n              type: integer\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an array, the elements of the array are accessible via self[i] and also by macros and functions.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15222"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      # ...\n      foo:\n        type: array\n        x-kubernetes-validations:\n          - rule: \"size(self) == 1\"\n        items:\n          type: string\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to a scalar, self is bound to the scalar value.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15223"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# ...\n  openAPIV3Schema:\n    type: object\n    properties:\n      spec:\n        type: object\n        properties:\n          # ...\n          foo:\n            type: integer\n            x-kubernetes-validations:\n            - rule: \"self > 0\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Examples:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15224"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-validations:\n- rule: \"self.x <= self.maxLimit\"\n  messageExpression: '\"x exceeded max limit of \" + string(self.maxLimit)'\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Keep in mind that CEL string concatenation (+ operator) does not auto-cast to string. If you have a non-string scalar, use the string(<value>) function to cast the scalar to a string like shown in the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15225"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-validations:\n- rule: \"self.x <= self.maxLimit\"\n  reason: \"FieldValueInvalid\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | The HTTP status code returned to the caller will match the reason of the first failed validation rule. The currently supported reasons are: \"FieldValueInvalid\", \"FieldValueForbidden\", \"FieldValueRequi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15226"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nx-kubernetes-validations:\n- rule: \"self.foo.test.x <= self.maxLimit\"\n  fieldPath: \".foo.test.x\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | In the example above, the validation checks the value of field x should be less than the value of maxLimit. If no fieldPath specified, when validation fails, the fieldPath would be default to wherever", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15227"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: string\nenum: [\"low\", \"medium\", \"high\"]\nx-kubernetes-validations:\n- rule: \"!(self == 'high' && oldSelf == 'low') && !(self == 'low' && oldSelf == 'high')\"\n  message: cannot transition directly between 'low' and 'high'\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Unlike other rules, transition rules apply only to operations meeting the following criteria:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15228"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      items:\n        type: string\n      x-kubernetes-validations:\n        - rule: \"self.all(x, x.contains('a string'))\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | then the API server rejects this rule on validation budget grounds with error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15229"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      maxItems: 25\n      items:\n        type: string\n        maxLength: 10\n      x-kubernetes-validations:\n        - rule: \"self.all(x, x.contains('a string'))\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | The cost estimation system takes into account how many times the rule will be executed in addition to the estimated cost of the rule itself. For instance, the following rule will have the same estimat", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15230"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      maxItems: 25\n      items:\n        type: string\n        x-kubernetes-validations:\n          - rule: \"self.contains('a string'))\"\n        maxLength: 10\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If a list inside of a list has a validation rule that uses self.all, that is significantly more expensive than a non-nested list with the same rule. A rule that would have been allowed on a non-nested", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15231"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      items:\n        type: integer\n    x-kubernetes-validations:\n      - rule: \"self.all(x, x == 5)\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | But the same rule on the following schema (with a nested array added) produces a validation error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15232"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nopenAPIV3Schema:\n  type: object\n  properties:\n    foo:\n      type: array\n      items:\n        type: array\n        items:\n          type: integer\n        x-kubernetes-validations:\n          - rule: \"self.all(x, x == 5)\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | This is because each item of foo is itself an array, and each subarray in turn calls self.all. Avoid nested lists and maps if possible where validation rules are used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15233"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                  default: \"5 0 * * *\"\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n                  default: 1\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15234"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15235"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"5 0 * * *\"\n  image: my-awesome-cron-image\n  replicas: 1\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15236"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: object\nproperties:\n  spec:\n    type: object\n    properties:\n      foo:\n        type: string\n        nullable: false\n        default: \"default\"\n      bar:\n        type: string\n        nullable: true\n      baz:\n        type: string\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | creating an object with null values for foo and bar and baz", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15237"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  foo: null\n  bar: null\n  baz: null\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15238"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  foo: \"default\"\n  bar: null\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | with foo pruned and defaulted because the field is non-nullable, bar maintaining the null value due to nullable: true, and baz pruned because the field is non-nullable and has no default.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15239"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              cronSpec:\n                type: string\n              image:\n                type: string\n              replicas:\n                type: integer\n    additionalPrinterColumns:\n    - name: Spec\n      type: string\n      description: The cron spec defining the interval a CronJob is run\n      jsonPath: .spec.cronSpec\n    - name: Replicas\n      type: integer\n      description: The number of jobs launched by the CronJob\n      jsonPath: .spec.replicas\n    - name: Age\n      type: date\n      jsonPath: .metadata.creationTimestamp\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15240"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15241"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15242"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n            status:\n              type: object\n              properties:\n                replicas:\n                  type: integer\n                labelSelector:\n                  type: string\n      # subresources describes the subresources for custom resources.\n      subresources:\n        # status enables the status subresource.\n        status: {}\n        # scale enables the scale subresource.\n        scale:\n          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.\n          specReplicasPath: .spec.replicas\n          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.\n          statusReplicasPath: .status.replicas\n          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.\n          labelSelectorPath: .status.labelSelector\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15243"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 3\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15244"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get <category-name>\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | The following example adds all in the list of categories in the CustomResourceDefinition and illustrates how to output the custom resource using kubectl get all.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15245"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n    # categories is a list of grouped resources the custom resource belongs to.\n    categories:\n    - all\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15246"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15247"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # A schema is required\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15248"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n  - name: v1\n    served: true\n    storage: false\n  validation:\n    openAPIV3Schema:\n      type: object\n      properties:\n        host:\n          type: string\n        port:\n          type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the PascalCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to create it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15249"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n    \n    schema: ...\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n    schema: ...\n  - name: v1\n    served: true\n    storage: true\n    schema: ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: crontabs.example.com spec: group: example.com na", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15250"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  validation: ...\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n  - name: v1\n    served: true\n    storage: true\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | An older API version cannot be dropped from a CustomResourceDefinition manifest until existing stored data has been migrated to the newer API version for all clusters that served the older version of", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15251"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1beta1\n    # This indicates the v1beta1 version of the custom resource is no longer served.\n    # API requests to this version receive a not found error in the server response.\n    served: false\n    schema: ...\n  - name: v1\n    served: true\n    # The new served version should be set as the storage version\n    storage: true\n    schema: ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | The above example has a None conversion between versions which only sets the apiVersion field on conversion and does not change the rest of the object. The API server also supports webhook conversions", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15252"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhook is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhook:\n      # conversionReviewVersions indicates what ConversionReview versions are understood/preferred by the webhook.\n      # The first version in the list understood by the API server is sent to the webhook.\n      # The webhook must respond with a ConversionReview object in the same version it received.\n      conversionReviewVersions: [\"v1\",\"v1beta1\"]\n      clientConfig:\n        service:\n          namespace: default\n          name: example-conversion-webhook-server\n          path: /crdconvert\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15253"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # prunes object fields that are not specified in OpenAPI schemas below.\n  preserveUnknownFields: false\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhookClientConfig is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhookClientConfig:\n      service:\n        namespace: default\n        name: example-conversion-webhook-server\n        path: /crdconvert\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to apply it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15254"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15255"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | The service stanza inside webhookClientConfig is a reference to the service for a conversion webhook. If the webhook is running within the cluster, then you should use service instead of url. The serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15256"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        service:\n          namespace: my-service-namespace\n          name: my-service-name\n          path: /my-path\n          port: 1234\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15257"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      service:\n        namespace: my-service-namespace\n        name: my-service-name\n        path: /my-path\n        port: 1234\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Webhooks are sent a POST request, with Content-Type: application/json, with a ConversionReview API object in the apiextensions.k8s.io API group serialized to JSON as the body.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15258"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      conversionReviewVersions: [\"v1\", \"v1beta1\"]\n      ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | conversionReviewVersions is a required field when creating apiextensions.k8s.io/v1 custom resource definitions. Webhooks are required to support at least one ConversionReview version understood by the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15259"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    conversionReviewVersions: [\"v1\", \"v1beta1\"]\n    ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | If no conversionReviewVersions are specified, the default when creating apiextensions.k8s.io/v1beta1 custom resource definitions is v1beta1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15260"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"apiextensions.k8s.io/v1\",\n  \"kind\": \"ConversionReview\",\n  \"request\": {\n    # Random uid uniquely identifying this conversion call\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \n    # The API group and version the objects should be converted to\n    \"desiredAPIVersion\": \"example.com/v1\",\n    \n    # The list of objects to convert.\n    # May contain one or more objects, in one or more versions.\n    \"objects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"hostPort\": \"localhost:1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"hostPort\": \"example.com:2345\"\n      }\n    ]\n  }\n}\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | { # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 \"apiVersion\": \"apiextensions.k8s.io/v1beta1\", \"kind\": \"ConversionReview\", \"request\": { # Random uid uniquely identifying this co", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15261"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{\n  # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\n  \"apiVersion\": \"apiextensions.k8s.io/v1beta1\",\n  \"kind\": \"ConversionReview\",\n  \"request\": {\n    # Random uid uniquely identifying this conversion call\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \n    # The API group and version the objects should be converted to\n    \"desiredAPIVersion\": \"example.com/v1\",\n    \n    # The list of objects to convert.\n    # May contain one or more objects, in one or more versions.\n    \"objects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"hostPort\": \"localhost:1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1beta1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"hostPort\": \"example.com:2345\"\n      }\n    ]\n  }\n}\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Webhooks respond with a 200 HTTP status code, Content-Type: application/json, and a body containing a ConversionReview object (in the same version they were sent), with the response stanza populated,", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15262"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"apiextensions.k8s.io/v1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    # must match <request.uid>\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \"result\": {\n      \"status\": \"Success\"\n    },\n    # Objects must match the order of request.objects, and have apiVersion set to <request.desiredAPIVersion>.\n    # kind, metadata.uid, metadata.name, and metadata.namespace fields must not be changed by the webhook.\n    # metadata.labels and metadata.annotations fields may be changed by the webhook.\n    # All other changes to metadata fields by the webhook are ignored.\n    \"convertedObjects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"host\": \"localhost\",\n        \"port\": \"1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"host\": \"example.com\",\n        \"port\": \"2345\"\n      }\n    ]\n  }\n}\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | { # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 \"apiVersion\": \"apiextensions.k8s.io/v1beta1\", \"kind\": \"ConversionReview\", \"response\": { # must match <request.uid> \"uid\": \"7", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15263"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{\n  # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\n  \"apiVersion\": \"apiextensions.k8s.io/v1beta1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    # must match <request.uid>\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n    \"result\": {\n      \"status\": \"Failed\"\n    },\n    # Objects must match the order of request.objects, and have apiVersion set to <request.desiredAPIVersion>.\n    # kind, metadata.uid, metadata.name, and metadata.namespace fields must not be changed by the webhook.\n    # metadata.labels and metadata.annotations fields may be changed by the webhook.\n    # All other changes to metadata fields by the webhook are ignored.\n    \"convertedObjects\": [\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-04T14:03:02Z\",\n          \"name\": \"local-crontab\",\n          \"namespace\": \"default\",\n          \"resourceVersion\": \"143\",\n          \"uid\": \"3415a7fc-162b-4300-b5da-fd6083580d66\"\n        },\n        \"host\": \"localhost\",\n        \"port\": \"1234\"\n      },\n      {\n        \"kind\": \"CronTab\",\n        \"apiVersion\": \"example.com/v1\",\n        \"metadata\": {\n          \"creationTimestamp\": \"2019-09-03T13:02:01Z\",\n          \"name\": \"remote-crontab\",\n          \"resourceVersion\": \"12893\",\n          \"uid\": \"359a83ec-b575-460d-b553-d859cedde8a0\"\n        },\n        \"host\": \"example.com\",\n        \"port\": \"2345\"\n      }\n    ]\n  }\n}\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | If conversion fails, a webhook should return a response stanza containing the following fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15264"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"apiextensions.k8s.io/v1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    \"uid\": \"<value from request.uid>\",\n    \"result\": {\n      \"status\": \"Failed\",\n      \"message\": \"hostPort could not be parsed into a separate host and port\"\n    }\n  }\n}\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | { # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 \"apiVersion\": \"apiextensions.k8s.io/v1beta1\", \"kind\": \"ConversionReview\", \"response\": { \"uid\": \"<value from request.uid>\", \"", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15265"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n{\n  # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\n  \"apiVersion\": \"apiextensions.k8s.io/v1beta1\",\n  \"kind\": \"ConversionReview\",\n  \"response\": {\n    \"uid\": \"<value from request.uid>\",\n    \"result\": {\n      \"status\": \"Failed\",\n      \"message\": \"hostPort could not be parsed into a separate host and port\"\n    }\n  }\n}\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | When an object is written, it is stored at the version designated as the storage version at the time of the write. If the storage version changes, existing objects are never converted automatically. H", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15266"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch customresourcedefinitions <CRD_Name> --subresource='status' --type='merge' -p '{\"status\":{\"storedVersions\":[\"v1\"]}}'\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Setting up an extension API server to work with the aggregation layer allows the Kubernetes apiserver to be extended with additional APIs, which are not part of the core Kubernetes APIs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15267"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\n11.4 - Configure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15268"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\n11.4 - Configure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15269"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15270"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15271"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15272"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n11.5 - Use an HTTP Proxy to Access the Kubernetes API | When the proxy server is running, you can explore the API using curl, wget, or a browser.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15273"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: LRMEMMW2 # shortened for readability \n    server: https://<API_SERVER_IP_ADDRESS>:6443  # the \"Kubernetes API\" server, in other words the IP address of kubernetes-remote-server.example\n    proxy-url: socks5://localhost:1080   # the \"SSH SOCKS5 proxy\" in the diagram above\n  name: default\ncontexts:\n- context:\n    cluster: default\n    user: default\n  name: default\ncurrent-context: default\nkind: Config\npreferences: {}\nusers:\n- name: default\n  user:\n    client-certificate-data: LS0tLS1CR== # shortened for readability\n    client-key-data: LS0tLS1CRUdJT=      # shortened for readability\n```\n\n11.6 - Use a SOCKS5 Proxy to Access the Kubernetes API | Once you have created the tunnel via the ssh command mentioned earlier, and defined either the environment variable or the proxy-url attribute, you can interact with your cluster through that proxy. F", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15274"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\n11.7 - Set up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15275"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    volumeMounts:\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\n11.7 - Set up Konnectivity service | Generate or obtain a certificate and kubeconfig for konnectivity-server. For example, you can use the OpenSSL command line tool to issue a X.509 certificate, using the cluster CA certificate /etc/kube", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15276"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nopenssl req -subj \"/CN=system:konnectivity-server\" -new -newkey rsa:2048 -nodes -out konnectivity.csr -keyout konnectivity.key\nopenssl x509 -req -in konnectivity.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out konnectivity.crt -days 375 -sha256\nSERVER=$(kubectl config view -o jsonpath='{.clusters..server}')\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-credentials system:konnectivity-server --client-certificate konnectivity.crt --client-key konnectivity.key --embed-certs=true\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-cluster kubernetes --server \"$SERVER\" --certificate-authority /etc/kubernetes/pki/ca.crt --embed-certs=true\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config set-context system:konnectivity-server@kubernetes --cluster kubernetes --user system:konnectivity-server\nkubectl --kubeconfig /etc/kubernetes/konnectivity-server.conf config use-context system:konnectivity-server@kubernetes\nrm -f konnectivity.crt konnectivity.key konnectivity.csr\n```\n\n11.7 - Set up Konnectivity service | Next, you need to deploy the Konnectivity server and agents. kubernetes-sigs/apiserver-network-proxy is a reference implementation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15277"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\n11.7 - Set up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15278"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\n11.7 - Set up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15279"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\n11.7 - Set up Konnectivity service | Kubernetes lets you use a public key infrastructure (PKI) to authenticate to your cluster as a client.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15280"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\n12.3 - Manage TLS Certificates in a Cluster | The ability to approve CSRs decides who trusts whom within your environment. The ability to approve CSRs should not be granted broadly or lightly.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15281"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny\n```\n\n12.3 - Manage TLS Certificates in a Cluster | The ability to approve CSRs decides who trusts whom within your environment. The ability to approve CSRs should not be granted broadly or lightly.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15282"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\n13.1 - Building a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15283"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15284"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15285"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo daemonset\n```\n\n13.3 - Perform a Rollback on a DaemonSet | To watch the progress of the rollback:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15286"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history\n```\n\n13.3 - Perform a Rollback on a DaemonSet | To see what is stored in each revision, find the DaemonSet revision raw resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15287"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\n13.4 - Running Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15288"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15289"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  creationTimestamp: \"2023-10-12T15:11:07Z\"\n  deletionGracePeriodSeconds: 0\n  deletionTimestamp: \"2023-10-12T15:12:45Z\"\n  finalizers:\n  - networking.k8s.io/service-cidr-finalizer\n  name: newcidr1\n  resourceVersion: \"1133\"\n  uid: 5ffd8afe-c78f-4e60-ae76-cec448a8af40\nspec:\n  cidrs:\n  - 10.96.0.0/24\nstatus:\n  conditions:\n  - lastTransitionTime: \"2023-10-12T15:12:45Z\"\n    message: There are still IPAddresses referencing the ServiceCIDR, please remove\n      them or create a new ServiceCIDR\n    reason: OrphanIPAddress\n    status: \"False\"\n    type: Ready\n```\n\n14.2 - Extend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15290"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nmatchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n```\n\n14.2 - Extend Service IP Ranges | as in the examples below.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15291"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(newCIDR, variables.allowed.exists(allowedCIDR, cidr(allowedCIDR).containsCIDR(newCIDR)))\"\n  # For all CIDRs (newCIDR) listed in the spec.cidrs of the submitted ServiceCIDR\n  # object, check if there exists at least one CIDR (allowedCIDR) in the `allowed`\n  # list of the VAP such that the allowedCIDR fully contains the newCIDR.\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs.default\"\n  validationActions: [Deny,Audit]\n```\n\n14.2 - Extend Service IP Ranges | Consult the CEL documentation to learn more about CEL if you want to write your own validation expression.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15292"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.deny\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  validations:\n  - expression: \"object.metadata.name == 'kubernetes'\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-deny-binding\"\nspec:\n  policyName: \"servicecidrs.deny\"\n  validationActions: [Deny,Audit]\n```\n\n14.2 - Extend Service IP Ranges | This document shares how to reconfigure the default Service IP range(s) assigned to a cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15293"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nenv:\n        - name: MY_POD_IPS\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIPs\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The following command prints the value of the MY_POD_IPS environment variable from within a container. The value is a comma separated list that corresponds to the Pod's IPv4 and IPv6 addresses.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15294"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15295"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: default\nspec:\n  clusterIP: 10.0.217.164\n  clusterIPs:\n  - 10.0.217.164\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 9376\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines IPv6 as the first array element in .spec.ipFamilies. Kubernetes will assign a cluster IP for the Service from the IPv6 range configured service-clu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15296"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15297"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 2001:db8:fd00::5118\n  clusterIPs:\n  - 2001:db8:fd00::5118\n  ipFamilies:\n  - IPv6\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines PreferDualStack in .spec.ipFamilyPolicy. Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and select th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15298"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15299"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15300"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create something\n```\n\n15 - Extend kubectl with plugins | It is currently not possible to create plugins that overwrite existing kubectl commands or extend commands other than create. For example, creating a plugin kubectl-version will cause that plugin to n", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15301"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-create-something\n```\n\n15 - Extend kubectl with plugins | It is currently not possible to create plugins that overwrite existing kubectl commands or extend commands other than create. For example, creating a plugin kubectl-version will cause that plugin to n", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15302"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n#!/bin/bash\n\n# optional argument handling\nif [[ \"$1\" == \"version\" ]]\nthen\n    echo \"1.0.0\"\n    exit 0\nfi\n\n# optional argument handling\nif [[ \"$1\" == \"config\" ]]\nthen\n    echo \"$KUBECONFIG\"\n    exit 0\nfi\n\necho \"I am a plugin named kubectl-foo\"\n```\n\n15 - Extend kubectl with plugins | To use a plugin, make the plugin executable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15303"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nexport KUBECONFIG=~/.kube/config\nkubectl foo config\n```\n\n15 - Extend kubectl with plugins | Additionally, the first argument that is passed to a plugin will always be the full path to the location where it was invoked ($0 would equal /usr/local/bin/kubectl-foo in the example above).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15304"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz arg1 --flag=value arg2\n```\n\n15 - Extend kubectl with plugins | Example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15305"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-foo-bar-baz-arg1\n```\n\n15 - Extend kubectl with plugins | Example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15306"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# create a plugin\necho -e '#!/bin/bash\\n\\necho \"My first command-line argument was $1\"' > kubectl-foo-bar-baz\nsudo chmod +x ./kubectl-foo-bar-baz\n\n# \"install\" your plugin by moving it to a directory in your $PATH\nsudo mv ./kubectl-foo-bar-baz /usr/local/bin\n\n# check that kubectl recognizes your plugin\nkubectl plugin list\n```\n\n15 - Extend kubectl with plugins | As you can see, your plugin was found based on the kubectl command specified by a user, and all extra arguments and flags were passed as-is to the plugin executable once it was found.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15307"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# create a plugin containing an underscore in its filename\necho -e '#!/bin/bash\\n\\necho \"I am a plugin with a dash in my name\"' > ./kubectl-foo_bar\nsudo chmod +x ./kubectl-foo_bar\n\n# move the plugin into your $PATH\nsudo mv ./kubectl-foo_bar /usr/local/bin\n\n# You can now invoke your plugin via kubectl:\nkubectl foo-bar\n```\n\n15 - Extend kubectl with plugins | Note that the introduction of underscores to a plugin filename does not prevent you from having commands such as kubectl foo_bar. The command from the above example, can be invoked using either a dash", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15308"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# You can invoke your custom command with a dash\nkubectl foo-bar\n```\n\n15 - Extend kubectl with plugins | It is possible to have multiple plugins with the same filename in different locations throughout your PATH. For example, given a PATH with the following value: PATH=/usr/local/bin/plugins:/usr/local/b", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15309"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# You can also invoke your custom command with an underscore\nkubectl foo_bar\n```\n\n15 - Extend kubectl with plugins | It is possible to have multiple plugins with the same filename in different locations throughout your PATH. For example, given a PATH with the following value: PATH=/usr/local/bin/plugins:/usr/local/b", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15310"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nPATH=/usr/local/bin/plugins:/usr/local/bin/moreplugins kubectl plugin list\n```\n\n15 - Extend kubectl with plugins | In the above scenario, the warning under /usr/local/bin/moreplugins/kubectl-foo tells you that this plugin will never be executed. Instead, the executable that appears first in your PATH, /usr/local/b", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15311"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\n# for a given kubectl command, the plugin with the longest possible filename will always be preferred\nkubectl foo bar baz\n```\n\n15 - Extend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15312"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz buz\n```\n\n15 - Extend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15313"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nls ./plugin_command_tree\n```\n\n15 - Extend kubectl with plugins | You can use the aforementioned kubectl plugin list command to ensure that your plugin is visible by kubectl, and verify that there are no warnings preventing it from being called as a kubectl command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15314"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-parent\nkubectl-parent-subcommand\nkubectl-parent-subcommand-subsubcommand\n```\n\n15 - Extend kubectl with plugins | You can use the aforementioned kubectl plugin list command to ensure that your plugin is visible by kubectl, and verify that there are no warnings preventing it from being called as a kubectl command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15315"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages-2Mi\n      name: hugepage-2mi\n    - mountPath: /hugepages-1Gi\n      name: hugepage-1gi\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        hugepages-1Gi: 2Gi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage-2mi\n    emptyDir:\n      medium: HugePages-2Mi\n  - name: hugepage-1gi\n    emptyDir:\n      medium: HugePages-1Gi\n```\n\n16 - Manage HugePages | A pod may use medium: HugePages only if it requests huge pages of one size.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15316"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages\n      name: hugepage\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage\n    emptyDir:\n      medium: HugePages\n```\n\n16 - Manage HugePages | Kubernetes includes stable support for managing AMD and NVIDIA GPUs (graphical processing units) across different nodes in your cluster, using device plugins.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15317"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\n17 - Schedule GPUs | If different nodes in your cluster have different types of GPUs, then you can use Node Labels and Node Selectors to schedule pods to appropriate nodes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15318"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  # You can use Kubernetes node affinity to schedule this Pod onto a node\n  # that provides the kind of GPU that its container needs in order to work\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: \"gpu.gpu-vendor.example/installed-memory\"\n            operator: Gt # (greater than)\n            values: [\"40535\"]\n          - key: \"feature.node.kubernetes.io/pci-10.present\" # NFD Feature label\n            values: [\"true\"] # (optional) only schedule on nodes with PCI device 10\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\n17 - Schedule GPUs | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15319"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\n1.1 - Install and Set Up kubectl on Linux | Install kubectl", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15320"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.1 - Install and Set Up kubectl on Linux | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15321"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\n1.1 - Install and Set Up kubectl on Linux | Update the apt package index and install packages needed to use the Kubernetes apt repository:sudo apt-get update # apt-transport-https may be a dummy package; if so, you can skip that package sudo ap", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15322"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n1.1 - Install and Set Up kubectl on Linux | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15323"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null\nsudo chmod a+r /etc/bash_completion.d/kubectl\n```\n\n1.1 - Install and Set Up kubectl on Linux | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15324"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\n1.1 - Install and Set Up kubectl on Linux | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15325"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nsha256sum: WARNING: 1 computed checksum did NOT match\n```\n\n1.1 - Install and Set Up kubectl on Linux | Install kubectl-convert", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15326"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\n1.1 - Install and Set Up kubectl on Linux | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15327"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\n1.2 - Install and Set Up kubectl on macOS | Make the kubectl binary executable.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15328"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15329"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\n1.2 - Install and Set Up kubectl on macOS | After installing and validating kubectl, delete the checksum file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15330"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you are on macOS and using Macports package manager, you can install kubectl with Macports.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15331"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.2 - Install and Set Up kubectl on macOS | In order for kubectl to find and access a Kubernetes cluster, it needs a kubeconfig file, which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cl", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15332"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n1.2 - Install and Set Up kubectl on macOS | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15333"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion bash >/usr/local/etc/bash_completion.d/kubectl\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you have an alias for kubectl, you can extend shell completion to work with that alias:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15334"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion fish | source\n```\n\n1.2 - Install and Set Up kubectl on macOS | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15335"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl-convert: FAILED\nshasum: WARNING: 1 computed checksum did NOT match\n```\n\n1.2 - Install and Set Up kubectl on macOS | Make kubectl-convert binary executable", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15336"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\n1.2 - Install and Set Up kubectl on macOS | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15337"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.3 - Install and Set Up kubectl on Windows | Or use this for detailed view of version:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15338"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client --output=yaml\n```\n\n1.3 - Install and Set Up kubectl on Windows | To install kubectl on Windows you can use either Chocolatey package manager, Scoop command-line installer, or winget package manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15339"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n1.3 - Install and Set Up kubectl on Windows | Navigate to your home directory:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15340"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n1.3 - Install and Set Up kubectl on Windows | In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud providers' managed Kubernetes offerings. These providers have released kubectl plugins to provide the cloud-spec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15341"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell | Out-String | Invoke-Expression\n```\n\n1.3 - Install and Set Up kubectl on Windows | This command will regenerate the auto-completion script on every PowerShell start up. You can also add the generated script directly to your $PROFILE file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15342"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl completion powershell >> $PROFILE\n```\n\n1.3 - Install and Set Up kubectl on Windows | After reloading your shell, kubectl autocompletion should be working.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15343"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert --help\n```\n\n1.3 - Install and Set Up kubectl on Windows | If you do not see an error, it means the plugin is successfully installed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15344"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# kubeadm-config.yaml\nkind: ClusterConfiguration\napiVersion: kubeadm.k8s.io/v1beta4\nkubernetesVersion: v1.21.0\n---\nkind: KubeletConfiguration\napiVersion: kubelet.config.k8s.io/v1beta1\ncgroupDriver: systemd\n```\n\n2.1.6 - Configuring a cgroup driver | Such a configuration file can then be passed to the kubeadm command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15345"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nencryptionAlgorithm: <ALGORITHM>\n```\n\n2.1.7 - Certificate Management with kubeadm | <ALGORITHM> can be one of RSA-2048 (default), RSA-3072, RSA-4096 or ECDSA-P256.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15346"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncertificateValidityPeriod: 8760h # Default: 365 days × 24 hours = 1 year\ncaCertificateValidityPeriod: 87600h # Default: 365 days × 24 hours * 10 = 10 years\n```\n\n2.1.7 - Certificate Management with kubeadm | The values of the fields follow the accepted format for Go's time.Duration values, with the longest supported unit being h (hours).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15347"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\ncontrollerManager:\n  extraArgs:\n  - name: \"cluster-signing-cert-file\"\n    value: \"/etc/kubernetes/pki/ca.crt\"\n  - name: \"cluster-signing-key-file\"\n    value: \"/etc/kubernetes/pki/ca.key\"\n```\n\n2.1.7 - Certificate Management with kubeadm | See Create CertificateSigningRequest for creating CSRs with the Kubernetes API.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15348"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nserverTLSBootstrap: true\n```\n\n2.1.7 - Certificate Management with kubeadm | If you have already created the cluster you must adapt it by doing the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15349"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <CSR-name>\n```\n\n2.1.7 - Certificate Management with kubeadm | By default, these serving certificate will expire after one year. Kubeadm sets the KubeletConfiguration field rotateCertificates to true, which means that close to expiration a new set of CSRs for the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15350"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# example.yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n# Will be used as the target \"cluster\" in the kubeconfig\nclusterName: \"kubernetes\"\n# Will be used as the \"server\" (IP or DNS name) of this cluster in the kubeconfig\ncontrolPlaneEndpoint: \"some-dns-address:6443\"\n# The cluster CA key and certificate will be loaded from this local directory\ncertificatesDir: \"/etc/kubernetes/pki\"\n```\n\n2.1.7 - Certificate Management with kubeadm | Make sure that these settings match the desired target cluster settings. To see the settings of an existing cluster use:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15351"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get cm kubeadm-config -n kube-system -o=jsonpath=\"{.data.ClusterConfiguration}\"\n```\n\n2.1.7 - Certificate Management with kubeadm | The following example will generate a kubeconfig file with credentials valid for 24 hours for a new user johndoe that is part of the appdevs group:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15352"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubeadm-config\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The configuration is located under the data.ClusterConfiguration key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15353"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kubelet-config\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The configuration is located under the data.kubelet key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15354"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit cm -n kube-system kube-proxy\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The configuration is located under the data.config.conf key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15355"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete po -n kube-system -l k8s-app=kube-proxy\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | New Pods that use the updated ConfigMap will be created.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15356"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment -n kube-system coredns\nkubectl edit service -n kube-system kube-dns\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | Once the CoreDNS changes are applied you can restart the CoreDNS deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15357"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart deployment -n kube-system coredns\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | During the execution of kubeadm upgrade on a managed node, kubeadm might overwrite configuration that was applied after the cluster was created (reconfiguration).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15358"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit no <node-name>\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | During kubeadm upgrade the contents of such a Node might get overwritten. If you would like to persist your modifications to the Node object after upgrade, you can prepare a kubectl patch and apply it", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15359"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch no <node-name> --patch-file <patch-file>\n```\n\n2.1.8 - Reconfiguring a kubeadm cluster | The main source of control plane configuration is the ClusterConfiguration object stored in the cluster. To extend the static Pod manifests configuration, patches can be used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15360"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npriorityclass/low-priority-class.yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15361"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: placeholder # these Pods represent placeholder capacity\nvalue: -1000\nglobalDefault: false\ndescription: \"Negative priority for placeholder pods to enable overprovisioning.\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | Then create the PriorityClass:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15362"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capac", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15363"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndeployments/deployment-with-capacity-reservation.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15364"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: capacity-reservation\n  # You should decide what namespace to deploy this into\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: capacity-placeholder\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: capacity-placeholder\n      annotations:\n        kubernetes.io/description: \"Capacity reservation\"\n    spec:\n      priorityClassName: placeholder\n      affinity: # Try to place these overhead Pods on different nodes\n                # if possible\n        podAntiAffinity:\n          preferredDuringSchedulingIgnoredDuringExecution:\n          - weight: 100\n            podAffinityTerm:\n              labelSelector:\n                matchLabels:\n                  app.kubernetes.io/name: capacity-placeholder\n              topologyKey: topology.kubernetes.io/hostname\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause:3.6\n        resources:\n          requests:\n            cpu: \"50m\"\n            memory: \"512Mi\"\n          limits:\n            memory: \"512Mi\"\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | You should select, or create, a namespace that the placeholder Pods will go into.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15365"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit deployment capacity-reservation\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, define the resource requests and limits for a single placeholder pod as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15366"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment capacity-reservation --replicas=5\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | Verify the scaling:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15367"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment capacity-reservation\n```\n\n2.2 - Overprovision Node Capacity For A Cluster | The output should reflect the updated number of replicas:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15368"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl drain <node-to-drain> --ignore-daemonsets\n```\n\n2.3.1 - Changing the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-drain> with the name of your node you are draining.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15369"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-to-uncordon>\n```\n\n2.3.1 - Changing the Container Runtime on a Node from Docker Engine to containerd | Replace <node-to-uncordon> with the name of your node you previously drained.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15370"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes -o wide\n```\n\n2.3.2 - Find Out What Container Runtime is Used on a Node | The output is similar to the following. The column CONTAINER-RUNTIME outputs the runtime and its version.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15371"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces \\\n-o=jsonpath='{range .items[*]}{\"\\n\"}{.metadata.namespace}{\":\\t\"}{.metadata.name}{\":\\t\"}{range .spec.volumes[*]}{.hostPath.path}{\", \"}{end}{end}' \\\n| sort \\\n| grep '/var/run/docker.sock'\n```\n\n2.3.5 - Migrating telemetry and security agents from dockershim | If your cluster nodes are customized and install additional security and telemetry agents on the node, check with the agent vendor to verify whether it has any dependency on Docker.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15372"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15373"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15374"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-limit-range\nspec:\n  limits:\n  - default:\n      memory: 512Mi\n    defaultRequest:\n      memory: 256Mi\n    type: Container\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the LimitRange in the default-mem-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15375"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies defa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15376"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15377"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo\nspec:\n  containers:\n  - name: default-mem-demo-ctr\n    image: nginx\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15378"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15379"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15380"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod default-mem-demo --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory limit, but not a request:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15381"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15382"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-2\nspec:\n  containers:\n  - name: default-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1Gi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15383"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-2.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15384"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-2 --output=yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to match its memory limit. Notice that the container was not assigned the default memory request value of 256Mi.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15385"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-defaults-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15386"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-mem-demo-3\nspec:\n  containers:\n  - name: default-mem-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        memory: \"128Mi\"\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15387"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-3.yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15388"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-mem-demo-3 --output=yaml --namespace=default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | The output shows that the container's memory request is set to the value specified in the container's manifest. The container is limited to use no more than 512MiB of memory, which matches the default", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15389"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-mem-example\n```\n\n2.5.1 - Configure Default Memory Requests and Limits for a Namespace | Configure Default CPU Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15390"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Here's a manifest for an example LimitRange. The manifest specifies a default CPU request and a default CPU limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15391"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15392"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-limit-range\nspec:\n  limits:\n  - default:\n      cpu: 1\n    defaultRequest:\n      cpu: 0.5\n    type: Container\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the LimitRange in the default-cpu-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15393"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Now if you create a Pod in the default-cpu-example namespace, and any container in that Pod does not specify its own values for CPU request and CPU limit, then the control plane applies default values", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15394"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15395"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo\nspec:\n  containers:\n  - name: default-cpu-demo-ctr\n    image: nginx\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15396"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | View the Pod's specification:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15397"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod default-cpu-demo --output=yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | The output shows that the Pod's only container has a CPU request of 500m cpu (which you can read as “500 millicpu”), and a CPU limit of 1 cpu. These are the default values specified by the LimitRange.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15398"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15399"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-2\nspec:\n  containers:\n  - name: default-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15400"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-2.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15401"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-defaults-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15402"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: default-cpu-demo-3\nspec:\n  containers:\n  - name: default-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      requests:\n        cpu: \"0.75\"\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15403"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-3.yaml --namespace=default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | View the specification of the Pod that you created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15404"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace default-cpu-example\n```\n\n2.5.2 - Configure Default CPU Requests and Limits for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15405"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Here's an example manifest for a LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15406"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15407"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: mem-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      memory: 1Gi\n    min:\n      memory: 500Mi\n    type: Container\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15408"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15409"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15410"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15411"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo\nspec:\n  containers:\n  - name: constraints-mem-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"600Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15412"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15413"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15414"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo --output=yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the container within that Pod has a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the constraints imposed by the LimitRange for this namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15415"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a memory request of 800 MiB and a memory limit of 1.5 GiB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15416"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15417"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-2\nspec:\n  containers:\n  - name: constraints-mem-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"1.5Gi\"\n      requests:\n        memory: \"800Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15418"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-2.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests more memory than is allowed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15419"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15420"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-3\nspec:\n  containers:\n  - name: constraints-mem-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15421"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-3.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod does not get created, because it defines a container that requests less memory than the enforced minimum:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15422"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/memory-constraints-pod-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15423"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-mem-demo-4\nspec:\n  containers:\n  - name: constraints-mem-demo-4-ctr\n    image: nginx\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15424"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-4.yaml --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15425"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-mem-demo-4 --namespace=constraints-mem-example --output=yaml\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The output shows that the Pod's only container has a memory request of 1 GiB and a memory limit of 1 GiB. How did that container get those values?", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15426"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-mem-demo-4 --namespace=constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | The maximum and minimum memory constraints imposed on a namespace by a LimitRange are enforced only when a Pod is created or updated. If you change the LimitRange, it does not affect Pods that were cr", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15427"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-mem-example\n```\n\n2.5.3 - Configure Minimum and Maximum Memory Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15428"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for an example LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15429"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints.yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15430"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: cpu-min-max-demo-lr\nspec:\n  limits:\n  - max:\n      cpu: \"800m\"\n    min:\n      cpu: \"200m\"\n    type: Container\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15431"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the LimitRange:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15432"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get limitrange cpu-min-max-demo-lr --output=yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows the minimum and maximum CPU constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created auto", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15433"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15434"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo\nspec:\n  containers:\n  - name: constraints-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15435"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Verify that the Pod is running and that its container is healthy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15436"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15437"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod constraints-cpu-demo --output=yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod's only container has a CPU request of 500 millicpu and CPU limit of 800 millicpu. These satisfy the constraints imposed by the LimitRange.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15438"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod constraints-cpu-demo --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Here's a manifest for a Pod that has one container. The container specifies a CPU request of 500 millicpu and a cpu limit of 1.5 cpu.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15439"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15440"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-2\nspec:\n  containers:\n  - name: constraints-cpu-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"1.5\"\n      requests:\n        cpu: \"500m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15441"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-2.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU limit that is too large:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15442"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15443"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-3\nspec:\n  containers:\n  - name: constraints-cpu-demo-3-ctr\n    image: nginx\n    resources:\n      limits:\n        cpu: \"800m\"\n      requests:\n        cpu: \"100m\"\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Attempt to create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15444"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-3.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | The output shows that the Pod does not get created, because it defines an unacceptable container. That container is not acceptable because it specifies a CPU request that is lower than the enforced mi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15445"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/cpu-constraints-pod-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15446"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: constraints-cpu-demo-4\nspec:\n  containers:\n  - name: constraints-cpu-demo-4-ctr\n    image: vish/stress\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15447"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/cpu-constraints-pod-4.yaml --namespace=constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15448"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace constraints-cpu-example\n```\n\n2.5.4 - Configure Minimum and Maximum CPU Constraints for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15449"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Here is a manifest for an example ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15450"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-mem-cpu.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15451"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: mem-cpu-demo\nspec:\n  hard:\n    requests.cpu: \"1\"\n    requests.memory: 1Gi\n    limits.cpu: \"2\"\n    limits.memory: 2Gi\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15452"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu.yaml --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15453"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | The ResourceQuota places these requirements on the quota-mem-cpu-example namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15454"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-mem-cpu-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15455"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"800Mi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"600Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15456"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Verify that the Pod is running and that its (only) container is healthy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15457"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod quota-mem-cpu-demo --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Once again, view detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15458"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | The output shows the quota along with how much of the quota has been used. You can see that the memory and CPU requests and limits for your Pod do not exceed the quota.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15459"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example -o jsonpath='{ .status.used }' | jq .\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Here is a manifest for a second Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15460"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-mem-cpu-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15461"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: quota-mem-cpu-demo-2\nspec:\n  containers:\n  - name: quota-mem-cpu-demo-2-ctr\n    image: redis\n    resources:\n      limits:\n        memory: \"1Gi\"\n        cpu: \"800m\"\n      requests:\n        memory: \"700Mi\"\n        cpu: \"400m\"\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | In the manifest, you can see that the Pod has a memory request of 700 MiB. Notice that the sum of the used memory request and this new memory request exceeds the memory request quota: 600 MiB + 700 Mi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15462"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod-2.yaml --namespace=quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | The second Pod does not get created. The output shows that creating the second Pod would cause the memory request total to exceed the memory request quota.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15463"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-mem-cpu-example\n```\n\n2.5.5 - Configure Memory and CPU Quotas for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15464"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Here is an example manifest for a ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15465"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-pod.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15466"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: pod-demo\nspec:\n  hard:\n    pods: \"2\"\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15467"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod.yaml --namespace=quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15468"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota pod-demo --namespace=quota-pod-example --output=yaml\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | The output shows that the namespace has a quota of two Pods, and that currently there are no Pods; that is, none of the quota is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15469"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-pod-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15470"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: pod-quota-demo\nspec:\n  selector:\n    matchLabels:\n      purpose: quota-demo\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        purpose: quota-demo\n    spec:\n      containers:\n      - name: pod-quota-demo\n        image: nginx\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15471"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-pod-deployment.yaml --namespace=quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | View detailed information about the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15472"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment pod-quota-demo --namespace=quota-pod-example --output=yaml\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | The output shows that even though the Deployment specifies three replicas, only two Pods were created because of the quota you defined earlier:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15473"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-pod-example\n```\n\n2.5.6 - Configure a Pod Quota for a Namespace | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15474"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\n2.6.2 - Use Calico for NetworkPolicy | The Calico pods begin with calico. Check to make sure each one has a status of Running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15475"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=cilium\n```\n\n2.6.3 - Use Cilium for NetworkPolicy | You'll see a list of Pods similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15476"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n kube-system -o wide\n```\n\n2.6.6 - Weave Net for NetworkPolicy | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15477"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080 &\n```\n\n2.7 - Access Clusters Using the Kubernetes API | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15478"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Check all possible clusters, as your .KUBECONFIG may have multiple contexts:\nkubectl config view -o jsonpath='{\"Cluster name\\tServer\\n\"}{range .clusters[*]}{.name}{\"\\t\"}{.cluster.server}{\"\\n\"}{end}'\n\n# Select name of cluster you want to interact with from above output:\nexport CLUSTER_NAME=\"some_server_name\"\n\n# Point to the API server referring the cluster name\nAPISERVER=$(kubectl config view -o jsonpath=\"{.clusters[?(@.name==\\\"$CLUSTER_NAME\\\")].cluster.server}\")\n\n# Create a secret to hold a token for the default service account\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n\n# Wait for the token controller to populate the secret with a token:\nwhile ! kubectl describe secret default-token | grep -E '^token' >/dev/null; do\n  echo \"waiting for token...\" >&2\n  sleep 1\ndone\n\n# Get the token value\nTOKEN=$(kubectl get secret default-token -o jsonpath='{.data.token}' | base64 --decode)\n\n# Explore the API with TOKEN\ncurl -X GET $APISERVER/api --header \"Authorization: Bearer $TOKEN\" --insecure\n```\n\n2.7 - Access Clusters Using the Kubernetes API | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15479"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15480"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -l k8s-app=kube-dns --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15481"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | and look for a deployment named coredns or kube-dns.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15482"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/dns/dns-horizontal-autoscaler.yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15483"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"nodes\"]\n    verbs: [\"list\", \"watch\"]\n  - apiGroups: [\"\"]\n    resources: [\"replicationcontrollers/scale\"]\n    verbs: [\"get\", \"update\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments/scale\", \"replicasets/scale\"]\n    verbs: [\"get\", \"update\"]\n# Remove the configmaps rule once below issue is fixed:\n# kubernetes-incubator/cluster-proportional-autoscaler#16\n  - apiGroups: [\"\"]\n    resources: [\"configmaps\"]\n    verbs: [\"get\", \"create\"]\n---\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: system:kube-dns-autoscaler\nsubjects:\n  - kind: ServiceAccount\n    name: kube-dns-autoscaler\n    namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-dns-autoscaler\n  apiGroup: rbac.authorization.k8s.io\n\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kube-dns-autoscaler\n  namespace: kube-system\n  labels:\n    k8s-app: kube-dns-autoscaler\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: kube-dns-autoscaler\n  template:\n    metadata:\n      labels:\n        k8s-app: kube-dns-autoscaler\n    spec:\n      priorityClassName: system-cluster-critical\n      securityContext:\n        seccompProfile:\n          type: RuntimeDefault\n        supplementalGroups: [ 65534 ]\n        fsGroup: 65534\n      nodeSelector:\n        kubernetes.io/os: linux\n      containers:\n      - name: autoscaler\n        image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4\n        resources:\n            requests:\n                cpu: \"20m\"\n                memory: \"10Mi\"\n        command:\n          - /cluster-proportional-autoscaler\n          - --namespace=kube-system\n          - --configmap=kube-dns-autoscaler\n          # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base\n          - --target=<SCALE_TARGET>\n          # When cluster is using large nodes(with more cores), \"coresPerReplica\" should dominate.\n          # If using small nodes, \"nodesPerReplica\" should dominate.\n          - --default-params={\"linear\":{\"coresPerReplica\":256,\"nodesPerReplica\":16,\"preventSinglePointFailure\":true,\"includeUnschedulableNodes\":true}}\n          - --logtostderr=true\n          - --v=2\n      tolerations:\n      - key: \"CriticalAddonsOnly\"\n        operator: \"Exists\"\n      serviceAccountName: kube-dns-autoscaler\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | In the file, replace <SCALE_TARGET> with your scale target.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15484"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f dns-horizontal-autoscaler.yaml\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output of a successful command is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15485"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15486"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit configmap kube-dns-autoscaler --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | Look for this line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15487"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment --replicas=0 kube-dns-autoscaler --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15488"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get rs --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output displays 0 in the DESIRED and CURRENT columns:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15489"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment kube-dns-autoscaler --namespace=kube-system\n```\n\n2.9 - Autoscale the DNS Service in a Cluster | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15490"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc cat-pictures-pvc -o jsonpath='{.spec.volumeName}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | And you can view the PVC before you make changes. Either view the manifest locally, or run kubectl get pvc <name-of-pvc> -o yaml. The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15491"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-pvc.yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: cat-pictures-pvc\nspec:\n  accessModes:\n  - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Here's an example Deployment that relies on that PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15492"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# cat-pictures-writer-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: cat-pictures-writer\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: cat-pictures-writer\n  template:\n    metadata:\n      labels:\n        app: cat-pictures-writer\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n        volumeMounts:\n        - name: cat-pictures\n          mountPath: /mnt\n      volumes:\n      - name: cat-pictures\n        persistentVolumeClaim:\n          claimName: cat-pictures-pvc\n          readOnly: false\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | As a first step, you need to edit your PersistentVolume's spec.persistentVolumeReclaimPolicy and set it to Retain. This ensures your PersistentVolume will not be deleted when you delete the correspond", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15493"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to stop any workloads that are using the PersistentVolumeClaim bound to the PersistentVolume you want to migrate, and then delete the PersistentVolumeClaim. Avoid making any other change", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15494"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=0 deployment cat-pictures-writer\nkubectl delete pvc cat-pictures-pvc\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"claimRef\":{\"uid\":\"\"}}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | After that, replace the PersistentVolume's list of valid access modes to be (only) ReadWriteOncePod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15495"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"accessModes\":[\"ReadWriteOncePod\"]}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | Next you need to modify your PersistentVolumeClaim to set ReadWriteOncePod as the only access mode. You should also set the PersistentVolumeClaim's spec.volumeName to the name of your PersistentVolume", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15496"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv cat-pictures-pv -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Delete\"}}'\n```\n\n2.10 - Change the Access Mode of a PersistentVolume to ReadWriteOncePod | This page shows how to change the default Storage Class that is used to provision volumes for PersistentVolumeClaims that have no special requirements.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15497"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\n2.11 - Change the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15498"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass standard -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"false\"}}}'\n```\n\n2.11 - Change the default StorageClass | where standard is the name of your chosen StorageClass.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15499"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch storageclass gold -p '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}'\n```\n\n2.11 - Change the default StorageClass | Please note you can have multiple StorageClass marked as default. If more than one StorageClass is marked as default, a PersistentVolumeClaim without an explicitly defined storageClassName will be cre", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15500"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageclass\n```\n\n2.11 - Change the default StorageClass | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15501"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n\n2.13 - Change the Reclaim Policy of a PersistentVolume | where <your-pv-name> is the name of your chosen PersistentVolume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15502"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pv <your-pv-name> -p \"{\\\"spec\\\":{\\\"persistentVolumeReclaimPolicy\\\":\\\"Retain\\\"}}\"\n```\n\n2.13 - Change the Reclaim Policy of a PersistentVolume | Verify that your chosen PersistentVolume has the right policy:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15503"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/cloud/ccm-example.yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\n2.14 - Cloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15504"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster.\n# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master\n# Note that this Daemonset will not work straight out of the box for your cloud, this is\n# meant to be a guideline.\n\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:cloud-controller-manager\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: cloud-controller-manager\n  namespace: kube-system\n---\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  labels:\n    k8s-app: cloud-controller-manager\n  name: cloud-controller-manager\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      k8s-app: cloud-controller-manager\n  template:\n    metadata:\n      labels:\n        k8s-app: cloud-controller-manager\n    spec:\n      serviceAccountName: cloud-controller-manager\n      containers:\n      - name: cloud-controller-manager\n        # for in-tree providers we use registry.k8s.io/cloud-controller-manager\n        # this can be replaced with any other image for out-of-tree providers\n        image: registry.k8s.io/cloud-controller-manager:v1.8.0\n        command:\n        - /usr/local/bin/cloud-controller-manager\n        - --cloud-provider=[YOUR_CLOUD_PROVIDER]  # Add your own cloud provider here!\n        - --leader-elect=true\n        - --use-service-account-credentials\n        # these flags will vary for every cloud provider\n        - --allocate-node-cidrs=true\n        - --configure-cloud-routes=true\n        - --cluster-cidr=172.17.0.0/16\n      tolerations:\n      # this is required so CCM can bootstrap itself\n      - key: node.cloudprovider.kubernetes.io/uninitialized\n        value: \"true\"\n        effect: NoSchedule\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      # this is to restrict CCM to only run on master nodes\n      # the node selector may vary depending on your cluster setup\n      nodeSelector:\n        node-role.kubernetes.io/master: \"\"\n```\n\n2.14 - Cloud Controller Manager Administration | Running cloud controller manager comes with a few possible limitations. Although these limitations are being addressed in upcoming releases, it's important that you are aware of these limitations for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15505"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1\nkind: CredentialProviderConfig\n# providers is a list of credential provider helper plugins that will be enabled by the kubelet.\n# Multiple providers may match against a single image, in which case credentials\n# from all providers will be returned to the kubelet. If multiple providers are called\n# for a single image, the results are combined. If providers return overlapping\n# auth keys, the value from the provider earlier in this list is used.\nproviders:\n  # name is the required name of the credential provider. It must match the name of the\n  # provider executable as seen by the kubelet. The executable must be in the kubelet's\n  # bin directory (set by the --image-credential-provider-bin-dir flag).\n  - name: ecr-credential-provider\n    # matchImages is a required list of strings used to match against images in order to\n    # determine if this provider should be invoked. If one of the strings matches the\n    # requested image from the kubelet, the plugin will be invoked and given a chance\n    # to provide credentials. Images are expected to contain the registry domain\n    # and URL path.\n    #\n    # Each entry in matchImages is a pattern which can optionally contain a port and a path.\n    # Globs can be used in the domain, but not in the port or the path. Globs are supported\n    # as subdomains like '*.k8s.io' or 'k8s.*.io', and top-level-domains such as 'k8s.*'.\n    # Matching partial subdomains like 'app*.k8s.io' is also supported. Each glob can only match\n    # a single subdomain segment, so `*.io` does **not** match `*.k8s.io`.\n    #\n    # A match exists between an image and a matchImage when all of the below are true:\n    # - Both contain the same number of domain parts and each part matches.\n    # - The URL path of an matchImages must be a prefix of the target image URL path.\n    # - If the matchImages contains a port, then the port must match in the image as well.\n    #\n    # Example values of matchImages:\n    # - 123456789.dkr.ecr.us-east-1.amazonaws.com\n    # - *.azurecr.io\n    # - gcr.io\n    # - *.*.registry.io\n    # - registry.io:8080/path\n    matchImages:\n      - \"*.dkr.ecr.*.amazonaws.com\"\n      - \"*.dkr.ecr.*.amazonaws.com.cn\"\n      - \"*.dkr.ecr-fips.*.amazonaws.com\"\n      - \"*.dkr.ecr.us-iso-east-1.c2s.ic.gov\"\n      - \"*.dkr.ecr.us-isob-east-1.sc2s.sgov.gov\"\n    # defaultCacheDuration is the default duration the plugin will cache credentials in-memory\n    # if a cache duration is not provided in the plugin response. This field is required.\n    defaultCacheDuration: \"12h\"\n    # Required input version of the exec CredentialProviderRequest. The returned CredentialProviderResponse\n    # MUST use the same encoding version as the input. Current supported values are:\n    # - credentialprovider.kubelet.k8s.io/v1\n    apiVersion: credentialprovider.kubelet.k8s.io/v1\n    # Arguments to pass to the command when executing it.\n    # +optional\n    # args:\n    #   - --example-argument\n    # Env defines additional environment variables to expose to the process. These\n    # are unioned with the host's environment, as well as variables client-go uses\n    # to pass argument to the plugin.\n    # +optional\n    env:\n      - name: AWS_PROFILE\n        value: example_profile\n\n    # tokenAttributes is the configuration for the service account token that will be passed to the plugin.\n    # The credential provider opts in to using service account tokens for image pull by setting this field.\n    # if this field is set without the `KubeletServiceAccountTokenForCredentialProviders` feature gate enabled, \n    # kubelet will fail to start with invalid configuration error.\n    # +optional\n    tokenAttributes:\n      # serviceAccountTokenAudience is the intended audience for the projected service account token.\n      # +required\n      serviceAccountTokenAudience: \"<audience for the token>\"\n      # cacheType indicates the type of cache key use for caching the credentials returned by the plugin\n      # when the service account token is used.\n      # The most conservative option is to set this to \"Token\", which means the kubelet will cache\n      # returned credentials on a per-token basis. This should be set if the returned credential's\n      # lifetime is limited to the service account token's lifetime.\n      # If the plugin's credential retrieval logic depends only on the service account and not on\n      # pod-specific claims, then the plugin can set this to \"ServiceAccount\". In this case, the\n      # kubelet will cache returned credentials on a per-serviceaccount basis. Use this when the\n      # returned credential is valid for all pods using the same service account.\n      # +required\n      cacheType: \"<Token or ServiceAccount>\"\n      # requireServiceAccount indicates whether the plugin requires the pod to have a service account.\n      # If set to true, kubelet will only invoke the plugin if the pod has a service account.\n      # If set to false, kubelet will invoke the plugin even if the pod does not have a service account\n      # and will not include a token in the CredentialProviderRequest. This is useful for plugins\n      # that are used to pull images for pods without service accounts (e.g., static pods).\n      # +required\n      requireServiceAccount: true\n      # requiredServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are required to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. If any of the keys defined in this list\n      # are not present in the service account, kubelet will not invoke the plugin and will return an error.\n      # This field is optional and may be empty. Plugins may use this field to extract additional information\n      # required to fetch credentials or allow workloads to opt in to using service account tokens for image pull.\n      # If non-empty, requireServiceAccount must be set to true.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # optionalServiceAccountAnnotationKeys list.\n      # +optional\n      requiredServiceAccountAnnotationKeys:\n      - \"example.com/required-annotation-key-1\"\n      - \"example.com/required-annotation-key-2\"\n      # optionalServiceAccountAnnotationKeys is the list of annotation keys that the plugin is interested in\n      # and that are optional to be present in the service account.\n      # The keys defined in this list will be extracted from the corresponding service account and passed\n      # to the plugin as part of the CredentialProviderRequest. The plugin is responsible for validating the\n      # existence of annotations and their values. This field is optional and may be empty.\n      # Plugins may use this field to extract additional information required to fetch credentials.\n      # The keys defined in this list must be unique and not overlap with the keys defined in the\n      # requiredServiceAccountAnnotationKeys list.\n      # +optional\n      optionalServiceAccountAnnotationKeys:\n      - \"example.com/optional-annotation-key-1\"\n      - \"example.com/optional-annotation-key-2\"\n```\n\n2.15 - Configure a kubelet image credential provider | The providers field is a list of enabled plugins used by the kubelet. Each entry has a few required fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15506"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | Here is the configuration file for a ResourceQuota object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15507"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-objects.yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\n2.16 - Configure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15508"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: object-quota-demo\nspec:\n  hard:\n    persistentvolumeclaims: \"1\"\n    services.loadbalancers: \"2\"\n    services.nodeports: \"0\"\n```\n\n2.16 - Configure Quotas for API Objects | Create the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15509"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects.yaml --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | View detailed information about the ResourceQuota:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15510"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourcequota object-quota-demo --namespace=quota-object-example --output=yaml\n```\n\n2.16 - Configure Quotas for API Objects | The output shows that in the quota-object-example namespace, there can be at most one PersistentVolumeClaim, at most two Services of type LoadBalancer, and no Services of type NodePort.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15511"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-objects-pvc.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n2.16 - Configure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15512"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n2.16 - Configure Quotas for API Objects | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15513"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc.yaml --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | Verify that the PersistentVolumeClaim was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15514"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get persistentvolumeclaims --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | The output shows that the PersistentVolumeClaim exists and has status Pending:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15515"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/resource/quota-objects-pvc-2.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\n2.16 - Configure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15516"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-quota-demo-2\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 4Gi\n```\n\n2.16 - Configure Quotas for API Objects | Attempt to create the second PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15517"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/resource/quota-objects-pvc-2.yaml --namespace=quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | The output shows that the second PersistentVolumeClaim was not created, because it would have exceeded the quota for the namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15518"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace quota-object-example\n```\n\n2.16 - Configure Quotas for API Objects | Configure Default Memory Requests and Limits for a Namespace", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15519"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health {\n            lameduck 5s\n        }\n        ready\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n            pods insecure\n            fallthrough in-addr.arpa ip6.arpa\n            ttl 30\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\n2.19 - Customizing DNS Service | The Corefile configuration includes the following plugins of CoreDNS:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15520"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n           pods insecure\n           fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . 172.16.0.1\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n    consul.local:53 {\n        errors\n        cache 30\n        forward . 10.150.0.1\n    }\n```\n\n2.19 - Customizing DNS Service | This page provides hints on diagnosing DNS problems.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15521"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/dns/dnsutils.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\n2.20 - Debugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15522"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dnsutils\n  namespace: default\nspec:\n  containers:\n  - name: dnsutils\n    image: registry.k8s.io/e2e-test-images/agnhost:2.39\n    imagePullPolicy: IfNotPresent\n  restartPolicy: Always\n```\n\n2.20 - Debugging DNS Resolution | Use that manifest to create a Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15523"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml\n```\n\n2.20 - Debugging DNS Resolution | …and verify its status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15524"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dnsutils\n```\n\n2.20 - Debugging DNS Resolution | Once that Pod is running, you can exec nslookup in that environment. If you see something like the following, DNS is working correctly.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15525"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\n2.20 - Debugging DNS Resolution | If the nslookup command fails, check the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15526"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti dnsutils -- cat /etc/resolv.conf\n```\n\n2.20 - Debugging DNS Resolution | Verify that the search path and name server are set up like the following (note that search path may vary for different cloud providers):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15527"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\n2.20 - Debugging DNS Resolution | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15528"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup kubernetes.default\n```\n\n2.20 - Debugging DNS Resolution | Use the kubectl get pods command to verify that the DNS pod is running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15529"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system -l k8s-app=kube-dns\n```\n\n2.20 - Debugging DNS Resolution | If you see that no CoreDNS Pod is running or that the Pod has failed/completed, the DNS add-on may not be deployed by default in your current environment and you will have to deploy it manually.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15530"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs --namespace=kube-system -l k8s-app=kube-dns\n```\n\n2.20 - Debugging DNS Resolution | Here is an example of a healthy CoreDNS log:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15531"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc --namespace=kube-system\n```\n\n2.20 - Debugging DNS Resolution | If you have created the Service or in the case it should be created by default but it does not appear, see debugging Services for more information.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15532"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=kube-dns --namespace=kube-system\n```\n\n2.20 - Debugging DNS Resolution | If you do not see the endpoints, see the endpoints section in the debugging Services documentation.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15533"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: coredns\n  namespace: kube-system\ndata:\n  Corefile: |\n    .:53 {\n        log\n        errors\n        health\n        kubernetes cluster.local in-addr.arpa ip6.arpa {\n          pods insecure\n          upstream\n          fallthrough in-addr.arpa ip6.arpa\n        }\n        prometheus :9153\n        forward . /etc/resolv.conf\n        cache 30\n        loop\n        reload\n        loadbalance\n    }\n```\n\n2.20 - Debugging DNS Resolution | After saving the changes, it may take up to minute or two for Kubernetes to propagate these changes to the CoreDNS pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15534"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe clusterrole system:coredns -n kube-system\n```\n\n2.20 - Debugging DNS Resolution | Expected output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15535"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:coredns -n kube-system\n```\n\n2.20 - Debugging DNS Resolution | Example insertion of EndpointSlices permissions:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15536"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>\n```\n\n2.20 - Debugging DNS Resolution | This query specifies the namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15537"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t dnsutils -- nslookup <service-name>.<namespace>\n```\n\n2.20 - Debugging DNS Resolution | To learn more about name resolution, see DNS for Services and Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15538"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment nginx --image=nginx\n```\n\n2.21 - Declare Network Policy | Expose the Deployment through a Service called nginx.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15539"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment nginx --port=80\n```\n\n2.21 - Declare Network Policy | The above commands create a Deployment with an nginx Pod and expose the Deployment through a Service named nginx. The nginx Pod and Deployment are found in the default namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15540"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\n2.21 - Declare Network Policy | In your shell, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15541"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/nginx-policy.yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\n2.21 - Declare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15542"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: NetworkPolicy\nmetadata:\n  name: access-nginx\nspec:\n  podSelector:\n    matchLabels:\n      app: nginx\n  ingress:\n  - from:\n    - podSelector:\n        matchLabels:\n          access: \"true\"\n```\n\n2.21 - Declare Network Policy | The name of a NetworkPolicy object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15543"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/nginx-policy.yaml\n```\n\n2.21 - Declare Network Policy | When you attempt to access the nginx Service from a Pod without the correct labels, the request times out:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15544"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --image=busybox -- /bin/sh\n```\n\n2.21 - Declare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15545"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run busybox --rm -ti --labels=\"access=true\" --image=busybox -- /bin/sh\n```\n\n2.21 - Declare Network Policy | In your shell, run the command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15546"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example # a custom resource API\n    providers:\n      # This configuration does not provide data confidentiality. The first\n      # configured provider is specifying the \"identity\" mechanism, which\n      # stores resources as plain text.\n      #\n      - identity: {} # plain text, in other words NO encryption\n      - aesgcm:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - secretbox:\n          keys:\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n  - resources:\n      - events\n    providers:\n      - identity: {} # do not encrypt Events even though *.* is specified below\n  - resources:\n      - '*.apps' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key2\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n  - resources:\n      - '*.*' # wildcard match requires Kubernetes 1.27 or later\n    providers:\n      - aescbc:\n          keys:\n          - name: key3\n            secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\n2.24 - Encrypting Confidential Data at Rest | Each resources array item is a separate config and contains a complete configuration. The resources.resources field is an array of Kubernetes resource names (resource or resource.group) that should be", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15547"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              # See the following text for more details about the secret value\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # this fallback allows reading unencrypted secrets;\n                     # for example, during initial migration\n```\n\n2.24 - Encrypting Confidential Data at Rest | To create a new encryption key (that does not use KMS), see Generate the encryption key.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15548"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# This is a fragment of a manifest for a static Pod.\n# Check whether this is correct for your cluster and for your API server.\n#\napiVersion: v1\nkind: Pod\nmetadata:\n  annotations:\n    kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.20.30.40:443\n  creationTimestamp: null\n  labels:\n    app.kubernetes.io/component: kube-apiserver\n    tier: control-plane\n  name: kube-apiserver\n  namespace: kube-system\nspec:\n  containers:\n  - command:\n    - kube-apiserver\n    ...\n    - --encryption-provider-config=/etc/kubernetes/enc/enc.yaml  # add this line\n    volumeMounts:\n    ...\n    - name: enc                           # add this line\n      mountPath: /etc/kubernetes/enc      # add this line\n      readOnly: true                      # add this line\n    ...\n  volumes:\n  ...\n  - name: enc                             # add this line\n    hostPath:                             # add this line\n      path: /etc/kubernetes/enc           # add this line\n      type: DirectoryOrCreate             # add this line\n  ...\n```\n\n2.24 - Encrypting Confidential Data at Rest | Restart your API server.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15549"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\n2.24 - Encrypting Confidential Data at Rest | Using the etcdctl command line tool, read that Secret out of etcd:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15550"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret secret1 -n default -o yaml\n```\n\n2.24 - Encrypting Confidential Data at Rest | The output should contain mykey: bXlkYXRh, with contents of mydata encoded using base64; read decoding a Secret to learn how to completely decode the Secret.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15551"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n      - identity: {} # REMOVE THIS LINE\n```\n\n2.24 - Encrypting Confidential Data at Rest | …and then restart each API server in turn. This change prevents the API server from accessing a plain-text Secret, even by accident.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15552"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      # list any other resources here that you previously were\n      # encrypting at rest\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET> # keep this in place\n                                               # make sure it comes after \"identity\"\n```\n\n2.24 - Encrypting Confidential Data at Rest | Then run the following command to force decryption of all Secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15553"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\n2.24 - Encrypting Confidential Data at Rest | Once you have replaced all existing encrypted resources with backing data that don't use encryption, you can remove the encryption settings from the kube-apiserver.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15554"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            # Do not use this (invalid) example key for encryption\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\n2.25 - Decrypt Confidential Data that is Already Encrypted at Rest | then change it to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15555"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - identity: {} # add this line\n      - aescbc:\n          keys:\n            - name: example\n              secret: 2KfZgdiq2K0g2YrYpyDYs9mF2LPZhQ==\n```\n\n2.25 - Decrypt Confidential Data that is Already Encrypted at Rest | and restart the kube-apiserver Pod on this node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15556"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/ip-masq-agent/master/ip-masq-agent.yaml\n```\n\n2.27 - IP Masquerade Agent User Guide | You must also apply the appropriate node label to any nodes in your cluster that you want the agent to run on.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15557"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes my-node node.kubernetes.io/masq-agent-ds-ready=true\n```\n\n2.27 - IP Masquerade Agent User Guide | More information can be found in the ip-masq-agent documentation here.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15558"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap ip-masq-agent --from-file=config --namespace=kube-system\n```\n\n2.27 - IP Masquerade Agent User Guide | This will update a file located at /etc/config/ip-masq-agent which is periodically checked every resyncInterval and applied to the cluster node. After the resync interval has expired, you should see t", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15559"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: LimitRange\nmetadata:\n  name: storagelimits\nspec:\n  limits:\n  - type: PersistentVolumeClaim\n    max:\n      storage: 2Gi\n    min:\n      storage: 1Gi\n```\n\n2.28 - Limit Storage Consumption | Minimum storage requests are used when the underlying storage provider requires certain minimums. For example, AWS EBS volumes have a 1Gi minimum requirement.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15560"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ResourceQuota\nmetadata:\n  name: storagequota\nspec:\n  hard:\n    persistentvolumeclaims: \"5\"\n    requests.storage: \"5Gi\"\n```\n\n2.28 - Limit Storage Consumption | A limit range can put a ceiling on how much storage is requested while a resource quota can effectively cap the storage consumed by a namespace through claim counts and cumulative storage capacity. Th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15561"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-kube-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | Do the same to the system::leader-locking-cloud-controller-manager role.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15562"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch -n kube-system role 'system::leader-locking-cloud-controller-manager' -p '{\"rules\": [ {\"apiGroups\":[ \"coordination.k8s.io\"], \"resources\": [\"leases\"], \"resourceNames\": [\"cloud-provider-extraction-migration\"], \"verbs\": [\"create\", \"list\", \"get\", \"update\"] } ]}' --type=merge`\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | Leader Migration optionally takes a configuration file representing the state of controller-to-manager assignment. At this moment, with in-tree cloud provider, kube-controller-manager runs route, serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15563"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: kube-controller-manager\n  - name: service\n    component: kube-controller-manager\n  - name: cloud-node-lifecycle\n    component: kube-controller-manager\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | Alternatively, because the controllers can run under either controller managers, setting component to * for both sides makes the configuration file consistent between both parties of the migration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15564"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | On each control plane node, save the content to /etc/leadermigration.conf, and update the manifest of kube-controller-manager so that the file is mounted inside the container at the same location. Als", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15565"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: cloud-controller-manager\n  - name: service\n    component: cloud-controller-manager\n  - name: cloud-node-lifecycle\n    component: cloud-controller-manager\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | When creating control plane nodes of version N + 1, the content should be deployed to /etc/leadermigration.conf. The manifest of cloud-controller-manager should be updated to mount the configuration f", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15566"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# wildcard version, with nodeipam\nkind: LeaderMigrationConfiguration\napiVersion: controllermanager.config.k8s.io/v1\nleaderName: cloud-provider-extraction-migration\nresourceLock: leases\ncontrollerLeaders:\n  - name: route\n    component: *\n  - name: service\n    component: *\n  - name: cloud-node-lifecycle\n    component: *\n  - name: nodeipam\n-   component: *\n```\n\n2.29 - Migrate Replicated Control Plane To Use Cloud Controller Manager | etcd is a consistent and highly-available key value store used as Kubernetes' backing store for all cluster data.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15567"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  KubeletInUserNamespace: true\n# We use cgroupfs that is delegated by systemd, so we do not use \"systemd\" driver\n# (unless you run another systemd in the namespace)\ncgroupDriver: \"cgroupfs\"\n```\n\n2.32 - Running Kubernetes Node Components as a Non-root User | When the KubeletInUserNamespace feature gate is enabled, the kubelet ignores errors that may happen during setting the following sysctl values on the node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15568"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\nmode: \"iptables\" # or \"userspace\"\nconntrack:\n# Skip setting sysctl value \"net.netfilter.nf_conntrack_max\"\n  maxPerCore: 0\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_established\"\n  tcpEstablishedTimeout: 0s\n# Skip setting \"net.netfilter.nf_conntrack_tcp_timeout_close\"\n  tcpCloseWaitTimeout: 0s\n```\n\n2.32 - Running Kubernetes Node Components as a Non-root User | Most of \"non-local\" volume drivers such as nfs and iscsi do not work. Local volumes like local, hostPath, emptyDir, configMap, secret, and downwardAPI are known to work.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15569"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl drain --ignore-daemonsets <node name>\n```\n\n2.33 - Safely Drain a Node | If there are pods managed by a DaemonSet, you will need to specify --ignore-daemonsets with kubectl to successfully drain the node. The kubectl drain subcommand on its own does not actually drain a no", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15570"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node name>\n```\n\n2.33 - Safely Drain a Node | afterwards to tell Kubernetes that it can resume scheduling new pods onto the node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15571"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\naddress: \"192.168.0.8\"\nport: 20250\nserializeImagePulls: false\nevictionHard:\n    memory.available:  \"100Mi\"\n    nodefs.available:  \"10%\"\n    nodefs.inodesFree: \"5%\"\n    imagefs.available: \"15%\"\n    imagefs.inodesFree: \"5%\"\n```\n\n2.35 - Set Kubelet Parameters Via A Configuration File | In this example, the kubelet is configured with the following settings:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15572"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\n2.36 - Share a Cluster with Namespaces | Kubernetes starts with four initial namespaces:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15573"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces <name>\n```\n\n2.36 - Share a Cluster with Namespaces | Or you can get detailed information with:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15574"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe namespaces <name>\n```\n\n2.36 - Share a Cluster with Namespaces | Note that these details show both resource quota (if present) as well as resource limit ranges.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15575"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: <insert-namespace-name-here>\n```\n\n2.36 - Share a Cluster with Namespaces | Then run:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15576"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./my-namespace.yaml\n```\n\n2.36 - Share a Cluster with Namespaces | Alternatively, you can create namespace using below command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15577"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace <insert-namespace-name-here>\n```\n\n2.36 - Share a Cluster with Namespaces | The name of your namespace must be a valid DNS label.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15578"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespaces <insert-some-namespace-name>\n```\n\n2.36 - Share a Cluster with Namespaces | This delete is asynchronous, so for a time you will see the namespace in the Terminating state.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15579"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces\n```\n\n2.36 - Share a Cluster with Namespaces | For this exercise, we will create two additional Kubernetes namespaces to hold our content.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15580"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-dev.json\n```\n\n2.36 - Share a Cluster with Namespaces | And then let's create the production namespace using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15581"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/admin/namespace-prod.json\n```\n\n2.36 - Share a Cluster with Namespaces | To be sure things are right, list all of the namespaces in our cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15582"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --show-labels\n```\n\n2.36 - Share a Cluster with Namespaces | A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster. Users interacting with one namespace do not see the content in another namespace. To demonstrate this, let", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15583"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment snowflake \\\n  --image=registry.k8s.io/serve_hostname \\\n  -n=development --replicas=2\n```\n\n2.36 - Share a Cluster with Namespaces | We have created a deployment whose replica size is 2 that is running the pod called snowflake with a basic container that serves the hostname.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15584"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=development\n```\n\n2.36 - Share a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15585"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=snowflake -n=development\n```\n\n2.36 - Share a Cluster with Namespaces | And this is great, developers are able to do what they want, and they do not have to worry about affecting content in the production namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15586"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment -n=production\nkubectl get pods -n=production\n```\n\n2.36 - Share a Cluster with Namespaces | Production likes to run cattle, so let's create some cattle pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15587"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment cattle --image=registry.k8s.io/serve_hostname -n=production\nkubectl scale deployment cattle --replicas=5 -n=production\n\nkubectl get deployment -n=production\n```\n\n2.36 - Share a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15588"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=cattle -n=production\n```\n\n2.36 - Share a Cluster with Namespaces | At this point, it should be clear that the resources users create in one namespace are hidden from the other namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15589"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f pod.yaml --output-version v1\n```\n\n2.37 - Upgrade A Cluster | The kubectl tool replaces the contents of pod.yaml with a manifest that sets kind to Pod (unchanged), but with a revised apiVersion.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15590"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx --output=yaml\n```\n\n2.38 - Use Cascading Deletion in a Cluster | The output has an ownerReferences field similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15591"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\n    ...\n    ownerReferences:\n    - apiVersion: apps/v1\n      blockOwnerDeletion: true\n      controller: true\n      kind: ReplicaSet\n      name: nginx-deployment-6b474476c4\n      uid: 4fdcd81c-bd5d-41f7-97af-3a3b759af9a7\n    ...\n```\n\n2.38 - Use Cascading Deletion in a Cluster | By default, Kubernetes uses background cascading deletion to delete dependents of an object. You can switch to foreground cascading deletion using either kubectl or the Kubernetes API, depending on th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15592"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=foreground\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15593"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15594"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=background\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15595"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15596"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment --cascade=orphan\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Using the Kubernetes API", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15597"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2.38 - Use Cascading Deletion in a Cluster | Use curl to trigger deletion:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15598"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n2.38 - Use Cascading Deletion in a Cluster | This page shows how to configure a Key Management Service (KMS) provider and plugin to enable secret data encryption. In Kubernetes 1.34 there are two versions of KMS at-rest encryption. You should us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15599"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          cachesize: 100\n          timeout: 3s\n      - kms:\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          cachesize: 100\n          timeout: 3s\n```\n\n2.39 - Using a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15600"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n      - configmaps\n      - pandas.awesome.bears.example\n    providers:\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginFoo\n          endpoint: unix:///tmp/socketfile-foo.sock\n          timeout: 3s\n      - kms:\n          apiVersion: v2\n          name: myKmsPluginBar\n          endpoint: unix:///tmp/socketfile-bar.sock\n          timeout: 3s\n```\n\n2.39 - Using a KMS provider for data encryption | Setting --encryption-provider-config-automatic-reload to true collapses all health checks to a single health check endpoint. Individual health checks are only available when KMS v1 providers are in us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15601"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic secret1 -n default --from-literal=mykey=mydata\n```\n\n2.39 - Using a KMS provider for data encryption | Using the etcdctl command line, read that secret out of etcd:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15602"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret secret1 -n default\n```\n\n2.39 - Using a KMS provider for data encryption | The Secret should contain mykey: mydata", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15603"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\n2.39 - Using a KMS provider for data encryption | To switch from a local encryption provider to the kms provider and re-encrypt all of the secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15604"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: EncryptionConfiguration\nresources:\n  - resources:\n      - secrets\n    providers:\n      - kms:\n          apiVersion: v2\n          name : myKmsPlugin\n          endpoint: unix:///tmp/socketfile.sock\n      - aescbc:\n          keys:\n            - name: key1\n              secret: <BASE 64 ENCODED SECRET>\n```\n\n2.39 - Using a KMS provider for data encryption | Restart all kube-apiserver processes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15605"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets --all-namespaces -o json | kubectl replace -f -\n```\n\n2.39 - Using a KMS provider for data encryption | If you no longer want to use encryption for data persisted in the Kubernetes API, read decrypt data that are already stored at rest.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15606"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: sysctl-example\nspec:\n  securityContext:\n    sysctls:\n    - name: kernel.shm_rmid_forced\n      value: \"0\"\n    - name: net.core.somaxconn\n      value: \"1024\"\n    - name: kernel.msgmax\n      value: \"65536\"\n  ...\n```\n\n2.42 - Using sysctls in a Kubernetes Cluster | It is good practice to consider nodes with special sysctl settings as tainted within a cluster, and only schedule pods onto them which need those sysctl settings. It is suggested to use the Kubernetes", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15607"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: guaranteed\nspec:\n  containers:\n  - name: guaranteed\n    image: consumer\n    imagePullPolicy: Never\n    resources:\n      limits:\n        cpu: \"2\"\n        memory: 150Gi\n      requests:\n        cpu: \"2\"\n        memory: 150Gi\n    command: [\"sleep\",\"infinity\"]\n```\n\n2.43 - Utilizing the NUMA-aware Memory Manager | Next, let us log into the node where it was deployed and examine the state file in /var/lib/kubelet/memory_manager_state:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15608"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | If the resource metrics API is available, the output includes a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15609"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | To specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15610"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15611"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15612"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15613"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15614"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the one Container in the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15615"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15616"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | A Container can exceed its memory request if the Node has memory available. But a Container is not allowed to use more than its memory limit. If a Container allocates more memory than its limit, the C", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15617"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15618"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15619"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-2.yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15620"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | At this point, the Container might be running or killed. Repeat the preceding command until the Container is killed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15621"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --output=yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container was killed because it is out of memory (OOM):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15622"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container is killed, restarted, killed again, restarted again, and so on:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15623"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-2 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Memory requests and limits are associated with Containers, but it is useful to think of a Pod as having a memory request and limit. The memory request for the Pod is the sum of the memory requests for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15624"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15625"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15626"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-3.yaml --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15627"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod status is PENDING. That is, the Pod is not scheduled to run on any Node, and it will remain in the PENDING state indefinitely:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15628"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-3 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient memory on the Nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15629"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-3 --namespace=mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | If you do not specify a memory limit for a Container, one of the following situations applies:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15630"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace mem-example\n```\n\n3.1 - Assign Memory Resources to Containers and Pods | Assign CPU Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15631"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | If the resource metrics API is available, the output will include a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15632"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | To specify a CPU request for a container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15633"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/cpu-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15634"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15635"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15636"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15637"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The output shows that the one container in the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15638"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15639"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | CPU requests and limits are associated with Containers, but it is useful to think of a Pod as having a CPU request and limit. The CPU request for a Pod is the sum of the CPU requests for all the Conta", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15640"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/cpu-request-limit-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15641"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15642"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15643"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo-2 --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The output shows that the Pod status is Pending. That is, the Pod has not been scheduled to run on any Node, and it will remain in the Pending state indefinitely:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15644"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod cpu-demo-2 --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient CPU resources on the Nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15645"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo-2 --namespace=cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | If you do not specify a CPU limit for a Container, then one of these situations applies:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15646"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace cpu-example\n```\n\n3.2 - Assign CPU Resources to Containers and Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15647"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.3.1 - Set Up DRA in a Cluster | If the component configuration was correct, the output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15648"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n3.3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15649"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslice <resourceslice-name> -o yaml\n```\n\n3.3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15650"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\n3.3.1 - Set Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15651"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndra/deviceclass.yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15652"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15653"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.3.1 - Set Up DRA in a Cluster | To delete the DeviceClass that you created in this task, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15654"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.3.1 - Set Up DRA in a Cluster | This page shows you how to allocate devices to your Pods by using dynamic resource allocation (DRA). These instructions are for workload operators. Before reading this page, familiarize yourself with", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15655"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | The output is similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15656"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndra/resourceclaimtemplate.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15657"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15658"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Review the following example manifest:dra/resourceclaim.yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaim metadata: name: example-resource-claim spec: devices: requests: - name: sing", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15659"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndra/resourceclaim.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15660"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15661"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | To request device allocation, specify a ResourceClaim or a ResourceClaimTemplate in the resourceClaims field of the Pod specification. Then, request a specific claim by name in the resources.claims fi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15662"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndra/dra-example-job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15663"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15664"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Try the following troubleshooting steps:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15665"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | To delete your resource claims, run one of the following commands:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15666"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | Delete the ResourceClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15667"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.3.2 - Allocate Devices to Workloads with DRA | This page shows how to specify CPU and memory resources for a Pod at pod-level in addition to container-level resource specifications. A Kubernetes node allocates resources to a pod based on the pod's", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15668"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | To specify memory requests for a Pod at pod-level, include the resources.requests.memory field in the Pod spec manifest. To specify a memory limit, include resources.limits.memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15669"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-memory-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15670"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15671"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-memory-request-limit.yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15672"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15673"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15674"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15675"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-cpu-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15676"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15677"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-cpu-request-limit.yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15678"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15679"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15680"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15681"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15682"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15683"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-resources.yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15684"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod-resources-demo --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15685"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | The output shows that one container in the Pod has a memory request of 50 MiB and a CPU request of 0.5 cores, with a memory limit of 100 MiB and a CPU limit of 0.5 cores. The Pod itself has a memory r", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15686"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace pod-resources-example\n```\n\n3.4 - Assign Pod-level CPU and memory resources | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15687"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15688"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15689"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15690"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15691"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15692"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it iis-auth-7776966999-n5nzr powershell.exe\n```\n\n3.5 - Configure GMSA for Windows Pods and containers | nltest.exe /parentdomain results in the following error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15693"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-resize.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15694"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15695"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod-resize.yaml\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | This pod starts in the Guaranteed QoS class. Verify its initial state:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15696"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"cpu\":\"800m\"}, \"limits\":{\"cpu\":\"800m\"}}}]}}'\n\n# Alternative methods:\n# kubectl -n qos-example edit pod resize-demo --subresource resize\n# kubectl -n qos-example apply -f <updated-manifest> --subresource resize --server-side\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status again after patching:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15697"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml --namespace=qos-example\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | You should see:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15698"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"memory\":\"300Mi\"}, \"limits\":{\"memory\":\"300Mi\"}}}]}}'\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status shortly after patching:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15699"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | You should now observe:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15700"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | You'll see changes indicating the problem:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15701"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod resize-demo\n```\n\n3.6 - Resize CPU and Memory Resources assigned to Containers | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15702"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nwindows/run-as-username-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15703"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15704"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-pod.yaml\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15705"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-pod-demo\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15706"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-pod-demo -- powershell\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15707"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nwindows/run-as-username-container.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15708"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15709"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-container.yaml\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15710"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-container-demo\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15711"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-container-demo -- powershell\n```\n\n3.7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username (the one set at the Container level):", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15712"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of Guaranteed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15713"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15714"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15715"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15716"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also verifies that the Pod Container has a memory request that matches its memory limit, and it has a CPU request th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15717"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | A Pod is given a QoS class of Burstable if:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15718"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15719"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15720"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15721"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-2 --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15722"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-2 --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not have any memory or CPU limits or requests.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15723"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15724"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n3.9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15725"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15726"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-3 --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of BestEffort:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15727"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-3 --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | Here is a manifest for a Pod that has two Containers. One container specifies a memory request of 200 MiB. The other Container does not specify any requests or limits.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15728"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n3.9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15729"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n3.9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15730"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15731"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-4 --namespace=qos-example --output=yaml\n```\n\n3.9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15732"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\n3.9 - Configure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15733"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace qos-example\n```\n\n3.9 - Configure Quality of Service for Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15734"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/extended-resource-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n3.10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15735"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n3.10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15736"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml\n```\n\n3.10 - Assign Extended Resources to a Container | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15737"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo\n```\n\n3.10 - Assign Extended Resources to a Container | Describe the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15738"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo\n```\n\n3.10 - Assign Extended Resources to a Container | The output shows dongle requests:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15739"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/resource/extended-resource-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n3.10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15740"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n3.10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15741"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml\n```\n\n3.10 - Assign Extended Resources to a Container | Describe the Pod", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15742"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo-2\n```\n\n3.10 - Assign Extended Resources to a Container | The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15743"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo-2\n```\n\n3.10 - Assign Extended Resources to a Container | The output shows that the Pod was created, but not scheduled to run on a Node. It has a status of Pending:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15744"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod extended-resource-demo\nkubectl delete pod extended-resource-demo-2\n```\n\n3.10 - Assign Extended Resources to a Container | This page shows how to configure a Pod to use a Volume for storage.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15745"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/storage/redis.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15746"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15747"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | Verify that the Pod's Container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15748"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod redis --watch\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15749"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and then create a file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15750"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and verify that test-file is still there.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15751"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\n```\n\n3.11 - Configure a Pod to Use a Volume for Storage | See Volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15752"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-volume.yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15753"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15754"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | View information about the PersistentVolume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15755"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15756"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-claim.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15757"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15758"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume wi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15759"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Now the output shows a STATUS of Bound.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15760"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc task-pv-claim\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, task-pv-volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15761"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15762"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15763"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15764"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod task-pv-pod\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Get a shell to the container running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15765"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it task-pv-pod -- /bin/bash\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15766"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod task-pv-pod\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15767"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-duplicate.yaml\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15768"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15769"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15770"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test -- /bin/bash\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15771"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test\nkubectl delete pvc task-pv-claim\nkubectl delete pv task-pv-volume\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | If you don't already have a shell open to the Node in your cluster, open a new shell the same way that you did earlier.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15772"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\n3.12 - Configure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15773"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15774"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15775"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/projected.yaml\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | Verify that the Pod's container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15776"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get --watch pod test-projected-volume\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15777"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test-projected-volume -- /bin/sh\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | In your shell, verify that the projected-volume directory contains your projected sources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15778"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test-projected-volume\nkubectl delete secret user pass\n```\n\n3.13 - Configure a Pod to Use a Projected Volume for Storage | A security context defines privilege and access control settings for a Pod or Container. Security context settings include, but are not limited to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15779"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15780"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15781"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15782"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15783"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15784"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-5.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15785"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15786"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-5.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15787"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15788"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15789"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-6.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15790"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15791"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-6.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15792"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15793"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- id\n```\n\n3.14 - Configure a Security Context for a Pod or Container | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15794"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo -o yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | You can see that the status.containerStatuses[].user.linux field exposes the process identity attached to the first container process.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15795"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\n3.14 - Configure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15796"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\n3.14 - Configure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15797"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15798"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15799"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-2.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15800"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-2\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15801"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-2 -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15802"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15803"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15804"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-3.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15805"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-3\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15806"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-3 -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15807"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15808"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15809"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-4.yaml\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15810"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-4 -- sh\n```\n\n3.14 - Configure a Security Context for a Pod or Container | In your shell, view the capabilities for process 1:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15811"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod security-context-demo\nkubectl delete pod security-context-demo-2\nkubectl delete pod security-context-demo-3\nkubectl delete pod security-context-demo-4\n```\n\n3.14 - Configure a Security Context for a Pod or Container | Kubernetes offers two distinct ways for clients that run within your cluster, or that otherwise have a relationship to your cluster's control plane to authenticate to the API server.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15812"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/<podname> -o yaml\n```\n\n3.15 - Configure Service Accounts for Pods | In the output, you see a field spec.serviceAccountName. Kubernetes automatically sets that value if you don't specify it when you create a Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15813"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\n3.15 - Configure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15814"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\n3.15 - Configure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15815"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15816"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nEOF\n```\n\n3.15 - Configure Service Accounts for Pods | The name of a ServiceAccount object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15817"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts/build-robot -o yaml\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15818"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\n3.15 - Configure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15819"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete serviceaccount/build-robot\n```\n\n3.15 - Configure Service Accounts for Pods | Suppose you have an existing service account named \"build-robot\" as mentioned earlier.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15820"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot\n```\n\n3.15 - Configure Service Accounts for Pods | The output from that command is a token that you can use to authenticate as that ServiceAccount. You can request a specific token duration using the --duration command line argument to kubectl create", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15821"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot --bound-object-kind Node --bound-object-name node-001 --bound-object-uid 123...456\n```\n\n3.15 - Configure Service Accounts for Pods | The token will be valid until it expires or either the associated Node or service account are deleted.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15822"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n3.15 - Configure Service Accounts for Pods | If you view the Secret using:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15823"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret/build-robot-secret -o yaml\n```\n\n3.15 - Configure Service Accounts for Pods | you can see that the Secret now contains an API token for the \"build-robot\" ServiceAccount.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15824"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secrets/build-robot-secret\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15825"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry myregistrykey --docker-server=<registry name> \\\n        --docker-username=DUMMY_USERNAME --docker-password=DUMMY_DOCKER_PASSWORD \\\n        --docker-email=DUMMY_DOCKER_EMAIL\n```\n\n3.15 - Configure Service Accounts for Pods | Verify it has been created.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15826"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets myregistrykey\n```\n\n3.15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15827"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch serviceaccount default -p '{\"imagePullSecrets\": [{\"name\": \"myregistrykey\"}]}'\n```\n\n3.15 - Configure Service Accounts for Pods | You can achieve the same outcome by editing the object manually:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15828"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit serviceaccount/default\n```\n\n3.15 - Configure Service Accounts for Pods | The output of the sa.yaml file is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15829"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\n3.15 - Configure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15830"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\n3.15 - Configure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15831"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=<registry name>/nginx --restart=Never\nkubectl get pod nginx -o=jsonpath='{.spec.imagePullSecrets[0].name}{\"\\n\"}'\n```\n\n3.15 - Configure Service Accounts for Pods | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15832"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-projected-svc-token.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n3.15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15833"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n3.15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15834"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/pod-projected-svc-token.yaml\n```\n\n3.15 - Configure Service Accounts for Pods | The kubelet will: request and store the token on behalf of the Pod; make the token available to the Pod at a configurable file path; and refresh the token as it approaches expiration. The kubelet proa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15835"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic regcred \\\n    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \\\n    --type=kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it. Be sure to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15836"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15837"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>\n```\n\n3.16 - Pull an Image from a Private Registry | where:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15838"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=yaml\n```\n\n3.16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15839"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\n3.16 - Pull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15840"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=\"jsonpath={.data.\\.dockerconfigjson}\" | base64 --decode\n```\n\n3.16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15841"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/private-reg-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n3.16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15842"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n3.16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15843"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-private-reg-pod.yaml\nkubectl get pod private-reg\n```\n\n3.16 - Pull an Image from a Private Registry | Also, in case the Pod fails to start with the status ImagePullBackOff, view the Pod events:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15844"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod private-reg\n```\n\n3.16 - Pull an Image from a Private Registry | If you then see an event with the reason set to FailedToRetrieveImagePullSecret, Kubernetes can't find a Secret with name (regcred, in this example).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15845"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/probe/exec-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15846"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15847"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | Within 30 seconds, view the Pod events:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15848"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | The output indicates that no liveness probes have failed yet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15849"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | At the bottom of the output, there are messages indicating that the liveness probes have failed, and the failed containers have been killed and recreated.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15850"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod liveness-exec\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | The output shows that RESTARTS has been incremented. Note that the RESTARTS counter increments as soon as a failed container comes back to the running state:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15851"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/probe/http-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15852"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15853"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/http-liveness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | After 10 seconds, view Pod events to verify that liveness probes have failed and the container has been restarted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15854"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-http\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | In releases after v1.13, local HTTP proxy environment variable settings do not affect the HTTP liveness probe.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15855"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/probe/tcp-liveness-readiness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15856"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15857"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that liveness probes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15858"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod goproxy\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | If your application implements the gRPC Health Checking Protocol, this example shows how to configure Kubernetes to use it for application liveness checks. Similarly you can configure readiness and st", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15859"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/probe/grpc-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15860"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15861"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/grpc-liveness.yaml\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that the liveness check has not failed:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15862"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod etcd-with-grpc\n```\n\n3.17 - Configure Liveness, Readiness and Startup Probes | When using a gRPC probe, there are some technical details to be aware of:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15863"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15864"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n3.18 - Assign Pods to Nodes | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15865"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15866"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15867"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15868"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml\n```\n\n3.18 - Assign Pods to Nodes | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15869"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n3.18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15870"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-specific-node.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15871"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15872"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15873"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15874"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15875"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-required-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15876"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15877"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15878"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15879"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-preferred-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15880"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15881"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15882"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n3.19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15883"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/init-containers.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n3.20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15884"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n3.20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15885"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/init-containers.yaml\n```\n\n3.20 - Configure Pod Initialization | Verify that the nginx container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15886"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod init-demo\n```\n\n3.20 - Configure Pod Initialization | The output shows that the nginx container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15887"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it init-demo -- /bin/bash\n```\n\n3.20 - Configure Pod Initialization | In your shell, send a GET request to the nginx server:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15888"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/lifecycle-events.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15889"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n3.21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15890"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap <map-name> <data-source>\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15891"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15892"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15893"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15894"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15895"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15896"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can display details of the game-config-2 ConfigMap using the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15897"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15898"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-env-file \\\n       --from-env-file=configure-pod-container/configmap/game-env-file.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce a ConfigMap. View the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15899"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap game-config-env-file -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15900"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15901"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap config-multi-env-files \\\n        --from-env-file=configure-pod-container/configmap/game-env-file.properties \\\n        --from-env-file=configure-pod-container/configmap/ui-env-file.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15902"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap config-multi-env-files -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15903"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15904"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=<my-key-name>=<path-to-file>\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | where <my-key-name> is the key you want to use in the ConfigMap and <path-to-file> is the location of the data source file you want the key to represent.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15905"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15906"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15907"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15908"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps special-config -o yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15909"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15910"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | and also:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15911"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps/game-config-4-m9dm2f92bt\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Notice that the generated ConfigMap name has a suffix appended by hashing the contents. This ensures that a new ConfigMap is generated each time the content is modified.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15912"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15913"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Assign the special.how value defined in the ConfigMap to the SPECIAL_LEVEL_KEY environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15914"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-single-configmap-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15915"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15916"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-single-configmap-env-variable.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variable SPECIAL_LEVEL_KEY=very.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15917"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmaps.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15918"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15919"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15920"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-multiple-configmap-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15921"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15922"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-multiple-configmap-env-variable.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL_KEY=very and LOG_LEVEL=INFO.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15923"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\nkubectl delete configmap special-config\nkubectl delete configmap env-config\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create a ConfigMap containing multiple key-value pairs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15924"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmap-multikeys.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15925"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15926"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Use envFrom to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15927"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-envFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15928"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15929"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-envFrom.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL=very and SPECIAL_TYPE=charm.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15930"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can use ConfigMap-defined environment variables in the command and args of a container using the $(VAR_NAME) Kubernetes substitution syntax.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15931"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-env-var-valueFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15932"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15933"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valueFrom.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | That pod produces the following output from the test-container container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15934"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Once you're happy to move on, delete that Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15935"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | As explained in Create ConfigMaps from files, when you create a ConfigMap using --from-file, the filename becomes a key stored in the data section of the ConfigMap. The file contents become the key's", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15936"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmap-multikeys.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15937"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15938"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Add the ConfigMap name under the volumes section of the Pod specification. This adds the ConfigMap data to the directory specified as volumeMounts.mountPath (in this case, /etc/config). The command se", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15939"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-volume.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15940"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15941"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command ls /etc/config/ produces the output below:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15942"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Use the path field to specify the desired file path for specific ConfigMap items. In this case, the SPECIAL_LEVEL item will be mounted in the config-volume volume at /etc/config/keys.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15943"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-volume-specific-key.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15944"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15945"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume-specific-key.yaml\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command cat /etc/config/keys produces the output below:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15946"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You can project keys to specific paths. Refer to the corresponding section in the Secrets guide for the syntax.You can set POSIX permissions for keys. Refer to the corresponding section in the Secrets", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15947"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15948"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15949"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15950"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n3.22 - Configure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15951"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/share-process-namespace.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15952"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15953"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | Attach to the shell container and run ps:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15954"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it nginx -c shell -- /bin/sh\n```\n\n3.23 - Share Process Namespace between Containers in a Pod | If you don't see a command prompt, try pressing enter. In the container shell:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15955"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/user-namespaces-stateless.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n3.24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15956"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n3.24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15957"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/user-namespaces-stateless.yaml\n```\n\n3.24 - Use a User Namespace With a Pod | Exec into the pod and run readlink /proc/self/ns/user:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15958"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti userns -- bash\n```\n\n3.24 - Use a User Namespace With a Pod | Run this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15959"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15960"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15961"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml\n```\n\n3.25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15962"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n3.25 - Use an Image Volume With a Pod | Check the content of a file in the volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15963"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes-subpath.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15964"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n3.25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15965"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml\n```\n\n3.25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15966"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n3.25 - Use an Image Volume With a Pod | Check the content of the file from the dir sub path in the volume:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15967"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Run this command on the node where kubelet is running\nmkdir -p /etc/kubernetes/manifests/\ncat <<EOF >/etc/kubernetes/manifests/static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\n3.26 - Create static Pods | Configure the kubelet on that node to set a staticPodPath value in the kubelet configuration file.See Set Kubelet Parameters Via A Configuration File for more information.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15968"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\n3.26 - Create static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15969"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod static-web-my-node1\n```\n\n3.26 - Create static Pods | You can see that the Pod is still running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15970"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15971"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc web-tcp\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | If you're using a cloud provider, your IP will be listed next to LoadBalancer Ingress.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15972"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n3.27 - Translate a Docker Compose File to Kubernetes Resources | Kompose has support for two providers: OpenShift and Kubernetes. You can choose a targeted provider using global option --provider. If no provider is specified, Kubernetes is set by default.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15973"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\n3.28 - Enforce Pod Security Standards by Configuring the Built-in Admission Controller | Namespaces can be labeled to enforce the Pod Security Standards. The three policies privileged, baseline and restricted broadly cover the security spectrum and are implemented by the Pod Security admi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15974"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15975"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\n    pod-security.kubernetes.io/enforce=baseline\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | If you're just getting started with the Pod Security Standards, a suitable first step would be to configure all namespaces with audit annotations for a stricter level such as baseline:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15976"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns --all \\\n  pod-security.kubernetes.io/audit=baseline \\\n  pod-security.kubernetes.io/warn=baseline\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | Note that this is not setting an enforce level, so that namespaces that haven't been explicitly evaluated can be distinguished. You can list namespaces without an explicitly set enforce level using th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15977"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --selector='!pod-security.kubernetes.io/enforce'\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | You can update a specific namespace as well. This command adds the enforce=restricted policy to my-existing-namespace, pinning the restricted policy version to v1.34.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15978"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns my-existing-namespace \\\n  pod-security.kubernetes.io/enforce=restricted \\\n  pod-security.kubernetes.io/enforce-version=v1.34\n```\n\n3.29 - Enforce Pod Security Standards with Namespace Labels | This page describes the process of migrating from PodSecurityPolicies to the built-in PodSecurity admission controller. This can be done effectively using a combination of dry-run and audit and warn m", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15979"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n $NAMESPACE -o jsonpath=\"{.items[*].metadata.annotations.kubernetes\\.io\\/psp}\" | tr \" \" \"\\n\" | sort -u\n```\n\n3.30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Once you have selected a Pod Security level for the namespace (or if you're trying several), it's a good idea to test it out first (you can skip this step if using the Privileged level). Pod Security", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15980"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/audit=$LEVEL\n```\n\n3.30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | If either of these approaches yield unexpected violations, you will need to either update the violating workloads to meet the policy requirements, or relax the namespace Pod Security level.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15981"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/enforce=$LEVEL\n```\n\n3.30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Finally, you can effectively bypass PodSecurityPolicy at the namespace level by binding the fully privileged PSP to all service accounts in the namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15982"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pods ${POD_NAME}\n```\n\n4.3.1 - Debug Pods | Look at the state of the containers in the pod. Are they all Running? Have there been recent restarts?", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15983"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l kubernetes.io/service-name=${SERVICE_NAME}\n```\n\n4.3.1 - Debug Pods | Make sure that the endpoints in the EndpointSlices match up with the number of pods that you expect to be members of your service. For example, if your Service is for an nginx container with 3 replica", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15984"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=name=nginx,type=frontend\n```\n\n4.3.1 - Debug Pods | to list pods that match this selector. Verify that the list matches the Pods that you expect to provide your Service. Verify that the pod's containerPort matches up with the Service's targetPort", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15985"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec <POD-NAME> -c <CONTAINER-NAME> -- <COMMAND>\n```\n\n4.3.2 - Debug Services | For the purposes of this walk-through, let's run some Pods. Since you're probably debugging your own Service you can substitute your own details, or you can follow along and get a second data point.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15986"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hostnames --image=registry.k8s.io/serve_hostname\n```\n\n4.3.2 - Debug Services | kubectl commands will print the type and name of the resource created or mutated, which can then be used in subsequent commands.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15987"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment hostnames --replicas=3\n```\n\n4.3.2 - Debug Services | Note that this is the same as if you had started the Deployment with the following YAML:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15988"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    matchLabels:\n      app: hostnames\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hostnames\n    spec:\n      containers:\n      - name: hostnames\n        image: registry.k8s.io/serve_hostname\n```\n\n4.3.2 - Debug Services | The label \"app\" is automatically set by kubectl create deployment to the name of the Deployment.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15989"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\n4.3.2 - Debug Services | You can also confirm that your Pods are serving. You can get the list of Pod IP addresses and test them directly.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15990"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames \\\n    -o go-template='{{range .items}}{{.status.podIP}}{{\"\\n\"}}{{end}}'\n```\n\n4.3.2 - Debug Services | The example container used for this walk-through serves its own hostname via HTTP on port 9376, but if you are debugging your own app, you'll want to use whatever port number your Pods are listening o", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15991"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\n4.3.2 - Debug Services | Let's create the Service. As before, this is for the walk-through - you can use your own Service's details here.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15992"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hostnames --port=80 --target-port=9376\n```\n\n4.3.2 - Debug Services | And read it back:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15993"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc hostnames\n```\n\n4.3.2 - Debug Services | Now you know that the Service exists.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15994"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app: hostnames\n  name: hostnames\nspec:\n  selector:\n    app: hostnames\n  ports:\n  - name: default\n    protocol: TCP\n    port: 80\n    targetPort: 9376\n```\n\n4.3.2 - Debug Services | In order to highlight the full range of configuration, the Service you created here uses a different port number than the Pods. For many real-world Services, these values might be the same.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15995"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service hostnames -o json\n```\n\n4.3.2 - Debug Services | If you got this far, you have confirmed that your Service is correctly defined and is resolved by DNS. Now let's check that the Pods you ran are actually being selected by the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15996"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=hostnames\n```\n\n4.3.2 - Debug Services | The -l app=hostnames argument is a label selector configured on the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15997"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get endpointslices -l k8s.io/service-name=hostnames\n\nNAME              ADDRESSTYPE   PORTS   ENDPOINTS\nhostnames-ytpni   IPv4          9376    10.244.0.5,10.244.0.6,10.244.0.7\n```\n\n4.3.2 - Debug Services | This confirms that the EndpointSlice controller has found the correct Pods for your Service. If the ENDPOINTS column is <none>, you should check that the spec.selector field of your Service actually s", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15998"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app.kubernetes.io/name=MyApp\n```\n\n4.3.3 - Debug a StatefulSet | If you find that any Pods listed are in Unknown or Terminating state for an extended period of time, refer to the Deleting StatefulSet Pods task for instructions on how to deal with them. You can debu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_15999"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndebug/termination.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16000"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: termination-demo\nspec:\n  containers:\n  - name: termination-demo-container\n    image: debian\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"sleep 10 && echo Sleep expired > /dev/termination-log\"]\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16001"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/termination.yaml\n```\n\n4.3.4 - Determine the Reason for Pod Failure | In the YAML file, in the command and args fields, you can see that the container sleeps for 10 seconds and then writes \"Sleep expired\" to the /dev/termination-log file. After the container writes the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16002"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Repeat the preceding command until the Pod is no longer running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16003"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo --output=yaml\n```\n\n4.3.4 - Determine the Reason for Pod Failure | The output includes the \"Sleep expired\" message:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16004"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\n...\n    lastState:\n      terminated:\n        containerID: ...\n        exitCode: 0\n        finishedAt: ...\n        message: |\n          Sleep expired          \n        ...\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Use a Go template to filter the output so that it includes only the termination message:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16005"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod termination-demo -o go-template=\"{{range .status.containerStatuses}}{{.lastState.terminated.message}}{{end}}\"\n```\n\n4.3.4 - Determine the Reason for Pod Failure | If you are running a multi-container Pod, you can use a Go template to include the container's name. By doing so, you can discover which of the containers is failing:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16006"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod multi-container-pod -o go-template='{{range .status.containerStatuses}}{{printf \"%s:\\n%s\\n\\n\" .name .lastState.terminated.message}}{{end}}'\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Kubernetes retrieves termination messages from the termination message file specified in the terminationMessagePath field of a Container, which has a default value of /dev/termination-log. By customiz", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16007"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: msg-path-demo\nspec:\n  containers:\n  - name: msg-path-demo-container\n    image: debian\n    terminationMessagePath: \"/tmp/my-log\"\n```\n\n4.3.4 - Determine the Reason for Pod Failure | Moreover, users can set the terminationMessagePolicy field of a Container for further customization. This field defaults to \"File\" which means the termination messages are retrieved only from the term", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16008"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <pod-name>\n```\n\n4.3.5 - Debug Init Containers | For example, a status of Init:1/2 indicates that one of two Init Containers has completed successfully:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16009"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\n4.3.5 - Debug Init Containers | For example, a Pod with two Init Containers might show the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16010"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx --template '{{.status.initContainerStatuses}}'\n```\n\n4.3.5 - Debug Init Containers | This command will return the same information as above in raw JSON.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16011"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs <pod-name> -c <init-container-2>\n```\n\n4.3.5 - Debug Init Containers | Init Containers that run a shell script print commands as they're executed. For example, you can do this in Bash by running set -x at the beginning of the script.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16012"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/nginx-with-request.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\n4.3.6 - Debug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16013"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        resources:\n          limits:\n            memory: \"128Mi\"\n            cpu: \"500m\"\n        ports:\n        - containerPort: 80\n```\n\n4.3.6 - Debug Running Pods | Create deployment by running following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16014"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/nginx-with-request.yaml\n```\n\n4.3.6 - Debug Running Pods | Check pod status by following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16015"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-67d4bdd6f5-w6kd7\n```\n\n4.3.6 - Debug Running Pods | Here you can see configuration information about the container(s) and Pod (labels, resource requirements, etc.), as well as status information about the container(s) and Pod (state, readiness, restart", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16016"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod nginx-deployment-1370807587-fz9sd\n```\n\n4.3.6 - Debug Running Pods | Here you can see the event generated by the scheduler saying that the Pod failed to schedule for reason FailedScheduling (and possibly others). The message tells us that there were not enough resource", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16017"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get events --namespace=my-namespace\n```\n\n4.3.6 - Debug Running Pods | To see events from all namespaces, you can use the --all-namespaces argument.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16018"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx-deployment-1006230814-6winp -o yaml\n```\n\n4.3.6 - Debug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16019"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: \"2022-02-17T21:51:01Z\"\n  generateName: nginx-deployment-67d4bdd6f5-\n  labels:\n    app: nginx\n    pod-template-hash: 67d4bdd6f5\n  name: nginx-deployment-67d4bdd6f5-w6kd7\n  namespace: default\n  ownerReferences:\n  - apiVersion: apps/v1\n    blockOwnerDeletion: true\n    controller: true\n    kind: ReplicaSet\n    name: nginx-deployment-67d4bdd6f5\n    uid: 7d41dfd4-84c0-4be4-88ab-cedbe626ad82\n  resourceVersion: \"1364\"\n  uid: a6501da1-0447-4262-98eb-c03d4002222e\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: nginx\n    ports:\n    - containerPort: 80\n      protocol: TCP\n    resources:\n      limits:\n        cpu: 500m\n        memory: 128Mi\n      requests:\n        cpu: 500m\n        memory: 128Mi\n    terminationMessagePath: /dev/termination-log\n    terminationMessagePolicy: File\n    volumeMounts:\n    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount\n      name: kube-api-access-bgsgp\n      readOnly: true\n  dnsPolicy: ClusterFirst\n  enableServiceLinks: true\n  nodeName: kube-worker-1\n  preemptionPolicy: PreemptLowerPriority\n  priority: 0\n  restartPolicy: Always\n  schedulerName: default-scheduler\n  securityContext: {}\n  serviceAccount: default\n  serviceAccountName: default\n  terminationGracePeriodSeconds: 30\n  tolerations:\n  - effect: NoExecute\n    key: node.kubernetes.io/not-ready\n    operator: Exists\n    tolerationSeconds: 300\n  - effect: NoExecute\n    key: node.kubernetes.io/unreachable\n    operator: Exists\n    tolerationSeconds: 300\n  volumes:\n  - name: kube-api-access-bgsgp\n    projected:\n      defaultMode: 420\n      sources:\n      - serviceAccountToken:\n          expirationSeconds: 3607\n          path: token\n      - configMap:\n          items:\n          - key: ca.crt\n            path: ca.crt\n          name: kube-root-ca.crt\n      - downwardAPI:\n          items:\n          - fieldRef:\n              apiVersion: v1\n              fieldPath: metadata.namespace\n            path: namespace\nstatus:\n  conditions:\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: Initialized\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: Ready\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:06Z\"\n    status: \"True\"\n    type: ContainersReady\n  - lastProbeTime: null\n    lastTransitionTime: \"2022-02-17T21:51:01Z\"\n    status: \"True\"\n    type: PodScheduled\n  containerStatuses:\n  - containerID: containerd://5403af59a2b46ee5a23fb0ae4b1e077f7ca5c5fb7af16e1ab21c00e0e616462a\n    image: docker.io/library/nginx:latest\n    imageID: docker.io/library/nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767\n    lastState: {}\n    name: nginx\n    ready: true\n    restartCount: 0\n    started: true\n    state:\n      running:\n        startedAt: \"2022-02-17T21:51:05Z\"\n  hostIP: 192.168.0.113\n  phase: Running\n  podIP: 10.88.0.3\n  podIPs:\n  - ip: 10.88.0.3\n  - ip: 2001:db8::1\n  qosClass: Guaranteed\n  startTime: \"2022-02-17T21:51:01Z\"\n```\n\n4.3.6 - Debug Running Pods | First, look at the logs of the affected container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16020"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs ${POD_NAME} ${CONTAINER_NAME}\n```\n\n4.3.6 - Debug Running Pods | If your container has previously crashed, you can access the previous container's crash log with:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16021"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous ${POD_NAME} ${CONTAINER_NAME}\n```\n\n4.3.6 - Debug Running Pods | If the container image includes debugging utilities, as is the case with images built from Linux and Windows OS base images, you can run commands inside a specific container with kubectl exec:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16022"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec ${POD_NAME} -c ${CONTAINER_NAME} -- ${CMD} ${ARG1} ${ARG2} ... ${ARGN}\n```\n\n4.3.6 - Debug Running Pods | As an example, to look at the logs from a running Cassandra pod, you might run", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16023"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec cassandra -- cat /var/log/cassandra/system.log\n```\n\n4.3.6 - Debug Running Pods | You can run a shell that's connected to your terminal using the -i and -t arguments to kubectl exec, for example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16024"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it cassandra -- sh\n```\n\n4.3.6 - Debug Running Pods | For more details, see Get a Shell to a Running Container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16025"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run ephemeral-demo --image=registry.k8s.io/pause:3.1 --restart=Never\n```\n\n4.3.6 - Debug Running Pods | The examples in this section use the pause container image because it does not contain debugging utilities, but this method works with all container images.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16026"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it ephemeral-demo -- sh\n```\n\n4.3.6 - Debug Running Pods | You can instead add a debugging container using kubectl debug. If you specify the -i/--interactive argument, kubectl will automatically attach to the console of the Ephemeral Container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16027"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it ephemeral-demo --image=busybox:1.28 --target=ephemeral-demo\n```\n\n4.3.6 - Debug Running Pods | This command adds a new busybox container and attaches to it. The --target parameter targets the process namespace of another container. It's necessary here because kubectl run does not enable process", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16028"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod ephemeral-demo\n```\n\n4.3.6 - Debug Running Pods | Use kubectl delete to remove the Pod when you're finished:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16029"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod ephemeral-demo\n```\n\n4.3.6 - Debug Running Pods | Sometimes Pod configuration options make it difficult to troubleshoot in certain situations. For example, you can't run kubectl exec to troubleshoot your container if your container image does not inc", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16030"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Run this command to create a copy of myapp named myapp-debug that adds a new Ubuntu container for debugging:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16031"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug myapp -it --image=ubuntu --share-processes --copy-to=myapp-debug\n```\n\n4.3.6 - Debug Running Pods | Don't forget to clean up the debugging Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16032"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\n4.3.6 - Debug Running Pods | Sometimes it's useful to change the command for a container, for example to add a debugging flag or because the application is crashing.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16033"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\n4.3.6 - Debug Running Pods | In some situations you may want to change a misbehaving Pod from its normal production container images to an image containing a debugging build or additional utilities.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16034"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp myapp-debug\n```\n\n4.3.6 - Debug Running Pods | If none of these approaches work, you can find the Node on which the Pod is running and create a Pod running on the Node. To create an interactive shell on a Node using kubectl debug, run:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16035"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\n4.3.6 - Debug Running Pods | When creating a debugging session on a node, keep in mind that:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16036"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod node-debugger-mynode-pdx84\n```\n\n4.3.6 - Debug Running Pods | When using kubectl debug to debug a node via a debugging Pod, a Pod via an ephemeral container, or a copied Pod, you can apply a profile to them. By applying a profile, specific properties such as sec", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16037"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Then, debug the Pod using an ephemeral container. If the ephemeral container needs to have privilege, you can use the sysadmin profile:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16038"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=sysadmin\n```\n\n4.3.6 - Debug Running Pods | Check the capabilities of the ephemeral container process by running the following command inside the container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16039"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\n4.3.6 - Debug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16040"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\n4.3.6 - Debug Running Pods | You can define a partial container spec for debugging as a custom profile in either YAML or JSON format, and apply it using the --custom flag.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16041"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run myapp --image=busybox:1.28 --restart=Never -- sleep 1d\n```\n\n4.3.6 - Debug Running Pods | Create a custom profile in YAML or JSON format. Here, create a YAML format file named custom-profile.yaml:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16042"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug -it myapp --image=busybox:1.28 --target=myapp --profile=general --custom=custom-profile.yaml\n```\n\n4.3.6 - Debug Running Pods | You can check that the ephemeral container has been added to the target Pod with the custom profile applied:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16043"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].env}'\n```\n\n4.3.6 - Debug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16044"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod myapp -o jsonpath='{.spec.ephemeralContainers[0].securityContext}'\n```\n\n4.3.6 - Debug Running Pods | Clean up the Pod when you're finished with it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16045"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod myapp\n```\n\n4.3.6 - Debug Running Pods | This page shows how to use kubectl exec to get a shell to a running container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16046"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/shell-demo.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\n4.3.7 - Get a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16047"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: shell-demo\nspec:\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n  containers:\n  - name: nginx\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n  hostNetwork: true\n  dnsPolicy: Default\n```\n\n4.3.7 - Get a Shell to a Running Container | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16048"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/shell-demo.yaml\n```\n\n4.3.7 - Get a Shell to a Running Container | Verify that the container is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16049"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod shell-demo\n```\n\n4.3.7 - Get a Shell to a Running Container | Get a shell to the running container:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16050"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec --stdin --tty shell-demo -- /bin/bash\n```\n\n4.3.7 - Get a Shell to a Running Container | In your shell, list the root directory:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16051"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- env\n```\n\n4.3.7 - Get a Shell to a Running Container | Experiment with running other commands. Here are some examples:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16052"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec shell-demo -- ps aux\nkubectl exec shell-demo -- ls /\nkubectl exec shell-demo -- cat /proc/1/mounts\n```\n\n4.3.7 - Get a Shell to a Running Container | If a Pod has more than one container, use --container or -c to specify a container in the kubectl exec command. For example, suppose you have a Pod named my-pod, and the Pod has two containers named m", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16053"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t my-pod --container main-app -- /bin/bash\n```\n\n4.3.7 - Get a Shell to a Running Container | This doc is about cluster troubleshooting; we assume you have already ruled out your application as the root cause of the problem you are experiencing. See the application troubleshooting guide for ti", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16054"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump\n```\n\n4.4 - Troubleshooting Clusters | Sometimes when debugging it can be useful to look at the status of a node -- for example, because you've noticed strange behavior of a Pod that's running on the node, or to find out why a Pod won't sc", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16055"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe node kube-worker-1\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16056"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get node kube-worker-1 -o yaml\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16057"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\nmetadata:\n  annotations:\n    node.alpha.kubernetes.io/ttl: \"0\"\n    volumes.kubernetes.io/controller-managed-attach-detach: \"true\"\n  creationTimestamp: \"2022-02-17T21:46:30Z\"\n  labels:\n    beta.kubernetes.io/arch: amd64\n    beta.kubernetes.io/os: linux\n    kubernetes.io/arch: amd64\n    kubernetes.io/hostname: kube-worker-1\n    kubernetes.io/os: linux\n  name: kube-worker-1\n  resourceVersion: \"4026\"\n  uid: 98efe7cb-2978-4a0b-842a-1a7bf12c05f8\nspec: {}\nstatus:\n  addresses:\n  - address: 192.168.0.113\n    type: InternalIP\n  - address: kube-worker-1\n    type: Hostname\n  allocatable:\n    cpu: \"2\"\n    ephemeral-storage: \"14167048988\"\n    hugepages-2Mi: \"0\"\n    memory: 1922788Ki\n    pods: \"110\"\n  capacity:\n    cpu: \"2\"\n    ephemeral-storage: 15372232Ki\n    hugepages-2Mi: \"0\"\n    memory: 2025188Ki\n    pods: \"110\"\n  conditions:\n  - lastHeartbeatTime: \"2022-02-17T22:20:32Z\"\n    lastTransitionTime: \"2022-02-17T22:20:32Z\"\n    message: Weave pod has set this\n    reason: WeaveIsUp\n    status: \"False\"\n    type: NetworkUnavailable\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient memory available\n    reason: KubeletHasSufficientMemory\n    status: \"False\"\n    type: MemoryPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has no disk pressure\n    reason: KubeletHasNoDiskPressure\n    status: \"False\"\n    type: DiskPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:13:25Z\"\n    message: kubelet has sufficient PID available\n    reason: KubeletHasSufficientPID\n    status: \"False\"\n    type: PIDPressure\n  - lastHeartbeatTime: \"2022-02-17T22:20:15Z\"\n    lastTransitionTime: \"2022-02-17T22:15:15Z\"\n    message: kubelet is posting ready status\n    reason: KubeletReady\n    status: \"True\"\n    type: Ready\n  daemonEndpoints:\n    kubeletEndpoint:\n      Port: 10250\n  nodeInfo:\n    architecture: amd64\n    bootID: 22333234-7a6b-44d4-9ce1-67e31dc7e369\n    containerRuntimeVersion: containerd://1.5.9\n    kernelVersion: 5.13.0-28-generic\n    kubeProxyVersion: v1.23.3\n    kubeletVersion: v1.23.3\n    machineID: 9384e2927f544209b5d7b67474bbf92b\n    operatingSystem: linux\n    osImage: Ubuntu 21.10\n    systemUUID: aa829ca9-73d7-064d-9019-df07404ad448\n```\n\n4.4 - Troubleshooting Clusters | For now, digging deeper into the cluster requires logging into the relevant machines. Here are the locations of the relevant log files. On systemd-based systems, you may need to use journalctl instead", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16058"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts\n```\n\n4.4.1 - Troubleshooting kubectl | Switch to the appropriate context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16059"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context <context-name>\n```\n\n4.4.1 - Troubleshooting kubectl | The kube-apiserver server is the central component of a Kubernetes cluster. If the API server or the load balancer that runs in front of your API servers is not reachable or not responding, you won't", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16060"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.clusters[0].cluster.certificate-authority-data}' | base64 -d | openssl x509 -noout -dates\n```\n\n4.4.1 - Troubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16061"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config view --flatten --output 'jsonpath={.users[0].user.client-certificate-data}'| base64 -d | openssl x509 -noout -dates\n```\n\n4.4.1 - Troubleshooting kubectl | output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16062"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/nodes/minikube\" | jq '.'\n```\n\n4.4.2 - Resource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16063"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/apis/metrics.k8s.io/v1beta1/namespaces/kube-system/pods/kube-scheduler-minikube\" | jq '.'\n```\n\n4.4.2 - Resource metrics pipeline | Here is the same API call using curl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16064"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndebug/node-problem-detector.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\n4.4.4 - Monitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16065"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n```\n\n4.4.4 - Monitor Node Health | Start node problem detector with kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16066"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/debug/node-problem-detector.yaml\n```\n\n4.4.4 - Monitor Node Health | If you are using a custom cluster bootstrap solution and don't need to overwrite the default configuration, you can leverage the Addon pod to further automate the deployment.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16067"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap node-problem-detector-config --from-file=config/\n```\n\n4.4.4 - Monitor Node Health | Change the node-problem-detector.yaml to use the ConfigMap:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16068"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ndebug/node-problem-detector-configmap.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\n4.4.4 - Monitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16069"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: node-problem-detector-v0.1\n  namespace: kube-system\n  labels:\n    k8s-app: node-problem-detector\n    version: v0.1\n    kubernetes.io/cluster-service: \"true\"\nspec:\n  selector:\n    matchLabels:\n      k8s-app: node-problem-detector  \n      version: v0.1\n      kubernetes.io/cluster-service: \"true\"\n  template:\n    metadata:\n      labels:\n        k8s-app: node-problem-detector\n        version: v0.1\n        kubernetes.io/cluster-service: \"true\"\n    spec:\n      hostNetwork: true\n      containers:\n      - name: node-problem-detector\n        image: registry.k8s.io/node-problem-detector:v0.1\n        securityContext:\n          privileged: true\n        resources:\n          limits:\n            cpu: \"200m\"\n            memory: \"100Mi\"\n          requests:\n            cpu: \"20m\"\n            memory: \"20Mi\"\n        volumeMounts:\n        - name: log\n          mountPath: /log\n          readOnly: true\n        - name: config # Overwrite the config/ directory with ConfigMap volume\n          mountPath: /config\n          readOnly: true\n      volumes:\n      - name: log\n        hostPath:\n          path: /var/log/\n      - name: config # Define ConfigMap volume\n        configMap:\n          name: node-problem-detector-config\n```\n\n4.4.4 - Monitor Node Health | Recreate the Node Problem Detector with the new configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16070"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\naudit/audit-policy.yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\n4.4.6 - Auditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16071"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: audit.k8s.io/v1 # This is required.\nkind: Policy\n# Don't generate audit events for all requests in RequestReceived stage.\nomitStages:\n  - \"RequestReceived\"\nrules:\n  # Log pod changes at RequestResponse level\n  - level: RequestResponse\n    resources:\n    - group: \"\"\n      # Resource \"pods\" doesn't match requests to any subresource of pods,\n      # which is consistent with the RBAC policy.\n      resources: [\"pods\"]\n  # Log \"pods/log\", \"pods/status\" at Metadata level\n  - level: Metadata\n    resources:\n    - group: \"\"\n      resources: [\"pods/log\", \"pods/status\"]\n\n  # Don't log requests to a configmap called \"controller-leader\"\n  - level: None\n    resources:\n    - group: \"\"\n      resources: [\"configmaps\"]\n      resourceNames: [\"controller-leader\"]\n\n  # Don't log watch requests by the \"system:kube-proxy\" on endpoints or services\n  - level: None\n    users: [\"system:kube-proxy\"]\n    verbs: [\"watch\"]\n    resources:\n    - group: \"\" # core API group\n      resources: [\"endpoints\", \"services\"]\n\n  # Don't log authenticated requests to certain non-resource URL paths.\n  - level: None\n    userGroups: [\"system:authenticated\"]\n    nonResourceURLs:\n    - \"/api*\" # Wildcard matching.\n    - \"/version\"\n\n  # Log the request body of configmap changes in kube-system.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n      resources: [\"configmaps\"]\n    # This rule only applies to resources in the \"kube-system\" namespace.\n    # The empty string \"\" can be used to select non-namespaced resources.\n    namespaces: [\"kube-system\"]\n\n  # Log configmap and secret changes in all other namespaces at the Metadata level.\n  - level: Metadata\n    resources:\n    - group: \"\" # core API group\n      resources: [\"secrets\", \"configmaps\"]\n\n  # Log all other resources in core and extensions at the Request level.\n  - level: Request\n    resources:\n    - group: \"\" # core API group\n    - group: \"extensions\" # Version of group should NOT be included.\n\n  # A catch-all rule to log all other requests at the Metadata level.\n  - level: Metadata\n    # Long-running requests like watches that fall under this rule will not\n    # generate an audit event in RequestReceived.\n    omitStages:\n      - \"RequestReceived\"\n```\n\n4.4.6 - Auditing | You can use a minimal audit policy file to log all requests at the Metadata level:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16072"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Log all requests at the Metadata level.\napiVersion: audit.k8s.io/v1\nkind: Policy\nrules:\n- level: Metadata\n```\n\n4.4.6 - Auditing | If you're crafting your own audit profile, you can use the audit profile for Google Container-Optimized OS as a starting point. You can check the configure-helper.sh script, which generates an audit p", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16073"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl debug node/mynode -it --image=ubuntu\n```\n\n4.4.7 - Debugging Kubernetes Nodes With Kubectl | The debug command helps to gather information and troubleshoot issues. Commands that you might use include ip, ifconfig, nc, ping, and ps and so on. You can also install other tools, such as mtr, tcpd", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16074"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | This sets the kubectl.kubernetes.io/last-applied-configuration: '{...}' annotation on each object. The annotation contains the contents of the object configuration file that was used to create the obj", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16075"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16076"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Run kubectl diff to print the object that will be created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16077"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | diff uses server-side dry-run, which needs to be enabled on kube-apiserver.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16078"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16079"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16080"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | You can also use kubectl apply to update all objects defined in a directory, even if those objects already exist. This approach accomplishes the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16081"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f <directory>\nkubectl apply -f <directory>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here's an example configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16082"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16083"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16084"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16085"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the kubectl.kubernetes.io/last-applied-configuration annotation was written to the live configuration, and it matches the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16086"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # This is the json representation of simple_deployment.yaml\n    # It was written by kubectl apply when the object was created\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Directly update the replicas field in the live configuration by using kubectl scale. This does not use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16087"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale deployment/nginx-deployment --replicas=2\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16088"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the replicas field has been set to 2, and the last-applied-configuration annotation does not contain a replicas field:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16089"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Update the simple_deployment.yaml configuration file to change the image from nginx:1.14.2 to nginx:1.16.1, and delete the minReadySeconds field:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16090"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/update_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16091"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Apply the changes made to the configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16092"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f https://k8s.io/examples/application/update_deployment.yaml\nkubectl apply -f https://k8s.io/examples/application/update_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16093"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/update_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows the following changes to the live configuration:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16094"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | There are two approaches to delete objects managed by kubectl apply.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16095"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <filename>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | As an alternative to kubectl delete, you can use kubectl apply to identify objects to be deleted after their manifests have been removed from a directory in the local filesystem.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16096"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <directory> --prune -l <labels> --prune-allowlist=<gvk-list>\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | FEATURE STATE: Kubernetes v1.27 [alpha]Caution:kubectl apply --prune --applyset is in alpha, and backwards incompatible changes might be introduced in subsequent releases.To use ApplySet-based pruning", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16097"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f <filename|url> -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | When kubectl apply updates the live configuration for an object, it does so by sending a patch request to the API server. The patch defines updates scoped to specific fields of the live object configu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16098"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/update_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16099"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # update the image\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Also, suppose this is the live configuration for the same Deployment object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16100"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # note that the annotation does not contain replicas\n    # because it was not updated through apply\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"minReadySeconds\":5,\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.14.2\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n  # ...\nspec:\n  replicas: 2 # written by scale\n  # ...\n  minReadySeconds: 5\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n      # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Here are the merge calculations that would be performed by kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16101"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    # ...\n    # The annotation contains the updated image to nginx 1.16.1,\n    # but does not contain the updated replicas to 2\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\n      \"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\n      \"spec\":{\"selector\":{\"matchLabels\":{\"app\":nginx}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"nginx\"}},\n      \"spec\":{\"containers\":[{\"image\":\"nginx:1.16.1\",\"name\":\"nginx\",\n      \"ports\":[{\"containerPort\":80}]}]}}}}      \n    # ...\nspec:\n  selector:\n    matchLabels:\n      # ...\n      app: nginx\n  replicas: 2 # Set by `kubectl scale`.  Ignored by `kubectl apply`.\n  # minReadySeconds cleared by `kubectl apply`\n  # ...\n  template:\n    metadata:\n      # ...\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.16.1 # Set by `kubectl apply`\n        # ...\n        name: nginx\n        ports:\n        - containerPort: 80\n        # ...\n      # ...\n    # ...\n  # ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | How a particular field in a configuration file is merged with the live configuration depends on the type of the field. There are several types of fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16102"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/simple_deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16103"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Create the object using kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16104"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/simple_deployment.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Print the live configuration using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16105"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | The output shows that the API server set several fields to default values in the live configuration. These fields were not specified in the configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16106"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\n# ...\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  minReadySeconds: 5\n  replicas: 1 # defaulted by apiserver\n  strategy:\n    rollingUpdate: # defaulted by apiserver - derived from strategy.type\n      maxSurge: 1\n      maxUnavailable: 1\n    type: RollingUpdate # defaulted by apiserver\n  template:\n    metadata:\n      creationTimestamp: null\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        imagePullPolicy: IfNotPresent # defaulted by apiserver\n        name: nginx\n        ports:\n        - containerPort: 80\n          protocol: TCP # defaulted by apiserver\n        resources: {} # defaulted by apiserver\n        terminationMessagePath: /dev/termination-log # defaulted by apiserver\n      dnsPolicy: ClusterFirst # defaulted by apiserver\n      restartPolicy: Always # defaulted by apiserver\n      securityContext: {} # defaulted by apiserver\n      terminationGracePeriodSeconds: 30 # defaulted by apiserver\n# ...\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | In a patch request, defaulted fields are not re-defaulted unless they are explicitly cleared as part of a patch request. This can cause unexpected behavior for fields that are defaulted based on the v", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16107"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16108"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16109"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl replace --save-config -f <kind>_<name>.yaml\n```\n\n5.1 - Declarative Management of Kubernetes Objects Using Configuration Files | Change processes to use kubectl apply for managing the object exclusively.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16110"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <kustomization_directory>\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To apply those resources, run kubectl apply with --kustomize or -k flag:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16111"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization_directory>\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Install kubectl.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16112"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-8mbdf7882g\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a ConfigMap from an env file, add an entry to the envs list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a .env file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16113"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-42cfbf598f\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the literals list in configMapGenerator. Here is an example of gen", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16114"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  name: example-configmap-2-g2hdhfc6tk\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16115"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create an application.properties file\ncat <<EOF >application.properties\nFOO=Bar\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: config\n          mountPath: /config\n      volumes:\n      - name: config\n        configMap:\n          name: example-configmap-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nconfigMapGenerator:\n- name: example-configmap-1\n  files:\n  - application.properties\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Generate the ConfigMap and Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16116"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  application.properties: |\n    FOO=Bar    \nkind: ConfigMap\nmetadata:\n  name: example-configmap-1-g4hk9g2ff8\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: my-app\n  name: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - image: my-app\n        name: app\n        volumeMounts:\n        - mountPath: /config\n          name: config\n      volumes:\n      - configMap:\n          name: example-configmap-1-g4hk9g2ff8\n        name: config\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | You can generate Secrets from files or literal key-value pairs. To generate a Secret from a file, add an entry to the files list in secretGenerator. Here is an example of generating a Secret with a da", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16117"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password.txt: dXNlcm5hbWU9YWRtaW4KcGFzc3dvcmQ9c2VjcmV0Cg==\nkind: Secret\nmetadata:\n  name: example-secret-1-t2kt65hgtb\ntype: Opaque\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | To generate a Secret from a literal key-value pair, add an entry to literals list in secretGenerator. Here is an example of generating a Secret with a data item from a key-value pair:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16118"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  password: c2VjcmV0\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  name: example-secret-2-t52t6g96d8\ntype: Opaque\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16119"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a password.txt file\ncat <<EOF >./password.txt\nusername=admin\npassword=secret\nEOF\n\ncat <<EOF >deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-app\n  labels:\n    app: my-app\nspec:\n  selector:\n    matchLabels:\n      app: my-app\n  template:\n    metadata:\n      labels:\n        app: my-app\n    spec:\n      containers:\n      - name: app\n        image: my-app\n        volumeMounts:\n        - name: password\n          mountPath: /secrets\n      volumes:\n      - name: password\n        secret:\n          secretName: example-secret-1\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nsecretGenerator:\n- name: example-secret-1\n  files:\n  - password.txt\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | The generated ConfigMaps and Secrets have a content hash suffix appended. This ensures that a new ConfigMap or Secret is generated when the contents are changed. To disable the behavior of appending a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16120"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  FOO: Bar\nkind: ConfigMap\nmetadata:\n  annotations:\n    note: generated\n  labels:\n    type: generated\n  name: example-configmap-3\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | It is quite common to set cross-cutting fields for all Kubernetes resources in a project. Some use cases for setting cross-cutting fields:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16121"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml\ncat <<EOF >./deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamespace: my-namespace\nnamePrefix: dev-\nnameSuffix: \"-001\"\nlabels:\n  - pairs:\n      app: bingo\n    includeSelectors: true \ncommonAnnotations:\n  oncallPager: 800-555-1212\nresources:\n- deployment.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view those fields are all set in the Deployment Resource:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16122"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  annotations:\n    oncallPager: 800-555-1212\n  labels:\n    app: bingo\n  name: dev-nginx-deployment-001\n  namespace: my-namespace\nspec:\n  selector:\n    matchLabels:\n      app: bingo\n  template:\n    metadata:\n      annotations:\n        oncallPager: 800-555-1212\n      labels:\n        app: bingo\n    spec:\n      containers:\n      - image: nginx\n        name: nginx\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | It is common to compose a set of resources in a project and manage them inside the same file or directory. Kustomize offers composing resources from different files and applying patches or other custo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16123"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\n# Create a kustomization.yaml composing them\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | The resources from kubectl kustomize ./ contain both the Deployment and the Service objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16124"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a patch increase_replicas.yaml\ncat <<EOF > increase_replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\nEOF\n\n# Create another patch set_memory.yaml\ncat <<EOF > set_memory.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  template:\n    spec:\n      containers:\n      - name: my-nginx\n        resources:\n          limits:\n            memory: 512Mi\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\npatches:\n  - path: increase_replicas.yaml\n  - path: set_memory.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to view the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16125"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            memory: 512Mi\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Not all resources or fields support strategicMerge patches. To support modifying arbitrary fields in arbitrary resources, Kustomize offers applying JSON patch through Json6902. To find the correct Res", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16126"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a json patch\ncat <<EOF > patch.yaml\n- op: replace\n  path: /spec/replicas\n  value: 3\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\n\npatches:\n- target:\n    group: apps\n    version: v1\n    kind: Deployment\n    name: my-nginx\n  path: patch.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see the replicas field is updated:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16127"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: nginx\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16128"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\ncat <<EOF >./kustomization.yaml\nresources:\n- deployment.yaml\nimages:\n- name: nginx\n  newName: my.image.registry/nginx\n  newTag: \"1.4.0\"\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the image being used is updated:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16129"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - image: my.image.registry/nginx:1.4.0\n        name: my-nginx\n        ports:\n        - containerPort: 80\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Sometimes, the application running in a Pod may need to use configuration values from other objects. For example, a Pod from a Deployment object need to read the corresponding Service name from Env or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16130"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file (quoting the here doc delimiter)\ncat <<'EOF' > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        command: [\"start\", \"--host\", \"MY_SERVICE_NAME_PLACEHOLDER\"]\nEOF\n\n# Create a service.yaml file\ncat <<EOF > service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nnameSuffix: \"-001\"\n\nresources:\n- deployment.yaml\n- service.yaml\n\nreplacements:\n- source:\n    kind: Service\n    name: my-nginx\n    fieldPath: metadata.name\n  targets:\n  - select:\n      kind: Deployment\n      name: my-nginx\n    fieldPaths:\n    - spec.template.spec.containers.0.command.2\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run kubectl kustomize ./ to see that the Service name injected into containers is dev-my-nginx-001:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16131"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: dev-my-nginx-001\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      run: my-nginx\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - command:\n        - start\n        - --host\n        - dev-my-nginx-001\n        image: nginx\n        name: my-nginx\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Kustomize has the concepts of bases and overlays. A base is a directory with a kustomization.yaml, which contains a set of resources and associated customization. A base could be either a local direct", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16132"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a directory to hold the base\nmkdir base\n# Create a base/deployment.yaml\ncat <<EOF > base/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\nEOF\n\n# Create a base/service.yaml file\ncat <<EOF > base/service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  ports:\n  - port: 80\n    protocol: TCP\n  selector:\n    run: my-nginx\nEOF\n# Create a base/kustomization.yaml\ncat <<EOF > base/kustomization.yaml\nresources:\n- deployment.yaml\n- service.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | This base can be used in multiple overlays. You can add different namePrefix or other cross-cutting fields in different overlays. Here are two overlays using the same base.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16133"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <kustomization directory>/\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Given the following kustomization.yaml,", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16134"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Create a deployment.yaml file\ncat <<EOF > deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  selector:\n    matchLabels:\n      run: my-nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx\n        ports:\n        - containerPort: 80\nEOF\n\n# Create a kustomization.yaml\ncat <<EOF >./kustomization.yaml\nnamePrefix: dev-\nlabels:\n  - pairs:\n      app: my-nginx\n    includeSelectors: true \nresources:\n- deployment.yaml\nEOF\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to apply the Deployment object dev-my-nginx:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16135"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe -k ./\n```\n\n5.2 - Declarative Management of Kubernetes Objects Using Kustomize | Run the following command to compare the Deployment object dev-my-nginx against the state that the cluster would be in if the manifest was applied:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16136"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport <myservicename>\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | In the preceding example, the create service nodeport command is called a subcommand of the create service command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16137"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport -h\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | The kubectl command supports verb-driven commands for some common update operations. These commands are named to enable users unfamiliar with Kubernetes objects to perform updates without knowing the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16138"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment/nginx\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | There are several commands for printing information about an object:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16139"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | You can use kubectl create --edit to make arbitrary changes to an object before it is created. Here's an example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16140"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip my-svc --clusterip=\"None\" -o yaml --dry-run=client > /tmp/srv.yaml\nkubectl create --edit -f /tmp/srv.yaml\n```\n\n5.3 - Managing Kubernetes Objects Using Imperative Commands | Kubernetes objects can be created, updated, and deleted by using the kubectl command-line tool along with an object configuration file written in YAML or JSON. This document explains how to define and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16141"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete <type> <name>\nkubectl delete <type> -l <label>\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | You can use kubectl get -f to view information about an object that is described in a configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16142"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f <url> --edit\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | Migrating from imperative commands to imperative object configuration involves several manual steps.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16143"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get <kind>/<name> -o yaml > <kind>_<name>.yaml\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | Manually remove the status field from the object configuration file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16144"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f <kind>_<name>.yaml\n```\n\n5.4 - Imperative Management of Kubernetes Objects Using Configuration Files | The recommended approach is to define a single, immutable PodTemplate label used only by the controller selector with no other semantic meaning.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16145"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-patch.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16146"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: patch-demo\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: patch-demo-ctr\n        image: nginx\n      tolerations:\n      - effect: NoSchedule\n        key: dedicated\n        value: test-team\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16147"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-patch.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16148"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16149"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has two Containers:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16150"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod <your-pod-name> --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the Pod has two Containers: one running nginx and one running redis:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16151"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file-tolerations.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16152"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the PodSpec in the Deployment has only one Toleration:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16153"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --type merge --patch-file patch-file-2.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the patched Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16154"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment patch-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The containers list that you specified in the patch has only one Container. The output shows that your list of one Container replaced the existing containers list.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16155"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-retainkeys.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16156"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: retainkeys-demo\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  strategy:\n    rollingUpdate:\n      maxSurge: 30%\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: retainkeys-demo-ctr\n        image: nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16157"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-retainkeys.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | At this point, the deployment is created and is using the RollingUpdate strategy.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16158"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-no-retainkeys.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In the output, you can see that it is not possible to set type as Recreate when a value is defined for spec.strategy.rollingUpdate:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16159"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment retainkeys-demo --type strategic --patch-file patch-file-retainkeys.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Examine the content of the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16160"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment retainkeys-demo --output yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output shows that the strategy object in the Deployment does not contain the rollingUpdate key anymore:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16161"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment patch-demo --patch-file patch-file.yaml\nkubectl patch deployment patch-demo --patch 'spec:\\n template:\\n  spec:\\n   containers:\\n   - name: patch-demo-ctr-2\\n     image: redis'\n\nkubectl patch deployment patch-demo --patch-file patch-file.json\nkubectl patch deployment patch-demo --patch '{\"spec\": {\"template\": {\"spec\": {\"containers\": [{\"name\": \"patch-demo-ctr-2\",\"image\": \"redis\"}]}}}}'\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The flag --subresource=[subresource-name] is used with kubectl commands like get, patch, edit, apply and replace to fetch and update status, scale and resize subresource of the resources you specify.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16162"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16163"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | Create the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16164"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | View the Pods associated with your Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16165"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In the output, you can see that Deployment has two Pods. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16166"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":3}}'\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16167"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In the output, you can see one new pod is created, so now you have 3 running pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16168"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-deployment -o yaml\n```\n\n5.5 - Update API Objects in Place Using kubectl patch | In this exercise, you used kubectl patch to change the live configuration of a Deployment object. You did not change the configuration file that you originally used to create the Deployment object. Ot", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16169"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Make sure to enable automatic reload of encryption configuration file by setting --encryption-provider-config-automatic-reload to true.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16170"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic my-secret --from-literal=key1=supersecret\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the serialized data for that Secret object is prefixed with k8s:enc:aescbc:v1:key1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16171"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - secrets\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgaXMgaXQ/\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | To ensure that previously created secret my-secret is re-encrypted with new key key2, you will use Storage Version Migration.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16172"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16173"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-secret.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of Secrets by checking the .status of the StorageVersionMigration. A successful migration should have its Succeeded condition set to true. Get the StorageVersionMigration object as f", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16174"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/secrets-migration -o yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16175"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: secrets-migration\n  uid: 628f6922-a9cb-4514-b076-12d3c178967c\n  resourceVersion: \"90\"\n  creationTimestamp: \"2024-03-12T20:29:45Z\"\nspec:\n  resource:\n    group: \"\"\n    version: v1\n    resource: secrets\nstatus:\n  conditions:\n  - type: Running\n    status: \"False\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationInProgress\n  - type: Succeeded\n    status: \"True\"\n    lastUpdateTime: \"2024-03-12T20:29:46Z\"\n    reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"84\"\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify the stored secret is now prefixed with k8s:enc:aescbc:v1:key2.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16176"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n    conversionReviewVersions:\n    - v1\n    - v2\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CRD using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16177"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create a manifest for an example testcrd. Name the manifest cr1.yaml and use these contents:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16178"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: SelfieRequest\nmetadata:\n  name: cr1\n  namespace: default\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16179"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr1.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v1 by getting the object from etcd.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16180"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\nname: selfierequests.stable.example.com\nspec:\n  group: stable.example.com\n  names:\n    plural: SelfieRequests\n    singular: SelfieRequest\n    kind: SelfieRequest\n    listKind: SelfieRequestList\n  scope: Namespaced\n  versions:\n    - name: v2\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            host:\n              type: string\n            port:\n              type: string\n    - name: v1\n      served: true\n      storage: false\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            hostPort:\n              type: string\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://127.0.0.1:9443/crdconvert\"\n        caBundle: <CABundle info>\n      conversionReviewVersions:\n        - v1\n        - v2\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Update CRD using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16181"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f test-crd.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR resource file with name cr2.yaml as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16182"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v2\nkind: SelfieRequest\nmetadata:\n  name: cr2\n  namespace: default\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create CR using kubectl:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16183"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cr2.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that CR is written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16184"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: SelfieRequest\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Create the object using kubectl as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16185"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f migrate-crd.yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Monitor migration of secrets using status. Successful migration should have Succeeded condition set to \"True\" in the status field. Get the migration resource as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16186"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get storageversionmigration.storagemigration.k8s.io/crdsvm -o yaml\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16187"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageVersionMigration\napiVersion: storagemigration.k8s.io/v1alpha1\nmetadata:\n  name: crdsvm\n  uid: 13062fe4-32d7-47cc-9528-5067fa0c6ac8\n  resourceVersion: \"111\"\n  creationTimestamp: \"2024-03-12T22:40:01Z\"\nspec:\n  resource:\n    group: stable.example.com\n    version: v1\n    resource: testcrds\nstatus:\n  conditions:\n    - type: Running\n      status: \"False\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationInProgress\n    - type: Succeeded\n      status: \"True\"\n      lastUpdateTime: \"2024-03-12T22:40:03Z\"\n      reason: StorageVersionMigrationSucceeded\n  resourceVersion: \"106\"\n```\n\n5.6 - Migrate Kubernetes Objects Using Storage Version Migration | Verify that previously created cr1 is now written and stored as v2 by getting the object from etcd.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16188"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-literal=username=admin \\\n    --from-literal=password='S!B\\*d$zDsb='\n```\n\n6.1 - Managing Secrets using kubectl | You must use single quotes '' to escape special characters such as $, \\, *, =, and ! in your strings. If you don't, your shell will interpret these characters.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16189"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=./username.txt \\\n    --from-file=./password.txt\n```\n\n6.1 - Managing Secrets using kubectl | The default key name is the file name. You can optionally set the key name using --from-file=[key=]source. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16190"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic db-user-pass \\\n    --from-file=username=./username.txt \\\n    --from-file=password=./password.txt\n```\n\n6.1 - Managing Secrets using kubectl | With either method, the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16191"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret db-user-pass\n```\n\n6.1 - Managing Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16192"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data}'\n```\n\n6.1 - Managing Secrets using kubectl | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16193"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret db-user-pass -o jsonpath='{.data.password}' | base64 --decode\n```\n\n6.1 - Managing Secrets using kubectl | You can edit an existing Secret object unless it is immutable. To edit a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16194"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit secrets <secret-name>\n```\n\n6.1 - Managing Secrets using kubectl | This opens your default editor and allows you to update the base64 encoded Secret values in the data field, such as in the following example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16195"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file, it will be\n# reopened with the relevant failures.\n#\napiVersion: v1\ndata:\n  password: UyFCXCpkJHpEc2I9\n  username: YWRtaW4=\nkind: Secret\nmetadata:\n  creationTimestamp: \"2022-06-28T17:44:13Z\"\n  name: db-user-pass\n  namespace: default\n  resourceVersion: \"12708504\"\n  uid: 91becd59-78fa-4c85-823f-6d44436242ac\ntype: Opaque\n```\n\n6.1 - Managing Secrets using kubectl | To delete a Secret, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16196"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\n6.1 - Managing Secrets using kubectl | You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two node", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16197"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: MWYyZDFlMmU2N2Rm\n```\n\n6.2 - Managing Secrets using Configuration File | Note that the name of a Secret object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16198"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\n6.2 - Managing Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16199"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\nstringData:\n  config.yaml: |\n    apiUrl: \"https://my.api.com/api/v1\"\n    username: <user>\n    password: <password>\n```\n\n6.2 - Managing Secrets using Configuration File | When you retrieve the Secret data, the command returns the encoded values, and not the plaintext values you provided in stringData.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16200"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret mysecret -o yaml\n```\n\n6.2 - Managing Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16201"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:40:59Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7225\"\n  uid: c280ad2e-e916-11e8-98f2-025000000001\ntype: Opaque\n```\n\n6.2 - Managing Secrets using Configuration File | If you specify a field in both data and stringData, the value from stringData is used.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16202"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\nstringData:\n  username: administrator\n```\n\n6.2 - Managing Secrets using Configuration File | The Secret object is created as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16203"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\ndata:\n  username: YWRtaW5pc3RyYXRvcg==\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-11-15T20:46:46Z\n  name: mysecret\n  namespace: default\n  resourceVersion: \"7579\"\n  uid: 91460ecb-e917-11e8-98f2-025000000001\ntype: Opaque\n```\n\n6.2 - Managing Secrets using Configuration File | YWRtaW5pc3RyYXRvcg== decodes to administrator.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16204"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: YmlyZHNhcmVudHJlYWw=\n```\n\n6.2 - Managing Secrets using Configuration File | Apply the manifest to your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16205"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./secret.yaml\n```\n\n6.2 - Managing Secrets using Configuration File | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16206"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret mysecret\n```\n\n6.2 - Managing Secrets using Configuration File | kubectl supports using the Kustomize object management tool to manage Secrets and ConfigMaps. You create a resource generator using Kustomize, which generates a Secret that you can apply to the API se", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16207"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\n6.3 - Managing Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16208"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get -k <directory-path> -o jsonpath='{.data}'\n```\n\n6.3 - Managing Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16209"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -k <directory-path>\n```\n\n6.3 - Managing Secrets using Kustomize | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16210"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret db-user-pass\n```\n\n6.3 - Managing Secrets using Kustomize | This page shows how to define commands and arguments when you run a container in a Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16211"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/commands.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\n7.1 - Define a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16212"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: command-demo\n  labels:\n    purpose: demonstrate-command\nspec:\n  containers:\n  - name: command-demo-container\n    image: debian\n    command: [\"printenv\"]\n    args: [\"HOSTNAME\", \"KUBERNETES_PORT\"]\n  restartPolicy: OnFailure\n```\n\n7.1 - Define a Command and Arguments for a Container | Create a Pod based on the YAML configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16213"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/commands.yaml\n```\n\n7.1 - Define a Command and Arguments for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16214"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs command-demo\n```\n\n7.1 - Define a Command and Arguments for a Container | The output shows the values of the HOSTNAME and KUBERNETES_PORT environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16215"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dependent-envars.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\n7.2 - Define Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16216"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dependent-envars-demo\nspec:\n  containers:\n    - name: dependent-envars-demo\n      args:\n        - while true; do echo -en '\\n'; printf UNCHANGED_REFERENCE=$UNCHANGED_REFERENCE'\\n'; printf SERVICE_ADDRESS=$SERVICE_ADDRESS'\\n';printf ESCAPED_REFERENCE=$ESCAPED_REFERENCE'\\n'; sleep 30; done;\n      command:\n        - sh\n        - -c\n      image: busybox:1.28\n      env:\n        - name: SERVICE_PORT\n          value: \"80\"\n        - name: SERVICE_IP\n          value: \"172.17.0.1\"\n        - name: UNCHANGED_REFERENCE\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: PROTOCOL\n          value: \"https\"\n        - name: SERVICE_ADDRESS\n          value: \"$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n        - name: ESCAPED_REFERENCE\n          value: \"$$(PROTOCOL)://$(SERVICE_IP):$(SERVICE_PORT)\"\n```\n\n7.2 - Define Dependent Environment Variables | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16217"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dependent-envars.yaml\n```\n\n7.2 - Define Dependent Environment Variables | List the running Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16218"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods dependent-envars-demo\n```\n\n7.2 - Define Dependent Environment Variables | Check the logs for the container running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16219"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs pod/dependent-envars-demo\n```\n\n7.2 - Define Dependent Environment Variables | As shown above, you have defined the correct dependency reference of SERVICE_ADDRESS, bad dependency reference of UNCHANGED_REFERENCE and skip dependent references of ESCAPED_REFERENCE.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16220"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/envars.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\n7.3 - Define Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16221"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envar-demo\n  labels:\n    purpose: demonstrate-envars\nspec:\n  containers:\n  - name: envar-demo-container\n    image: gcr.io/google-samples/hello-app:2.0\n    env:\n    - name: DEMO_GREETING\n      value: \"Hello from the environment\"\n    - name: DEMO_FAREWELL\n      value: \"Such a sweet sorrow\"\n```\n\n7.3 - Define Environment Variables for a Container | Create a Pod based on that manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16222"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml\n```\n\n7.3 - Define Environment Variables for a Container | List the running Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16223"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l purpose=demonstrate-envars\n```\n\n7.3 - Define Environment Variables for a Container | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16224"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec envar-demo -- printenv\n```\n\n7.3 - Define Environment Variables for a Container | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16225"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: print-greeting\nspec:\n  containers:\n  - name: env-print-demo\n    image: bash\n    env:\n    - name: GREETING\n      value: \"Warm greetings to\"\n    - name: HONORIFIC\n      value: \"The Most Honorable\"\n    - name: NAME\n      value: \"Kubernetes\"\n    - name: MESSAGE\n      value: \"$(GREETING) $(HONORIFIC) $(NAME)\"\n    command: [\"echo\"]\n    args: [\"$(MESSAGE)\"]\n```\n\n7.3 - Define Environment Variables for a Container | Upon creation, the command echo Warm greetings to The Most Honorable Kubernetes is run on the container.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16226"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/envars-file-container.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16227"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfile-test-pod\nspec:\n  initContainers:\n    - name: setup-envfile\n      image:  nginx\n      command: ['sh', '-c', 'echo \"DB_ADDRESS=address\\nREST_ENDPOINT=endpoint\" > /data/config.env']\n      volumeMounts:\n        - name: config\n          mountPath: /data\n  containers:\n    - name: use-envfile\n      image: nginx\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: DB_ADDRESS\n          valueFrom:\n            fileKeyRef:\n              path: config.env\n              volumeName: config\n              key: DB_ADDRESS\n              optional: false\n  restartPolicy: Never\n  volumes:\n    - name: config\n      emptyDir: {}\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | In this manifest, you can see the initContainer mounts an emptyDir volume and writes environment variables to a file within it, and the regular containers reference both the file and the environment v", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16228"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/envars-file-container.yaml\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16229"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod -c use-envfile | grep DB_ADDRESS\n```\n\n7.4 - Define Environment Variable Values Using An Init Container | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16230"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-envars-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16231"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-fieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_NODE_NAME MY_POD_NAME MY_POD_NAMESPACE;\n          printenv MY_POD_IP MY_POD_SERVICE_ACCOUNT;\n          sleep 10;\n        done;\n      env:\n        - name: MY_NODE_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.nodeName\n        - name: MY_POD_NAME\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.name\n        - name: MY_POD_NAMESPACE\n          valueFrom:\n            fieldRef:\n              fieldPath: metadata.namespace\n        - name: MY_POD_IP\n          valueFrom:\n            fieldRef:\n              fieldPath: status.podIP\n        - name: MY_POD_SERVICE_ACCOUNT\n          valueFrom:\n            fieldRef:\n              fieldPath: spec.serviceAccountName\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In that manifest, you can see five environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_NODE_NAME environment vari", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16232"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-pod.yaml\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16233"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-fieldref\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16234"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it dapi-envars-fieldref -- sh\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In your shell, view the environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16235"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-envars-container.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16236"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          printenv MY_CPU_REQUEST MY_CPU_LIMIT;\n          printenv MY_MEM_REQUEST MY_MEM_LIMIT;\n          sleep 10;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      env:\n        - name: MY_CPU_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.cpu\n        - name: MY_CPU_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.cpu\n        - name: MY_MEM_REQUEST\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: requests.memory\n        - name: MY_MEM_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: test-container\n              resource: limits.memory\n  restartPolicy: Never\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | In this manifest, you can see four environment variables. The env field is an array of environment variable definitions. The first element in the array specifies that the MY_CPU_REQUEST environment va", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16237"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-envars-container.yaml\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16238"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-envars-resourcefieldref\n```\n\n7.5 - Expose Pod Information to Containers Through Environment Variables | The output shows the values of selected environment variables:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16239"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-volume.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16240"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example\n  labels:\n    zone: us-est-coast\n    cluster: test-cluster1\n    rack: rack-22\n  annotations:\n    build: two\n    builder: john-doe\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          if [[ -e /etc/podinfo/labels ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/labels; fi;\n          if [[ -e /etc/podinfo/annotations ]]; then\n            echo -en '\\n\\n'; cat /etc/podinfo/annotations; fi;\n          sleep 5;\n        done;\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"labels\"\n            fieldRef:\n              fieldPath: metadata.labels\n          - path: \"annotations\"\n            fieldRef:\n              fieldPath: metadata.annotations\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI Volume, and the container mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16241"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume.yaml\n```\n\n7.6 - Expose Pod Information to Containers Through Files | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16242"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs kubernetes-downwardapi-volume-example\n```\n\n7.6 - Expose Pod Information to Containers Through Files | The output shows the contents of the labels file and the annotations file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16243"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example -- sh\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In your shell, view the labels file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16244"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/dapi-volume-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16245"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kubernetes-downwardapi-volume-example-2\nspec:\n  containers:\n    - name: client-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [\"sh\", \"-c\"]\n      args:\n      - while true; do\n          echo -en '\\n';\n          if [[ -e /etc/podinfo/cpu_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_limit; fi;\n          if [[ -e /etc/podinfo/cpu_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/cpu_request; fi;\n          if [[ -e /etc/podinfo/mem_limit ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_limit; fi;\n          if [[ -e /etc/podinfo/mem_request ]]; then\n            echo -en '\\n'; cat /etc/podinfo/mem_request; fi;\n          sleep 5;\n        done;\n      resources:\n        requests:\n          memory: \"32Mi\"\n          cpu: \"125m\"\n        limits:\n          memory: \"64Mi\"\n          cpu: \"250m\"\n      volumeMounts:\n        - name: podinfo\n          mountPath: /etc/podinfo\n  volumes:\n    - name: podinfo\n      downwardAPI:\n        items:\n          - path: \"cpu_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.cpu\n              divisor: 1m\n          - path: \"cpu_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.cpu\n              divisor: 1m\n          - path: \"mem_limit\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: limits.memory\n              divisor: 1Mi\n          - path: \"mem_request\"\n            resourceFieldRef:\n              containerName: client-container\n              resource: requests.memory\n              divisor: 1Mi\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In the manifest, you can see that the Pod has a downwardAPI volume, and that the single container in that Pod mounts the volume at /etc/podinfo.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16246"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/dapi-volume-resources.yaml\n```\n\n7.6 - Expose Pod Information to Containers Through Files | Get a shell into the container that is running in your Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16247"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it kubernetes-downwardapi-volume-example-2 -- sh\n```\n\n7.6 - Expose Pod Information to Containers Through Files | In your shell, view the cpu_limit file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16248"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16249"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: test-secret\ndata:\n  username: bXktYXBw\n  password: Mzk1MjgkdmRnN0pi\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Secret", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16250"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | View information about the Secret:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16251"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get secret test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16252"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16253"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal='username=my-app' --from-literal='password=39528$vdg7Jb'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | This is more convenient. The detailed approach shown earlier runs through each step explicitly to demonstrate what is happening.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16254"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/secret-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16255"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: nginx\n      volumeMounts:\n        # name must match the volume name below\n        - name: secret-volume\n          mountPath: /etc/secret-volume\n          readOnly: true\n  # The secret data is exposed to Containers in the Pod through a Volume.\n  volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16256"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/inject/secret-pod.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Verify that your Pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16257"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod secret-test-pod\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16258"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t secret-test-pod -- /bin/bash\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The secret data is exposed to the Container through a Volume mounted under /etc/secret-volume.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16259"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n      readOnly: true\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      items:\n      - key: username\n        path: my-group/my-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | When you deploy this Pod, the following happens:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16260"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod\nspec:\n  containers:\n  - name: mypod\n    image: redis\n    volumeMounts:\n    - name: foo\n      mountPath: \"/etc/foo\"\n  volumes:\n  - name: foo\n    secret:\n      secretName: mysecret\n      defaultMode: 0400\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The Secret is mounted on /etc/foo; all the files created by the secret volume mount have permission 0400.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16261"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Assign the backend-username value defined in the Secret to the SECRET_USERNAME environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16262"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/pod-single-secret-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16263"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: env-single-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: SECRET_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16264"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-single-secret-env-variable.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | In your shell, display the content of SECRET_USERNAME container environment variable.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16265"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t env-single-secret -- /bin/sh -c 'echo $SECRET_USERNAME'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16266"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic backend-user --from-literal=backend-username='backend-admin'\nkubectl create secret generic db-user --from-literal=db-username='db-admin'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16267"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/pod-multiple-secret-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16268"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envvars-multiple-secrets\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    env:\n    - name: BACKEND_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: backend-user\n          key: backend-username\n    - name: DB_USERNAME\n      valueFrom:\n        secretKeyRef:\n          name: db-user\n          key: db-username\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16269"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-multiple-secret-env-variable.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | In your shell, display the container environment variables.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16270"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envvars-multiple-secrets -- /bin/sh -c 'env | grep _USERNAME'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16271"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Use envFrom to define all of the Secret's data as container environment variables. The key from the Secret becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16272"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/inject/pod-secret-envFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16273"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: envfrom-secret\nspec:\n  containers:\n  - name: envars-test-container\n    image: nginx\n    envFrom:\n    - secretRef:\n        name: test-secret\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Create the Pod:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16274"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/inject/pod-secret-envFrom.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | In your shell, display username and password container environment variables.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16275"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -i -t envfrom-secret -- /bin/sh -c 'echo \"username: $username\\npassword: $password\\n\"'\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16276"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic prod-db-secret --from-literal=username=produser --from-literal=password=Y4nys7f11\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16277"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic test-db-secret --from-literal=username=testuser --from-literal=password=iluvtests\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16278"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic dev-db-secret --from-literal=username=devuser --from-literal=password='S!B\\*d$zDsb='\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | You do not need to escape special characters in passwords from files (--from-file).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16279"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF > pod.yaml\napiVersion: v1\nkind: List\nitems:\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: prod-db-client-pod\n    labels:\n      name: prod-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: prod-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\n- kind: Pod\n  apiVersion: v1\n  metadata:\n    name: test-db-client-pod\n    labels:\n      name: test-db-client\n  spec:\n    volumes:\n    - name: secret-volume\n      secret:\n        secretName: test-db-secret\n    containers:\n    - name: db-client-container\n      image: myClientImage\n      volumeMounts:\n      - name: secret-volume\n        readOnly: true\n        mountPath: \"/etc/secret-volume\"\nEOF\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Apply all those objects on the API server by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16280"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod.yaml\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | Both containers will have the following files present on their filesystems with the values for each container's environment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16281"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: prod-db-client-pod\n  labels:\n    name: prod-db-client\nspec:\n  serviceAccount: prod-db-client\n  containers:\n  - name: db-client-container\n    image: myClientImage\n```\n\n7.7 - Distribute Credentials Securely Using Secrets | This page shows how to run an application using a Kubernetes Deployment object.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16282"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16283"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Create a Deployment based on the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16284"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment.yaml\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Display information about the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16285"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment nginx-deployment\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16286"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16287"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\n8.1 - Run a Stateless Application Using a Deployment | where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16288"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-update.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16289"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16290"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-update.yaml\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Watch the deployment create pods with new names and delete the old pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16291"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n8.1 - Run a Stateless Application Using a Deployment | You can increase the number of Pods in your Deployment by applying a new YAML file. This YAML file sets replicas to 4, which specifies that the Deployment should have four Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16292"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/deployment-scale.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16293"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 4 # Update the replicas from 2 to 4\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16.1\n        ports:\n        - containerPort: 80\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Apply the new YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16294"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/deployment-scale.yaml\n```\n\n8.1 - Run a Stateless Application Using a Deployment | Verify that the Deployment has four Pods:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16295"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16296"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-deployment\n```\n\n8.1 - Run a Stateless Application Using a Deployment | The preferred way to create a replicated application is to use a Deployment, which in turn uses a ReplicaSet. Before the Deployment and ReplicaSet were added to Kubernetes, replicated applications wer", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16297"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-deployment.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16298"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: mysql\n  clusterIP: None\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - image: mysql:9\n        name: mysql\n        env:\n          # Use secret in real usage\n        - name: MYSQL_ROOT_PASSWORD\n          value: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16299"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-pv.yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16300"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the PV and PVC of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16301"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml\n```\n\n8.2 - Run a Single-Instance Stateful Application | Deploy the contents of the YAML file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16302"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-deployment.yaml\n```\n\n8.2 - Run a Single-Instance Stateful Application | Display information about the Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16303"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment mysql\n```\n\n8.2 - Run a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16304"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\n8.2 - Run a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16305"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe pvc mysql-pv-claim\n```\n\n8.2 - Run a Single-Instance Stateful Application | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16306"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run -it --rm --image=mysql:9 --restart=Never mysql-client -- mysql -h mysql -ppassword\n```\n\n8.2 - Run a Single-Instance Stateful Application | This command creates a new Pod in the cluster running a MySQL client and connects it to the server through the Service. If it connects, you know your stateful MySQL database is up and running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16307"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment,svc mysql\nkubectl delete pvc mysql-pv-claim\nkubectl delete pv mysql-pv-volume\n```\n\n8.2 - Run a Single-Instance Stateful Application | If you manually provisioned a PersistentVolume, you also need to manually delete it, as well as release the underlying resource. If you used a dynamic provisioner, it automatically deletes the Persist", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16308"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-configmap.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\n8.3 - Run a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16309"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\ndata:\n  primary.cnf: |\n    # Apply this config only on the primary.\n    [mysqld]\n    log-bin    \n  replica.cnf: |\n    # Apply this config only on replicas.\n    [mysqld]\n    super-read-only\n```\n\n8.3 - Run a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16310"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-configmap.yaml\n```\n\n8.3 - Run a Replicated Stateful Application | This ConfigMap provides my.cnf overrides that let you independently control configuration on the primary MySQL server and its replicas. In this case, you want the primary server to be able to serve re", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16311"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-services.yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\n8.3 - Run a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16312"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Headless service for stable DNS entries of StatefulSet members.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  clusterIP: None\n  selector:\n    app: mysql\n---\n# Client service for connecting to any MySQL instance for reads.\n# For writes, you must instead connect to the primary: mysql-0.mysql.\napiVersion: v1\nkind: Service\nmetadata:\n  name: mysql-read\n  labels:\n    app: mysql\n    app.kubernetes.io/name: mysql\n    readonly: \"true\"\nspec:\n  ports:\n  - name: mysql\n    port: 3306\n  selector:\n    app: mysql\n```\n\n8.3 - Run a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16313"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-services.yaml\n```\n\n8.3 - Run a Replicated Stateful Application | The headless Service provides a home for the DNS entries that the StatefulSet controllers creates for each Pod that's part of the set. Because the headless Service is named mysql, the Pods are accessi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16314"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/mysql/mysql-statefulset.yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n8.3 - Run a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16315"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n  name: mysql\nspec:\n  selector:\n    matchLabels:\n      app: mysql\n      app.kubernetes.io/name: mysql\n  serviceName: mysql\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: mysql\n        app.kubernetes.io/name: mysql\n    spec:\n      initContainers:\n      - name: init-mysql\n        image: mysql:5.7\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Generate mysql server-id from pod ordinal index.\n          [[ $HOSTNAME =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          echo [mysqld] > /mnt/conf.d/server-id.cnf\n          # Add an offset to avoid reserved server-id=0 value.\n          echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf\n          # Copy appropriate conf.d files from config-map to emptyDir.\n          if [[ $ordinal -eq 0 ]]; then\n            cp /mnt/config-map/primary.cnf /mnt/conf.d/\n          else\n            cp /mnt/config-map/replica.cnf /mnt/conf.d/\n          fi          \n        volumeMounts:\n        - name: conf\n          mountPath: /mnt/conf.d\n        - name: config-map\n          mountPath: /mnt/config-map\n      - name: clone-mysql\n        image: gcr.io/google-samples/xtrabackup:1.0\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          # Skip the clone if data already exists.\n          [[ -d /var/lib/mysql/mysql ]] && exit 0\n          # Skip the clone on primary (ordinal index 0).\n          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1\n          ordinal=${BASH_REMATCH[1]}\n          [[ $ordinal -eq 0 ]] && exit 0\n          # Clone data from previous peer.\n          ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql\n          # Prepare the backup.\n          xtrabackup --prepare --target-dir=/var/lib/mysql          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n      containers:\n      - name: mysql\n        image: mysql:5.7\n        env:\n        - name: MYSQL_ALLOW_EMPTY_PASSWORD\n          value: \"1\"\n        ports:\n        - name: mysql\n          containerPort: 3306\n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 500m\n            memory: 1Gi\n        livenessProbe:\n          exec:\n            command: [\"mysqladmin\", \"ping\"]\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n        readinessProbe:\n          exec:\n            # Check we can execute queries over TCP (skip-networking is off).\n            command: [\"mysql\", \"-h\", \"127.0.0.1\", \"-e\", \"SELECT 1\"]\n          initialDelaySeconds: 5\n          periodSeconds: 2\n          timeoutSeconds: 1\n      - name: xtrabackup\n        image: gcr.io/google-samples/xtrabackup:1.0\n        ports:\n        - name: xtrabackup\n          containerPort: 3307\n        command:\n        - bash\n        - \"-c\"\n        - |\n          set -ex\n          cd /var/lib/mysql\n\n          # Determine binlog position of cloned data, if any.\n          if [[ -f xtrabackup_slave_info && \"x$(<xtrabackup_slave_info)\" != \"x\" ]]; then\n            # XtraBackup already generated a partial \"CHANGE MASTER TO\" query\n            # because we're cloning from an existing replica. (Need to remove the tailing semicolon!)\n            cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in\n            # Ignore xtrabackup_binlog_info in this case (it's useless).\n            rm -f xtrabackup_slave_info xtrabackup_binlog_info\n          elif [[ -f xtrabackup_binlog_info ]]; then\n            # We're cloning directly from primary. Parse binlog position.\n            [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1\n            rm -f xtrabackup_binlog_info xtrabackup_slave_info\n            echo \"CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\\\n                  MASTER_LOG_POS=${BASH_REMATCH[2]}\" > change_master_to.sql.in\n          fi\n\n          # Check if we need to complete a clone by starting replication.\n          if [[ -f change_master_to.sql.in ]]; then\n            echo \"Waiting for mysqld to be ready (accepting connections)\"\n            until mysql -h 127.0.0.1 -e \"SELECT 1\"; do sleep 1; done\n\n            echo \"Initializing replication from clone position\"\n            mysql -h 127.0.0.1 \\\n                  -e \"$(<change_master_to.sql.in), \\\n                          MASTER_HOST='mysql-0.mysql', \\\n                          MASTER_USER='root', \\\n                          MASTER_PASSWORD='', \\\n                          MASTER_CONNECT_RETRY=10; \\\n                        START SLAVE;\" || exit 1\n            # In case of container restart, attempt this at-most-once.\n            mv change_master_to.sql.in change_master_to.sql.orig\n          fi\n\n          # Start a server to send backups when requested by peers.\n          exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \\\n            \"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root\"          \n        volumeMounts:\n        - name: data\n          mountPath: /var/lib/mysql\n          subPath: mysql\n        - name: conf\n          mountPath: /etc/mysql/conf.d\n        resources:\n          requests:\n            cpu: 100m\n            memory: 100Mi\n      volumes:\n      - name: conf\n        emptyDir: {}\n      - name: config-map\n        configMap:\n          name: mysql\n  volumeClaimTemplates:\n  - metadata:\n      name: data\n    spec:\n      accessModes: [\"ReadWriteOnce\"]\n      resources:\n        requests:\n          storage: 10Gi\n```\n\n8.3 - Run a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16316"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mysql/mysql-statefulset.yaml\n```\n\n8.3 - Run a Replicated Stateful Application | You can watch the startup progress by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16317"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\n8.3 - Run a Replicated Stateful Application | After a while, you should see all 3 Pods become Running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16318"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i --rm --restart=Never --\\\n  mysql -h mysql-0.mysql <<EOF\nCREATE DATABASE test;\nCREATE TABLE test.messages (message VARCHAR(250));\nINSERT INTO test.messages VALUES ('hello');\nEOF\n```\n\n8.3 - Run a Replicated Stateful Application | Use the hostname mysql-read to send test queries to any server that reports being Ready:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16319"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-read -e \"SELECT * FROM test.messages\"\n```\n\n8.3 - Run a Replicated Stateful Application | You should get output like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16320"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client-loop --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  bash -ic \"while sleep 1; do mysql -h mysql-read -e 'SELECT @@server_id,NOW()'; done\"\n```\n\n8.3 - Run a Replicated Stateful Application | You should see the reported @@server_id change randomly, because a different endpoint might be selected upon each connection attempt:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16321"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql /usr/bin/mysql.off\n```\n\n8.3 - Run a Replicated Stateful Application | This reaches into the actual container's filesystem for Pod mysql-2 and renames the mysql command so the readiness probe can't find it. After a few seconds, the Pod should report one of its containers", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16322"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2\n```\n\n8.3 - Run a Replicated Stateful Application | Look for 1/2 in the READY column:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16323"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql.off /usr/bin/mysql\n```\n\n8.3 - Run a Replicated Stateful Application | The StatefulSet also recreates Pods if they're deleted, similar to what a ReplicaSet does for stateless Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16324"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-2\n```\n\n8.3 - Run a Replicated Stateful Application | The StatefulSet controller notices that no mysql-2 Pod exists anymore, and creates a new one with the same name and linked to the same PersistentVolumeClaim. You should see server ID 102 disappear fro", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16325"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide\n```\n\n8.3 - Run a Replicated Stateful Application | The Node name should show up in the last column:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16326"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod mysql-2 -o wide --watch\n```\n\n8.3 - Run a Replicated Stateful Application | It should look something like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16327"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon <node-name>\n```\n\n8.3 - Run a Replicated Stateful Application | When you use MySQL replication, you can scale your read query capacity by adding replicas. For a StatefulSet, you can achieve this with a single command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16328"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql  --replicas=5\n```\n\n8.3 - Run a Replicated Stateful Application | Watch the new Pods come up by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16329"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql --watch\n```\n\n8.3 - Run a Replicated Stateful Application | Once they're up, you should see server IDs 103 and 104 start appearing in the SELECT @@server_id loop output.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16330"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run mysql-client --image=mysql:5.7 -i -t --rm --restart=Never --\\\n  mysql -h mysql-3.mysql -e \"SELECT * FROM test.messages\"\n```\n\n8.3 - Run a Replicated Stateful Application | Scaling back down is also seamless:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16331"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulset mysql --replicas=3\n```\n\n8.3 - Run a Replicated Stateful Application | Although scaling up creates new PersistentVolumeClaims automatically, scaling down does not automatically delete these PVCs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16332"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc -l app=mysql\n```\n\n8.3 - Run a Replicated Stateful Application | Which shows that all 5 PVCs still exist, despite having scaled the StatefulSet down to 3:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16333"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pvc data-mysql-3\nkubectl delete pvc data-mysql-4\n```\n\n8.3 - Run a Replicated Stateful Application | Cancel the SELECT @@server_id loop by pressing Ctrl+C in its terminal, or running the following from another terminal:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16334"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod mysql-client-loop --now\n```\n\n8.3 - Run a Replicated Stateful Application | Delete the StatefulSet. This also begins terminating the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16335"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulset mysql\n```\n\n8.3 - Run a Replicated Stateful Application | Verify that the Pods disappear. They might take some time to finish terminating.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16336"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=mysql\n```\n\n8.3 - Run a Replicated Stateful Application | You'll know the Pods have terminated when the above returns:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16337"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap,service,pvc -l app=mysql\n```\n\n8.3 - Run a Replicated Stateful Application | If you manually provisioned PersistentVolumes, you also need to manually delete them, as well as release the underlying resources. If you used a dynamic provisioner, it automatically deletes the Persi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16338"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get statefulsets <stateful-set-name>\n```\n\n8.4 - Scale a StatefulSet | Change the number of replicas of your StatefulSet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16339"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>\n```\n\n8.4 - Scale a StatefulSet | Alternatively, you can do in-place updates on your StatefulSets.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16340"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <stateful-set-file-updated>\n```\n\n8.4 - Scale a StatefulSet | Otherwise, edit that field with kubectl edit:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16341"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit statefulsets <stateful-set-name>\n```\n\n8.4 - Scale a StatefulSet | Or use kubectl patch:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16342"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch statefulsets <stateful-set-name> -p '{\"spec\":{\"replicas\":<new-replicas>}}'\n```\n\n8.4 - Scale a StatefulSet | You cannot scale down a StatefulSet when any of the stateful Pods it manages is unhealthy. Scaling down only takes place after those stateful Pods become running and ready.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16343"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml>\n```\n\n8.5 - Delete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16344"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete statefulsets <statefulset-name>\n```\n\n8.5 - Delete a StatefulSet | You may need to delete the associated headless service separately after the StatefulSet itself is deleted.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16345"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete service <service-name>\n```\n\n8.5 - Delete a StatefulSet | When deleting a StatefulSet through kubectl, the StatefulSet scales down to 0. All Pods that are part of this workload are also deleted. If you want to delete only the StatefulSet and not the Pods, us", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16346"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f <file.yaml> --cascade=orphan\n```\n\n8.5 - Delete a StatefulSet | By passing --cascade=orphan to kubectl delete, the Pods managed by the StatefulSet are left behind even after the StatefulSet object itself is deleted. If the pods have a label app.kubernetes.io/name=", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16347"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods -l app.kubernetes.io/name=MyApp\n```\n\n8.5 - Delete a StatefulSet | Deleting the Pods in a StatefulSet will not delete the associated volumes. This is to ensure that you have the chance to copy data off the volume before deleting it. Deleting the PVC after the pods ha", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16348"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod>\n```\n\n8.6 - Force Delete StatefulSet Pods | For the above to lead to graceful termination, the Pod must not specify a pod.Spec.TerminationGracePeriodSeconds of 0. The practice of setting a pod.Spec.TerminationGracePeriodSeconds of 0 seconds is", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16349"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0 --force\n```\n\n8.6 - Force Delete StatefulSet Pods | If you're using any version of kubectl <= 1.4, you should omit the --force option and use:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16350"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods <pod> --grace-period=0\n```\n\n8.6 - Force Delete StatefulSet Pods | If even after these commands the pod is stuck on Unknown state, use the following command to remove the pod from the cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16351"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod <pod> -p '{\"metadata\":{\"finalizers\":null}}'\n```\n\n8.6 - Force Delete StatefulSet Pods | Always perform force deletion of StatefulSet Pods carefully and with complete knowledge of the risks involved.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16352"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/php-apache.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16353"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: php-apache\nspec:\n  selector:\n    matchLabels:\n      run: php-apache\n  template:\n    metadata:\n      labels:\n        run: php-apache\n    spec:\n      containers:\n      - name: php-apache\n        image: registry.k8s.io/hpa-example\n        ports:\n        - containerPort: 80\n        resources:\n          limits:\n            cpu: 500m\n          requests:\n            cpu: 200m\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: php-apache\n  labels:\n    run: php-apache\nspec:\n  ports:\n  - port: 80\n  selector:\n    run: php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | To do so, run the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16354"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/php-apache.yaml\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Now that the server is running, create the autoscaler using kubectl. The kubectl autoscale subcommand, part of kubectl, helps you do this.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16355"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment php-apache --cpu=50% --min=1 --max=10\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | You can check the current status of the newly-made HorizontalPodAutoscaler, by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16356"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | You should see the replica count matching the figure from the HorizontalPodAutoscaler", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16357"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment php-apache\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Once CPU utilization dropped to 0, the HPA automatically scaled the number of replicas back down to 1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16358"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get hpa php-apache -o yaml > /tmp/hpa-v2.yaml\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Open the /tmp/hpa-v2.yaml file in an editor, and you should see YAML which looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16359"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n      current:\n        averageUtilization: 0\n        averageValue: 0\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Notice that the targetCPUUtilizationPercentage field has been replaced with an array called metrics. The CPU utilization metric is a resource metric, since it is represented as a percentage of a resou", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16360"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ntype: Object\nobject:\n  metric:\n    name: requests-per-second\n  describedObject:\n    apiVersion: networking.k8s.io/v1\n    kind: Ingress\n    name: main-route\n  target:\n    type: Value\n    value: 2k\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | If you provide multiple such metric blocks, the HorizontalPodAutoscaler will consider each metric in turn. The HorizontalPodAutoscaler will calculate proposed replica counts for each metric, and then", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16361"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n  - type: Pods\n    pods:\n      metric:\n        name: packets-per-second\n      target:\n        type: AverageValue\n        averageValue: 1k\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      target:\n        type: Value\n        value: 10k\nstatus:\n  observedGeneration: 1\n  lastScaleTime: <some-time>\n  currentReplicas: 1\n  desiredReplicas: 1\n  currentMetrics:\n  - type: Resource\n    resource:\n      name: cpu\n    current:\n      averageUtilization: 0\n      averageValue: 0\n  - type: Object\n    object:\n      metric:\n        name: requests-per-second\n      describedObject:\n        apiVersion: networking.k8s.io/v1\n        kind: Ingress\n        name: main-route\n      current:\n        value: 10k\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Then, your HorizontalPodAutoscaler would attempt to ensure that each pod was consuming roughly 50% of its requested CPU, serving 1000 packets per second, and that all pods behind the main-route Ingres", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16362"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe hpa cm-test\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | For this HorizontalPodAutoscaler, you can see several conditions in a healthy state. The first, AbleToScale, indicates whether or not the HPA is able to fetch and update scales, as well as whether or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16363"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/hpa/php-apache.yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16364"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\nkind: HorizontalPodAutoscaler\nmetadata:\n  name: php-apache\nspec:\n  scaleTargetRef:\n    apiVersion: apps/v1\n    kind: Deployment\n    name: php-apache\n  minReplicas: 1\n  maxReplicas: 10\n  metrics:\n  - type: Resource\n    resource:\n      name: cpu\n      target:\n        type: Utilization\n        averageUtilization: 50\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | Then, create the autoscaler by executing the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16365"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/hpa/php-apache.yaml\n```\n\n8.8 - HorizontalPodAutoscaler Walkthrough | This page shows how to limit the number of concurrent disruptions that your application experiences, allowing for higher availability while permitting the cluster administrator to manage the clusters", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16366"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npolicy/zookeeper-pod-disruption-budget-minavailable.yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16367"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  minAvailable: 2\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | Example PDB Using maxUnavailable:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16368"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npolicy/zookeeper-pod-disruption-budget-maxunavailable.yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16369"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  name: zk-pdb\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      app: zookeeper\n```\n\n8.9 - Specifying a Disruption Budget for your Application | For example, if the above zk-pdb object selects the pods of a StatefulSet of size 3, both specifications have the exact same meaning. The use of maxUnavailable is recommended as it automatically respo", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16370"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f mypdb.yaml\n```\n\n8.9 - Specifying a Disruption Budget for your Application | Use kubectl to check that your PDB is created.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16371"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\n8.9 - Specifying a Disruption Budget for your Application | If there are matching pods (say, 3), then you would see something like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16372"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets\n```\n\n8.9 - Specifying a Disruption Budget for your Application | The non-zero value for ALLOWED DISRUPTIONS means that the disruption controller has seen the pods, counted the matching pods, and updated the status of the PDB.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16373"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get poddisruptionbudgets zk-pdb -o yaml\n```\n\n8.9 - Specifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16374"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\nkind: PodDisruptionBudget\nmetadata:\n  annotations:\n…\n  creationTimestamp: \"2020-03-04T04:22:56Z\"\n  generation: 1\n  name: zk-pdb\n…\nstatus:\n  currentHealthy: 3\n  desiredHealthy: 2\n  disruptionsAllowed: 1\n  expectedPods: 3\n  observedGeneration: 1\n```\n\n8.9 - Specifying a Disruption Budget for your Application | The current implementation considers healthy pods, as pods that have .status.conditions item with type=\"Ready\" and status=\"True\". These pods are tracked via .status.currentHealthy field in the PDB sta", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16375"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/job/cronjob.yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n9.1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16376"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n9.1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16377"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/job/cronjob.yaml\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16378"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16379"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs --watch\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16380"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n9.1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16381"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob hello\n```\n\n9.1 - Running Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16382"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-statefulset.yaml\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | Now, we can experiment with accessing the message queue. We will create a temporary interactive pod, install some tools on it, and experiment with queues.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16383"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-1 .\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16384"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-1 <username>/job-wq-1\ndocker push <username>/job-wq-1\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | If you are using an alternative container image registry, tag the image and push it there instead.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16385"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/job/rabbitmq/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16386"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16387"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-1\n```\n\n9.2 - Coarse Parallel Processing Using a Work Queue | All the pods for that Job succeeded! You're done.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16388"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-pod.yaml\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-service.yaml\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | Now let's fill the queue with some \"tasks\". In this example, the tasks are strings to be printed.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16389"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty temp --image redis --command \"/bin/sh\"\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | Now hit enter, start the Redis CLI, and create a list with some work items in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16390"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-2 .\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16391"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-2 <username>/job-wq-2\ndocker push <username>/job-wq-2\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | You need to push to a public repository or configure your cluster to be able to access your private repository.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16392"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/job/redis/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16393"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16394"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-2\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | You can wait for the Job to succeed, with a timeout:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16395"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs pods/job-wq-2-7r7b2\n```\n\n9.3 - Fine Parallel Processing Using a Work Queue | As you can see, one of the pods for this Job worked on several work units.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16396"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/job/indexed-job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16397"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16398"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/job/indexed-job-vol.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16399"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16400"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/indexed-job\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16401"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs indexed-job-fdhq5 # Change this to match the name of a Pod from that Job\n```\n\n9.4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16402"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\n9.5 - Job with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16403"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs example-job-0-qws42\n```\n\n9.5 - Job with Pod-to-Pod Communication | This task demonstrates running multiple Jobs based on a common template. You can use this approach to process batches of work in parallel.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16404"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/job/job-tmpl.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n9.6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16405"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n9.6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16406"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./jobs\n```\n\n9.6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16407"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l jobgroup=jobexample\n```\n\n9.6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16408"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l jobgroup=jobexample\n```\n\n9.6 - Parallel Processing using Expansions | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16409"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l jobgroup=jobexample\n```\n\n9.6 - Parallel Processing using Expansions | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16410"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-failjob.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16411"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16412"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-failjob.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 30 seconds the entire Job should be terminated. Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16413"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, the following conditions display:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16414"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-failjob\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16415"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-ignore.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16416"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16417"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-ignore.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Run this command to check the nodeName the Pod is scheduled to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16418"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl drain nodes/$nodeName --ignore-daemonsets --grace-period=0\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the .status.failed to check the counter for the Job is not incremented:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16419"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-ignore -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Uncordon the node:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16420"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon nodes/$nodeName\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The Job resumes and succeeds.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16421"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-ignore\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16422"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-config-issue.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16423"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16424"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-config-issue.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Note that, the image is misconfigured, as it does not exist.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16425"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16426"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod $podName --subresource=status --patch-file=patch.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | If applied successfully, you will get a notification like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16427"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods/$podName\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16428"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see a job Failed condition with the field reason equal PodFailurePolicy. Additionally, the message field contains a more detailed information about the Job termination, such as: Pod", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16429"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-config-issue\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16430"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-backoff-limit-per-index-failindex.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16431"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16432"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-backoff-limit-per-index-failindex.yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 15 seconds, inspect the status of the Pods for the Job. You can do that by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16433"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16434"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see that the failedIndexes field shows \"0,1\", because both indexes failed. Because the index 1 was not retried the number of failed Pods, indicated by the status field \"failed\" equa", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16435"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-backoff-limit-per-index-failindex\n```\n\n9.7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16436"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n10.2 - Accessing Clusters | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16437"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n10.2 - Accessing Clusters | Next, wait for the token controller to populate the Secret with a token:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16438"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\n10.3 - Configure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16439"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file\nkubectl config --kubeconfig=config-demo set-cluster test --server=https://5.6.7.8 --insecure-skip-tls-verify\n```\n\n10.3 - Configure Access to Multiple Clusters | Add user details to your configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16440"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile\nkubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password\n```\n\n10.3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16441"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer\nkubectl config --kubeconfig=config-demo set-context dev-storage --cluster=development --namespace=storage --user=developer\nkubectl config --kubeconfig=config-demo set-context exp-test --cluster=test --namespace=default --user=experimenter\n```\n\n10.3 - Configure Access to Multiple Clusters | Open your config-demo file to see the added details. As an alternative to opening the config-demo file, you can use the config view command.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16442"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view\n```\n\n10.3 - Configure Access to Multiple Clusters | The output shows the two clusters, two users, and three contexts:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16443"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\n10.3 - Configure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16444"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-frontend\n```\n\n10.3 - Configure Access to Multiple Clusters | Now whenever you enter a kubectl command, the action will apply to the cluster, and namespace listed in the dev-frontend context. And the command will use the credentials of the user listed in the dev", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16445"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n10.3 - Configure Access to Multiple Clusters | The output shows configuration information associated with the dev-frontend context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16446"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\n10.3 - Configure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16447"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context exp-test\n```\n\n10.3 - Configure Access to Multiple Clusters | Now any kubectl command you give will apply to the default namespace of the test cluster. And the command will use the credentials of the user listed in the exp-test context.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16448"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n10.3 - Configure Access to Multiple Clusters | Finally, suppose you want to work for a while in the storage namespace of the development cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16449"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-storage\n```\n\n10.3 - Configure Access to Multiple Clusters | View configuration associated with the new current context, dev-storage.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16450"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n10.3 - Configure Access to Multiple Clusters | In your config-exercise directory, create a file named config-demo-2 with this content:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16451"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\n10.3 - Configure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16452"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-deployment.yaml\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the deployment was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16453"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the Deployment was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16454"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get replicaset\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the ReplicaSet was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16455"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-service.yaml\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the Service was created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16456"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service mongo\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The output displays the service created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16457"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pods/mongo-75f59d57f4-4nd6q 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16458"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16459"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward replicaset/mongo-75f59d57f4 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16460"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/mongo 28015:27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | Any of the above commands works. The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16461"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo :27017\n```\n\n10.4 - Use Port Forwarding to Access Applications in a Cluster | The kubectl tool finds a local port number that is not in use (avoiding low ports numbers, because these might be used by other applications). The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16462"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/access/hello-application.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16463"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16464"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has two Pods each of which runs the Hello World application.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16465"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16466"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16467"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=NodePort --name=example-service\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | Display information about the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16468"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16469"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=\"run=load-balancer-example\" --output=wide\n```\n\n10.5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16470"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/access/backend-deployment.yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16471"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16472"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-deployment.yaml\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | View information about the backend Deployment:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16473"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment backend\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | The output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16474"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/access/backend-service.yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16475"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16476"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-service.yaml\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | At this point, you have a backend Deployment running three replicas of your hello application, and you have a Service that can route traffic to them. However, this service is neither available nor res", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16477"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/access/frontend-service.yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16478"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16479"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/access/frontend-deployment.yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16480"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16481"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/frontend-deployment.yaml\nkubectl apply -f https://k8s.io/examples/service/access/frontend-service.yaml\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | The output verifies that both resources were created:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16482"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend --watch\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | This displays the configuration for the frontend Service and watches for changes. Initially, the external IP is listed as <pending>:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16483"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete services frontend backend\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | To delete the Deployments, the ReplicaSets and the Pods that are running the backend and frontend applications, enter this command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16484"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment frontend backend\n```\n\n10.6 - Connect a Frontend to a Backend Using Services | This page shows how to create an external load balancer.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16485"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16486"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16487"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n10.7 - Create an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16488"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\n10.7 - Create an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16489"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec['initContainers', 'containers'][*].image}\" |\\\ntr -s '[[:space:]]' '\\n' |\\\nsort |\\\nuniq -c\n```\n\n10.8 - List All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16490"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{\"\\n\"}{.metadata.name}{\":\\t\"}{range .spec.containers[*]}{.image}{\", \"}{end}{end}' |\\\nsort\n```\n\n10.8 - List All Container Images Running in a Cluster | To target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching app=nginx.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16491"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec.containers[*].image}\" -l app=nginx\n```\n\n10.8 - List All Container Images Running in a Cluster | To target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the kube-system namespace.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16492"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace kube-system -o jsonpath=\"{.items[*].spec.containers[*].image}\"\n```\n\n10.8 - List All Container Images Running in a Cluster | As an alternative to jsonpath, Kubectl supports using go-templates for formatting the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16493"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o go-template --template=\"{{range .items}}{{range .spec.containers}}{{.image}} {{end}}{{end}}\"\n```\n\n10.8 - List All Container Images Running in a Cluster | An Ingress is an API object that defines rules which allow external access to services in a cluster. An Ingress controller fulfills the rules set in the Ingress.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16494"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n ingress-nginx\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16495"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16496"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16497"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web --type=NodePort --port=8080\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16498"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service web\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16499"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/example-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16500"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16501"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16502"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16503"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web2\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16504"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web2 --port=8080 --type=NodePort\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16505"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-ingress.yaml\n```\n\n10.9 - Set up Ingress on Minikube with the NGINX Ingress Controller | You should see:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16506"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\npods/two-container-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16507"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10.10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16508"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\nmetadata:\n  name: <name of the registration object>\nspec:\n  group: <API group name this extension apiserver hosts>\n  version: <API version this extension apiserver hosts>\n  groupPriorityMinimum: <priority this APIService for this group, see API documentation>\n  versionPriority: <prioritizes ordering of this version within a group, see API documentation>\n  service:\n    namespace: <namespace of the extension apiserver service>\n    name: <name of the extension apiserver service>\n  caBundle: <pem encoded ca cert that signs the server cert used by the webhook>\n```\n\n11.1 - Configure the Aggregation Layer | The name of an APIService object must be a valid path segment name.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16509"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\nkind: APIService\n...\nspec:\n  ...\n  service:\n    namespace: my-service-namespace\n    name: my-service-name\n    port: 1234\n  caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.1 - Configure the Aggregation Layer | This page shows how to install a custom resource into the Kubernetes API by creating a CustomResourceDefinition.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16510"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.stable.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: stable.example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n    - name: v1\n      # Each version can be enabled/disabled by Served flag.\n      served: true\n      # One and only one version must be marked as the storage version.\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16511"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Then a new namespaced RESTful API endpoint is created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16512"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16513"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You can then manage your CronTab objects using kubectl. For example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16514"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get ct -o yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You should see that it contains the custom cronSpec and image fields from the YAML you used to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16515"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nitems:\n- apiVersion: stable.example.com/v1\n  kind: CronTab\n  metadata:\n    annotations:\n      kubectl.kubernetes.io/last-applied-configuration: |\n        {\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"CronTab\",\"metadata\":{\"annotations\":{},\"name\":\"my-new-cron-object\",\"namespace\":\"default\"},\"spec\":{\"cronSpec\":\"* * * * */5\",\"image\":\"my-awesome-cron-image\"}}        \n    creationTimestamp: \"2021-06-20T07:35:27Z\"\n    generation: 1\n    name: my-new-cron-object\n    namespace: default\n    resourceVersion: \"1326\"\n    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9\n  spec:\n    cronSpec: '* * * * */5'\n    image: my-awesome-cron-image\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16516"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f resourcedefinition.yaml\nkubectl get crontabs\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16517"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  someRandomField: 42\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16518"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create --validate=false -f my-crontab.yaml -o yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16519"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: stable.example.com/v1\nkind: CronTab\nmetadata:\n  creationTimestamp: 2017-05-31T12:56:35Z\n  generation: 1\n  name: my-new-cron-object\n  namespace: default\n  resourceVersion: \"285\"\n  uid: 9423255b-4600-11e7-af6a-28d2447dc82b\nspec:\n  cronSpec: '* * * * */5'\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16520"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nfoo:\n  apiVersion: v1\n  kind: Pod\n  spec:\n    # ...\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16521"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  finalizers:\n  - stable.example.com/finalizer\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16522"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16523"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | A request to create a custom object of kind CronTab is rejected if there are invalid values in its fields. In the following example, the custom object contains fields with invalid values:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16524"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * *\"\n  image: my-awesome-cron-image\n  replicas: 15\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16525"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | then you get an error:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16526"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 5\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16527"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\ncrontab \"my-new-cron-object\" created\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16528"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  minReplicas: 0\n  replicas: 20\n  maxReplicas: 10\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | with the response:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16529"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        # openAPIV3Schema is the schema for validating custom objects.\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                  pattern: '^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$'\n                  default: \"5 0 * * *\"\n                image:\n                  type: string\n                replicas:\n                  type: integer\n                  minimum: 1\n                  maximum: 10\n                  default: 1\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16530"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | leads to", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16531"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"5 0 * * *\"\n  image: my-awesome-cron-image\n  replicas: 1\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16532"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              cronSpec:\n                type: string\n              image:\n                type: string\n              replicas:\n                type: integer\n    additionalPrinterColumns:\n    - name: Spec\n      type: string\n      description: The cron spec defining the interval a CronJob is run\n      jsonPath: .spec.cronSpec\n    - name: Replicas\n      type: integer\n      description: The number of jobs launched by the CronJob\n      jsonPath: .spec.replicas\n    - name: Age\n      type: date\n      jsonPath: .metadata.creationTimestamp\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16533"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create an instance using the my-crontab.yaml from the previous section.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16534"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get crontab my-new-cron-object\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Notice the NAME, SPEC, REPLICAS, and AGE columns in the output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16535"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncustomresourcedefinition/shirt-resource-definition.yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16536"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: shirts.stable.example.com\nspec:\n  group: stable.example.com\n  scope: Namespaced\n  names:\n    plural: shirts\n    singular: shirt\n    kind: Shirt\n  versions:\n  - name: v1\n    served: true\n    storage: true\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          spec:\n            type: object\n            properties:\n              color:\n                type: string\n              size:\n                type: string\n    selectableFields:\n    - jsonPath: .spec.color\n    - jsonPath: .spec.size\n    additionalPrinterColumns:\n    - jsonPath: .spec.color\n      name: Color\n      type: string\n    - jsonPath: .spec.size\n      name: Size\n      type: string\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16537"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resource-definition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Define some Shirts by editing shirt-resources.yaml; for example:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16538"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncustomresourcedefinition/shirt-resources.yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16539"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example1\nspec:\n  color: blue\n  size: S\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example2\nspec:\n  color: blue\n  size: M\n---\napiVersion: stable.example.com/v1\nkind: Shirt\nmetadata:\n  name: example3\nspec:\n  color: green\n  size: M\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16540"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resources.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Get all the resources:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16541"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | The output is:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16542"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=blue\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16543"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get shirts.stable.example.com --field-selector spec.color=green,spec.size=M\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Should output:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16544"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n            status:\n              type: object\n              properties:\n                replicas:\n                  type: integer\n                labelSelector:\n                  type: string\n      # subresources describes the subresources for custom resources.\n      subresources:\n        # status enables the status subresource.\n        status: {}\n        # scale enables the scale subresource.\n        scale:\n          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.\n          specReplicasPath: .spec.replicas\n          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.\n          statusReplicasPath: .status.replicas\n          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.\n          labelSelectorPath: .status.labelSelector\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | And create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16545"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16546"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n  replicas: 3\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16547"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | Then new namespaced RESTful API endpoints are created at:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16548"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=5 crontabs/my-new-cron-object\ncrontabs \"my-new-cron-object\" scaled\n\nkubectl get crontabs my-new-cron-object -o jsonpath='{.spec.replicas}'\n5\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You can use a PodDisruptionBudget to protect custom resources that have the scale subresource enabled.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16549"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.stable.example.com\nspec:\n  group: stable.example.com\n  versions:\n    - name: v1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n                cronSpec:\n                  type: string\n                image:\n                  type: string\n                replicas:\n                  type: integer\n  scope: Namespaced\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n    shortNames:\n    - ct\n    # categories is a list of grouped resources the custom resource belongs to.\n    categories:\n    - all\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16550"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f resourcedefinition.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | After the CustomResourceDefinition object has been created, you can create custom objects.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16551"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: \"stable.example.com/v1\"\nkind: CronTab\nmetadata:\n  name: my-new-cron-object\nspec:\n  cronSpec: \"* * * * */5\"\n  image: my-awesome-cron-image\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | and create it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16552"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-crontab.yaml\n```\n\n11.2.1 - Extend the Kubernetes API with CustomResourceDefinitions | You can specify the category when using kubectl get:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16553"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # A schema is required\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16554"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n  - name: v1\n    served: true\n    storage: false\n  validation:\n    openAPIV3Schema:\n      type: object\n      properties:\n        host:\n          type: string\n        port:\n          type: string\n  # The conversion section is introduced in Kubernetes 1.13+ with a default value of\n  # None conversion (strategy sub-field set to None).\n  conversion:\n    # None conversion assumes the same schema for all versions and only sets the apiVersion\n    # field of custom resources to the proper value\n    strategy: None\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the PascalCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to create it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16555"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab.yaml\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | After creation, the API server starts to serve each enabled version at an HTTP REST endpoint. In the above example, the API versions are available at /apis/example.com/v1beta1 and /apis/example.com/v1", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16556"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n    \n    schema: ...\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n    schema: ...\n  - name: v1\n    served: true\n    storage: true\n    schema: ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: crontabs.example.com spec: group: example.com na", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16557"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  validation: ...\n  versions:\n  - name: v1alpha1\n    served: true\n    storage: false\n    # This indicates the v1alpha1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    deprecated: true\n    # This overrides the default warning returned to API clients making v1alpha1 API requests.\n    deprecationWarning: \"example.com/v1alpha1 CronTab is deprecated; see http://example.com/v1alpha1-v1 for instructions to migrate to example.com/v1 CronTab\"\n  - name: v1beta1\n    served: true\n    # This indicates the v1beta1 version of the custom resource is deprecated.\n    # API requests to this version receive a warning header in the server response.\n    # A default warning message is returned for this version.\n    deprecated: true\n  - name: v1\n    served: true\n    storage: true\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | An older API version cannot be dropped from a CustomResourceDefinition manifest until existing stored data has been migrated to the newer API version for all clusters that served the older version of", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16558"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n  name: crontabs.example.com\nspec:\n  group: example.com\n  names:\n    plural: crontabs\n    singular: crontab\n    kind: CronTab\n  scope: Namespaced\n  versions:\n  - name: v1beta1\n    # This indicates the v1beta1 version of the custom resource is no longer served.\n    # API requests to this version receive a not found error in the server response.\n    served: false\n    schema: ...\n  - name: v1\n    served: true\n    # The new served version should be set as the storage version\n    storage: true\n    schema: ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | The above example has a None conversion between versions which only sets the apiVersion field on conversion and does not change the rest of the object. The API server also supports webhook conversions", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16559"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhook is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhook:\n      # conversionReviewVersions indicates what ConversionReview versions are understood/preferred by the webhook.\n      # The first version in the list understood by the API server is sent to the webhook.\n      # The webhook must respond with a ConversionReview object in the same version it received.\n      conversionReviewVersions: [\"v1\",\"v1beta1\"]\n      clientConfig:\n        service:\n          namespace: default\n          name: example-conversion-webhook-server\n          path: /crdconvert\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the for", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16560"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\nmetadata:\n  # name must match the spec fields below, and be in the form: <plural>.<group>\n  name: crontabs.example.com\nspec:\n  # group name to use for REST API: /apis/<group>/<version>\n  group: example.com\n  # prunes object fields that are not specified in OpenAPI schemas below.\n  preserveUnknownFields: false\n  # list of versions supported by this CustomResourceDefinition\n  versions:\n  - name: v1beta1\n    # Each version can be enabled/disabled by Served flag.\n    served: true\n    # One and only one version must be marked as the storage version.\n    storage: true\n    # Each version can define its own schema when there is no top-level\n    # schema is defined.\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          hostPort:\n            type: string\n  - name: v1\n    served: true\n    storage: false\n    schema:\n      openAPIV3Schema:\n        type: object\n        properties:\n          host:\n            type: string\n          port:\n            type: string\n  conversion:\n    # the Webhook strategy instructs the API server to call an external webhook for any conversion between custom resources.\n    strategy: Webhook\n    # webhookClientConfig is required when strategy is `Webhook` and it configures the webhook endpoint to be called by API server.\n    webhookClientConfig:\n      service:\n        namespace: default\n        name: example-conversion-webhook-server\n        path: /crdconvert\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n  # either Namespaced or Cluster\n  scope: Namespaced\n  names:\n    # plural name to be used in the URL: /apis/<group>/<version>/<plural>\n    plural: crontabs\n    # singular name to be used as an alias on the CLI and for display\n    singular: crontab\n    # kind is normally the CamelCased singular type. Your resource manifests use this.\n    kind: CronTab\n    # shortNames allow shorter string to match your resource on the CLI\n    shortNames:\n    - ct\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | You can save the CustomResourceDefinition in a YAML file, then use kubectl apply to apply it.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16561"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-versioned-crontab-with-conversion.yaml\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Make sure the conversion service is up and running before applying new changes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16562"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16563"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | The service stanza inside webhookClientConfig is a reference to the service for a conversion webhook. If the webhook is running within the cluster, then you should use service instead of url. The serv", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16564"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      clientConfig:\n        service:\n          namespace: my-service-namespace\n          name: my-service-name\n          path: /my-path\n          port: 1234\n        caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | # Deprecated in v1.16 in favor of apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition ... spec: ... conversion: strategy: Webhook webhookClientC", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16565"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhookClientConfig:\n      service:\n        namespace: my-service-namespace\n        name: my-service-name\n        path: /my-path\n        port: 1234\n      caBundle: \"Ci0tLS0tQk...<base64-encoded PEM bundle>...tLS0K\"\n...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Webhooks are sent a POST request, with Content-Type: application/json, with a ConversionReview API object in the apiextensions.k8s.io API group serialized to JSON as the body.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16566"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    webhook:\n      conversionReviewVersions: [\"v1\", \"v1beta1\"]\n      ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | conversionReviewVersions is a required field when creating apiextensions.k8s.io/v1 custom resource definitions. Webhooks are required to support at least one ConversionReview version understood by the", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16567"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.16 in favor of apiextensions.k8s.io/v1\napiVersion: apiextensions.k8s.io/v1beta1\nkind: CustomResourceDefinition\n...\nspec:\n  ...\n  conversion:\n    strategy: Webhook\n    conversionReviewVersions: [\"v1\", \"v1beta1\"]\n    ...\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | If no conversionReviewVersions are specified, the default when creating apiextensions.k8s.io/v1beta1 custom resource definitions is v1beta1.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16568"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl patch customresourcedefinitions <CRD_Name> --subresource='status' --type='merge' -p '{\"status\":{\"storedVersions\":[\"v1\"]}}'\n```\n\n11.2.2 - Versions in CustomResourceDefinitions | Setting up an extension API server to work with the aggregation layer allows the Kubernetes apiserver to be extended with additional APIs, which are not part of the core Kubernetes APIs.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16569"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\ndocker build -t gcr.io/my-gcp-project/my-kube-scheduler:1.0 .     # The image name and the repository\ngcloud docker -- push gcr.io/my-gcp-project/my-kube-scheduler:1.0 # used in here is just an example\n```\n\n11.4 - Configure Multiple Schedulers | Now that you have your scheduler in a container image, create a pod configuration for it and run it in your Kubernetes cluster. But instead of creating a pod directly in the cluster, you can use a Dep", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16570"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/my-scheduler.yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\n11.4 - Configure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16571"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-kube-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:kube-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: my-scheduler-as-volume-scheduler\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\nroleRef:\n  kind: ClusterRole\n  name: system:volume-scheduler\n  apiGroup: rbac.authorization.k8s.io\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: my-scheduler-extension-apiserver-authentication-reader\n  namespace: kube-system\nroleRef:\n  kind: Role\n  name: extension-apiserver-authentication-reader\n  apiGroup: rbac.authorization.k8s.io\nsubjects:\n- kind: ServiceAccount\n  name: my-scheduler\n  namespace: kube-system\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-scheduler-config\n  namespace: kube-system\ndata:\n  my-scheduler-config.yaml: |\n    apiVersion: kubescheduler.config.k8s.io/v1\n    kind: KubeSchedulerConfiguration\n    profiles:\n      - schedulerName: my-scheduler\n    leaderElection:\n      leaderElect: false    \n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    component: scheduler\n    tier: control-plane\n  name: my-scheduler\n  namespace: kube-system\nspec:\n  selector:\n    matchLabels:\n      component: scheduler\n      tier: control-plane\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        component: scheduler\n        tier: control-plane\n        version: second\n    spec:\n      serviceAccountName: my-scheduler\n      containers:\n      - command:\n        - /usr/local/bin/kube-scheduler\n        - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml\n        image: gcr.io/my-gcp-project/my-kube-scheduler:1.0\n        livenessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n          initialDelaySeconds: 15\n        name: kube-second-scheduler\n        readinessProbe:\n          httpGet:\n            path: /healthz\n            port: 10259\n            scheme: HTTPS\n        resources:\n          requests:\n            cpu: '0.1'\n        securityContext:\n          privileged: false\n        volumeMounts:\n          - name: config-volume\n            mountPath: /etc/kubernetes/my-scheduler\n      hostNetwork: false\n      hostPID: false\n      volumes:\n        - name: config-volume\n          configMap:\n            name: my-scheduler-config\n```\n\n11.4 - Configure Multiple Schedulers | In the above manifest, you use a KubeSchedulerConfiguration to customize the behavior of your scheduler implementation. This configuration has been passed to the kube-scheduler during initialization w", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16572"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f my-scheduler.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Verify that the scheduler pod is running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16573"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace=kube-system\n```\n\n11.4 - Configure Multiple Schedulers | You should see a \"Running\" my-scheduler pod, in addition to the default kube-scheduler pod in this list.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16574"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit clusterrole system:kube-scheduler\n```\n\n11.4 - Configure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16575"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\n11.4 - Configure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16576"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    rbac.authorization.kubernetes.io/autoupdate: \"true\"\n  labels:\n    kubernetes.io/bootstrapping: rbac-defaults\n  name: system:kube-scheduler\nrules:\n  - apiGroups:\n      - coordination.k8s.io\n    resources:\n      - leases\n    verbs:\n      - create\n  - apiGroups:\n      - coordination.k8s.io\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - leases\n    verbs:\n      - get\n      - update\n  - apiGroups:\n      - \"\"\n    resourceNames:\n      - kube-scheduler\n      - my-scheduler\n    resources:\n      - endpoints\n    verbs:\n      - delete\n      - get\n      - patch\n      - update\n```\n\n11.4 - Configure Multiple Schedulers | Now that your second scheduler is running, create some pods, and direct them to be scheduled by either the default scheduler or the one you deployed. In order to schedule a given pod using a specific", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16577"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/pod1.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16578"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: no-annotation\n  labels:\n    name: multischeduler-example\nspec:\n  containers:\n  - name: pod-with-no-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | When no scheduler name is supplied, the pod is automatically scheduled using the default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16579"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod1.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Pod spec with default-scheduler", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16580"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/pod2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16581"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-default-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: default-scheduler\n  containers:\n  - name: pod-with-default-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | A scheduler is specified by supplying the scheduler name as a value to spec.schedulerName. In this case, we supply the name of the default scheduler which is default-scheduler.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16582"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod2.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Pod spec with my-scheduler", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16583"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/sched/pod3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16584"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: annotation-second-scheduler\n  labels:\n    name: multischeduler-example\nspec:\n  schedulerName: my-scheduler\n  containers:\n  - name: pod-with-second-annotation-container\n    image: registry.k8s.io/pause:3.8\n```\n\n11.4 - Configure Multiple Schedulers | In this case, we specify that this pod should be scheduled using the scheduler that we deployed - my-scheduler. Note that the value of spec.schedulerName should match the name supplied for the schedul", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16585"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod3.yaml\n```\n\n11.4 - Configure Multiple Schedulers | Verify that all three pods are running.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16586"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:2.0 --port=8080\n```\n\n11.5 - Use an HTTP Proxy to Access the Kubernetes API | This command starts a proxy to the Kubernetes API server:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16587"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority-data: LRMEMMW2 # shortened for readability \n    server: https://<API_SERVER_IP_ADDRESS>:6443  # the \"Kubernetes API\" server, in other words the IP address of kubernetes-remote-server.example\n    proxy-url: socks5://localhost:1080   # the \"SSH SOCKS5 proxy\" in the diagram above\n  name: default\ncontexts:\n- context:\n    cluster: default\n    user: default\n  name: default\ncurrent-context: default\nkind: Config\npreferences: {}\nusers:\n- name: default\n  user:\n    client-certificate-data: LS0tLS1CR== # shortened for readability\n    client-key-data: LS0tLS1CRUdJT=      # shortened for readability\n```\n\n11.6 - Use a SOCKS5 Proxy to Access the Kubernetes API | Once you have created the tunnel via the ssh command mentioned earlier, and defined either the environment variable or the proxy-url attribute, you can interact with your cluster through that proxy. F", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16588"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/egress-selector-configuration.yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\n11.7 - Set up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16589"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.k8s.io/v1beta1\nkind: EgressSelectorConfiguration\negressSelections:\n# Since we want to control the egress traffic to the cluster, we use the\n# \"cluster\" as the name. Other supported values are \"etcd\", and \"controlplane\".\n- name: cluster\n  connection:\n    # This controls the protocol between the API Server and the Konnectivity\n    # server. Supported values are \"GRPC\" and \"HTTPConnect\". There is no\n    # end user visible difference between the two modes. You need to set the\n    # Konnectivity server to work in the same mode.\n    proxyProtocol: GRPC\n    transport:\n      # This controls what transport the API Server uses to communicate with the\n      # Konnectivity server. UDS is recommended if the Konnectivity server\n      # locates on the same machine as the API Server. You need to configure the\n      # Konnectivity server to listen on the same UDS socket.\n      # The other supported transport is \"tcp\". You will need to set up TLS \n      # config to secure the TCP transport.\n      uds:\n        udsName: /etc/kubernetes/konnectivity-server/konnectivity-server.socket\n```\n\n11.7 - Set up Konnectivity service | You need to configure the API Server to use the Konnectivity service and direct the network traffic to the cluster nodes:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16590"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/konnectivity-server.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\n11.7 - Set up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16591"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: konnectivity-server\n  namespace: kube-system\nspec:\n  priorityClassName: system-cluster-critical\n  hostNetwork: true\n  containers:\n  - name: konnectivity-server-container\n    image: registry.k8s.io/kas-network-proxy/proxy-server:v0.0.37\n    command: [\"/proxy-server\"]\n    args: [\n            \"--logtostderr=true\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--uds-name=/etc/kubernetes/konnectivity-server/konnectivity-server.socket\",\n            \"--delete-existing-uds-file\",\n            # The following two lines assume the Konnectivity server is\n            # deployed on the same machine as the apiserver, and the certs and\n            # key of the API Server are at the specified location.\n            \"--cluster-cert=/etc/kubernetes/pki/apiserver.crt\",\n            \"--cluster-key=/etc/kubernetes/pki/apiserver.key\",\n            # This needs to be consistent with the value set in egressSelectorConfiguration.\n            \"--mode=grpc\",\n            \"--server-port=0\",\n            \"--agent-port=8132\",\n            \"--admin-port=8133\",\n            \"--health-port=8134\",\n            \"--agent-namespace=kube-system\",\n            \"--agent-service-account=konnectivity-agent\",\n            \"--kubeconfig=/etc/kubernetes/konnectivity-server.conf\",\n            \"--authentication-audience=system:konnectivity-server\"\n            ]\n    livenessProbe:\n      httpGet:\n        scheme: HTTP\n        host: 127.0.0.1\n        port: 8134\n        path: /healthz\n      initialDelaySeconds: 30\n      timeoutSeconds: 60\n    ports:\n    - name: agentport\n      containerPort: 8132\n      hostPort: 8132\n    - name: adminport\n      containerPort: 8133\n      hostPort: 8133\n    - name: healthport\n      containerPort: 8134\n      hostPort: 8134\n    volumeMounts:\n    - name: k8s-certs\n      mountPath: /etc/kubernetes/pki\n      readOnly: true\n    - name: kubeconfig\n      mountPath: /etc/kubernetes/konnectivity-server.conf\n      readOnly: true\n    - name: konnectivity-uds\n      mountPath: /etc/kubernetes/konnectivity-server\n      readOnly: false\n  volumes:\n  - name: k8s-certs\n    hostPath:\n      path: /etc/kubernetes/pki\n  - name: kubeconfig\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server.conf\n      type: FileOrCreate\n  - name: konnectivity-uds\n    hostPath:\n      path: /etc/kubernetes/konnectivity-server\n      type: DirectoryOrCreate\n```\n\n11.7 - Set up Konnectivity service | Then deploy the Konnectivity agents in your cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16592"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/konnectivity-agent.yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\n11.7 - Set up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16593"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\n# Alternatively, you can deploy the agents as Deployments. It is not necessary\n# to have an agent on each node.\nkind: DaemonSet\nmetadata:\n  labels:\n    addonmanager.kubernetes.io/mode: Reconcile\n    k8s-app: konnectivity-agent\n  namespace: kube-system\n  name: konnectivity-agent\nspec:\n  selector:\n    matchLabels:\n      k8s-app: konnectivity-agent\n  template:\n    metadata:\n      labels:\n        k8s-app: konnectivity-agent\n    spec:\n      priorityClassName: system-cluster-critical\n      tolerations:\n        - key: \"CriticalAddonsOnly\"\n          operator: \"Exists\"\n      containers:\n        - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.37\n          name: konnectivity-agent\n          command: [\"/proxy-agent\"]\n          args: [\n                  \"--logtostderr=true\",\n                  \"--ca-cert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt\",\n                  # Since the konnectivity server runs with hostNetwork=true,\n                  # this is the IP address of the master machine.\n                  \"--proxy-server-host=35.225.206.7\",\n                  \"--proxy-server-port=8132\",\n                  \"--admin-server-port=8133\",\n                  \"--health-server-port=8134\",\n                  \"--service-account-token-path=/var/run/secrets/tokens/konnectivity-agent-token\"\n                  ]\n          volumeMounts:\n            - mountPath: /var/run/secrets/tokens\n              name: konnectivity-agent-token\n          livenessProbe:\n            httpGet:\n              port: 8134\n              path: /healthz\n            initialDelaySeconds: 15\n            timeoutSeconds: 15\n      serviceAccountName: konnectivity-agent\n      volumes:\n        - name: konnectivity-agent-token\n          projected:\n            sources:\n              - serviceAccountToken:\n                  path: konnectivity-agent-token\n                  audience: system:konnectivity-server\n```\n\n11.7 - Set up Konnectivity service | Last, if RBAC is enabled in your cluster, create the relevant RBAC rules:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16594"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nadmin/konnectivity/konnectivity-rbac.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\n11.7 - Set up Konnectivity service | Kubernetes lets you use a public key infrastructure (PKI) to authenticate to your cluster as a client.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16595"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: system:konnectivity-server\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: system:auth-delegator\nsubjects:\n  - apiGroup: rbac.authorization.k8s.io\n    kind: User\n    name: system:konnectivity-server\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: konnectivity-agent\n  namespace: kube-system\n  labels:\n    kubernetes.io/cluster-service: \"true\"\n    addonmanager.kubernetes.io/mode: Reconcile\n```\n\n11.7 - Set up Konnectivity service | Kubernetes lets you use a public key infrastructure (PKI) to authenticate to your cluster as a client.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16596"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: myuser # example\nspec:\n  # This is an encoded CSR. Change this to the base64-encoded contents of myuser.csr\n  request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZqQ0NBVDRDQVFBd0VURVBNQTBHQTFVRUF3d0dZVzVuWld4aE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRgpBQU9DQVE4QU1JSUJDZ0tDQVFFQTByczhJTHRHdTYxakx2dHhWTTJSVlRWMDNHWlJTWWw0dWluVWo4RElaWjBOCnR2MUZtRVFSd3VoaUZsOFEzcWl0Qm0wMUFSMkNJVXBGd2ZzSjZ4MXF3ckJzVkhZbGlBNVhwRVpZM3ExcGswSDQKM3Z3aGJlK1o2MVNrVHF5SVBYUUwrTWM5T1Nsbm0xb0R2N0NtSkZNMUlMRVI3QTVGZnZKOEdFRjJ6dHBoaUlFMwpub1dtdHNZb3JuT2wzc2lHQ2ZGZzR4Zmd4eW8ybmlneFNVekl1bXNnVm9PM2ttT0x1RVF6cXpkakJ3TFJXbWlECklmMXBMWnoyalVnald4UkhCM1gyWnVVV1d1T09PZnpXM01LaE8ybHEvZi9DdS8wYk83c0x0MCt3U2ZMSU91TFcKcW90blZtRmxMMytqTy82WDNDKzBERHk5aUtwbXJjVDBnWGZLemE1dHJRSURBUUFCb0FBd0RRWUpLb1pJaHZjTgpBUUVMQlFBRGdnRUJBR05WdmVIOGR4ZzNvK21VeVRkbmFjVmQ1N24zSkExdnZEU1JWREkyQTZ1eXN3ZFp1L1BVCkkwZXpZWFV0RVNnSk1IRmQycVVNMjNuNVJsSXJ3R0xuUXFISUh5VStWWHhsdnZsRnpNOVpEWllSTmU3QlJvYXgKQVlEdUI5STZXT3FYbkFvczFqRmxNUG5NbFpqdU5kSGxpT1BjTU1oNndLaTZzZFhpVStHYTJ2RUVLY01jSVUyRgpvU2djUWdMYTk0aEpacGk3ZnNMdm1OQUxoT045UHdNMGM1dVJVejV4T0dGMUtCbWRSeEgvbUNOS2JKYjFRQm1HCkkwYitEUEdaTktXTU0xMzhIQXdoV0tkNjVoVHdYOWl4V3ZHMkh4TG1WQzg0L1BHT0tWQW9FNkpsYWFHdTlQVmkKdjlOSjVaZlZrcXdCd0hKbzZXdk9xVlA3SVFjZmg3d0drWm89Ci0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo=\n  signerName: kubernetes.io/kube-apiserver-client\n  expirationSeconds: 86400  # one day\n  usages:\n  - client auth\nEOF\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Some points to note:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16597"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve myuser\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Retrieve the certificate from the CSR, to check it looks OK.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16598"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr/myuser -o yaml\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The certificate value is in Base64-encoded format under .status.certificate.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16599"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr myuser -o jsonpath='{.status.certificate}'| base64 -d > myuser.crt\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | The next step is to add this user into the kubeconfig file.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16600"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials myuser --client-key=myuser.key --client-certificate=myuser.crt --embed-certs=true\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | Then, you need to add the context:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16601"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context myuser --cluster=kubernetes --user=myuser\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | To test it:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16602"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl --context myuser auth whoami\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | You should see output confirming that you are “myuser“.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16603"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create role developer --verb=create --verb=get --verb=list --verb=update --verb=delete --resource=pods\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | This is a sample command to create a RoleBinding for this new user:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16604"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding developer-binding-myuser --role=developer --user=myuser\n```\n\n12.1 - Issue a Certificate for a Kubernetes API Client Using A CertificateSigningRequest | This page shows how to enable and configure certificate rotation for the kubelet.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16605"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <<EOF | kubectl apply -f -\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\nmetadata:\n  name: my-svc.my-namespace\nspec:\n  request: $(cat server.csr | base64 | tr -d '\\n')\n  signerName: example.com/serving\n  usages:\n  - digital signature\n  - key encipherment\n  - server auth\nEOF\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Notice that the server.csr file created in step 1 is base64 encoded and stashed in the .spec.request field. You are also requesting a certificate with the \"digital signature\", \"key encipherment\", and", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16606"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe csr my-svc.my-namespace\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Approving the certificate signing request is either done by an automated approval process or on a one off basis by a cluster administrator. If you're authorized to approve a certificate request, you c", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16607"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve my-svc.my-namespace\n```\n\n12.3 - Manage TLS Certificates in a Cluster | You should now see the following:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16608"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.spec.request}' | \\\n  base64 --decode | \\\n  cfssl sign -ca ca.pem -ca-key ca-key.pem -config server-signing-config.json - | \\\n  cfssljson -bare ca-signed-server\n```\n\n12.3 - Manage TLS Certificates in a Cluster | You should see the output similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16609"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o json | \\\n  jq '.status.certificate = \"'$(base64 ca-signed-server.pem | tr -d '\\n')'\"' | \\\n  kubectl replace --raw /apis/certificates.k8s.io/v1/certificatesigningrequests/my-svc.my-namespace/status -f -\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Once the CSR is approved and the signed certificate is uploaded, run:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16610"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get csr my-svc.my-namespace -o jsonpath='{.status.certificate}' \\\n    | base64 --decode > server.crt\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Now you can populate server.crt and server-key.pem in a Secret that you could later mount into a Pod (for example, to use with a webserver that serves HTTPS).", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16611"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls server --cert server.crt --key server-key.pem\n```\n\n12.3 - Manage TLS Certificates in a Cluster | Finally, you can populate ca.pem into a ConfigMap and use it as the trust root to verify the serving certificate:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16612"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap example-serving-ca --from-file ca.crt=ca.pem\n```\n\n12.3 - Manage TLS Certificates in a Cluster | A Kubernetes administrator (with appropriate permissions) can manually approve (or deny) CertificateSigningRequests by using the kubectl certificate approve and kubectl certificate deny commands. Howe", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16613"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napplication/basic-daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\n13.1 - Building a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16614"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: example-daemonset\nspec:\n  selector:\n    matchLabels:\n      app.kubernetes.io/name: example\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io/name: example\n    spec:\n      containers:\n      - name: pause\n        image: registry.k8s.io/pause\n      initContainers:\n      - name: log-machine-id\n        image: busybox:1.37\n        command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']\n        volumeMounts:\n        - name: machine-id\n          mountPath: /etc/machine-id\n          readOnly: true\n        - name: log-dir\n          mountPath: /var/log\n      volumes:\n      - name: machine-id\n        hostPath:\n          path: /etc/machine-id\n          type: File\n      - name: log-dir\n        hostPath:\n          path: /var/log\n```\n\n13.1 - Building a Basic DaemonSet | Create a DaemonSet based on the (YAML) manifest:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16615"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/basic-daemonset.yaml\n```\n\n13.1 - Building a Basic DaemonSet | Once applied, you can verify that the DaemonSet is running a Pod on every node in the cluster:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16616"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n13.1 - Building a Basic DaemonSet | The output will list one Pod per node, similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16617"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec <pod-name> -- cat /var/log/machine-id.log\n```\n\n13.1 - Building a Basic DaemonSet | Where <pod-name> is the name of one of your Pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16618"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete --cascade=foreground --ignore-not-found --now daemonsets/example-daemonset\n```\n\n13.1 - Building a Basic DaemonSet | This simple DaemonSet example introduces key components like init containers and host path volumes, which can be expanded upon for more advanced use cases. For more details refer to DaemonSet.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16619"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/fluentd-daemonset.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16620"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16621"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Alternatively, use kubectl apply to create the same DaemonSet if you plan to update the DaemonSet with kubectl apply.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16622"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Check the update strategy of your DaemonSet, and make sure it's set to RollingUpdate:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16623"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get ds/fluentd-elasticsearch -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}' -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you haven't created the DaemonSet in the system, check your DaemonSet manifest with the following command instead:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16624"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset.yaml --dry-run=client -o go-template='{{.spec.updateStrategy.type}}{{\"\\n\"}}'\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | The output from both commands should be:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16625"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/fluentd-daemonset-update.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16626"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: fluentd-elasticsearch\n  namespace: kube-system\n  labels:\n    k8s-app: fluentd-logging\nspec:\n  selector:\n    matchLabels:\n      name: fluentd-elasticsearch\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  template:\n    metadata:\n      labels:\n        name: fluentd-elasticsearch\n    spec:\n      tolerations:\n      # these tolerations are to have the daemonset runnable on control plane nodes\n      # remove them if your control plane nodes should not run pods\n      - key: node-role.kubernetes.io/control-plane\n        operator: Exists\n        effect: NoSchedule\n      - key: node-role.kubernetes.io/master\n        operator: Exists\n        effect: NoSchedule\n      containers:\n      - name: fluentd-elasticsearch\n        image: quay.io/fluentd_elasticsearch/fluentd:v5.0.1\n        resources:\n          limits:\n            memory: 200Mi\n          requests:\n            cpu: 100m\n            memory: 200Mi\n        volumeMounts:\n        - name: varlog\n          mountPath: /var/log\n        - name: varlibdockercontainers\n          mountPath: /var/lib/docker/containers\n          readOnly: true\n      terminationGracePeriodSeconds: 30\n      volumes:\n      - name: varlog\n        hostPath:\n          path: /var/log\n      - name: varlibdockercontainers\n        hostPath:\n          path: /var/lib/docker/containers\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you update DaemonSets using configuration files, use kubectl apply:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16627"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/controllers/fluentd-daemonset-update.yaml\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you update DaemonSets using imperative commands, use kubectl edit :", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16628"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl edit ds/fluentd-elasticsearch -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | If you only need to update the container image in the DaemonSet template, i.e. .spec.template.spec.containers[*].image, use kubectl set image:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16629"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl set image ds/fluentd-elasticsearch fluentd-elasticsearch=quay.io/fluentd_elasticsearch/fluentd:v2.6.0 -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Finally, watch the rollout status of the latest DaemonSet rolling update:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16630"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/fluentd-elasticsearch -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | When the rollout is complete, the output is similar to this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16631"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l name=fluentd-elasticsearch -o wide -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | Once you've found those nodes, delete some non-DaemonSet pods from the node to make room for new DaemonSet pods.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16632"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete ds fluentd-elasticsearch -n kube-system\n```\n\n13.2 - Perform a Rolling Update on a DaemonSet | This page shows how to perform a rollback on a DaemonSet.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16633"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name>\n```\n\n13.3 - Perform a Rollback on a DaemonSet | This returns a list of DaemonSet revisions:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16634"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history daemonset <daemonset-name> --revision=1\n```\n\n13.3 - Perform a Rollback on a DaemonSet | This returns the details of that revision:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16635"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status ds/<daemonset-name>\n```\n\n13.3 - Perform a Rollback on a DaemonSet | When the rollback is complete, the output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16636"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get controllerrevision -l <daemonset-selector-key>=<daemonset-selector-value>\n```\n\n13.3 - Perform a Rollback on a DaemonSet | This returns a list of ControllerRevisions:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16637"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-1 example-node-2 ssd=true\n```\n\n13.4 - Running Pods on Only Some Nodes | Let's create a DaemonSet which will provision the daemon pods on the SSD labeled nodes only.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16638"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncontrollers/daemonset-label-selector.yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\n13.4 - Running Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16639"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: ssd-driver\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: ssd-driver-pod\n  template:\n    metadata:\n      labels:\n        app: ssd-driver-pod\n    spec:\n      nodeSelector:\n        ssd: \"true\"\n      containers:\n        - name: example-container\n          image: example-image\n```\n\n13.4 - Running Pods on Only Some Nodes | Create the DaemonSet from the manifest by using kubectl create or kubectl apply", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16640"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes example-node-3 ssd=true\n```\n\n13.4 - Running Pods on Only Some Nodes | Labelling the node automatically triggers the control plane (specifically, the DaemonSet controller) to run a new daemon pod on that node.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16641"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o wide\n```\n\n13.4 - Running Pods on Only Some Nodes | The output is similar to:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16642"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image nginx\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | Examine a Pod IP:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16643"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | The hosts file content would look like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16644"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx -- cat /etc/hosts\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16645"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/hostaliases-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16646"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hostaliases-pod\nspec:\n  restartPolicy: Never\n  hostAliases:\n  - ip: \"127.0.0.1\"\n    hostnames:\n    - \"foo.local\"\n    - \"bar.local\"\n  - ip: \"10.1.2.3\"\n    hostnames:\n    - \"foo.remote\"\n    - \"bar.remote\"\n  containers:\n  - name: cat-hosts\n    image: busybox:1.28\n    command:\n    - cat\n    args:\n    - \"/etc/hosts\"\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | You can start a Pod with that configuration by running:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16647"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | Examine a Pod's details to see its IPv4 address and its status:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16648"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pod --output=wide\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | The hosts file content looks like this:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16649"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl logs hostaliases-pod\n```\n\n14.1 - Adding entries to Pod /etc/hosts with HostAliases | with the additional entries specified at the bottom.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16650"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr\n```\n\n14.2 - Extend Service IP Ranges | The well-known kubernetes Service, that exposes the kube-apiserver endpoint to the Pods, calculates the first IP address from the default ServiceCIDR range and uses that IP address as its cluster IP a", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16651"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get service kubernetes\n```\n\n14.2 - Extend Service IP Ranges | The default Service, in this case, uses the ClusterIP 10.96.0.1, that has the corresponding IPAddress object.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16652"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddress 10.96.0.1\n```\n\n14.2 - Extend Service IP Ranges | The ServiceCIDRs are protected with finalizers, to avoid leaving Service ClusterIPs orphans; the finalizer is only removed if there is another subnet that contains the existing IPAddresses or there ar", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16653"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\ncat <EOF | kubectl apply -f -\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  name: newcidr1\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\n14.2 - Extend Service IP Ranges | and this will allow you to create new Services with ClusterIPs that will be picked from this new range.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16654"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl delete servicecidr newcidr1\n```\n\n14.2 - Extend Service IP Ranges | Kubernetes uses a finalizer on the ServiceCIDR to track this dependent relationship.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16655"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1 -o yaml\n```\n\n14.2 - Extend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16656"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1beta1\nkind: ServiceCIDR\nmetadata:\n  creationTimestamp: \"2023-10-12T15:11:07Z\"\n  deletionGracePeriodSeconds: 0\n  deletionTimestamp: \"2023-10-12T15:12:45Z\"\n  finalizers:\n  - networking.k8s.io/service-cidr-finalizer\n  name: newcidr1\n  resourceVersion: \"1133\"\n  uid: 5ffd8afe-c78f-4e60-ae76-cec448a8af40\nspec:\n  cidrs:\n  - 10.96.0.0/24\nstatus:\n  conditions:\n  - lastTransitionTime: \"2023-10-12T15:12:45Z\"\n    message: There are still IPAddresses referencing the ServiceCIDR, please remove\n      them or create a new ServiceCIDR\n    reason: OrphanIPAddress\n    status: \"False\"\n    type: Ready\n```\n\n14.2 - Extend Service IP Ranges | By removing the Services containing the IP addresses that are blocking the deletion of the ServiceCIDR", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16657"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidr newcidr1\n```\n\n14.2 - Extend Service IP Ranges | Cluster administrators can implement policies to control the creation and modification of ServiceCIDR resources within the cluster. This allows for centralized management of the IP address ranges used", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16658"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(newCIDR, variables.allowed.exists(allowedCIDR, cidr(allowedCIDR).containsCIDR(newCIDR)))\"\n  # For all CIDRs (newCIDR) listed in the spec.cidrs of the submitted ServiceCIDR\n  # object, check if there exists at least one CIDR (allowedCIDR) in the `allowed`\n  # list of the VAP such that the allowedCIDR fully contains the newCIDR.\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs.default\"\n  validationActions: [Deny,Audit]\n```\n\n14.2 - Extend Service IP Ranges | Consult the CEL documentation to learn more about CEL if you want to write your own validation expression.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16659"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs.deny\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  validations:\n  - expression: \"object.metadata.name == 'kubernetes'\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-deny-binding\"\nspec:\n  policyName: \"servicecidrs.deny\"\n  validationActions: [Deny,Audit]\n```\n\n14.2 - Extend Service IP Ranges | This document shares how to reconfigure the default Service IP range(s) assigned to a cluster.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16660"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .spec.podCIDRs}}{{printf \"%s\\n\" .}}{{end}}'\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | There should be one IPv4 block and one IPv6 block allocated.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16661"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .status.addresses}}{{printf \"%s: %s\\n\" .type .address}}{{end}}'\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Validate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with a valid Pod in your cluster. In this example the Pod name is pod01:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16662"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get pods pod01 -o go-template --template='{{range .status.podIPs}}{{printf \"%s\\n\" .ip}}{{end}}'\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | You can also validate Pod IPs using the Downward API via the status.podIPs fieldPath. The following snippet demonstrates how you can expose the Pod IPs via an environment variable called MY_POD_IPS wi", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16663"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- set | grep MY_POD_IPS\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The Pod's IP addresses will also be written to /etc/hosts within a container. The following command executes a cat on /etc/hosts on a dual stack Pod. From the output you can verify both the IPv4 and I", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16664"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it pod01 -- cat /etc/hosts\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that does not explicitly define .spec.ipFamilyPolicy. Kubernetes will assign a cluster IP for the Service from the first configured service-cluster-ip-range and set the .s", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16665"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-default-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16666"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16667"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv4 address from the first configured range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16668"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  namespace: default\nspec:\n  clusterIP: 10.0.217.164\n  clusterIPs:\n  - 10.0.217.164\n  ipFamilies:\n  - IPv4\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 9376\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines IPv6 as the first array element in .spec.ipFamilies. Kubernetes will assign a cluster IP for the Service from the IPv6 range configured service-clu", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16669"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-ipfamilies-ipv6.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16670"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilies:\n  - IPv6\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Use kubectl to view the YAML for the Service.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16671"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc my-service -o yaml\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The Service has .spec.ipFamilyPolicy set to SingleStack and .spec.clusterIP set to an IPv6 address from the IPv6 range set via --service-cluster-ip-range flag on kube-controller-manager.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16672"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  labels:\n    app.kubernetes.io/name: MyApp\n  name: my-service\nspec:\n  clusterIP: 2001:db8:fd00::5118\n  clusterIPs:\n  - 2001:db8:fd00::5118\n  ipFamilies:\n  - IPv6\n  ipFamilyPolicy: SingleStack\n  ports:\n  - port: 80\n    protocol: TCP\n    targetPort: 80\n  selector:\n    app.kubernetes.io/name: MyApp\n  sessionAffinity: None\n  type: ClusterIP\nstatus:\n  loadBalancer: {}\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Create the following Service that explicitly defines PreferDualStack in .spec.ipFamilyPolicy. Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and select th", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16673"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-preferred-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16674"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | The kubectl get svc command will only show the primary IP in the CLUSTER-IP field.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16675"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using kubectl describe. You may then validate access to the service via the IPs and ports.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16676"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc -l app.kubernetes.io/name=MyApp\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | If the cloud provider supports the provisioning of IPv6 enabled external load balancers, create the following Service with PreferDualStack in .spec.ipFamilyPolicy, IPv6 as the first element of the .sp", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16677"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/dual-stack-prefer-ipv6-lb-svc.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16678"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-service\n  labels:\n    app.kubernetes.io/name: MyApp\nspec:\n  ipFamilyPolicy: PreferDualStack\n  ipFamilies:\n  - IPv6\n  type: LoadBalancer\n  selector:\n    app.kubernetes.io/name: MyApp\n  ports:\n    - protocol: TCP\n      port: 80\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Check the Service:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16679"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl get svc -l app.kubernetes.io/name=MyApp\n```\n\n14.4 - Validate IPv4/IPv6 dual-stack | Validate that the Service receives a CLUSTER-IP address from the IPv6 address block along with an EXTERNAL-IP. You may then validate access to the service via the IP and port.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16680"}
{"instruction": "Write a bash example for tasks", "response": "Here's a bash example:\n\n```bash\nkubectl foo bar baz buz\n```\n\n15 - Extend kubectl with plugins | This design choice ensures that plugin sub-commands can be implemented across multiple files, if needed, and that these sub-commands can be nested under a \"parent\" plugin command:", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16681"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages-2Mi\n      name: hugepage-2mi\n    - mountPath: /hugepages-1Gi\n      name: hugepage-1gi\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        hugepages-1Gi: 2Gi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage-2mi\n    emptyDir:\n      medium: HugePages-2Mi\n  - name: hugepage-1gi\n    emptyDir:\n      medium: HugePages-1Gi\n```\n\n16 - Manage HugePages | A pod may use medium: HugePages only if it requests huge pages of one size.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16682"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: huge-pages-example\nspec:\n  containers:\n  - name: example\n    image: fedora:latest\n    command:\n    - sleep\n    - inf\n    volumeMounts:\n    - mountPath: /hugepages\n      name: hugepage\n    resources:\n      limits:\n        hugepages-2Mi: 100Mi\n        memory: 100Mi\n      requests:\n        memory: 100Mi\n  volumes:\n  - name: hugepage\n    emptyDir:\n      medium: HugePages\n```\n\n16 - Manage HugePages | Kubernetes includes stable support for managing AMD and NVIDIA GPUs (graphical processing units) across different nodes in your cluster, using device plugins.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16683"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\n17 - Schedule GPUs | If different nodes in your cluster have different types of GPUs, then you can use Node Labels and Node Selectors to schedule pods to appropriate nodes.", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16684"}
{"instruction": "Write a yaml example for tasks", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: example-vector-add\nspec:\n  restartPolicy: OnFailure\n  # You can use Kubernetes node affinity to schedule this Pod onto a node\n  # that provides the kind of GPU that its container needs in order to work\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: \"gpu.gpu-vendor.example/installed-memory\"\n            operator: Gt # (greater than)\n            values: [\"40535\"]\n          - key: \"feature.node.kubernetes.io/pci-10.present\" # NFD Feature label\n            values: [\"true\"] # (optional) only schedule on nodes with PCI device 10\n  containers:\n    - name: example-vector-add\n      image: \"registry.example/example-vector-add:v42\"\n      resources:\n        limits:\n          gpu-vendor.example/example-gpu: 1 # requesting 1 GPU\n```\n\n17 - Schedule GPUs | © 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0", "category": "tasks_code", "subcategory": "general-tasks", "source": "https://kubernetes.io/docs/tasks/_print/", "id": "k8s_00779_code_16685"}
{"instruction": "How do you run jobs in Kubernetes?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Run JobsRun Jobs using parallel processing.1: Running Automated Tasks with a CronJob2: Coarse Parallel Processing Using a Work Queue3: Fine Parallel Processing Using a Work Queue4: Indexed Job for Parallel Processing with Static Work Assignment5: Job with Pod-to-Pod Communication6: Parallel Processing using Expansions7: Handling retriable and non-retriable pod failures with Pod failure policy1 - Running Automated Tasks with a CronJobThis page shows how to run automated tasks using Kubernetes CronJob object.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesCreating a CronJobCron jobs require a config file. Here is a manifest for a CronJob that runs a simple demonstration task every minute:application/job/cronjob.yaml apiVersion: batch/v1 kind: CronJob metadata: name: hello spec: schedule: \"* * * * *\" jobTemplate: spec: template: spec: containers: - name: hello image: busybox:1.28 imagePullPolicy: IfNotPresent command: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure Run the example CronJob by using this command:kubectl create -f https://k8s.io/examples/application/job/cronjob.yaml The output is similar to this:cronjob.batch/hello created After creating the cron job, get its status using this command:kubectl get cronjob hello The output is similar to this:NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE hello */1 * * * * False 0 <none> 10s As you can see from the results of the command, the cron job has not scheduled or run any jobs yet. Watch for the job to be created in around one minute:kubectl get jobs --watch The output is similar to this:NAME COMPLETIONS DURATION AGE hello-4111706356 0/1 0s hello-4111706356 0/1 0s 0s hello-4111706356 1/1 5s 5s Now you've seen one running job scheduled by the \"hello\" cron job. You can stop watching the job and view the cron job again to see that it scheduled the job:kubectl get cronjob hello The output is similar to this:NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE hello */1 * * * * False 0 50s 75s You should see that the cron job hello successfully scheduled a job at the time specified in LAST SCHEDULE. There are currently 0 active jobs, meaning that the job has completed or failed.Now, find the pods that the last scheduled job created and view the standard output of one of the pods.Note:The job name is different from the pod name.# Replace \"hello-4111706356\" with the job name in your system pods=$(kubectl get pods --selector=job-name=hello-4111706356 --output=jsonpath={.items[*].metadata.name}) Show the pod log:kubectl logs $pods The output is similar to this:Fri Feb 22 11:02:09 UTC 2019 Hello from the Kubernetes cluster Deleting a CronJobWhen you don't need a cron job any more, delete it with kubectl delete cronjob <cronjob name>:kubectl delete cronjob hello Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.2 - Coarse Parallel Processing Using a Work QueueIn this example, you will run a Kubernetes Job with multiple parallel worker processes.In this example, as each pod is created, it picks up one unit of work from a task queue, completes it, deletes it from the queue, and exits.Here is an overview of the steps in this example:Start a message queue service. In this example, you use RabbitMQ, but you could use another one. In practice you would set up a message queue service once and reuse it for many jobs.Create a queue, and fill it with mess", "category": "tasks", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16687"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/job/cronjob.yaml\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16688"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16689"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs --watch\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16690"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16691"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob hello\n```\n\n1 - Running Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16692"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-statefulset.yaml\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | Now, we can experiment with accessing the message queue. We will create a temporary interactive pod, install some tools on it, and experiment with queues.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16693"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-1 .\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16694"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-1 <username>/job-wq-1\ndocker push <username>/job-wq-1\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | If you are using an alternative container image registry, tag the image and push it there instead.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16695"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16696"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-1\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | All the pods for that Job succeeded! You're done.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16697"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-pod.yaml\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-service.yaml\n```\n\n3 - Fine Parallel Processing Using a Work Queue | Now let's fill the queue with some \"tasks\". In this example, the tasks are strings to be printed.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16698"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty temp --image redis --command \"/bin/sh\"\n```\n\n3 - Fine Parallel Processing Using a Work Queue | Now hit enter, start the Redis CLI, and create a list with some work items in it.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16699"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-2 .\n```\n\n3 - Fine Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16700"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-2 <username>/job-wq-2\ndocker push <username>/job-wq-2\n```\n\n3 - Fine Parallel Processing Using a Work Queue | You need to push to a public repository or configure your cluster to be able to access your private repository.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16701"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16702"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-2\n```\n\n3 - Fine Parallel Processing Using a Work Queue | You can wait for the Job to succeed, with a timeout:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16703"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs pods/job-wq-2-7r7b2\n```\n\n3 - Fine Parallel Processing Using a Work Queue | As you can see, one of the pods for this Job worked on several work units.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16704"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16705"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16706"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/indexed-job\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16707"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs indexed-job-fdhq5 # Change this to match the name of a Pod from that Job\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16708"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\n5 - Job with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16709"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs example-job-0-qws42\n```\n\n5 - Job with Pod-to-Pod Communication | This task demonstrates running multiple Jobs based on a common template. You can use this approach to process batches of work in parallel.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16710"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16711"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./jobs\n```\n\n6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16712"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l jobgroup=jobexample\n```\n\n6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16713"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l jobgroup=jobexample\n```\n\n6 - Parallel Processing using Expansions | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16714"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l jobgroup=jobexample\n```\n\n6 - Parallel Processing using Expansions | The output should be:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16715"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\n{% set params = [{ \"name\": \"apple\", \"url\": \"http://dbpedia.org/resource/Apple\", },\n                  { \"name\": \"banana\", \"url\": \"http://dbpedia.org/resource/Banana\", },\n                  { \"name\": \"cherry\", \"url\": \"http://dbpedia.org/resource/Cherry\" }]\n%}\n{% for p in params %}\n{% set name = p[\"name\"] %}\n{% set url = p[\"url\"] %}\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: jobexample-{{ name }}\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing URL {{ url }} && sleep 5\"]\n      restartPolicy: Never\n{% endfor %}\n```\n\n6 - Parallel Processing using Expansions | The above template defines two parameters for each Job object using a list of python dicts (lines 1-4). A for loop emits one Job manifest for each set of parameters (remaining lines).", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16716"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16717"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-failjob.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 30 seconds the entire Job should be terminated. Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16718"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, the following conditions display:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16719"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-failjob\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16720"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16721"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-ignore.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Run this command to check the nodeName the Pod is scheduled to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16722"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl drain nodes/$nodeName --ignore-daemonsets --grace-period=0\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the .status.failed to check the counter for the Job is not incremented:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16723"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-ignore -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Uncordon the node:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16724"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon nodes/$nodeName\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The Job resumes and succeeds.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16725"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-ignore\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16726"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16727"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-config-issue.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Note that, the image is misconfigured, as it does not exist.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16728"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16729"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod $podName --subresource=status --patch-file=patch.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | If applied successfully, you will get a notification like this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16730"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods/$podName\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16731"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see a job Failed condition with the field reason equal PodFailurePolicy. Additionally, the message field contains a more detailed information about the Job termination, such as: Pod", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16732"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-config-issue\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16733"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16734"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-backoff-limit-per-index-failindex.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 15 seconds, inspect the status of the Pods for the Job. You can do that by running:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16735"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16736"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see that the failedIndexes field shows \"0,1\", because both indexes failed. Because the index 1 was not retried the number of failed Pods, indicated by the status field \"failed\" equa", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16737"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-backoff-limit-per-index-failindex\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16738"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16739"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob <cronjob name>\n```\n\n1 - Running Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16740"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16741"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16742"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16743"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16744"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\nsubdomain: <headless-svc-name>\n```\n\n5 - Job with Pod-to-Pod Communication | Below is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16745"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\n5 - Job with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16746"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16747"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16748"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16749"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16750"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\ncontainerStatuses:\n- image: non-existing-repo/non-existing-image:example\n   ...\n   state:\n   waiting:\n      message: Back-off pulling image \"non-existing-repo/non-existing-image:example\"\n      reason: ImagePullBackOff\n      ...\nphase: Pending\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Note that the pod remains in the Pending phase as it fails to pull the misconfigured image. This, in principle, could be a transient issue and the image could get pulled. However, in this case, the im", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16751"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16752"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napplication/job/cronjob.yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16753"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: hello\nspec:\n  schedule: \"* * * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n          - name: hello\n            image: busybox:1.28\n            imagePullPolicy: IfNotPresent\n            command:\n            - /bin/sh\n            - -c\n            - date; echo Hello from the Kubernetes cluster\n          restartPolicy: OnFailure\n```\n\n1 - Running Automated Tasks with a CronJob | Run the example CronJob by using this command:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16754"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/application/job/cronjob.yaml\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16755"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16756"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs --watch\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16757"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get cronjob hello\n```\n\n1 - Running Automated Tasks with a CronJob | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16758"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete cronjob hello\n```\n\n1 - Running Automated Tasks with a CronJob | Deleting the cron job removes all the jobs and pods it created and stops it from creating additional jobs. You can read more about removing jobs in garbage collection.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16759"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/application/job/rabbitmq/rabbitmq-statefulset.yaml\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | Now, we can experiment with accessing the message queue. We will create a temporary interactive pod, install some tools on it, and experiment with queues.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16760"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-1 .\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16761"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-1 <username>/job-wq-1\ndocker push <username>/job-wq-1\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | If you are using an alternative container image registry, tag the image and push it there instead.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16762"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napplication/job/rabbitmq/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16763"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-1\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-1\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/<project>/job-wq-1\n        env:\n        - name: BROKER_URL\n          value: amqp://guest:guest@rabbitmq-service:5672\n        - name: QUEUE\n          value: job1\n      restartPolicy: OnFailure\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | In this example, each pod works on one item from the queue and then exits. So, the completion count of the Job corresponds to the number of work items done. That is why the example manifest has .spec.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16764"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-1\n```\n\n2 - Coarse Parallel Processing Using a Work Queue | All the pods for that Job succeeded! You're done.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16765"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-pod.yaml\nkubectl apply -f https://k8s.io/examples/application/job/redis/redis-service.yaml\n```\n\n3 - Fine Parallel Processing Using a Work Queue | Now let's fill the queue with some \"tasks\". In this example, the tasks are strings to be printed.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16766"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl run -i --tty temp --image redis --command \"/bin/sh\"\n```\n\n3 - Fine Parallel Processing Using a Work Queue | Now hit enter, start the Redis CLI, and create a list with some work items in it.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16767"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker build -t job-wq-2 .\n```\n\n3 - Fine Parallel Processing Using a Work Queue | For the Docker Hub, tag your app image with your username and push to the Hub with the below commands. Replace <username> with your Hub username.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16768"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\ndocker tag job-wq-2 <username>/job-wq-2\ndocker push <username>/job-wq-2\n```\n\n3 - Fine Parallel Processing Using a Work Queue | You need to push to a public repository or configure your cluster to be able to access your private repository.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16769"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napplication/job/redis/job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16770"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-wq-2\nspec:\n  parallelism: 2\n  template:\n    metadata:\n      name: job-wq-2\n    spec:\n      containers:\n      - name: c\n        image: gcr.io/myproject/job-wq-2\n      restartPolicy: OnFailure\n```\n\n3 - Fine Parallel Processing Using a Work Queue | In this example, each pod works on several items from the queue and then exits when there are no more items. Since the workers themselves detect when the workqueue is empty, and the Job controller doe", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16771"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/job-wq-2\n```\n\n3 - Fine Parallel Processing Using a Work Queue | You can wait for the Job to succeed, with a timeout:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16772"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs pods/job-wq-2-7r7b2\n```\n\n3 - Fine Parallel Processing Using a Work Queue | As you can see, one of the pods for this Job worked on several work units.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16773"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napplication/job/indexed-job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16774"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      initContainers:\n      - name: 'input'\n        image: 'docker.io/library/bash'\n        command:\n        - \"bash\"\n        - \"-c\"\n        - |\n          items=(foo bar baz qux xyz)\n          echo ${items[$JOB_COMPLETION_INDEX]} > /input/data.txt          \n        volumeMounts:\n        - mountPath: /input\n          name: input\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        emptyDir: {}\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | In the example above, you use the builtin JOB_COMPLETION_INDEX environment variable set by the Job controller for all containers. An init container maps the index to a static value and writes it to a", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16775"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napplication/job/indexed-job-vol.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16776"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: 'indexed-job'\nspec:\n  completions: 5\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: 'worker'\n        image: 'docker.io/library/busybox'\n        command:\n        - \"rev\"\n        - \"/input/data.txt\"\n        volumeMounts:\n        - mountPath: /input\n          name: input\n      volumes:\n      - name: input\n        downwardAPI:\n          items:\n          - path: \"data.txt\"\n            fieldRef:\n              fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | Now run the Job:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16777"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl describe jobs/indexed-job\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16778"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs indexed-job-fdhq5 # Change this to match the name of a Pod from that Job\n```\n\n4 - Indexed Job for Parallel Processing with Static Work Assignment | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16779"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: headless-svc\nspec:\n  clusterIP: None # clusterIP must be None to create a headless service\n  selector:\n    job-name: example-job # must match Job name\n---\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  completions: 3\n  parallelism: 3\n  completionMode: Indexed\n  template:\n    spec:\n      subdomain: headless-svc # has to match Service name\n      restartPolicy: Never\n      containers:\n      - name: example-workload\n        image: bash:latest\n        command:\n        - bash\n        - -c\n        - |\n          for i in 0 1 2\n          do\n            gotStatus=\"-1\"\n            wantStatus=\"0\"             \n            while [ $gotStatus -ne $wantStatus ]\n            do                                       \n              ping -c 1 example-job-${i}.headless-svc > /dev/null 2>&1\n              gotStatus=$?                \n              if [ $gotStatus -ne $wantStatus ]; then\n                echo \"Failed to ping pod example-job-${i}.headless-svc, retrying in 1 second...\"\n                sleep 1\n              fi\n            done                                                         \n            echo \"Successfully pinged pod: example-job-${i}.headless-svc\"\n          done\n```\n\n5 - Job with Pod-to-Pod Communication | After applying the example above, reach each other over the network using: <pod-hostname>.<headless-service-name>. You should see output similar to the following:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16780"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs example-job-0-qws42\n```\n\n5 - Job with Pod-to-Pod Communication | This task demonstrates running multiple Jobs based on a common template. You can use this approach to process batches of work in parallel.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16781"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napplication/job/job-tmpl.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16782"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: process-item-$ITEM\n  labels:\n    jobgroup: jobexample\nspec:\n  template:\n    metadata:\n      name: jobexample\n      labels:\n        jobgroup: jobexample\n    spec:\n      containers:\n      - name: c\n        image: busybox:1.28\n        command: [\"sh\", \"-c\", \"echo Processing item $ITEM && sleep 5\"]\n      restartPolicy: Never\n```\n\n6 - Parallel Processing using Expansions | The file you downloaded is not yet a valid Kubernetes manifest. Instead that template is a YAML representation of a Job object with some placeholders that need to be filled in before it can be used. T", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16783"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f ./jobs\n```\n\n6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16784"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l jobgroup=jobexample\n```\n\n6 - Parallel Processing using Expansions | The output is similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16785"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l jobgroup=jobexample\n```\n\n6 - Parallel Processing using Expansions | The output is similar to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16786"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f -l jobgroup=jobexample\n```\n\n6 - Parallel Processing using Expansions | The output should be:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16787"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-failjob.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16788"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-failjob\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 42 to simulate a software bug.\" && sleep 30 && exit 42\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16789"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-failjob.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 30 seconds the entire Job should be terminated. Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16790"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, the following conditions display:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16791"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-failjob\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16792"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-ignore.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16793"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-ignore\nspec:\n  completions: 4\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/bash:5\n        command: [\"bash\"]\n        args:\n        - -c\n        - echo \"Hello world! I'm going to exit with 0 (success).\" && sleep 90 && exit 0\n  backoffLimit: 0\n  podFailurePolicy:\n    rules:\n    - action: Ignore\n      onPodConditions:\n      - type: DisruptionTarget\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16794"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-ignore.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Run this command to check the nodeName the Pod is scheduled to:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16795"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl drain nodes/$nodeName --ignore-daemonsets --grace-period=0\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the .status.failed to check the counter for the Job is not incremented:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16796"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-ignore -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Uncordon the node:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16797"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon nodes/$nodeName\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The Job resumes and succeeds.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16798"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-ignore\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16799"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-pod-failure-policy-config-issue.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16800"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-pod-failure-policy-config-issue\nspec:\n  completions: 8\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: \"non-existing-repo/non-existing-image:example\"\n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailJob\n      onPodConditions:\n      - type: ConfigIssue\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16801"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-pod-failure-policy-config-issue.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Note that, the image is misconfigured, as it does not exist.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16802"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16803"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod $podName --subresource=status --patch-file=patch.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | If applied successfully, you will get a notification like this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16804"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete pods/$podName\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Inspect the status of the Job by running:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16805"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-pod-failure-policy-config-issue -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see a job Failed condition with the field reason equal PodFailurePolicy. Additionally, the message field contains a more detailed information about the Job termination, such as: Pod", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16806"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-pod-failure-policy-config-issue\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16807"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\n/controllers/job-backoff-limit-per-index-failindex.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16808"}
{"instruction": "Write a yaml example for run jobs", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: job-backoff-limit-per-index-failindex\nspec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed\n  backoffLimitPerIndex: 1\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: main\n        image: docker.io/library/python:3\n        command:\n          # The script:\n          # - fails the Pod with index 0 with exit code 1, which results in one retry;\n          # - fails the Pod with index 1 with exit code 42 which results\n          #   in failing the index without retry.\n          # - succeeds Pods with any other index.\n          - python3\n          - -c\n          - |\n            import os, sys\n            index = int(os.environ.get(\"JOB_COMPLETION_INDEX\"))\n            if index == 0:\n              sys.exit(1)\n            elif index == 1:\n              sys.exit(42)\n            else:\n              sys.exit(0)            \n  backoffLimit: 6\n  podFailurePolicy:\n    rules:\n    - action: FailIndex\n      onExitCodes:\n        containerName: main\n        operator: In\n        values: [42]\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | Apply the manifest:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16809"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/controllers/job-backoff-limit-per-index-failindex.yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | After around 15 seconds, inspect the status of the Pods for the Job. You can do that by running:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16810"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | You will see output similar to this:", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16811"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl get jobs -l job-name=job-backoff-limit-per-index-failindex -o yaml\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | In the Job status, see that the failedIndexes field shows \"0,1\", because both indexes failed. Because the index 1 was not retried the number of failed Pods, indicated by the status field \"failed\" equa", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16812"}
{"instruction": "Write a bash example for run jobs", "response": "Here's a bash example:\n\n```bash\nkubectl delete jobs/job-backoff-limit-per-index-failindex\n```\n\n7 - Handling retriable and non-retriable pod failures with Pod failure policy | The cluster automatically cleans up the Pods.", "category": "tasks_code", "subcategory": "run-jobs", "source": "https://kubernetes.io/docs/tasks/job/_print/", "id": "k8s_00780_code_16813"}
{"instruction": "How do you configure pods and containers in Kubernetes?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Configure Pods and ContainersPerform common configuration tasks for Pods and containers.1: Assign Memory Resources to Containers and Pods2: Assign CPU Resources to Containers and Pods3: Assign Devices to Pods and Containers3.1: Set Up DRA in a Cluster3.2: Allocate Devices to Workloads with DRA4: Assign Pod-level CPU and memory resources5: Configure GMSA for Windows Pods and containers6: Resize CPU and Memory Resources assigned to Containers7: Configure RunAsUserName for Windows pods and containers8: Create a Windows HostProcess Pod9: Configure Quality of Service for Pods10: Assign Extended Resources to a Container11: Configure a Pod to Use a Volume for Storage12: Configure a Pod to Use a PersistentVolume for Storage13: Configure a Pod to Use a Projected Volume for Storage14: Configure a Security Context for a Pod or Container15: Configure Service Accounts for Pods16: Pull an Image from a Private Registry17: Configure Liveness, Readiness and Startup Probes18: Assign Pods to Nodes19: Assign Pods to Nodes using Node Affinity20: Configure Pod Initialization21: Attach Handlers to Container Lifecycle Events22: Configure a Pod to Use a ConfigMap23: Share Process Namespace between Containers in a Pod24: Use a User Namespace With a Pod25: Use an Image Volume With a Pod26: Create static Pods27: Translate a Docker Compose File to Kubernetes Resources28: Enforce Pod Security Standards by Configuring the Built-in Admission Controller29: Enforce Pod Security Standards with Namespace Labels30: Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller1 - Assign Memory Resources to Containers and PodsThis page shows how to assign a memory request and a memory limit to a Container. A Container is guaranteed to have as much memory as it requests, but is not allowed to use more memory than its limit.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesTo check the version, enter kubectl version.Each node in your cluster must have at least 300 MiB of memory.A few of the steps on this page require you to run the metrics-server service in your cluster. If you have the metrics-server running, you can skip those steps.If you are running Minikube, run the following command to enable the metrics-server:minikube addons enable metrics-server To see whether the metrics-server is running, or another provider of the resource metrics API (metrics.k8s.io), run the following command:kubectl get apiservices If the resource metrics API is available, the output includes a reference to metrics.k8s.io.NAME v1beta1.metrics.k8s.io Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace mem-example Specify a memory request and a memory limitTo specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.In this exercise, you create a Pod that has one Container. The Container has a memory request of 100 MiB and a memory limit of 200 MiB. Here's the configuration file for the Pod:pods/resource/memory-request-limit.yaml apiVersion: v1 kind: Pod metadata: name: memory-demo namespace: mem-example spec: containers: - name: memory-demo-ctr image: polinux/stress resources: requests: memory: \"100Mi\" limits: memory: \"200Mi\" command: [\"stress\"] args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"] The args section in the configuration file provides arguments", "category": "tasks", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n1 - Assign Memory Resources to Containers and Pods | If the resource metrics API is available, the output includes a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16815"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | To specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16816"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16817"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16818"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16819"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the one Container in the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16820"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16821"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | A Container can exceed its memory request if the Node has memory available. But a Container is not allowed to use more than its memory limit. If a Container allocates more memory than its limit, the C", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16822"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16823"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-2.yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16824"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | At this point, the Container might be running or killed. Repeat the preceding command until the Container is killed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16825"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --output=yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container was killed because it is out of memory (OOM):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16826"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container is killed, restarted, killed again, restarted again, and so on:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16827"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS      RESTARTS   AGE\nmemory-demo-2   0/1       OOMKilled   1          37s\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16828"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-2   1/1       Running   2          40s\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16829"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container starts and fails repeatedly:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16830"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output includes a record of the Container being killed because of an out-of-memory condition:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16831"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | Memory requests and limits are associated with Containers, but it is useful to think of a Pod as having a memory request and limit. The memory request for the Pod is the sum of the memory requests for", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16832"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16833"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-3.yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16834"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod status is PENDING. That is, the Pod is not scheduled to run on any Node, and it will remain in the PENDING state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16835"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-3   0/1       Pending   0          25s\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod, including events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16836"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-3 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient memory on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16837"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-3 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | If you do not specify a memory limit for a Container, one of the following situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16838"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | Assign CPU Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16839"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n2 - Assign CPU Resources to Containers and Pods | If the resource metrics API is available, the output will include a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16840"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | To specify a CPU request for a container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16841"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16842"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16843"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16844"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | The output shows that the one container in the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16845"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16846"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | CPU requests and limits are associated with Containers, but it is useful to think of a Pod as having a CPU request and limit. The CPU request for a Pod is the sum of the CPU requests for all the Conta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16847"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16848"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16849"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo-2 --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | The output shows that the Pod status is Pending. That is, the Pod has not been scheduled to run on any Node, and it will remain in the Pending state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16850"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod cpu-demo-2 --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient CPU resources on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16851"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo-2 --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | If you do not specify a CPU limit for a Container, then one of these situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16852"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16853"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.1 - Set Up DRA in a Cluster | If the component configuration was correct, the output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16854"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16855"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslice <resourceslice-name> -o yaml\n```\n\n3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16856"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\n3.1 - Set Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16857"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16858"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.1 - Set Up DRA in a Cluster | To delete the DeviceClass that you created in this task, run the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16859"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.1 - Set Up DRA in a Cluster | This page shows you how to allocate devices to your Pods by using dynamic resource allocation (DRA). These instructions are for workload operators. Before reading this page, familiarize yourself with", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16860"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.2 - Allocate Devices to Workloads with DRA | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16861"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16862"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Review the following example manifest:dra/resourceclaim.yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaim metadata: name: example-resource-claim spec: devices: requests: - name: sing", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16863"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16864"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | To request device allocation, specify a ResourceClaim or a ResourceClaimTemplate in the resourceClaims field of the Pod specification. Then, request a specific claim by name in the resources.claims fi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16865"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16866"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Try the following troubleshooting steps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16867"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | To delete your resource claims, run one of the following commands:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16868"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Delete the ResourceClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16869"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This page shows how to specify CPU and memory resources for a Pod at pod-level in addition to container-level resource specifications. A Kubernetes node allocates resources to a pod based on the pod's", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16870"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | To specify memory requests for a Pod at pod-level, include the resources.requests.memory field in the Pod spec manifest. To specify a memory limit, include resources.limits.memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16871"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16872"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-memory-request-limit.yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16873"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16874"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16875"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16876"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16877"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-cpu-request-limit.yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16878"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16879"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16880"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16881"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16882"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-resources.yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16883"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod-resources-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16884"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that one container in the Pod has a memory request of 50 MiB and a CPU request of 0.5 cores, with a memory limit of 100 MiB and a CPU limit of 0.5 cores. The Pod itself has a memory r", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16885"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16886"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\n5 - Configure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16887"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\n5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16888"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n5 - Configure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16889"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n5 - Configure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16890"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n5 - Configure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16891"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it iis-auth-7776966999-n5nzr powershell.exe\n```\n\n5 - Configure GMSA for Windows Pods and containers | nltest.exe /parentdomain results in the following error:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16892"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16893"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod-resize.yaml\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | This pod starts in the Guaranteed QoS class. Verify its initial state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16894"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"cpu\":\"800m\"}, \"limits\":{\"cpu\":\"800m\"}}}]}}'\n\n# Alternative methods:\n# kubectl -n qos-example edit pod resize-demo --subresource resize\n# kubectl -n qos-example apply -f <updated-manifest> --subresource resize --server-side\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status again after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16895"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml --namespace=qos-example\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | You should see:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16896"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"memory\":\"300Mi\"}, \"limits\":{\"memory\":\"300Mi\"}}}]}}'\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status shortly after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16897"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | You should now observe:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16898"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | You'll see changes indicating the problem:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16899"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod resize-demo\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16900"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16901"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-pod.yaml\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16902"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-pod-demo\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16903"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-pod-demo -- powershell\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16904"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16905"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-container.yaml\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16906"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-container-demo\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16907"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-container-demo -- powershell\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username (the one set at the Container level):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16908"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace qos-example\n```\n\n9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of Guaranteed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16909"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16910"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16911"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also verifies that the Pod Container has a memory request that matches its memory limit, and it has a CPU request th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16912"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | A Pod is given a QoS class of Burstable if:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16913"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16914"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16915"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-2 --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16916"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-2 --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not have any memory or CPU limits or requests.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16917"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16918"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16919"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-3 --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of BestEffort:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16920"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-3 --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | Here is a manifest for a Pod that has two Containers. One container specifies a memory request of 200 MiB. The other Container does not specify any requests or limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16921"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16922"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16923"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-4 --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16924"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\n9 - Configure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16925"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace qos-example\n```\n\n9 - Configure Quality of Service for Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16926"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16927"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml\n```\n\n10 - Assign Extended Resources to a Container | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16928"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo\n```\n\n10 - Assign Extended Resources to a Container | Describe the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16929"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo\n```\n\n10 - Assign Extended Resources to a Container | The output shows dongle requests:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16930"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16931"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml\n```\n\n10 - Assign Extended Resources to a Container | Describe the Pod", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16932"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo-2\n```\n\n10 - Assign Extended Resources to a Container | The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16933"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo-2\n```\n\n10 - Assign Extended Resources to a Container | The output shows that the Pod was created, but not scheduled to run on a Node. It has a status of Pending:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16934"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod extended-resource-demo\nkubectl delete pod extended-resource-demo-2\n```\n\n10 - Assign Extended Resources to a Container | This page shows how to configure a Pod to use a Volume for storage.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16935"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16936"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml\n```\n\n11 - Configure a Pod to Use a Volume for Storage | Verify that the Pod's Container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16937"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod redis --watch\n```\n\n11 - Configure a Pod to Use a Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16938"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and then create a file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16939"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and verify that test-file is still there.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16940"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\n```\n\n11 - Configure a Pod to Use a Volume for Storage | See Volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16941"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16942"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | View information about the PersistentVolume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16943"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16944"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16945"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume wi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16946"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Now the output shows a STATUS of Bound.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16947"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc task-pv-claim\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, task-pv-volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16948"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16949"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16950"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod task-pv-pod\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Get a shell to the container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16951"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it task-pv-pod -- /bin/bash\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16952"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod task-pv-pod\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16953"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16954"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16955"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test -- /bin/bash\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16956"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test\nkubectl delete pvc task-pv-claim\nkubectl delete pv task-pv-volume\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | If you don't already have a shell open to the Node in your cluster, open a new shell the same way that you did earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16957"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16958"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16959"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/projected.yaml\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | Verify that the Pod's container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16960"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get --watch pod test-projected-volume\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16961"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test-projected-volume -- /bin/sh\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | In your shell, verify that the projected-volume directory contains your projected sources:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16962"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test-projected-volume\nkubectl delete secret user pass\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | A security context defines privilege and access control settings for a Pod or Container. Security context settings include, but are not limited to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16963"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16964"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16965"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16966"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16967"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16968"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-5.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16969"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16970"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16971"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16972"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-6.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16973"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16974"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- id\n```\n\n14 - Configure a Security Context for a Pod or Container | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16975"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo -o yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | You can see that the status.containerStatuses[].user.linux field exposes the process identity attached to the first container process.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16976"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\n14 - Configure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16977"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\n14 - Configure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16978"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16979"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-2.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16980"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-2\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16981"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-2 -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16982"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16983"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-3.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16984"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-3\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16985"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-3 -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16986"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16987"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-4.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16988"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-4 -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, view the capabilities for process 1:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16989"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod security-context-demo\nkubectl delete pod security-context-demo-2\nkubectl delete pod security-context-demo-3\nkubectl delete pod security-context-demo-4\n```\n\n14 - Configure a Security Context for a Pod or Container | Kubernetes offers two distinct ways for clients that run within your cluster, or that otherwise have a relationship to your cluster's control plane to authenticate to the API server.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16990"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/<podname> -o yaml\n```\n\n15 - Configure Service Accounts for Pods | In the output, you see a field spec.serviceAccountName. Kubernetes automatically sets that value if you don't specify it when you create a Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16991"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\n15 - Configure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16992"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\n15 - Configure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16993"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16994"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nEOF\n```\n\n15 - Configure Service Accounts for Pods | The name of a ServiceAccount object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16995"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts/build-robot -o yaml\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16996"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\n15 - Configure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16997"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete serviceaccount/build-robot\n```\n\n15 - Configure Service Accounts for Pods | Suppose you have an existing service account named \"build-robot\" as mentioned earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16998"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot\n```\n\n15 - Configure Service Accounts for Pods | The output from that command is a token that you can use to authenticate as that ServiceAccount. You can request a specific token duration using the --duration command line argument to kubectl create", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_16999"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot --bound-object-kind Node --bound-object-name node-001 --bound-object-uid 123...456\n```\n\n15 - Configure Service Accounts for Pods | The token will be valid until it expires or either the associated Node or service account are deleted.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17000"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n15 - Configure Service Accounts for Pods | If you view the Secret using:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17001"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secret/build-robot-secret -o yaml\n```\n\n15 - Configure Service Accounts for Pods | you can see that the Secret now contains an API token for the \"build-robot\" ServiceAccount.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17002"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe secrets/build-robot-secret\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17003"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry myregistrykey --docker-server=<registry name> \\\n        --docker-username=DUMMY_USERNAME --docker-password=DUMMY_DOCKER_PASSWORD \\\n        --docker-email=DUMMY_DOCKER_EMAIL\n```\n\n15 - Configure Service Accounts for Pods | Verify it has been created.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17004"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets myregistrykey\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17005"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch serviceaccount default -p '{\"imagePullSecrets\": [{\"name\": \"myregistrykey\"}]}'\n```\n\n15 - Configure Service Accounts for Pods | You can achieve the same outcome by editing the object manually:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17006"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl edit serviceaccount/default\n```\n\n15 - Configure Service Accounts for Pods | The output of the sa.yaml file is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17007"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\n15 - Configure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17008"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\n15 - Configure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17009"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=<registry name>/nginx --restart=Never\nkubectl get pod nginx -o=jsonpath='{.spec.imagePullSecrets[0].name}{\"\\n\"}'\n```\n\n15 - Configure Service Accounts for Pods | The output is:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17010"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17011"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/pod-projected-svc-token.yaml\n```\n\n15 - Configure Service Accounts for Pods | The kubelet will: request and store the token on behalf of the Pod; make the token available to the Pod at a configurable file path; and refresh the token as it approaches expiration. The kubelet proa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17012"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic regcred \\\n    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \\\n    --type=kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it. Be sure to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17013"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17014"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>\n```\n\n16 - Pull an Image from a Private Registry | where:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17015"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=yaml\n```\n\n16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17016"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17017"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=\"jsonpath={.data.\\.dockerconfigjson}\" | base64 --decode\n```\n\n16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17018"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17019"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-private-reg-pod.yaml\nkubectl get pod private-reg\n```\n\n16 - Pull an Image from a Private Registry | Also, in case the Pod fails to start with the status ImagePullBackOff, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17020"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod private-reg\n```\n\n16 - Pull an Image from a Private Registry | If you then see an event with the reason set to FailedToRetrieveImagePullSecret, Kubernetes can't find a Secret with name (regcred, in this example).", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17021"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17022"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | Within 30 seconds, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17023"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | The output indicates that no liveness probes have failed yet:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17024"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | At the bottom of the output, there are messages indicating that the liveness probes have failed, and the failed containers have been killed and recreated.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17025"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod liveness-exec\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | The output shows that RESTARTS has been incremented. Note that the RESTARTS counter increments as soon as a failed container comes back to the running state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17026"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17027"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/http-liveness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | After 10 seconds, view Pod events to verify that liveness probes have failed and the container has been restarted:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17028"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-http\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In releases after v1.13, local HTTP proxy environment variable settings do not affect the HTTP liveness probe.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17029"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17030"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that liveness probes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17031"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod goproxy\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | If your application implements the gRPC Health Checking Protocol, this example shows how to configure Kubernetes to use it for application liveness checks. Similarly you can configure readiness and st", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17032"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17033"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/grpc-liveness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that the liveness check has not failed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17034"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod etcd-with-grpc\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | When using a gRPC probe, there are some technical details to be aware of:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17035"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17036"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n18 - Assign Pods to Nodes | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17037"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17038"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17039"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml\n```\n\n18 - Assign Pods to Nodes | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17040"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17041"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17042"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17043"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n19 - Assign Pods to Nodes using Node Affinity | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17044"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17045"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17046"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17047"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17048"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17049"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17050"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17051"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17052"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/init-containers.yaml\n```\n\n20 - Configure Pod Initialization | Verify that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17053"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod init-demo\n```\n\n20 - Configure Pod Initialization | The output shows that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17054"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it init-demo -- /bin/bash\n```\n\n20 - Configure Pod Initialization | In your shell, send a GET request to the nginx server:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17055"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17056"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/lifecycle-events.yaml\n```\n\n21 - Attach Handlers to Container Lifecycle Events | Verify that the Container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17057"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod lifecycle-demo\n```\n\n21 - Attach Handlers to Container Lifecycle Events | Get a shell into the Container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17058"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it lifecycle-demo -- /bin/bash\n```\n\n21 - Attach Handlers to Container Lifecycle Events | In your shell, verify that the postStart handler created the message file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17059"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap <map-name> <data-source>\n```\n\n22 - Configure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17060"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17061"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17062"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17063"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17064"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17065"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can display details of the game-config-2 ConfigMap using the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17066"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17067"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-env-file \\\n       --from-env-file=configure-pod-container/configmap/game-env-file.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce a ConfigMap. View the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17068"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap game-config-env-file -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | the output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17069"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\n22 - Configure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17070"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap config-multi-env-files \\\n        --from-env-file=configure-pod-container/configmap/game-env-file.properties \\\n        --from-env-file=configure-pod-container/configmap/ui-env-file.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17071"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap config-multi-env-files -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17072"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17073"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=<my-key-name>=<path-to-file>\n```\n\n22 - Configure a Pod to Use a ConfigMap | where <my-key-name> is the key you want to use in the ConfigMap and <path-to-file> is the location of the data source file you want the key to represent.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17074"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17075"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config-3 -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17076"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17077"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17078"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps special-config -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17079"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17080"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | and also:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17081"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps/game-config-4-m9dm2f92bt\n```\n\n22 - Configure a Pod to Use a ConfigMap | Notice that the generated ConfigMap name has a suffix appended by hashing the contents. This ensures that a new ConfigMap is generated each time the content is modified.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17082"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17083"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very\n```\n\n22 - Configure a Pod to Use a ConfigMap | Assign the special.how value defined in the ConfigMap to the SPECIAL_LEVEL_KEY environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17084"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17085"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-single-configmap-env-variable.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variable SPECIAL_LEVEL_KEY=very.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17086"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17087"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17088"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17089"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-multiple-configmap-env-variable.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL_KEY=very and LOG_LEVEL=INFO.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17090"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\nkubectl delete configmap special-config\nkubectl delete configmap env-config\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create a ConfigMap containing multiple key-value pairs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17091"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17092"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Use envFrom to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17093"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17094"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-envFrom.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL=very and SPECIAL_TYPE=charm.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17095"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use ConfigMap-defined environment variables in the command and args of a container using the $(VAR_NAME) Kubernetes substitution syntax.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17096"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17097"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valueFrom.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | That pod produces the following output from the test-container container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17098"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod\n```\n\n22 - Configure a Pod to Use a ConfigMap | Once you're happy to move on, delete that Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17099"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | As explained in Create ConfigMaps from files, when you create a ConfigMap using --from-file, the filename becomes a key stored in the data section of the ConfigMap. The file contents become the key's", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17100"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17101"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Add the ConfigMap name under the volumes section of the Pod specification. This adds the ConfigMap data to the directory specified as volumeMounts.mountPath (in this case, /etc/config). The command se", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17102"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17103"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command ls /etc/config/ produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17104"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | Use the path field to specify the desired file path for specific ConfigMap items. In this case, the SPECIAL_LEVEL item will be mounted in the config-volume volume at /etc/config/keys.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17105"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17106"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume-specific-key.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command cat /etc/config/keys produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17107"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can project keys to specific paths. Refer to the corresponding section in the Secrets guide for the syntax.You can set POSIX permissions for keys. Refer to the corresponding section in the Secrets", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17108"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\n22 - Configure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17109"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17110"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17111"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n22 - Configure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17112"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17113"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml\n```\n\n23 - Share Process Namespace between Containers in a Pod | Attach to the shell container and run ps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17114"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it nginx -c shell -- /bin/sh\n```\n\n23 - Share Process Namespace between Containers in a Pod | If you don't see a command prompt, try pressing enter. In the container shell:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17115"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17116"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/user-namespaces-stateless.yaml\n```\n\n24 - Use a User Namespace With a Pod | Exec into the pod and run readlink /proc/self/ns/user:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17117"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti userns -- bash\n```\n\n24 - Use a User Namespace With a Pod | Run this command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17118"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17119"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml\n```\n\n25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17120"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n25 - Use an Image Volume With a Pod | Check the content of a file in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17121"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17122"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml\n```\n\n25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17123"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n25 - Use an Image Volume With a Pod | Check the content of the file from the dir sub path in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17124"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Run this command on the node where kubelet is running\nmkdir -p /etc/kubernetes/manifests/\ncat <<EOF >/etc/kubernetes/manifests/static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\n26 - Create static Pods | Configure the kubelet on that node to set a staticPodPath value in the kubelet configuration file.See Set Kubelet Parameters Via A Configuration File for more information.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17125"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\n26 - Create static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17126"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod static-web-my-node1\n```\n\n26 - Create static Pods | You can see that the Pod is still running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17127"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17128"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc web-tcp\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | If you're using a cloud provider, your IP will be listed next to LoadBalancer Ingress.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17129"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | Kompose has support for two providers: OpenShift and Kubernetes. You can choose a targeted provider using global option --provider. If no provider is specified, Kubernetes is set by default.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17130"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\ndocker-compose\n├── Chart.yaml\n├── README.md\n└── templates\n    ├── redis-deployment.yaml\n    ├── redis-svc.yaml\n    ├── web-deployment.yaml\n    └── web-svc.yaml\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | The chart structure is aimed at providing a skeleton for building your Helm charts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17131"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\n28 - Enforce Pod Security Standards by Configuring the Built-in Admission Controller | Namespaces can be labeled to enforce the Pod Security Standards. The three policies privileged, baseline and restricted broadly cover the security spectrum and are implemented by the Pod Security admi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17132"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17133"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\n    pod-security.kubernetes.io/enforce=baseline\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | If you're just getting started with the Pod Security Standards, a suitable first step would be to configure all namespaces with audit annotations for a stricter level such as baseline:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17134"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns --all \\\n  pod-security.kubernetes.io/audit=baseline \\\n  pod-security.kubernetes.io/warn=baseline\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | Note that this is not setting an enforce level, so that namespaces that haven't been explicitly evaluated can be distinguished. You can list namespaces without an explicitly set enforce level using th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17135"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --selector='!pod-security.kubernetes.io/enforce'\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | You can update a specific namespace as well. This command adds the enforce=restricted policy to my-existing-namespace, pinning the restricted policy version to v1.34.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17136"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns my-existing-namespace \\\n  pod-security.kubernetes.io/enforce=restricted \\\n  pod-security.kubernetes.io/enforce-version=v1.34\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | This page describes the process of migrating from PodSecurityPolicies to the built-in PodSecurity admission controller. This can be done effectively using a combination of dry-run and audit and warn m", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17137"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n $NAMESPACE -o jsonpath=\"{.items[*].metadata.annotations.kubernetes\\.io\\/psp}\" | tr \" \" \"\\n\" | sort -u\n```\n\n30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Once you have selected a Pod Security level for the namespace (or if you're trying several), it's a good idea to test it out first (you can skip this step if using the Privileged level). Pod Security", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17138"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/audit=$LEVEL\n```\n\n30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | If either of these approaches yield unexpected violations, you will need to either update the violating workloads to meet the policy requirements, or relax the namespace Pod Security level.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17139"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/enforce=$LEVEL\n```\n\n30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Finally, you can effectively bypass PodSecurityPolicy at the namespace level by binding the fully privileged PSP to all service accounts in the namespace.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17140"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17141"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\nresources:\n  requests:\n    memory: 100Mi\n  limits:\n    memory: 200Mi\n...\n```\n\n1 - Assign Memory Resources to Containers and Pods | Run kubectl top to fetch the metrics for the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17142"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17143"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nlastState:\n   terminated:\n     containerID: 65183c1877aaec2e8427bc95609cc52677a454b56fcb24340dbd22917c23b10f\n     exitCode: 137\n     finishedAt: 2017-06-20T20:52:19Z\n     reason: OOMKilled\n     startedAt: null\n```\n\n1 - Assign Memory Resources to Containers and Pods | The Container in this exercise can be restarted, so the kubelet restarts it. Repeat this command several times to see that the Container is repeatedly killed and restarted:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17144"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS      RESTARTS   AGE\nmemory-demo-2   0/1       OOMKilled   1          37s\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17145"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-2   1/1       Running   2          40s\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod history:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17146"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container starts and fails repeatedly:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17147"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe nodes\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output includes a record of the Container being killed because of an out-of-memory condition:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17148"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17149"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\nNAME            READY     STATUS    RESTARTS   AGE\nmemory-demo-3   0/1       Pending   0          25s\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod, including events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17150"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17151"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nresources:\n  limits:\n    cpu: \"1\"\n  requests:\n    cpu: 500m\n```\n\n2 - Assign CPU Resources to Containers and Pods | Use kubectl top to fetch the metrics for the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17152"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17153"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\n3.1 - Set Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17154"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17155"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17156"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17157"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17158"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17159"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\nspec: \n  containers:    \n  ...\n  resources:\n    requests:\n      memory: 100Mi\n    limits:\n      memory: 200Mi\n...\n```\n\n4 - Assign Pod-level CPU and memory resources | Run kubectl top to fetch the metrics for the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17160"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17161"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  ...\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: 500m\n```\n\n4 - Assign Pod-level CPU and memory resources | Use kubectl top to fetch the metrics for the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17162"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17163"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n  name: pod-resources-demo-ctr-1\n  resources:\n      requests:\n        cpu: 500m\n        memory: 50Mi\n      limits:\n        cpu: 500m\n        memory: 100Mi\n  ...\n  name: pod-resources-demo-ctr-2\n  resources: {}  \nresources:\n  limits:\n      cpu: 1\n      memory: 200Mi\n    requests:\n      cpu: 1\n      memory: 100Mi\n...\n```\n\n4 - Assign Pod-level CPU and memory resources | Since pod-level requests and limits are specified, the request guarantees for both containers in the pod will be equal 1 core or CPU and 100Mi of memory. Additionally, both containers together won't b", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17164"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-crd.yaml\n```\n\n5 - Configure GMSA for Windows Pods and containers | Two webhooks need to be configured on the Kubernetes cluster to populate and validate GMSA credential spec references at the Pod or container level:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17165"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\n5 - Configure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17166"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-Webapp1-credspec.yml\n```\n\n5 - Configure GMSA for Windows Pods and containers | A cluster role needs to be defined for each GMSA credential spec resource. This authorizes the use verb on a specific GMSA resource by a subject which is typically a service account. The following exa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17167"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f gmsa-webapp1-role.yaml\n```\n\n5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17168"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\n5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17169"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n5 - Configure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17170"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n5 - Configure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17171"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n5 - Configure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17172"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nimage: registry.domain.example/iis-auth:1809v1\n        lifecycle:\n          postStart:\n            exec:\n              command: [\"powershell.exe\",\"-command\",\"do { Restart-Service -Name netlogon } while ( $($Result = (nltest.exe /query); if ($Result -like '*0x0 NERR_Success*') {return $true} else {return $false}) -eq $false)\"]\n        imagePullPolicy: IfNotPresent\n```\n\n5 - Configure GMSA for Windows Pods and containers | If you add the lifecycle section show above to your Pod spec, the Pod will execute the commands listed to restart the netlogon service until the nltest.exe /query command exits without error.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17173"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nresizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired\n    - resourceName: memory\n      restartPolicy: RestartContainer\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | If resizePolicy[*].restartPolicy is not specified for a resource, it defaults to NotRequired.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17174"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17175"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17176"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17177"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  securityContext:\n    windowsOptions:\n      hostProcess: true\n      runAsUserName: \"NT AUTHORITY\\\\Local service\"\n  hostNetwork: true\n  containers:\n  - name: test\n    image: image1:latest\n    command:\n      - ping\n      - -t\n      - 127.0.0.1\n  nodeSelector:\n    \"kubernetes.io/os\": windows\n```\n\n8 - Create a Windows HostProcess Pod | HostProcess containers support the ability to mount volumes within the container volume space. Volume mount behavior differs depending on the version of containerd runtime used by on the node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17178"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  windowsOptions:\n    hostProcess: true\n    runAsUserName: hpc-localgroup\n```\n\n8 - Create a Windows HostProcess Pod | Schedule the pod!", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17179"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17180"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    resources:\n      limits:\n        cpu: 700m\n        memory: 200Mi\n      requests:\n        cpu: 700m\n        memory: 200Mi\n    ...\nstatus:\n  qosClass: Guaranteed\n```\n\n9 - Configure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17181"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17182"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n  - image: nginx\n    imagePullPolicy: Always\n    name: qos-demo-2-ctr\n    resources:\n      limits:\n        memory: 200Mi\n      requests:\n        memory: 100Mi\n  ...\nstatus:\n  qosClass: Burstable\n```\n\n9 - Configure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17183"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17184"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    resources: {}\n  ...\nstatus:\n  qosClass: BestEffort\n```\n\n9 - Configure Quality of Service for Pods | Delete your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17185"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17186"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  containers:\n    ...\n    name: qos-demo-4-ctr-1\n    resources:\n      requests:\n        memory: 200Mi\n    ...\n    name: qos-demo-4-ctr-2\n    resources: {}\n    ...\nstatus:\n  qosClass: Burstable\n```\n\n9 - Configure Quality of Service for Pods | Rather than see all the fields, you can view just the field you need:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17187"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\n9 - Configure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17188"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17189"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nLimits:\n  example.com/dongle: 3\nRequests:\n  example.com/dongle: 3\n```\n\n10 - Assign Extended Resources to a Container | Here is the configuration file for a Pod that has one Container. The Container requests two dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17190"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17191"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nNAME                       READY     STATUS    RESTARTS   AGE\nextended-resource-demo-2   0/1       Pending   0          6m\n```\n\n10 - Assign Extended Resources to a Container | Delete the Pods that you created for this exercise:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17192"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17193"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17194"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17195"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17196"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17197"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17198"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17199"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17200"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17201"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17202"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\n14 - Configure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17203"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\n14 - Configure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17204"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nsecurityContext:\n  runAsUser: 1000\n  runAsGroup: 3000\n  fsGroup: 2000\n  fsGroupChangePolicy: \"OnRootMismatch\"\n```\n\n14 - Configure a Security Context for a Pod or Container | If you deploy a Container Storage Interface (CSI) driver which supports the VOLUME_MOUNT_GROUP NodeServiceCapability, the process of setting file ownership and permissions based on the fsGroup specifi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17205"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17206"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17207"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17208"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seccompProfile:\n    type: RuntimeDefault\n```\n\n14 - Configure a Security Context for a Pod or Container | Here is an example that sets the Seccomp profile to a pre-configured file at <kubelet-root-dir>/seccomp/my-profiles/profile-allow.json:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17209"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seccompProfile:\n    type: Localhost\n    localhostProfile: my-profiles/profile-allow.json\n```\n\n14 - Configure a Security Context for a Pod or Container | To set the AppArmor profile for a Container, include the appArmorProfile field in the securityContext section of your Container. The appArmorProfile field is a AppArmorProfile object consisting of typ", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17210"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n- name: container-1\n  securityContext:\n    appArmorProfile:\n      type: RuntimeDefault\n```\n\n14 - Configure a Security Context for a Pod or Container | Here is an example that sets the AppArmor profile to a pre-configured profile named k8s-apparmor-example-deny-write:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17211"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\ncontainers:\n- name: container-1\n  securityContext:\n    appArmorProfile:\n      type: Localhost\n      localhostProfile: k8s-apparmor-example-deny-write\n```\n\n14 - Configure a Security Context for a Pod or Container | For more details please see, Restrict a Container's Access to Resources with AppArmor.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17212"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  seLinuxOptions:\n    level: \"s0:c123,c456\"\n```\n\n14 - Configure a Security Context for a Pod or Container | Kubernetes v1.27 introduced an early limited form of this behavior that was only applicable to volumes (and PersistentVolumeClaims) using the ReadWriteOncePod access mode.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17213"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod <pod-name>\n```\n\n14 - Configure a Security Context for a Pod or Container | A cluster admin can use this information to identify pods affected by the planning change and proactively opt-out Pods from the optimization (i.e. set spec.securityContext.seLinuxChangePolicy: Recursi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17214"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n...\nsecurityContext:\n  procMount: Unmasked\n```\n\n14 - Configure a Security Context for a Pod or Container | The security context for a Pod applies to the Pod's Containers and also to the Pod's Volumes when applicable. Specifically fsGroup and seLinuxOptions are applied to Volumes as follows:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17215"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\n15 - Configure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17216"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\n15 - Configure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17217"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\n15 - Configure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17218"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccount build-robot -o yaml\n```\n\n15 - Configure Service Accounts for Pods | You can't see the build-robot-secret Secret in the ServiceAccount API objects .secrets field because that field is only populated with auto-generated Secrets.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17219"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\n15 - Configure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17220"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\n15 - Configure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17221"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"aud\": [  # matches the requested audiences, or the API server's default audiences when none are explicitly requested\n    \"https://kubernetes.default.svc\"\n  ],\n  \"exp\": 1731613413,\n  \"iat\": 1700077413,\n  \"iss\": \"https://kubernetes.default.svc\",  # matches the first value passed to the --service-account-issuer flag\n  \"jti\": \"ea28ed49-2e11-4280-9ec5-bc3d1d84661a\", \n  \"kubernetes.io\": {\n    \"namespace\": \"kube-system\",\n    \"node\": {\n      \"name\": \"127.0.0.1\",\n      \"uid\": \"58456cb0-dd00-45ed-b797-5578fdceaced\"\n    },\n    \"pod\": {\n      \"name\": \"coredns-69cbfb9798-jv9gn\",\n      \"uid\": \"778a530c-b3f4-47c0-9cd5-ab018fb64f33\"\n    },\n    \"serviceaccount\": {\n      \"name\": \"coredns\",\n      \"uid\": \"a087d5a0-e1dd-43ec-93ac-f13d89cd13af\"\n    },\n    \"warnafter\": 1700081020\n  },\n  \"nbf\": 1700077413,\n  \"sub\": \"system:serviceaccount:kube-system:coredns\"\n}\n```\n\n15 - Configure Service Accounts for Pods | To provide a Pod with a token with an audience of vault and a validity duration of two hours, you could define a Pod manifest that is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17222"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17223"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17224"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17225"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17226"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17227"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17228"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17229"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17230"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nports:\n- name: liveness-port\n  containerPort: 8080\n\nlivenessProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | Sometimes, you have to deal with applications that require additional startup time on their first initialization. In such cases, it can be tricky to set up liveness probe parameters without compromisi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17231"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nports:\n- name: liveness-port\n  containerPort: 8080\n\nlivenessProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n  failureThreshold: 1\n  periodSeconds: 10\n\nstartupProbe:\n  httpGet:\n    path: /healthz\n    port: liveness-port\n  failureThreshold: 30\n  periodSeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | Thanks to the startup probe, the application will have a maximum of 5 minutes (30 * 10 = 300s) to finish its startup. Once the startup probe has succeeded once, the liveness probe takes over to provid", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17232"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nreadinessProbe:\n  exec:\n    command:\n    - cat\n    - /tmp/healthy\n  initialDelaySeconds: 5\n  periodSeconds: 5\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | Configuration for HTTP and TCP readiness probes also remains identical to liveness probes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17233"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n  httpGet:\n    httpHeaders:\n      - name: Accept\n        value: application/json\n\nstartupProbe:\n  httpGet:\n    httpHeaders:\n      - name: User-Agent\n        value: MyUserAgent\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | You can also remove these two headers by defining them with an empty value.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17234"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nlivenessProbe:\n  httpGet:\n    httpHeaders:\n      - name: Accept\n        value: \"\"\n\nstartupProbe:\n  httpGet:\n    httpHeaders:\n      - name: User-Agent\n        value: \"\"\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | When the kubelet probes a Pod using HTTP, it only follows redirects if the redirect is to the same host. If the kubelet receives 11 or more redirects during probing, the probe is considered successful", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17235"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  terminationGracePeriodSeconds: 3600  # pod-level\n  containers:\n  - name: test\n    image: ...\n\n    ports:\n    - name: liveness-port\n      containerPort: 8080\n\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: liveness-port\n      failureThreshold: 1\n      periodSeconds: 60\n      # Override pod-level terminationGracePeriodSeconds #\n      terminationGracePeriodSeconds: 60\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | Probe-level terminationGracePeriodSeconds cannot be set for readiness probes. It will be rejected by the API server.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17236"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17237"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17238"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17239"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17240"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17241"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17242"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/lifecycle-events.yaml\n```\n\n21 - Attach Handlers to Container Lifecycle Events | Verify that the Container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17243"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod lifecycle-demo\n```\n\n21 - Attach Handlers to Container Lifecycle Events | Get a shell into the Container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17244"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it lifecycle-demo -- /bin/bash\n```\n\n21 - Attach Handlers to Container Lifecycle Events | In your shell, verify that the postStart handler created the message file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17245"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | Use the kubectl create configmap command to create ConfigMaps from directories, files, or literal values:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17246"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | Use the kubectl create configmap command to create ConfigMaps from directories, files, or literal values:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17247"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17248"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | Each filename being used for ConfigMap creation must consist of only acceptable characters, which are: letters (A to Z and a to z), digits (0 to 9), '-', '_', or '.'. If you use kubectl create configm", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17249"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | The kubectl command does not print an error when it encounters an invalid filename.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17250"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17251"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | For example,", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17252"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\n22 - Configure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17253"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17254"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config-3 -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17255"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17256"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17257"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17258"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n---\n# kustomization.yaml contents for creating a ConfigMap from literals\nconfigMapGenerator:\n- name: special-config-2\n  literals:\n  - special.how=very\n  - special.type=charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Apply the kustomization directory to create the ConfigMap object:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17259"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17260"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17261"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17262"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17263"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17264"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17265"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17266"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17267"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17268"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17269"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\n22 - Configure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17270"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap -o jsonpath='{.binaryData}' <name>\n```\n\n22 - Configure a Pod to Use a ConfigMap | Pods can load data from a ConfigMap that uses either data or binaryData.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17271"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17272"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17273"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n22 - Configure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17274"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nrm kustomization.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | If you created a directory configure-pod-container and no longer need it, you should remove that too, or move it into the trash can / deleted files location.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17275"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nrm -r configure-pod-container\n```\n\n22 - Configure a Pod to Use a ConfigMap | This page shows how to configure process namespace sharing for a pod. When process namespace sharing is enabled, processes in a container are visible to all other containers in the same pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17276"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17277"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17278"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17279"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17280"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\n26 - Create static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17281"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\ndocker.io/library/nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31\n```\n\n26 - Create static Pods | You can see the mirror Pod on the API server:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17282"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nservices:\n\n  redis-leader:\n    container_name: redis-leader\n    image: redis\n    ports:\n      - \"6379\"\n\n  redis-replica:\n    container_name: redis-replica\n    image: redis\n    ports:\n      - \"6379\"\n    command: redis-server --replicaof redis-leader 6379 --dir /tmp\n\n  web:\n    container_name: web\n    image: quay.io/kompose/web\n    ports:\n      - \"8080:8080\"\n    environment:\n      - GET_HOSTS_FROM=dns\n    labels:\n      kompose.service.type: LoadBalancer\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | To convert the docker-compose.yml file to files that you can use with kubectl, run kompose convert and then kubectl apply -f <output file>.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17283"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <output file>\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17284"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17285"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nminikube service web-tcp\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | Otherwise, let's look up what IP your service is using!", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17286"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nversion: \"2\"\nservices:\n  nginx:\n    image: nginx\n    dockerfile: foobar\n    build: ./foobar\n    cap_add:\n      - ALL\n    container_name: foobar\n    labels:\n      kompose.service.type: nodeport\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | kompose.service.expose defines if the service needs to be made accessible from outside the cluster or not. If the value is set to \"true\", the provider sets the endpoint automatically, and for any othe", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17287"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nversion: \"2\"\nservices:\n  web:\n    image: tuna/docker-counter23\n    ports:\n    - \"5000:5000\"\n    links:\n    - redis\n    labels:\n      kompose.service.expose: \"counter.example.com\"\n  redis:\n    image: redis:3.0\n    ports:\n    - \"6379\"\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | The currently supported options are:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17288"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nversion: '2'\n\nservices:\n  pival:\n    image: perl\n    command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n    restart: \"on-failure\"\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | If the Docker Compose file has a volume specified for a service, the Deployment (Kubernetes) or DeploymentConfig (OpenShift) strategy is changed to \"Recreate\" instead of \"RollingUpdate\" (default). Thi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17289"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\n28 - Enforce Pod Security Standards by Configuring the Built-in Admission Controller | Namespaces can be labeled to enforce the Pod Security Standards. The three policies privileged, baseline and restricted broadly cover the security spectrum and are implemented by the Pod Security admi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17290"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17291"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n1 - Assign Memory Resources to Containers and Pods | If the resource metrics API is available, the output includes a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17292"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | To specify a memory request for a Container, include the resources:requests field in the Container's resource manifest. To specify a memory limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17293"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17294"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"100Mi\"\n      limits:\n        memory: \"200Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | The args section in the configuration file provides arguments for the Container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17295"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit.yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17296"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17297"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the one Container in the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17298"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17299"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | A Container can exceed its memory request if the Node has memory available. But a Container is not allowed to use more than its memory limit. If a Container allocates more memory than its limit, the C", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17300"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17301"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-2\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-2-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"50Mi\"\n      limits:\n        memory: \"100Mi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"250M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | In the args section of the configuration file, you can see that the Container will attempt to allocate 250 MiB of memory, which is well above the 100 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17302"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-2.yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17303"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | At this point, the Container might be running or killed. Repeat the preceding command until the Container is killed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17304"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --output=yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container was killed because it is out of memory (OOM):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17305"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container is killed, restarted, killed again, restarted again, and so on:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17306"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-2 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | Memory requests and limits are associated with Containers, but it is useful to think of a Pod as having a memory request and limit. The memory request for the Pod is the sum of the memory requests for", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17307"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/memory-request-limit-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17308"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo-3\n  namespace: mem-example\nspec:\n  containers:\n  - name: memory-demo-3-ctr\n    image: polinux/stress\n    resources:\n      requests:\n        memory: \"1000Gi\"\n      limits:\n        memory: \"1000Gi\"\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n1 - Assign Memory Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17309"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/memory-request-limit-3.yaml --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17310"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo-3 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Pod status is PENDING. That is, the Pod is not scheduled to run on any Node, and it will remain in the PENDING state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17311"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod memory-demo-3 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient memory on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17312"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-demo-3 --namespace=mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | If you do not specify a memory limit for a Container, one of the following situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17313"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace mem-example\n```\n\n1 - Assign Memory Resources to Containers and Pods | Assign CPU Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17314"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get apiservices\n```\n\n2 - Assign CPU Resources to Containers and Pods | If the resource metrics API is available, the output will include a reference to metrics.k8s.io.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17315"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | To specify a CPU request for a container, include the resources:requests field in the Container resource manifest. To specify a CPU limit, include resources:limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17316"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/cpu-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17317"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"1\"\n      requests:\n        cpu: \"0.5\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17318"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit.yaml --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17319"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17320"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | The output shows that the one container in the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17321"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17322"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | CPU requests and limits are associated with Containers, but it is useful to think of a Pod as having a CPU request and limit. The CPU request for a Pod is the sum of the CPU requests for all the Conta", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17323"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/cpu-request-limit-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17324"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo-2\n  namespace: cpu-example\nspec:\n  containers:\n  - name: cpu-demo-ctr-2\n    image: vish/stress\n    resources:\n      limits:\n        cpu: \"100\"\n      requests:\n        cpu: \"100\"\n    args:\n    - -cpus\n    - \"2\"\n```\n\n2 - Assign CPU Resources to Containers and Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17325"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/cpu-request-limit-2.yaml --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | View the Pod status:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17326"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo-2 --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | The output shows that the Pod status is Pending. That is, the Pod has not been scheduled to run on any Node, and it will remain in the Pending state indefinitely:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17327"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod cpu-demo-2 --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | The output shows that the Container cannot be scheduled because of insufficient CPU resources on the Nodes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17328"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-demo-2 --namespace=cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | If you do not specify a CPU limit for a Container, then one of these situations applies:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17329"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace cpu-example\n```\n\n2 - Assign CPU Resources to Containers and Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17330"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.1 - Set Up DRA in a Cluster | If the component configuration was correct, the output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17331"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslices\n```\n\n3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17332"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get resourceslice <resourceslice-name> -o yaml\n```\n\n3.1 - Set Up DRA in a Cluster | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17333"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceSlice\n# lines omitted for clarity\nspec:\n  devices:\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-0\n  - attributes:\n      type:\n        string: gpu\n    capacity:\n      memory:\n        value: 64Gi\n    name: gpu-1\n  driver: driver.example.com\n  nodeName: cluster-1-node-1\n# lines omitted for clarity\n```\n\n3.1 - Set Up DRA in a Cluster | You can also check the driver provider's documentation for available properties and values.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17334"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\ndra/deviceclass.yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17335"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: DeviceClass\nmetadata:\n  name: example-device-class\nspec:\n  selectors:\n  - cel:\n      expression: |-\n        device.driver == \"driver.example.com\"\n```\n\n3.1 - Set Up DRA in a Cluster | Create the DeviceClass in your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17336"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.1 - Set Up DRA in a Cluster | To delete the DeviceClass that you created in this task, run the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17337"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/deviceclass.yaml\n```\n\n3.1 - Set Up DRA in a Cluster | This page shows you how to allocate devices to your Pods by using dynamic resource allocation (DRA). These instructions are for workload operators. Before reading this page, familiarize yourself with", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17338"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get deviceclasses\n```\n\n3.2 - Allocate Devices to Workloads with DRA | The output is similar to the following:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17339"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\ndra/resourceclaimtemplate.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17340"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaimTemplate\nmetadata:\n  name: example-resource-claim-template\nspec:\n  spec:\n    devices:\n      requests:\n      - name: gpu-claim\n        exactly:\n          deviceClassName: example-device-class\n          selectors:\n          - cel:\n              expression: |-\n                device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n                device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates a ResourceClaimTemplate that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17341"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Review the following example manifest:dra/resourceclaim.yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaim metadata: name: example-resource-claim spec: devices: requests: - name: sing", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17342"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\ndra/resourceclaim.yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17343"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\nkind: ResourceClaim\nmetadata:\n  name: example-resource-claim\nspec:\n  devices:\n    requests:\n    - name: single-gpu-claim\n      exactly:\n        deviceClassName: example-device-class\n        allocationMode: All\n        selectors:\n        - cel:\n            expression: |-\n              device.attributes[\"driver.example.com\"].type == \"gpu\" &&\n              device.capacity[\"driver.example.com\"].memory == quantity(\"64Gi\")\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This manifest creates ResourceClaim that requests devices in the example-device-class DeviceClass that match both of the following parameters:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17344"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | To request device allocation, specify a ResourceClaim or a ResourceClaimTemplate in the resourceClaims field of the Pod specification. Then, request a specific claim by name in the resources.claims fi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17345"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\ndra/dra-example-job.yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17346"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-dra-job\nspec:\n  completions: 10\n  parallelism: 2\n  template:\n    spec:\n      restartPolicy: Never\n      containers:\n      - name: container0\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: separate-gpu-claim\n      - name: container1\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      - name: container2\n        image: ubuntu:24.04\n        command: [\"sleep\", \"9999\"]\n        resources:\n          claims:\n          - name: shared-gpu-claim\n      resourceClaims:\n      - name: separate-gpu-claim\n        resourceClaimTemplateName: example-resource-claim-template\n      - name: shared-gpu-claim\n        resourceClaimName: example-resource-claim\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Each Pod in this Job has the following properties:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17347"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Try the following troubleshooting steps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17348"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/dra-example-job.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | To delete your resource claims, run one of the following commands:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17349"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaimtemplate.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | Delete the ResourceClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17350"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f https://k8s.io/examples/dra/resourceclaim.yaml\n```\n\n3.2 - Allocate Devices to Workloads with DRA | This page shows how to specify CPU and memory resources for a Pod at pod-level in addition to container-level resource specifications. A Kubernetes node allocates resources to a pod based on the pod's", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17351"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | To specify memory requests for a Pod at pod-level, include the resources.requests.memory field in the Pod spec manifest. To specify a memory limit, include resources.limits.memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17352"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-memory-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17353"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    requests:\n      memory: \"100Mi\"\n    limits:\n      memory: \"200Mi\"\n  containers:\n  - name: memory-demo-ctr\n    image: nginx\n    command: [\"stress\"]\n    args: [\"--vm\", \"1\", \"--vm-bytes\", \"150M\", \"--vm-hang\", \"1\"]\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section in the manifest provides arguments for the container when it starts. The \"--vm-bytes\", \"150M\" arguments tell the Container to attempt to allocate 150 MiB of memory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17354"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-memory-request-limit.yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17355"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17356"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a memory request of 100 MiB and a memory limit of 200 MiB.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17357"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod memory-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that the Pod is using about 162,900,000 bytes of memory, which is about 150 MiB. This is greater than the Pod's 100 MiB request, but within the Pod's 200 MiB limit.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17358"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-cpu-request-limit.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17359"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n    requests:\n      cpu: \"0.5\"\n  containers:\n  - name: cpu-demo-ctr\n    image: vish/stress\n    args:\n    - -cpus\n    - \"2\"\n```\n\n4 - Assign Pod-level CPU and memory resources | The args section of the configuration file provides arguments for the container when it starts. The -cpus \"2\" argument tells the Container to attempt to use 2 CPUs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17360"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-cpu-request-limit.yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17361"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17362"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod cpu-demo --output=yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17363"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl top pod cpu-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17364"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-level-resources.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17365"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-resources-demo\n  namespace: pod-resources-example\nspec:\n  resources:\n    limits:\n      cpu: \"1\"\n      memory: \"200Mi\"\n    requests:\n      cpu: \"1\"\n      memory: \"100Mi\"\n  containers:\n  - name: pod-resources-demo-ctr-1\n    image: nginx\n    resources:\n      limits:\n        cpu: \"0.5\"\n        memory: \"100Mi\"\n      requests:\n        cpu: \"0.5\"\n        memory: \"50Mi\"\n  - name: pod-resources-demo-ctr-2\n    image: fedora\n    command:\n    - sleep\n    - inf\n```\n\n4 - Assign Pod-level CPU and memory resources | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17366"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/pod-level-resources.yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Verify that the Pod Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17367"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod-resources-demo --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17368"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod memory-demo --output=yaml --namespace=pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | The output shows that one container in the Pod has a memory request of 50 MiB and a CPU request of 0.5 cores, with a memory limit of 100 MiB and a CPU limit of 0.5 cores. The Pod itself has a memory r", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17369"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace pod-resources-example\n```\n\n4 - Assign Pod-level CPU and memory resources | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17370"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: windows.k8s.io/v1\nkind: GMSACredentialSpec\nmetadata:\n  name: gmsa-WebApp1  # This is an arbitrary name but it will be used as a reference\ncredspec:\n  ActiveDirectoryConfig:\n    GroupManagedServiceAccounts:\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: CONTOSO  # NETBIOS Domain Name\n    - Name: WebApp1   # Username of the GMSA account\n      Scope: contoso.com # DNS Domain Name\n  CmsPlugins:\n  - ActiveDirectory\n  DomainJoinConfig:\n    DnsName: contoso.com  # DNS Domain Name\n    DnsTreeName: contoso.com # DNS Domain Name Root\n    Guid: 244818ae-87ac-4fcd-92ec-e79e5252348a  # GUID of the Domain\n    MachineAccountName: WebApp1 # Username of the GMSA account\n    NetBiosName: CONTOSO  # NETBIOS Domain Name\n    Sid: S-1-5-21-2126449477-2524075714-3094792973 # SID of the Domain\n```\n\n5 - Configure GMSA for Windows Pods and containers | The above credential spec resource may be saved as gmsa-Webapp1-credspec.yaml and applied to the cluster using: kubectl apply -f gmsa-Webapp1-credspec.yml", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17371"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Create the Role to read the credspec\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: webapp1-role\nrules:\n- apiGroups: [\"windows.k8s.io\"]\n  resources: [\"gmsacredentialspecs\"]\n  verbs: [\"use\"]\n  resourceNames: [\"gmsa-WebApp1\"]\n```\n\n5 - Configure GMSA for Windows Pods and containers | A service account (that Pods will be configured with) needs to be bound to the cluster role create above. This authorizes the service account to use the desired GMSA credential spec resource. The foll", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17372"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: allow-default-svc-account-read-on-gmsa-WebApp1\n  namespace: default\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: default\nroleRef:\n  kind: ClusterRole\n  name: webapp1-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n5 - Configure GMSA for Windows Pods and containers | The Pod spec field securityContext.windowsOptions.gmsaCredentialSpecName is used to specify references to desired GMSA credential spec custom resources in Pod specs. This configures all containers in", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17373"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      securityContext:\n        windowsOptions:\n          gmsaCredentialSpecName: gmsa-webapp1\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n5 - Configure GMSA for Windows Pods and containers | Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container securityContext.windowsOptions.gmsaCredentialSpecName field. For example:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17374"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    run: with-creds\n  name: with-creds\n  namespace: default\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: with-creds\n  template:\n    metadata:\n      labels:\n        run: with-creds\n    spec:\n      containers:\n      - image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019\n        imagePullPolicy: Always\n        name: iis\n        securityContext:\n          windowsOptions:\n            gmsaCredentialSpecName: gmsa-Webapp1\n      nodeSelector:\n        kubernetes.io/os: windows\n```\n\n5 - Configure GMSA for Windows Pods and containers | As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17375"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it iis-auth-7776966999-n5nzr powershell.exe\n```\n\n5 - Configure GMSA for Windows Pods and containers | nltest.exe /parentdomain results in the following error:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17376"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/pod-resize.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17377"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: resize-demo\nspec:\n  containers:\n  - name: pause\n    image: registry.k8s.io/pause:3.8\n    resizePolicy:\n    - resourceName: cpu\n      restartPolicy: NotRequired # Default, but explicit here\n    - resourceName: memory\n      restartPolicy: RestartContainer\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Create the pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17378"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f pod-resize.yaml\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | This pod starts in the Guaranteed QoS class. Verify its initial state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17379"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"cpu\":\"800m\"}, \"limits\":{\"cpu\":\"800m\"}}}]}}'\n\n# Alternative methods:\n# kubectl -n qos-example edit pod resize-demo --subresource resize\n# kubectl -n qos-example apply -f <updated-manifest> --subresource resize --server-side\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status again after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17380"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml --namespace=qos-example\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | You should see:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17381"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch pod resize-demo --subresource resize --patch \\\n  '{\"spec\":{\"containers\":[{\"name\":\"pause\", \"resources\":{\"requests\":{\"memory\":\"300Mi\"}, \"limits\":{\"memory\":\"300Mi\"}}}]}}'\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Check the pod status shortly after patching:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17382"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | You should now observe:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17383"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod resize-demo --output=yaml\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | You'll see changes indicating the problem:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17384"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod resize-demo\n```\n\n6 - Resize CPU and Memory Resources assigned to Containers | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17385"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nwindows/run-as-username-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17386"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-pod-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17387"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-pod.yaml\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17388"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-pod-demo\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17389"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-pod-demo -- powershell\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17390"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nwindows/run-as-username-container.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17391"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: run-as-username-container-demo\nspec:\n  securityContext:\n    windowsOptions:\n      runAsUserName: \"ContainerUser\"\n  containers:\n  - name: run-as-username-demo\n    image: mcr.microsoft.com/windows/servercore:ltsc2019\n    command: [\"ping\", \"-t\", \"localhost\"]\n    securityContext:\n        windowsOptions:\n            runAsUserName: \"ContainerAdministrator\"\n  nodeSelector:\n    kubernetes.io/os: windows\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17392"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/windows/run-as-username-container.yaml\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17393"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod run-as-username-container-demo\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17394"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it run-as-username-container-demo -- powershell\n```\n\n7 - Configure RunAsUserName for Windows pods and containers | Check that the shell is running user the correct username (the one set at the Container level):", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17395"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace qos-example\n```\n\n9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of Guaranteed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17396"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17397"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n      requests:\n        memory: \"200Mi\"\n        cpu: \"700m\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17398"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17399"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also verifies that the Pod Container has a memory request that matches its memory limit, and it has a CPU request th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17400"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | A Pod is given a QoS class of Burstable if:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17401"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17402"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-2\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-2-ctr\n    image: nginx\n    resources:\n      limits:\n        memory: \"200Mi\"\n      requests:\n        memory: \"100Mi\"\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17403"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17404"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-2 --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17405"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-2 --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not have any memory or CPU limits or requests.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17406"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17407"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-3\n  namespace: qos-example\nspec:\n  containers:\n  - name: qos-demo-3-ctr\n    image: nginx\n```\n\n9 - Configure Quality of Service for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17408"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17409"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-3 --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of BestEffort:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17410"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod qos-demo-3 --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | Here is a manifest for a Pod that has two Containers. One container specifies a memory request of 200 MiB. The other Container does not specify any requests or limits.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17411"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/qos/qos-pod-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17412"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: qos-demo-4\n  namespace: qos-example\nspec:\n  containers:\n\n  - name: qos-demo-4-ctr-1\n    image: nginx\n    resources:\n      requests:\n        memory: \"200Mi\"\n\n  - name: qos-demo-4-ctr-2\n    image: redis\n```\n\n9 - Configure Quality of Service for Pods | Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the criteria for QoS class Guaranteed, and one of its Containers has a memory request.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17413"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example\n```\n\n9 - Configure Quality of Service for Pods | View detailed information about the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17414"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod qos-demo-4 --namespace=qos-example --output=yaml\n```\n\n9 - Configure Quality of Service for Pods | The output shows that Kubernetes gave the Pod a QoS class of Burstable:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17415"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{\"\\n\"}'\n```\n\n9 - Configure Quality of Service for Pods | Delete your namespace:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17416"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace qos-example\n```\n\n9 - Configure Quality of Service for Pods | Assign Memory Resources to Containers and Pods", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17417"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/extended-resource-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17418"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo\nspec:\n  containers:\n  - name: extended-resource-demo-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 3\n      limits:\n        example.com/dongle: 3\n```\n\n10 - Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17419"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml\n```\n\n10 - Assign Extended Resources to a Container | Verify that the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17420"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo\n```\n\n10 - Assign Extended Resources to a Container | Describe the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17421"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo\n```\n\n10 - Assign Extended Resources to a Container | The output shows dongle requests:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17422"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/resource/extended-resource-pod-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17423"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: extended-resource-demo-2\nspec:\n  containers:\n  - name: extended-resource-demo-2-ctr\n    image: nginx\n    resources:\n      requests:\n        example.com/dongle: 2\n      limits:\n        example.com/dongle: 2\n```\n\n10 - Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17424"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml\n```\n\n10 - Assign Extended Resources to a Container | Describe the Pod", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17425"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod extended-resource-demo-2\n```\n\n10 - Assign Extended Resources to a Container | The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17426"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod extended-resource-demo-2\n```\n\n10 - Assign Extended Resources to a Container | The output shows that the Pod was created, but not scheduled to run on a Node. It has a status of Pending:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17427"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod extended-resource-demo\nkubectl delete pod extended-resource-demo-2\n```\n\n10 - Assign Extended Resources to a Container | This page shows how to configure a Pod to use a Volume for storage.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17428"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/storage/redis.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17429"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: redis\nspec:\n  containers:\n  - name: redis\n    image: redis\n    volumeMounts:\n    - name: redis-storage\n      mountPath: /data/redis\n  volumes:\n  - name: redis-storage\n    emptyDir: {}\n```\n\n11 - Configure a Pod to Use a Volume for Storage | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17430"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/redis.yaml\n```\n\n11 - Configure a Pod to Use a Volume for Storage | Verify that the Pod's Container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17431"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod redis --watch\n```\n\n11 - Configure a Pod to Use a Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17432"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and then create a file:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17433"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it redis -- /bin/bash\n```\n\n11 - Configure a Pod to Use a Volume for Storage | In your shell, go to /data/redis, and verify that test-file is still there.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17434"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod redis\n```\n\n11 - Configure a Pod to Use a Volume for Storage | See Volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17435"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-volume.yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17436"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: task-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 10Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/mnt/data\"\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The configuration file specifies that the volume is at /mnt/data on the cluster's Node. The configuration also specifies a size of 10 gibibytes and an access mode of ReadWriteOnce, which means the vol", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17437"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | View information about the PersistentVolume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17438"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17439"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-claim.yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17440"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: task-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 3Gi\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Create the PersistentVolumeClaim:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17441"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume wi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17442"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pv task-pv-volume\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Now the output shows a STATUS of Bound.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17443"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pvc task-pv-claim\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, task-pv-volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17444"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17445"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but it does not specify a PersistentVolume. From the Pod's point of view, the claim is a volume.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17446"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17447"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod task-pv-pod\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Get a shell to the container running in your Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17448"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it task-pv-pod -- /bin/bash\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17449"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod task-pv-pod\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17450"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/storage/pv-duplicate.yaml\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17451"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test\nspec:\n  containers:\n    - name: test\n      image: nginx\n      volumeMounts:\n        # a mount for site-data\n        - name: config\n          mountPath: /usr/share/nginx/html\n          subPath: html\n        # another mount for nginx config\n        - name: config\n          mountPath: /etc/nginx/nginx.conf\n          subPath: nginx.conf\n  volumes:\n    - name: config\n      persistentVolumeClaim:\n        claimName: task-pv-storage\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Here:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17452"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | Verify that the container in the Pod is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17453"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test -- /bin/bash\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | In your shell, verify that nginx is serving the index.html file from the hostPath volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17454"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test\nkubectl delete pvc task-pv-claim\nkubectl delete pv task-pv-volume\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | If you don't already have a shell open to the Node in your cluster, open a new shell the same way that you did earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17455"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: pv1\n  annotations:\n    pv.beta.kubernetes.io/gid: \"1234\"\n```\n\n12 - Configure a Pod to Use a PersistentVolume for Storage | When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID is applied to all containers in the Pod in the same way that GIDs specified in the Pod's security context are. Every", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17456"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/storage/projected.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17457"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: test-projected-volume\nspec:\n  containers:\n  - name: test-projected-volume\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"86400\"\n    volumeMounts:\n    - name: all-in-one\n      mountPath: \"/projected-volume\"\n      readOnly: true\n  volumes:\n  - name: all-in-one\n    projected:\n      sources:\n      - secret:\n          name: user\n      - secret:\n          name: pass\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | Create the Secrets:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17458"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/storage/projected.yaml\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | Verify that the Pod's container is running, and then watch for changes to the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17459"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get --watch pod test-projected-volume\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | The output looks like this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17460"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it test-projected-volume -- /bin/sh\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | In your shell, verify that the projected-volume directory contains your projected sources:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17461"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod test-projected-volume\nkubectl delete secret user pass\n```\n\n13 - Configure a Pod to Use a Projected Volume for Storage | A security context defines privilege and access control settings for a Pod or Container. Security context settings include, but are not limited to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17462"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17463"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    fsGroup: 2000\n    supplementalGroups: [4000]\n  volumes:\n  - name: sec-ctx-vol\n    emptyDir: {}\n  containers:\n  - name: sec-ctx-demo\n    image: busybox:1.28\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    volumeMounts:\n    - name: sec-ctx-vol\n      mountPath: /data/demo\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | In the configuration file, the runAsUser field specifies that for any Containers in the Pod, all processes run with user ID 1000. The runAsGroup field specifies the primary group ID of 3000 for all pr", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17464"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17465"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17466"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17467"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-5.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17468"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This Pod security context contains runAsUser, runAsGroup and supplementalGroups. However, you can see that the actual supplementary groups attached to the container process will include group IDs whic", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17469"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-5.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17470"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell to the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17471"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17472"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-6.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17473"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo\nspec:\n  securityContext:\n    runAsUser: 1000\n    runAsGroup: 3000\n    supplementalGroups: [4000]\n    supplementalGroupsPolicy: Strict\n  containers:\n  - name: sec-ctx-demo\n    image: registry.k8s.io/e2e-test-images/agnhost:2.45\n    command: [ \"sh\", \"-c\", \"sleep 1h\" ]\n    securityContext:\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | This pod manifest defines supplementalGroupsPolicy=Strict. You can see that no group memberships defined in /etc/group are merged to the supplementary groups for container processes.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17474"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-6.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17475"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo\n```\n\n14 - Configure a Security Context for a Pod or Container | Check the process identity:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17476"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo -- id\n```\n\n14 - Configure a Security Context for a Pod or Container | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17477"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo -o yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | You can see that the status.containerStatuses[].user.linux field exposes the process identity attached to the first container process.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17478"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Node\n...\nstatus:\n  features:\n    supplementalGroupsPolicy: true\n```\n\n14 - Configure a Security Context for a Pod or Container | At this alpha release(from v1.31 to v1.32), when a pod with SupplementalGroupsPolicy=Strict are scheduled to a node that does NOT support this feature(i.e. .status.features.supplementalGroupsPolicy=fa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17479"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Event\n...\ntype: Warning\nreason: SupplementalGroupsPolicyNotSupported\nmessage: \"SupplementalGroupsPolicy=Strict is not supported in this node\"\ninvolvedObject:\n  apiVersion: v1\n  kind: Pod\n  ...\n```\n\n14 - Configure a Security Context for a Pod or Container | By default, Kubernetes recursively changes ownership and permissions for the contents of each volume to match the fsGroup specified in a Pod's securityContext when that volume is mounted. For large vo", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17480"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-2.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17481"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-2\nspec:\n  securityContext:\n    runAsUser: 1000\n  containers:\n  - name: sec-ctx-demo-2\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      runAsUser: 2000\n      allowPrivilegeEscalation: false\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17482"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-2.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17483"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-2\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17484"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-2 -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17485"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-3.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17486"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-3\nspec:\n  containers:\n  - name: sec-ctx-3\n    image: gcr.io/google-samples/hello-app:2.0\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17487"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-3.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Verify that the Pod's Container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17488"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod security-context-demo-3\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17489"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-3 -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, list the running processes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17490"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/security/security-context-4.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17491"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: security-context-demo-4\nspec:\n  containers:\n  - name: sec-ctx-4\n    image: gcr.io/google-samples/hello-app:2.0\n    securityContext:\n      capabilities:\n        add: [\"NET_ADMIN\", \"SYS_TIME\"]\n```\n\n14 - Configure a Security Context for a Pod or Container | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17492"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/security/security-context-4.yaml\n```\n\n14 - Configure a Security Context for a Pod or Container | Get a shell into the running Container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17493"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it security-context-demo-4 -- sh\n```\n\n14 - Configure a Security Context for a Pod or Container | In your shell, view the capabilities for process 1:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17494"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod security-context-demo\nkubectl delete pod security-context-demo-2\nkubectl delete pod security-context-demo-3\nkubectl delete pod security-context-demo-4\n```\n\n14 - Configure a Security Context for a Pod or Container | Kubernetes offers two distinct ways for clients that run within your cluster, or that otherwise have a relationship to your cluster's control plane to authenticate to the API server.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17495"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods/<podname> -o yaml\n```\n\n15 - Configure Service Accounts for Pods | In the output, you see a field spec.serviceAccountName. Kubernetes automatically sets that value if you don't specify it when you create a Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17496"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nautomountServiceAccountToken: false\n...\n```\n\n15 - Configure Service Accounts for Pods | You can also opt out of automounting API credentials for a particular Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17497"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: build-robot\n  automountServiceAccountToken: false\n  ...\n```\n\n15 - Configure Service Accounts for Pods | If both the ServiceAccount and the Pod's .spec specify a value for automountServiceAccountToken, the Pod spec takes precedence.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17498"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17499"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\nEOF\n```\n\n15 - Configure Service Accounts for Pods | The name of a ServiceAccount object must be a valid DNS subdomain name.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17500"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get serviceaccounts/build-robot -o yaml\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17501"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2019-06-16T00:12:34Z\n  name: build-robot\n  namespace: default\n  resourceVersion: \"272500\"\n  uid: 721ab723-13bc-11e5-aec2-42010af0021e\n```\n\n15 - Configure Service Accounts for Pods | You can use authorization plugins to set permissions on service accounts.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17502"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete serviceaccount/build-robot\n```\n\n15 - Configure Service Accounts for Pods | Suppose you have an existing service account named \"build-robot\" as mentioned earlier.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17503"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot\n```\n\n15 - Configure Service Accounts for Pods | The output from that command is a token that you can use to authenticate as that ServiceAccount. You can request a specific token duration using the --duration command line argument to kubectl create", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17504"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create token build-robot --bound-object-kind Node --bound-object-name node-001 --bound-object-uid 123...456\n```\n\n15 - Configure Service Accounts for Pods | The token will be valid until it expires or either the associated Node or service account are deleted.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17505"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n15 - Configure Service Accounts for Pods | If you view the Secret using:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17506"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secret/build-robot-secret -o yaml\n```\n\n15 - Configure Service Accounts for Pods | you can see that the Secret now contains an API token for the \"build-robot\" ServiceAccount.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17507"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe secrets/build-robot-secret\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17508"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry myregistrykey --docker-server=<registry name> \\\n        --docker-username=DUMMY_USERNAME --docker-password=DUMMY_DOCKER_PASSWORD \\\n        --docker-email=DUMMY_DOCKER_EMAIL\n```\n\n15 - Configure Service Accounts for Pods | Verify it has been created.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17509"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secrets myregistrykey\n```\n\n15 - Configure Service Accounts for Pods | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17510"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl patch serviceaccount default -p '{\"imagePullSecrets\": [{\"name\": \"myregistrykey\"}]}'\n```\n\n15 - Configure Service Accounts for Pods | You can achieve the same outcome by editing the object manually:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17511"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl edit serviceaccount/default\n```\n\n15 - Configure Service Accounts for Pods | The output of the sa.yaml file is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17512"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  resourceVersion: \"243024\"\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\n```\n\n15 - Configure Service Accounts for Pods | Using your editor, delete the line with key resourceVersion, add lines for imagePullSecrets: and save it. Leave the uid value set the same as you found it.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17513"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  creationTimestamp: 2021-07-07T22:02:39Z\n  name: default\n  namespace: default\n  uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6\nimagePullSecrets:\n  - name: myregistrykey\n```\n\n15 - Configure Service Accounts for Pods | Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its spec.imagePullSecrets field set automatically:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17514"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl run nginx --image=<registry name>/nginx --restart=Never\nkubectl get pod nginx -o=jsonpath='{.spec.imagePullSecrets[0].name}{\"\\n\"}'\n```\n\n15 - Configure Service Accounts for Pods | The output is:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17515"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-projected-svc-token.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17516"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n  - image: nginx\n    name: nginx\n    volumeMounts:\n    - mountPath: /var/run/secrets/tokens\n      name: vault-token\n  serviceAccountName: build-robot\n  volumes:\n  - name: vault-token\n    projected:\n      sources:\n      - serviceAccountToken:\n          path: vault-token\n          expirationSeconds: 7200\n          audience: vault\n```\n\n15 - Configure Service Accounts for Pods | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17517"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://k8s.io/examples/pods/pod-projected-svc-token.yaml\n```\n\n15 - Configure Service Accounts for Pods | The kubelet will: request and store the token on behalf of the Pod; make the token available to the Pod at a configurable file path; and refresh the token as it approaches expiration. The kubelet proa", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17518"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic regcred \\\n    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \\\n    --type=kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | If you need more control (for example, to set a namespace or a label on the new secret) then you can customise the Secret before storing it. Be sure to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17519"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: myregistrykey\n  namespace: awesomeapps\ndata:\n  .dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==\ntype: kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | If you get the error message error: no objects passed to create, it may mean the base64 encoded string is invalid. If you get an error message like Secret \"myregistrykey\" is invalid: data[.dockerconfi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17520"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>\n```\n\n16 - Pull an Image from a Private Registry | where:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17521"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=yaml\n```\n\n16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17522"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  ...\n  name: regcred\n  ...\ndata:\n  .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=\ntype: kubernetes.io/dockerconfigjson\n```\n\n16 - Pull an Image from a Private Registry | The value of the .dockerconfigjson field is a base64 representation of your Docker credentials.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17523"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get secret regcred --output=\"jsonpath={.data.\\.dockerconfigjson}\" | base64 --decode\n```\n\n16 - Pull an Image from a Private Registry | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17524"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/private-reg-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17525"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: private-reg\nspec:\n  containers:\n  - name: private-reg-container\n    image: <your-private-image>\n  imagePullSecrets:\n  - name: regcred\n```\n\n16 - Pull an Image from a Private Registry | Download the above file onto your computer:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17526"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f my-private-reg-pod.yaml\nkubectl get pod private-reg\n```\n\n16 - Pull an Image from a Private Registry | Also, in case the Pod fails to start with the status ImagePullBackOff, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17527"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod private-reg\n```\n\n16 - Pull an Image from a Private Registry | If you then see an event with the reason set to FailedToRetrieveImagePullSecret, Kubernetes can't find a Secret with name (regcred, in this example).", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17528"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/probe/exec-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17529"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-exec\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/busybox:1.27.2\n    args:\n    - /bin/sh\n    - -c\n    - touch /tmp/healthy; sleep 30; rm -f /tmp/healthy; sleep 600\n    livenessProbe:\n      exec:\n        command:\n        - cat\n        - /tmp/healthy\n      initialDelaySeconds: 5\n      periodSeconds: 5\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single Container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 5 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17530"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/exec-liveness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | Within 30 seconds, view the Pod events:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17531"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | The output indicates that no liveness probes have failed yet:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17532"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-exec\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | At the bottom of the output, there are messages indicating that the liveness probes have failed, and the failed containers have been killed and recreated.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17533"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod liveness-exec\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | The output shows that RESTARTS has been incremented. Note that the RESTARTS counter increments as soon as a failed container comes back to the running state:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17534"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/probe/http-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17535"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    test: liveness\n  name: liveness-http\nspec:\n  containers:\n  - name: liveness\n    image: registry.k8s.io/e2e-test-images/agnhost:2.40\n    args:\n    - liveness\n    livenessProbe:\n      httpGet:\n        path: /healthz\n        port: 8080\n        httpHeaders:\n        - name: Custom-Header\n          value: Awesome\n      initialDelaySeconds: 3\n      periodSeconds: 3\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In the configuration file, you can see that the Pod has a single container. The periodSeconds field specifies that the kubelet should perform a liveness probe every 3 seconds. The initialDelaySeconds", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17536"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/http-liveness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | After 10 seconds, view Pod events to verify that liveness probes have failed and the container has been restarted:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17537"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod liveness-http\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | In releases after v1.13, local HTTP proxy environment variable settings do not affect the HTTP liveness probe.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17538"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/probe/tcp-liveness-readiness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17539"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: goproxy\n  labels:\n    app: goproxy\nspec:\n  containers:\n  - name: goproxy\n    image: registry.k8s.io/goproxy:0.1\n    ports:\n    - containerPort: 8080\n    readinessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n    livenessProbe:\n      tcpSocket:\n        port: 8080\n      initialDelaySeconds: 15\n      periodSeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | As you can see, configuration for a TCP check is quite similar to an HTTP check. This example uses both readiness and liveness probes. The kubelet will run the first liveness probe 15 seconds after th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17540"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that liveness probes:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17541"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod goproxy\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | If your application implements the gRPC Health Checking Protocol, this example shows how to configure Kubernetes to use it for application liveness checks. Similarly you can configure readiness and st", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17542"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/probe/grpc-liveness.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17543"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: etcd-with-grpc\nspec:\n  containers:\n  - name: etcd\n    image: registry.k8s.io/etcd:3.5.1-0\n    command: [ \"/usr/local/bin/etcd\", \"--data-dir\",  \"/var/lib/etcd\", \"--listen-client-urls\", \"http://0.0.0.0:2379\", \"--advertise-client-urls\", \"http://127.0.0.1:2379\", \"--log-level\", \"debug\"]\n    ports:\n    - containerPort: 2379\n    livenessProbe:\n      grpc:\n        port: 2379\n      initialDelaySeconds: 10\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | To use a gRPC probe, port must be configured. If you want to distinguish probes of different types and probes for different features you can use the service field. You can set service to the value liv", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17544"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/probe/grpc-liveness.yaml\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | After 15 seconds, view Pod events to verify that the liveness check has not failed:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17545"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe pod etcd-with-grpc\n```\n\n17 - Configure Liveness, Readiness and Startup Probes | When using a gRPC probe, there are some technical details to be aware of:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17546"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17547"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n18 - Assign Pods to Nodes | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17548"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17549"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17550"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\n  labels:\n    env: test\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n  nodeSelector:\n    disktype: ssd\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17551"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml\n```\n\n18 - Assign Pods to Nodes | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17552"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n18 - Assign Pods to Nodes | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17553"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-specific-node.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17554"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  nodeName: foo-node # schedule pod to specific node\n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n18 - Assign Pods to Nodes | Use the configuration file to create a pod that will get scheduled on foo-node only.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17555"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17556"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <your-node-name> disktype=ssd\n```\n\n19 - Assign Pods to Nodes using Node Affinity | where <your-node-name> is the name of your chosen node.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17557"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get nodes --show-labels\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17558"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-required-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17559"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      requiredDuringSchedulingIgnoredDuringExecution:\n        nodeSelectorTerms:\n        - matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd            \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17560"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17561"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17562"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-nginx-preferred-affinity.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17563"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  affinity:\n    nodeAffinity:\n      preferredDuringSchedulingIgnoredDuringExecution:\n      - weight: 1\n        preference:\n          matchExpressions:\n          - key: disktype\n            operator: In\n            values:\n            - ssd          \n  containers:\n  - name: nginx\n    image: nginx\n    imagePullPolicy: IfNotPresent\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Apply the manifest to create a Pod that is scheduled onto your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17564"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml\n```\n\n19 - Assign Pods to Nodes using Node Affinity | Verify that the pod is running on your chosen node:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17565"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --output=wide\n```\n\n19 - Assign Pods to Nodes using Node Affinity | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17566"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/init-containers.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17567"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: init-demo\nspec:\n  containers:\n  - name: nginx\n    image: nginx\n    ports:\n    - containerPort: 80\n    volumeMounts:\n    - name: workdir\n      mountPath: /usr/share/nginx/html\n  # These containers are run during pod initialization\n  initContainers:\n  - name: install\n    image: busybox:1.28\n    command:\n    - wget\n    - \"-O\"\n    - \"/work-dir/index.html\"\n    - http://info.cern.ch\n    volumeMounts:\n    - name: workdir\n      mountPath: \"/work-dir\"\n  dnsPolicy: Default\n  volumes:\n  - name: workdir\n    emptyDir: {}\n```\n\n20 - Configure Pod Initialization | In the configuration file, you can see that the Pod has a Volume that the init container and the application container share.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17568"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/init-containers.yaml\n```\n\n20 - Configure Pod Initialization | Verify that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17569"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pod init-demo\n```\n\n20 - Configure Pod Initialization | The output shows that the nginx container is running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17570"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it init-demo -- /bin/bash\n```\n\n20 - Configure Pod Initialization | In your shell, send a GET request to the nginx server:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17571"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/lifecycle-events.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17572"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: lifecycle-demo\nspec:\n  containers:\n  - name: lifecycle-demo-container\n    image: nginx\n    lifecycle:\n      postStart:\n        exec:\n          command: [\"/bin/sh\", \"-c\", \"echo Hello from the postStart handler > /usr/share/message\"]\n      preStop:\n        exec:\n          command: [\"/bin/sh\",\"-c\",\"nginx -s quit; while killall -0 nginx; do sleep 1; done\"]\n```\n\n21 - Attach Handlers to Container Lifecycle Events | In the configuration file, you can see that the postStart command writes a message file to the Container's /usr/share directory. The preStop command shuts down nginx gracefully. This is helpful if the", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17573"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap <map-name> <data-source>\n```\n\n22 - Configure a Pod to Use a ConfigMap | where <map-name> is the name you want to assign to the ConfigMap and <data-source> is the directory, file, or literal value to draw the data from. The name of a ConfigMap object must be a valid DNS su", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17574"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17575"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps game-config -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17576"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:52:05Z\n  name: game-config\n  namespace: default\n  resourceVersion: \"516\"\n  uid: b4952dc3-d670-11e5-8cd0-68f728db1985\ndata:\n  game.properties: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30    \n  ui.properties: |\n    color.good=purple\n    color.bad=yellow\n    allow.textmode=true\n    how.nice.to.look=fairlyNice\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17577"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17578"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17579"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can display details of the game-config-2 ConfigMap using the following command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17580"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps game-config-2\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17581"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-env-file \\\n       --from-env-file=configure-pod-container/configmap/game-env-file.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce a ConfigMap. View the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17582"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap game-config-env-file -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | the output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17583"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:36:28Z\n  name: game-config-env-file\n  namespace: default\n  resourceVersion: \"809965\"\n  uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  enemies: aliens\n  lives: \"3\"\n```\n\n22 - Configure a Pod to Use a ConfigMap | Starting with Kubernetes v1.23, kubectl supports the --from-env-file argument to be specified multiple times to create a ConfigMap from multiple data sources.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17584"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap config-multi-env-files \\\n        --from-env-file=configure-pod-container/configmap/game-env-file.properties \\\n        --from-env-file=configure-pod-container/configmap/ui-env-file.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17585"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap config-multi-env-files -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | where the output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17586"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2019-12-27T18:38:34Z\n  name: config-multi-env-files\n  namespace: default\n  resourceVersion: \"810136\"\n  uid: 252c4572-eb35-11e7-887b-42010a8002b8\ndata:\n  allowed: '\"true\"'\n  color: purple\n  enemies: aliens\n  how: fairlyNice\n  lives: \"3\"\n  textmode: \"true\"\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can define a key other than the file name to use in the data section of your ConfigMap when using the --from-file argument:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17587"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=<my-key-name>=<path-to-file>\n```\n\n22 - Configure a Pod to Use a ConfigMap | where <my-key-name> is the key you want to use in the ConfigMap and <path-to-file> is the location of the data source file you want the key to represent.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17588"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties\n```\n\n22 - Configure a Pod to Use a ConfigMap | would produce the following ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17589"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T18:54:22Z\n  name: game-config-3\n  namespace: default\n  resourceVersion: \"530\"\n  uid: 05f8da22-d671-11e5-8cd0-68f728db1985\ndata:\n  game-special-key: |\n    enemies=aliens\n    lives=3\n    enemies.cheat=true\n    enemies.cheat.level=noGoodRotten\n    secret.code.passphrase=UUDDLRLRBABAS\n    secret.code.allowed=true\n    secret.code.lives=30\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use kubectl create configmap with the --from-literal argument to define a literal value from the command line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17590"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can pass in multiple key-value pairs. Each pair provided on the command line is represented as a separate entry in the data section of the ConfigMap.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17591"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps special-config -o yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | The output is similar to this:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17592"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2022-02-18T19:14:38Z\n  name: special-config\n  namespace: default\n  resourceVersion: \"651\"\n  uid: dadce046-d673-11e5-8cd0-68f728db1985\ndata:\n  special.how: very\n  special.type: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can also create a ConfigMap from generators and then apply it to create the object in the cluster's API server. You should specify the generators in a kustomization.yaml file within a directory.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17593"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get configmap\n```\n\n22 - Configure a Pod to Use a ConfigMap | and also:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17594"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe configmaps/game-config-4-m9dm2f92bt\n```\n\n22 - Configure a Pod to Use a ConfigMap | Notice that the generated ConfigMap name has a suffix appended by hashing the contents. This ensures that a new ConfigMap is generated each time the content is modified.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17595"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmap special-config\nkubectl delete configmap env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now that you have learned to define ConfigMaps, you can move on to the next section, and learn how to use these objects with Pods.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17596"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap special-config --from-literal=special.how=very\n```\n\n22 - Configure a Pod to Use a ConfigMap | Assign the special.how value defined in the ConfigMap to the SPECIAL_LEVEL_KEY environment variable in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17597"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-single-configmap-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17598"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        # Define the environment variable\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY\n              name: special-config\n              # Specify the key associated with the value\n              key: special.how\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17599"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-single-configmap-env-variable.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variable SPECIAL_LEVEL_KEY=very.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17600"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmaps.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17601"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  special.how: very\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: env-config\n  namespace: default\ndata:\n  log_level: INFO\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17602"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Define the environment variables in the Pod specification.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17603"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-multiple-configmap-env-variable.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17604"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: special.how\n        - name: LOG_LEVEL\n          valueFrom:\n            configMapKeyRef:\n              name: env-config\n              key: log_level\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17605"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-multiple-configmap-env-variable.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL_KEY=very and LOG_LEVEL=INFO.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17606"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\nkubectl delete configmap special-config\nkubectl delete configmap env-config\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create a ConfigMap containing multiple key-value pairs.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17607"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmap-multikeys.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17608"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17609"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Use envFrom to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17610"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-envFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17611"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"env\" ]\n      envFrom:\n      - configMapRef:\n          name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17612"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-envFrom.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Now, the Pod's output includes environment variables SPECIAL_LEVEL=very and SPECIAL_TYPE=charm.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17613"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can use ConfigMap-defined environment variables in the command and args of a container using the $(VAR_NAME) Kubernetes substitution syntax.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17614"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-env-var-valueFrom.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17615"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/echo\", \"$(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)\" ]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_LEVEL\n        - name: SPECIAL_TYPE_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: special-config\n              key: SPECIAL_TYPE\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create that Pod, by running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17616"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valueFrom.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | That pod produces the following output from the test-container container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17617"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl logs dapi-test-pod\n```\n\n22 - Configure a Pod to Use a ConfigMap | Once you're happy to move on, delete that Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17618"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | As explained in Create ConfigMaps from files, when you create a ConfigMap using --from-file, the filename becomes a key stored in the data section of the ConfigMap. The file contents become the key's", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17619"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\nconfigmap/configmap-multikeys.yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17620"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: special-config\n  namespace: default\ndata:\n  SPECIAL_LEVEL: very\n  SPECIAL_TYPE: charm\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17621"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | Add the ConfigMap name under the volumes section of the Pod specification. This adds the ConfigMap data to the directory specified as volumeMounts.mountPath (in this case, /etc/config). The command se", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17622"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-volume.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17623"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\", \"-c\", \"ls /etc/config/\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        # Provide the name of the ConfigMap containing the files you want\n        # to add to the container\n        name: special-config\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17624"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command ls /etc/config/ produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17625"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | Use the path field to specify the desired file path for specific ConfigMap items. In this case, the SPECIAL_LEVEL item will be mounted in the config-volume volume at /etc/config/keys.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17626"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/pod-configmap-volume-specific-key.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17627"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: registry.k8s.io/busybox:1.27.2\n      command: [ \"/bin/sh\",\"-c\",\"cat /etc/config/keys\" ]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: special-config\n        items:\n        - key: SPECIAL_LEVEL\n          path: keys\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | Create the Pod:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17628"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume-specific-key.yaml\n```\n\n22 - Configure a Pod to Use a ConfigMap | When the pod runs, the command cat /etc/config/keys produces the output below:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17629"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod dapi-test-pod --now\n```\n\n22 - Configure a Pod to Use a ConfigMap | You can project keys to specific paths. Refer to the corresponding section in the Secrets guide for the syntax.You can set POSIX permissions for keys. Refer to the corresponding section in the Secrets", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17630"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  creationTimestamp: 2016-02-18T19:14:38Z\n  name: example-config\n  namespace: default\ndata:\n  # example of a simple property defined using --from-literal\n  example.property.1: hello\n  example.property.2: world\n  # example of a complex property defined using --from-file\n  example.property.file: |-\n    property.1=value-1\n    property.2=value-2\n    property.3=value-3\n```\n\n22 - Configure a Pod to Use a ConfigMap | When kubectl creates a ConfigMap from inputs that are not ASCII or UTF-8, the tool puts these into the binaryData field of the ConfigMap, and not in data. Both text and binary data sources can be comb", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17631"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"env\"]\n      env:\n        - name: SPECIAL_LEVEL_KEY\n          valueFrom:\n            configMapKeyRef:\n              name: a-config\n              key: akey\n              optional: true # mark the variable as optional\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | If you run this pod, and there is no ConfigMap named a-config, the output is empty. If you run this pod, and there is a ConfigMap named a-config but that ConfigMap doesn't have a key named akey, the o", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17632"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-test-pod\nspec:\n  containers:\n    - name: test-container\n      image: gcr.io/google_containers/busybox\n      command: [\"/bin/sh\", \"-c\", \"ls /etc/config\"]\n      volumeMounts:\n      - name: config-volume\n        mountPath: /etc/config\n  volumes:\n    - name: config-volume\n      configMap:\n        name: no-config\n        optional: true # mark the source ConfigMap as optional\n  restartPolicy: Never\n```\n\n22 - Configure a Pod to Use a ConfigMap | You must create the ConfigMap object before you reference it in a Pod specification. Alternatively, mark the ConfigMap reference as optional in the Pod spec (see Optional ConfigMaps). If you reference", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17633"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete configmaps/game-config configmaps/game-config-2 configmaps/game-config-3 \\\n               configmaps/game-config-env-file\nkubectl delete pod dapi-test-pod --now\n\n# You might already have removed the next set\nkubectl delete configmaps/special-config configmaps/env-config\nkubectl delete configmap -l 'game-config in (config-4,config-5)'\n```\n\n22 - Configure a Pod to Use a ConfigMap | Remove the kustomization.yaml file that you used to generate the ConfigMap:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17634"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/share-process-namespace.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17635"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  shareProcessNamespace: true\n  containers:\n  - name: nginx\n    image: nginx\n  - name: shell\n    image: busybox:1.28\n    command: [\"sleep\", \"3600\"]\n    securityContext:\n      capabilities:\n        add:\n        - SYS_PTRACE\n    stdin: true\n    tty: true\n```\n\n23 - Share Process Namespace between Containers in a Pod | Create the pod nginx on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17636"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/share-process-namespace.yaml\n```\n\n23 - Share Process Namespace between Containers in a Pod | Attach to the shell container and run ps:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17637"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it nginx -c shell -- /bin/sh\n```\n\n23 - Share Process Namespace between Containers in a Pod | If you don't see a command prompt, try pressing enter. In the container shell:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17638"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/user-namespaces-stateless.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17639"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: userns\nspec:\n  hostUsers: false\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n```\n\n24 - Use a User Namespace With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17640"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/user-namespaces-stateless.yaml\n```\n\n24 - Use a User Namespace With a Pod | Exec into the pod and run readlink /proc/self/ns/user:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17641"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti userns -- bash\n```\n\n24 - Use a User Namespace With a Pod | Run this command:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17642"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17643"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17644"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes.yaml\n```\n\n25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17645"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n25 - Use an Image Volume With a Pod | Check the content of a file in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17646"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\npods/image-volumes-subpath.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17647"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: image-volume\nspec:\n  containers:\n  - name: shell\n    command: [\"sleep\", \"infinity\"]\n    image: debian\n    volumeMounts:\n    - name: volume\n      mountPath: /volume\n      subPath: dir\n  volumes:\n  - name: volume\n    image:\n      reference: quay.io/crio/artifact:v2\n      pullPolicy: IfNotPresent\n```\n\n25 - Use an Image Volume With a Pod | Create the pod on your cluster:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17648"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml\n```\n\n25 - Use an Image Volume With a Pod | Attach to the container:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17649"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it image-volume bash\n```\n\n25 - Use an Image Volume With a Pod | Check the content of the file from the dir sub path in the volume:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17650"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\n# Run this command on the node where kubelet is running\nmkdir -p /etc/kubernetes/manifests/\ncat <<EOF >/etc/kubernetes/manifests/static-web.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\nEOF\n```\n\n26 - Create static Pods | Configure the kubelet on that node to set a staticPodPath value in the kubelet configuration file.See Set Kubelet Parameters Via A Configuration File for more information.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17651"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: static-web\n  labels:\n    role: myrole\nspec:\n  containers:\n    - name: web\n      image: nginx\n      ports:\n        - name: web\n          containerPort: 80\n          protocol: TCP\n```\n\n26 - Create static Pods | Configure the kubelet on your selected node to use this web manifest by running it with --manifest-url=<manifest-url>. On Fedora, edit /etc/kubernetes/kubelet to include this line:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17652"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod static-web-my-node1\n```\n\n26 - Create static Pods | You can see that the Pod is still running:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17653"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | The output is similar to:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17654"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl describe svc web-tcp\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | If you're using a cloud provider, your IP will be listed next to LoadBalancer Ingress.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17655"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml\n```\n\n27 - Translate a Docker Compose File to Kubernetes Resources | Kompose has support for two providers: OpenShift and Kubernetes. You can choose a targeted provider using global option --provider. If no provider is specified, Kubernetes is set by default.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17656"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodSecurity\n  configuration:\n    apiVersion: pod-security.admission.config.k8s.io/v1 # see compatibility note\n    kind: PodSecurityConfiguration\n    # Defaults applied when a mode label is not set.\n    #\n    # Level label values must be one of:\n    # - \"privileged\" (default)\n    # - \"baseline\"\n    # - \"restricted\"\n    #\n    # Version label values must be one of:\n    # - \"latest\" (default) \n    # - specific version like \"v1.34\"\n    defaults:\n      enforce: \"privileged\"\n      enforce-version: \"latest\"\n      audit: \"privileged\"\n      audit-version: \"latest\"\n      warn: \"privileged\"\n      warn-version: \"latest\"\n    exemptions:\n      # Array of authenticated usernames to exempt.\n      usernames: []\n      # Array of runtime class names to exempt.\n      runtimeClasses: []\n      # Array of namespaces to exempt.\n      namespaces: []\n```\n\n28 - Enforce Pod Security Standards by Configuring the Built-in Admission Controller | Namespaces can be labeled to enforce the Pod Security Standards. The three policies privileged, baseline and restricted broadly cover the security spectrum and are implemented by the Pod Security admi", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17657"}
{"instruction": "Write a yaml example for configure pods and containers", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: my-baseline-namespace\n  labels:\n    pod-security.kubernetes.io/enforce: baseline\n    pod-security.kubernetes.io/enforce-version: v1.34\n\n    # We are setting these to our _desired_ `enforce` level.\n    pod-security.kubernetes.io/audit: restricted\n    pod-security.kubernetes.io/audit-version: v1.34\n    pod-security.kubernetes.io/warn: restricted\n    pod-security.kubernetes.io/warn-version: v1.34\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | It is helpful to apply the --dry-run flag when initially evaluating security profile changes for namespaces. The Pod Security Standard checks will still be run in dry run mode, giving you information", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17658"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --dry-run=server --overwrite ns --all \\\n    pod-security.kubernetes.io/enforce=baseline\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | If you're just getting started with the Pod Security Standards, a suitable first step would be to configure all namespaces with audit annotations for a stricter level such as baseline:", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17659"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns --all \\\n  pod-security.kubernetes.io/audit=baseline \\\n  pod-security.kubernetes.io/warn=baseline\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | Note that this is not setting an enforce level, so that namespaces that haven't been explicitly evaluated can be distinguished. You can list namespaces without an explicitly set enforce level using th", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17660"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get namespaces --selector='!pod-security.kubernetes.io/enforce'\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | You can update a specific namespace as well. This command adds the enforce=restricted policy to my-existing-namespace, pinning the restricted policy version to v1.34.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17661"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns my-existing-namespace \\\n  pod-security.kubernetes.io/enforce=restricted \\\n  pod-security.kubernetes.io/enforce-version=v1.34\n```\n\n29 - Enforce Pod Security Standards with Namespace Labels | This page describes the process of migrating from PodSecurityPolicies to the built-in PodSecurity admission controller. This can be done effectively using a combination of dry-run and audit and warn m", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17662"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n $NAMESPACE -o jsonpath=\"{.items[*].metadata.annotations.kubernetes\\.io\\/psp}\" | tr \" \" \"\\n\" | sort -u\n```\n\n30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Once you have selected a Pod Security level for the namespace (or if you're trying several), it's a good idea to test it out first (you can skip this step if using the Privileged level). Pod Security", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17663"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/audit=$LEVEL\n```\n\n30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | If either of these approaches yield unexpected violations, you will need to either update the violating workloads to meet the policy requirements, or relax the namespace Pod Security level.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17664"}
{"instruction": "Write a bash example for configure pods and containers", "response": "Here's a bash example:\n\n```bash\nkubectl label --overwrite ns $NAMESPACE pod-security.kubernetes.io/enforce=$LEVEL\n```\n\n30 - Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission Controller | Finally, you can effectively bypass PodSecurityPolicy at the namespace level by binding the fully privileged PSP to all service accounts in the namespace.", "category": "tasks_code", "subcategory": "configure-pods-containers", "source": "https://kubernetes.io/docs/tasks/configure-pod-container/_print/", "id": "k8s_00781_code_17665"}
{"instruction": "How do you access applications in a cluster in Kubernetes?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Access Applications in a ClusterConfigure load balancing, port forwarding, or setup firewall or DNS configurations to access applications in a cluster.1: Deploy and Access the Kubernetes Dashboard2: Accessing Clusters3: Configure Access to Multiple Clusters4: Use Port Forwarding to Access Applications in a Cluster5: Use a Service to Access an Application in a Cluster6: Connect a Frontend to a Backend Using Services7: Create an External Load Balancer8: List All Container Images Running in a Cluster9: Set up Ingress on Minikube with the NGINX Ingress Controller10: Communicate Between Containers in the Same Pod Using a Shared Volume11: Configure DNS for a Cluster12: Access Services Running on Clusters1 - Deploy and Access the Kubernetes DashboardDeploy the web UI (Kubernetes Dashboard) and access it.Dashboard is a web-based Kubernetes user interface. You can use Dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster resources. You can use Dashboard to get an overview of applications running on your cluster, as well as for creating or modifying individual Kubernetes resources (such as Deployments, Jobs, DaemonSets, etc). For example, you can scale a Deployment, initiate a rolling update, restart a pod or deploy new applications using a deploy wizard.Dashboard also provides information on the state of Kubernetes resources in your cluster and on any errors that may have occurred.Deploying the Dashboard UINote:Kubernetes Dashboard supports only Helm-based installation currently as it is faster and gives us better control over all dependencies required by Dashboard to run.The Dashboard UI is not deployed by default. To deploy it, run the following command:# Add kubernetes-dashboard repository helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ # Deploy a Helm Release named \"kubernetes-dashboard\" using the kubernetes-dashboard chart helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard Accessing the Dashboard UITo protect your cluster data, Dashboard deploys with a minimal RBAC configuration by default. Currently, Dashboard only supports logging in with a Bearer Token. To create a token for this demo, you can follow our guide on creating a sample user.Warning:The sample user created in the tutorial will have administrative privileges and is for educational purposes only.Command line proxyYou can enable access to the Dashboard using the kubectl command-line tool, by running the following command:kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443 Kubectl will make Dashboard available at https://localhost:8443.The UI can only be accessed from the machine where the command is executed. See kubectl port-forward --help for more options.Note:The kubeconfig authentication method does not support external identity providers or X.509 certificate-based authentication.Welcome viewWhen you access Dashboard on an empty cluster, you'll see the welcome page. This page contains a link to this document as well as a button to deploy your first application. In addition, you can view which system applications are running by default in the kube-system namespace of your cluster, for example the Dashboard itself.Deploying containerized applicationsDashboard lets you create and deploy a containerized application as a Deployment and optional Service with a simple wizard. You can either manually specify application details, or upload a YAML or JSON manifest file containing application configuration.Click the CREATE button in the upper right corner of any page to begin.Specifying application detailsThe deploy wizard expects that you provide the following information:App name (mandatory): Name for your application. A label w", "category": "tasks", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443\n```\n\n1 - Deploy and Access the Kubernetes Dashboard | Kubectl will make Dashboard available at https://localhost:8443.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17667"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2 - Accessing Clusters | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17668"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n2 - Accessing Clusters | Next, wait for the token controller to populate the Secret with a token:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17669"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\n3 - Configure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17670"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file\nkubectl config --kubeconfig=config-demo set-cluster test --server=https://5.6.7.8 --insecure-skip-tls-verify\n```\n\n3 - Configure Access to Multiple Clusters | Add user details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17671"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile\nkubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password\n```\n\n3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17672"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer\nkubectl config --kubeconfig=config-demo set-context dev-storage --cluster=development --namespace=storage --user=developer\nkubectl config --kubeconfig=config-demo set-context exp-test --cluster=test --namespace=default --user=experimenter\n```\n\n3 - Configure Access to Multiple Clusters | Open your config-demo file to see the added details. As an alternative to opening the config-demo file, you can use the config view command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17673"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view\n```\n\n3 - Configure Access to Multiple Clusters | The output shows the two clusters, two users, and three contexts:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17674"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\n3 - Configure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17675"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-frontend\n```\n\n3 - Configure Access to Multiple Clusters | Now whenever you enter a kubectl command, the action will apply to the cluster, and namespace listed in the dev-frontend context. And the command will use the credentials of the user listed in the dev", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17676"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n3 - Configure Access to Multiple Clusters | The output shows configuration information associated with the dev-frontend context:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17677"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\n3 - Configure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17678"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context exp-test\n```\n\n3 - Configure Access to Multiple Clusters | Now any kubectl command you give will apply to the default namespace of the test cluster. And the command will use the credentials of the user listed in the exp-test context.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17679"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n3 - Configure Access to Multiple Clusters | Finally, suppose you want to work for a while in the storage namespace of the development cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17680"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-storage\n```\n\n3 - Configure Access to Multiple Clusters | View configuration associated with the new current context, dev-storage.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17681"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n3 - Configure Access to Multiple Clusters | In your config-exercise directory, create a file named config-demo-2 with this content:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17682"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\n3 - Configure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17683"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-deployment.yaml\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17684"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the Deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17685"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicaset\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the ReplicaSet was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17686"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-service.yaml\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the Service was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17687"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service mongo\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output displays the service created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17688"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pods/mongo-75f59d57f4-4nd6q 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17689"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17690"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward replicaset/mongo-75f59d57f4 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17691"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/mongo 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | Any of the above commands works. The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17692"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo :27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The kubectl tool finds a local port number that is not in use (avoiding low ports numbers, because these might be used by other applications). The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17693"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17694"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml\n```\n\n5 - Use a Service to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has two Pods each of which runs the Hello World application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17695"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\n5 - Use a Service to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17696"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\n5 - Use a Service to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17697"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=NodePort --name=example-service\n```\n\n5 - Use a Service to Access an Application in a Cluster | Display information about the Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17698"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17699"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=\"run=load-balancer-example\" --output=wide\n```\n\n5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17700"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services example-service\n```\n\n5 - Use a Service to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17701"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\n5 - Use a Service to Access an Application in a Cluster | Follow the Connecting Applications with Services tutorial.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17702"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17703"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-deployment.yaml\n```\n\n6 - Connect a Frontend to a Backend Using Services | View information about the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17704"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment backend\n```\n\n6 - Connect a Frontend to a Backend Using Services | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17705"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17706"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-service.yaml\n```\n\n6 - Connect a Frontend to a Backend Using Services | At this point, you have a backend Deployment running three replicas of your hello application, and you have a Service that can route traffic to them. However, this service is neither available nor res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17707"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17708"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17709"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/frontend-deployment.yaml\nkubectl apply -f https://k8s.io/examples/service/access/frontend-service.yaml\n```\n\n6 - Connect a Frontend to a Backend Using Services | The output verifies that both resources were created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17710"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend --watch\n```\n\n6 - Connect a Frontend to a Backend Using Services | This displays the configuration for the frontend Service and watches for changes. Initially, the external IP is listed as <pending>:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17711"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services frontend backend\n```\n\n6 - Connect a Frontend to a Backend Using Services | To delete the Deployments, the ReplicaSets and the Pods that are running the backend and frontend applications, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17712"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment frontend backend\n```\n\n6 - Connect a Frontend to a Backend Using Services | This page shows how to create an external load balancer.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17713"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\n7 - Create an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17714"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\n7 - Create an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17715"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n7 - Create an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17716"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\n7 - Create an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17717"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec['initContainers', 'containers'][*].image}\" |\\\ntr -s '[[:space:]]' '\\n' |\\\nsort |\\\nuniq -c\n```\n\n8 - List All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17718"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{\"\\n\"}{.metadata.name}{\":\\t\"}{range .spec.containers[*]}{.image}{\", \"}{end}{end}' |\\\nsort\n```\n\n8 - List All Container Images Running in a Cluster | To target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching app=nginx.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17719"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec.containers[*].image}\" -l app=nginx\n```\n\n8 - List All Container Images Running in a Cluster | To target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the kube-system namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17720"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace kube-system -o jsonpath=\"{.items[*].spec.containers[*].image}\"\n```\n\n8 - List All Container Images Running in a Cluster | As an alternative to jsonpath, Kubectl supports using go-templates for formatting the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17721"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o go-template --template=\"{{range .items}}{{range .spec.containers}}{{.image}} {{end}}{{end}}\"\n```\n\n8 - List All Container Images Running in a Cluster | An Ingress is an API object that defines rules which allow external access to services in a cluster. An Ingress controller fulfills the rules set in the Ingress.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17722"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n ingress-nginx\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17723"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17724"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17725"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web --type=NodePort --port=8080\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17726"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service web\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17727"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17728"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17729"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17730"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web2\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17731"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web2 --port=8080 --type=NodePort\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17732"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-ingress.yaml\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | You should see:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17733"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17734"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/two-container-pod.yaml\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | View information about the Pod and the Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17735"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pod two-containers --output=yaml\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | Here is a portion of the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17736"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  ...\n  name: two-containers\n  namespace: default\n  ...\nspec:\n  ...\n  containerStatuses:\n\n  - containerID: docker://c1d8abd1 ...\n    image: debian\n    ...\n    lastState:\n      terminated:\n        ...\n    name: debian-container\n    ...\n\n  - containerID: docker://96c1ff2c5bb ...\n    image: nginx\n    ...\n    name: nginx-container\n    ...\n    state:\n      running:\n    ...\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | You can see that the debian Container has terminated, and the nginx Container is still running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17737"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it two-containers -c nginx-container -- /bin/bash\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In your shell, verify that nginx is running:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17738"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443\n```\n\n1 - Deploy and Access the Kubernetes Dashboard | Kubectl will make Dashboard available at https://localhost:8443.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17739"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward --help\n```\n\n1 - Deploy and Access the Kubernetes Dashboard | When you access Dashboard on an empty cluster, you'll see the welcome page. This page contains a link to this document as well as a button to deploy your first application. In addition, you can view w", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17740"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe secret...\n```\n\n2 - Accessing Clusters | First, create the Secret, requesting a token for the default ServiceAccount:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17741"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context\n```\n\n3 - Configure Access to Multiple Clusters | You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two node", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17742"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl version --client\n```\n\n3 - Configure Access to Multiple Clusters | Suppose you have two clusters, one for development work and one for test work. In the development cluster, your frontend developers work in a namespace called frontend, and your storage developers wor", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17743"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\n3 - Configure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17744"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset users.<name>\n```\n\n3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17745"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset clusters.<name>\n```\n\n3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17746"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl --kubeconfig=config-demo config unset contexts.<name>\n```\n\n3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17747"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\n3 - Configure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17748"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\n3 - Configure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17749"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\n3 - Configure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17750"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\n```\n\n3 - Configure Access to Multiple Clusters | For more information about how kubeconfig files are merged, see Organizing Cluster Access Using kubeconfig Files", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17751"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17752"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services example-service\n```\n\n5 - Use a Service to Access an Application in a Cluster | To delete the Deployment, the ReplicaSet, and the Pods that are running the Hello World application, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17753"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment hello-world\n```\n\n5 - Use a Service to Access an Application in a Cluster | Follow the Connecting Applications with Services tutorial.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17754"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17755"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17756"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17757"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17758"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\n7 - Create an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17759"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\n7 - Create an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17760"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n7 - Create an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17761"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nminikube service example-service --url\n```\n\n7 - Create an External Load Balancer | By default, the source IP seen in the target container is not the original source IP of the client. To enable preservation of the client IP, the following fields can be configured in the .spec of the", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17762"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\n7 - Create an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17763"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces\n```\n\n8 - List All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17764"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pod nginx\n```\n\n8 - List All Container Images Running in a Cluster | The formatting can be controlled further by using the range operation to iterate over elements individually.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17765"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17766"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n- path: /v2\n  pathType: Prefix\n  backend:\n    service:\n      name: web2\n      port:\n        number: 8080\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Apply the changes:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17767"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17768"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/pods/two-container-pod.yaml\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | View information about the Pod and the Containers:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17769"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pod two-containers --output=yaml\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | Here is a portion of the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17770"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  ...\n  name: two-containers\n  namespace: default\n  ...\nspec:\n  ...\n  containerStatuses:\n\n  - containerID: docker://c1d8abd1 ...\n    image: debian\n    ...\n    lastState:\n      terminated:\n        ...\n    name: debian-container\n    ...\n\n  - containerID: docker://96c1ff2c5bb ...\n    image: nginx\n    ...\n    name: nginx-container\n    ...\n    state:\n      running:\n    ...\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | You can see that the debian Container has terminated, and the nginx Container is still running.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17771"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl exec -it two-containers -c nginx-container -- /bin/bash\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In your shell, verify that nginx is running:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17772"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl proxy --port=8080\n```\n\n2 - Accessing Clusters | See kubectl proxy for more details.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17773"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: default-token\n  annotations:\n    kubernetes.io/service-account.name: default\ntype: kubernetes.io/service-account-token\nEOF\n```\n\n2 - Accessing Clusters | Next, wait for the token controller to populate the Secret with a token:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17774"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\nclusters:\n- cluster:\n  name: development\n- cluster:\n  name: test\n\nusers:\n- name: developer\n- name: experimenter\n\ncontexts:\n- context:\n  name: dev-frontend\n- context:\n  name: dev-storage\n- context:\n  name: exp-test\n```\n\n3 - Configure Access to Multiple Clusters | A configuration file describes clusters, users, and contexts. Your config-demo file has the framework to describe two clusters, two users, and three contexts.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17775"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-cluster development --server=https://1.2.3.4 --certificate-authority=fake-ca-file\nkubectl config --kubeconfig=config-demo set-cluster test --server=https://5.6.7.8 --insecure-skip-tls-verify\n```\n\n3 - Configure Access to Multiple Clusters | Add user details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17776"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-credentials developer --client-certificate=fake-cert-file --client-key=fake-key-seefile\nkubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password\n```\n\n3 - Configure Access to Multiple Clusters | Add context details to your configuration file:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17777"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo set-context dev-frontend --cluster=development --namespace=frontend --user=developer\nkubectl config --kubeconfig=config-demo set-context dev-storage --cluster=development --namespace=storage --user=developer\nkubectl config --kubeconfig=config-demo set-context exp-test --cluster=test --namespace=default --user=experimenter\n```\n\n3 - Configure Access to Multiple Clusters | Open your config-demo file to see the added details. As an alternative to opening the config-demo file, you can use the config view command.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17778"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view\n```\n\n3 - Configure Access to Multiple Clusters | The output shows the two clusters, two users, and three contexts:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17779"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://5.6.7.8\n  name: test\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\n- context:\n    cluster: development\n    namespace: storage\n    user: developer\n  name: dev-storage\n- context:\n    cluster: test\n    namespace: default\n    user: experimenter\n  name: exp-test\ncurrent-context: \"\"\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n- name: experimenter\n  user:\n    # Documentation note (this comment is NOT part of the command output).\n    # Storing passwords in Kubernetes client config is risky.\n    # A better alternative would be to use a credential plugin\n    # and store the credentials separately.\n    # See https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n    password: some-password\n    username: exp\n```\n\n3 - Configure Access to Multiple Clusters | The fake-ca-file, fake-cert-file and fake-key-file above are the placeholders for the pathnames of the certificate files. You need to change these to the actual pathnames of certificate files in your", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17780"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-frontend\n```\n\n3 - Configure Access to Multiple Clusters | Now whenever you enter a kubectl command, the action will apply to the cluster, and namespace listed in the dev-frontend context. And the command will use the credentials of the user listed in the dev", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17781"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n3 - Configure Access to Multiple Clusters | The output shows configuration information associated with the dev-frontend context:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17782"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nclusters:\n- cluster:\n    certificate-authority: fake-ca-file\n    server: https://1.2.3.4\n  name: development\ncontexts:\n- context:\n    cluster: development\n    namespace: frontend\n    user: developer\n  name: dev-frontend\ncurrent-context: dev-frontend\nkind: Config\npreferences: {}\nusers:\n- name: developer\n  user:\n    client-certificate: fake-cert-file\n    client-key: fake-key-file\n```\n\n3 - Configure Access to Multiple Clusters | Now suppose you want to work for a while in the test cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17783"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context exp-test\n```\n\n3 - Configure Access to Multiple Clusters | Now any kubectl command you give will apply to the default namespace of the test cluster. And the command will use the credentials of the user listed in the exp-test context.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17784"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n3 - Configure Access to Multiple Clusters | Finally, suppose you want to work for a while in the storage namespace of the development cluster.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17785"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo use-context dev-storage\n```\n\n3 - Configure Access to Multiple Clusters | View configuration associated with the new current context, dev-storage.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17786"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=config-demo view --minify\n```\n\n3 - Configure Access to Multiple Clusters | In your config-exercise directory, create a file named config-demo-2 with this content:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17787"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\npreferences: {}\n\ncontexts:\n- context:\n    cluster: development\n    namespace: ramp\n    user: developer\n  name: dev-ramp-up\n```\n\n3 - Configure Access to Multiple Clusters | The preceding configuration file defines a new context named dev-ramp-up.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17788"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-deployment.yaml\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17789"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the Deployment was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17790"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicaset\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output displays that the ReplicaSet was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17791"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/mongodb/mongo-service.yaml\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output of a successful command verifies that the Service was created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17792"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service mongo\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The output displays the service created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17793"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward pods/mongo-75f59d57f4-4nd6q 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17794"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17795"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward replicaset/mongo-75f59d57f4 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | or", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17796"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward service/mongo 28015:27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | Any of the above commands works. The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17797"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward deployment/mongo :27017\n```\n\n4 - Use Port Forwarding to Access Applications in a Cluster | The kubectl tool finds a local port number that is not in use (avoiding low ports numbers, because these might be used by other applications). The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17798"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/access/hello-application.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17799"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: hello-world\nspec:\n  selector:\n    matchLabels:\n      run: load-balancer-example\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: load-balancer-example\n    spec:\n      containers:\n        - name: hello-world\n          image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:2.0\n          ports:\n            - containerPort: 8080\n              protocol: TCP\n```\n\n5 - Use a Service to Access an Application in a Cluster | Run a Hello World application in your cluster: Create the application Deployment using the file above:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17800"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml\n```\n\n5 - Use a Service to Access an Application in a Cluster | The preceding command creates a Deployment and an associated ReplicaSet. The ReplicaSet has two Pods each of which runs the Hello World application.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17801"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployments hello-world\nkubectl describe deployments hello-world\n```\n\n5 - Use a Service to Access an Application in a Cluster | Display information about your ReplicaSet objects:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17802"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get replicasets\nkubectl describe replicasets\n```\n\n5 - Use a Service to Access an Application in a Cluster | Create a Service object that exposes the deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17803"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment hello-world --type=NodePort --name=example-service\n```\n\n5 - Use a Service to Access an Application in a Cluster | Display information about the Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17804"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17805"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --selector=\"run=load-balancer-example\" --output=wide\n```\n\n5 - Use a Service to Access an Application in a Cluster | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17806"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/access/backend-deployment.yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17807"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: backend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: backend\n      track: stable\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: backend\n        track: stable\n    spec:\n      containers:\n        - name: hello\n          image: \"gcr.io/google-samples/hello-go-gke:1.0\"\n          ports:\n            - name: http\n              containerPort: 80\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17808"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-deployment.yaml\n```\n\n6 - Connect a Frontend to a Backend Using Services | View information about the backend Deployment:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17809"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe deployment backend\n```\n\n6 - Connect a Frontend to a Backend Using Services | The output is similar to this:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17810"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/access/backend-service.yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17811"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: hello\nspec:\n  selector:\n    app: hello\n    tier: backend\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: http\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | In the configuration file, you can see that the Service, named hello routes traffic to Pods that have the labels app: hello and tier: backend.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17812"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/backend-service.yaml\n```\n\n6 - Connect a Frontend to a Backend Using Services | At this point, you have a backend Deployment running three replicas of your hello application, and you have a Service that can route traffic to them. However, this service is neither available nor res", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17813"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/access/frontend-service.yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17814"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: frontend\nspec:\n  selector:\n    app: hello\n    tier: frontend\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 80\n  type: LoadBalancer\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17815"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/access/frontend-deployment.yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17816"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: frontend\nspec:\n  selector:\n    matchLabels:\n      app: hello\n      tier: frontend\n      track: stable\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: hello\n        tier: frontend\n        track: stable\n    spec:\n      containers:\n        - name: nginx\n          image: \"gcr.io/google-samples/hello-frontend:1.0\"\n          lifecycle:\n            preStop:\n              exec:\n                command: [\"/usr/sbin/nginx\",\"-s\",\"quit\"]\n...\n```\n\n6 - Connect a Frontend to a Backend Using Services | Create the frontend Deployment and Service:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17817"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/access/frontend-deployment.yaml\nkubectl apply -f https://k8s.io/examples/service/access/frontend-service.yaml\n```\n\n6 - Connect a Frontend to a Backend Using Services | The output verifies that both resources were created:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17818"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service frontend --watch\n```\n\n6 - Connect a Frontend to a Backend Using Services | This displays the configuration for the frontend Service and watches for changes. Initially, the external IP is listed as <pending>:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17819"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete services frontend backend\n```\n\n6 - Connect a Frontend to a Backend Using Services | To delete the Deployments, the ReplicaSets and the Pods that are running the backend and frontend applications, enter this command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17820"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment frontend backend\n```\n\n6 - Connect a Frontend to a Backend Using Services | This page shows how to create an external load balancer.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17821"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  type: LoadBalancer\n```\n\n7 - Create an External Load Balancer | You can alternatively create the service with the kubectl expose command and its --type=LoadBalancer flag:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17822"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment example --port=8765 --target-port=9376 \\\n        --name=example-service --type=LoadBalancer\n```\n\n7 - Create an External Load Balancer | This command creates a new Service using the same selectors as the referenced resource (in the case of the example above, a Deployment named example).", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17823"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl describe services example-service\n```\n\n7 - Create an External Load Balancer | which should produce output similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17824"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: example-service\nspec:\n  selector:\n    app: example\n  ports:\n    - port: 8765\n      targetPort: 9376\n  externalTrafficPolicy: Local\n  type: LoadBalancer\n```\n\n7 - Create an External Load Balancer | Load balancing services from some cloud providers do not let you configure different weights for each target.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17825"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec['initContainers', 'containers'][*].image}\" |\\\ntr -s '[[:space:]]' '\\n' |\\\nsort |\\\nuniq -c\n```\n\n8 - List All Container Images Running in a Cluster | The jsonpath is interpreted as follows:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17826"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{\"\\n\"}{.metadata.name}{\":\\t\"}{range .spec.containers[*]}{.image}{\", \"}{end}{end}' |\\\nsort\n```\n\n8 - List All Container Images Running in a Cluster | To target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching app=nginx.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17827"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o jsonpath=\"{.items[*].spec.containers[*].image}\" -l app=nginx\n```\n\n8 - List All Container Images Running in a Cluster | To target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the kube-system namespace.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17828"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --namespace kube-system -o jsonpath=\"{.items[*].spec.containers[*].image}\"\n```\n\n8 - List All Container Images Running in a Cluster | As an alternative to jsonpath, Kubectl supports using go-templates for formatting the output:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17829"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces -o go-template --template=\"{{range .items}}{{range .spec.containers}}{{.image}} {{end}}{{end}}\"\n```\n\n8 - List All Container Images Running in a Cluster | An Ingress is an API object that defines rules which allow external access to services in a cluster. An Ingress controller fulfills the rules set in the Ingress.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17830"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -n ingress-nginx\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17831"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17832"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17833"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web --type=NodePort --port=8080\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17834"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get service web\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output is similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17835"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\nservice/networking/example-ingress.yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17836"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: example-ingress\nspec:\n  ingressClassName: nginx\n  rules:\n    - host: hello-world.example\n      http:\n        paths:\n          - path: /\n            pathType: Prefix\n            backend:\n              service:\n                name: web\n                port:\n                  number: 8080\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | Create the Ingress object by running the following command:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17837"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17838"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17839"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment web2\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be similar to:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17840"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl expose deployment web2 --port=8080 --type=NodePort\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | The output should be:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17841"}
{"instruction": "Write a bash example for access applications in a cluster", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f example-ingress.yaml\n```\n\n9 - Set up Ingress on Minikube with the NGINX Ingress Controller | You should see:", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17842"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\npods/two-container-pod.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17843"}
{"instruction": "Write a yaml example for access applications in a cluster", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: two-containers\nspec:\n\n  restartPolicy: Never\n\n  volumes:\n  - name: shared-data\n    emptyDir: {}\n\n  containers:\n\n  - name: nginx-container\n    image: nginx\n    volumeMounts:\n    - name: shared-data\n      mountPath: /usr/share/nginx/html\n\n  - name: debian-container\n    image: debian\n    volumeMounts:\n    - name: shared-data\n      mountPath: /pod-data\n    command: [\"/bin/sh\"]\n    args: [\"-c\", \"echo Hello from the debian container > /pod-data/index.html\"]\n```\n\n10 - Communicate Between Containers in the Same Pod Using a Shared Volume | In the configuration file, you can see that the Pod has a Volume named shared-data.", "category": "tasks_code", "subcategory": "manage-clusters", "source": "https://kubernetes.io/docs/tasks/access-application-cluster/_print/", "id": "k8s_00782_code_17844"}
{"instruction": "What is the reference documentation for kubernetes api?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Kubernetes API1: Workload Resources1.1: Pod1.2: Binding1.3: PodTemplate1.4: ReplicationController1.5: ReplicaSet1.6: Deployment1.7: StatefulSet1.8: ControllerRevision1.9: DaemonSet1.10: Job1.11: CronJob1.12: HorizontalPodAutoscaler1.13: HorizontalPodAutoscaler1.14: PriorityClass1.15: DeviceTaintRule v1alpha31.16: ResourceClaim1.17: ResourceClaimTemplate1.18: ResourceSlice2: Service Resources2.1: Service2.2: Endpoints2.3: EndpointSlice2.4: Ingress2.5: IngressClass3: Config and Storage Resources3.1: ConfigMap3.2: Secret3.3: CSIDriver3.4: CSINode3.5: CSIStorageCapacity3.6: PersistentVolumeClaim3.7: PersistentVolume3.8: StorageClass3.9: StorageVersionMigration v1alpha13.10: Volume3.11: VolumeAttachment3.12: VolumeAttributesClass4: Authentication Resources4.1: ServiceAccount4.2: TokenRequest4.3: TokenReview4.4: CertificateSigningRequest4.5: ClusterTrustBundle v1beta14.6: SelfSubjectReview4.7: PodCertificateRequest v1alpha15: Authorization Resources5.1: LocalSubjectAccessReview5.2: SelfSubjectAccessReview5.3: SelfSubjectRulesReview5.4: SubjectAccessReview5.5: ClusterRole5.6: ClusterRoleBinding5.7: Role5.8: RoleBinding6: Policy Resources6.1: FlowSchema6.2: LimitRange6.3: ResourceQuota6.4: NetworkPolicy6.5: PodDisruptionBudget6.6: PriorityLevelConfiguration6.7: ValidatingAdmissionPolicy6.8: ValidatingAdmissionPolicyBinding6.9: MutatingAdmissionPolicy v1beta16.10: MutatingAdmissionPolicyBinding v1alpha17: Extend Resources7.1: CustomResourceDefinition7.2: DeviceClass7.3: MutatingWebhookConfiguration7.4: ValidatingWebhookConfiguration8: Cluster Resources8.1: APIService8.2: ComponentStatus8.3: Event8.4: IPAddress8.5: Lease8.6: LeaseCandidate v1beta18.7: Namespace8.8: Node8.9: RuntimeClass8.10: ServiceCIDR9: Common Definitions9.1: DeleteOptions9.2: LabelSelector9.3: ListMeta9.4: LocalObjectReference9.5: NodeSelectorRequirement9.6: ObjectFieldSelector9.7: ObjectMeta9.8: ObjectReference9.9: Patch9.10: Quantity9.11: ResourceFieldSelector9.12: Status9.13: TypedLocalObjectReference10: Other Resources10.1: MutatingAdmissionPolicyBindingList v1beta111: Common ParametersKubernetes' API is the application that serves Kubernetes functionality through a RESTful interface and stores the state of the cluster.Kubernetes resources and \"records of intent\" are all stored as API objects, and modified via RESTful calls to the API. The API allows configuration to be managed in a declarative way. Users can interact with the Kubernetes API directly, or via tools like kubectl. The core Kubernetes API is flexible and can also be extended to support custom resources.1 - Workload Resources1.1 - PodPod is a collection of containers that can run on a host.apiVersion: v1import \"k8s.io/api/core/v1\"PodPod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.apiVersion: v1kind: Podmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (PodSpec)Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (PodStatus)Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusPodSpecPodSpec is a description of a pod.Containerscontainers ([]Container), requiredPatch strategy: merge on key nameMap: unique values on key name will be kept during a mergeList of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.initContainers ([]Container)Patch strategy: merge on key nameMap: unique values on key name will be kept during a mergeList of initializatio", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\n```\n\n1.12 - HorizontalPodAutoscaler | import \"k8s.io/api/autoscaling/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17846"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\n```\n\n1.13 - HorizontalPodAutoscaler | import \"k8s.io/api/autoscaling/v2\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17847"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\n```\n\n1.14 - PriorityClass | import \"k8s.io/api/scheduling/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17848"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\n```\n\n1.15 - DeviceTaintRule v1alpha3 | import \"k8s.io/api/resource/v1alpha3\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17849"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n1.16 - ResourceClaim | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17850"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n1.17 - ResourceClaimTemplate | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17851"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n1.18 - ResourceSlice | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17852"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\n```\n\n2.3 - EndpointSlice | import \"k8s.io/api/discovery/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17853"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n2.4 - Ingress | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17854"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n2.5 - IngressClass | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17855"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n3.3 - CSIDriver | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17856"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n3.4 - CSINode | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17857"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n3.5 - CSIStorageCapacity | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17858"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n3.8 - StorageClass | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17859"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storagemigration.k8s.io/v1alpha1\n```\n\n3.9 - StorageVersionMigration v1alpha1 | import \"k8s.io/api/storagemigration/v1alpha1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17860"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n3.11 - VolumeAttachment | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17861"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n3.12 - VolumeAttributesClass | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17862"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\n4.2 - TokenRequest | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17863"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\n4.3 - TokenReview | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17864"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\n```\n\n4.4 - CertificateSigningRequest | import \"k8s.io/api/certificates/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17865"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1beta1\n```\n\n4.5 - ClusterTrustBundle v1beta1 | import \"k8s.io/api/certificates/v1beta1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17866"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\n4.6 - SelfSubjectReview | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17867"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\n```\n\n4.7 - PodCertificateRequest v1alpha1 | import \"k8s.io/api/certificates/v1alpha1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17868"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.1 - LocalSubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17869"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.2 - SelfSubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17870"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.3 - SelfSubjectRulesReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17871"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.4 - SubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17872"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.5 - ClusterRole | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17873"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.6 - ClusterRoleBinding | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17874"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.7 - Role | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17875"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.8 - RoleBinding | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17876"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\n```\n\n6.1 - FlowSchema | import \"k8s.io/api/flowcontrol/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17877"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n6.4 - NetworkPolicy | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17878"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\n```\n\n6.5 - PodDisruptionBudget | import \"k8s.io/api/policy/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17879"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\n```\n\n6.6 - PriorityLevelConfiguration | import \"k8s.io/api/flowcontrol/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17880"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n6.7 - ValidatingAdmissionPolicy | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17881"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n6.8 - ValidatingAdmissionPolicyBinding | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17882"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\n```\n\n6.9 - MutatingAdmissionPolicy v1beta1 | import \"k8s.io/api/admissionregistration/v1beta1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17883"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\n```\n\n6.10 - MutatingAdmissionPolicyBinding v1alpha1 | import \"k8s.io/api/admissionregistration/v1alpha1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17884"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\n```\n\n7.1 - CustomResourceDefinition | import \"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17885"}
{"instruction": "Write a bash example for kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl get \\<shortname>\n```\n\n7.1 - CustomResourceDefinition | names.singular (string)", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17886"}
{"instruction": "Write a bash example for kubernetes api", "response": "Here's a bash example:\n\n```bash\nkubectl get \\<shortname>\n```\n\n7.1 - CustomResourceDefinition | acceptedNames.singular (string)", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17887"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n7.2 - DeviceClass | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17888"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n7.3 - MutatingWebhookConfiguration | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17889"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n7.4 - ValidatingWebhookConfiguration | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17890"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\n```\n\n8.1 - APIService | import \"k8s.io/kube-aggregator/pkg/apis/apiregistration/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17891"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: events.k8s.io/v1\n```\n\n8.3 - Event | import \"k8s.io/api/events/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17892"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n8.4 - IPAddress | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17893"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\n```\n\n8.5 - Lease | import \"k8s.io/api/coordination/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17894"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1beta1\n```\n\n8.6 - LeaseCandidate v1beta1 | import \"k8s.io/api/coordination/v1beta1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17895"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: node.k8s.io/v1\n```\n\n8.9 - RuntimeClass | import \"k8s.io/api/node/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17896"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n8.10 - ServiceCIDR | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17897"}
{"instruction": "Write a yaml example for kubernetes api", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\n```\n\n10.1 - MutatingAdmissionPolicyBindingList v1beta1 | import \"k8s.io/api/admissionregistration/v1beta1\"", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/kubernetes-api/_print/", "id": "k8s_00783_code_17898"}
{"instruction": "Explain container runtimes in Kubernetes", "response": "Container RuntimesNote: Dockershim has been removed from the Kubernetes project as of release 1.24. Read the Dockershim Removal FAQ for further details.You need to install a container runtime into each node in the cluster so that Pods can run there. This page outlines what is involved and describes related tasks for setting up nodes.Kubernetes 1.34 requires that you use a runtime that conforms with the Container Runtime Interface (CRI).See CRI version support for more information.This page provides an outline of how to use several common container runtimes with Kubernetes.containerdCRI-ODocker EngineMirantis Container RuntimeNote:Kubernetes releases before v1.24 included a direct integration with Docker Engine, using a component named dockershim. That special direct integration is no longer part of Kubernetes (this removal was announced as part of the v1.20 release). You can read Check whether Dockershim removal affects you to understand how this removal might affect you. To learn about migrating from using dockershim, see Migrating from dockershim.If you are running a version of Kubernetes other than v1.34, check the documentation for that version.Install and configure prerequisitesNetwork configurationBy default, the Linux kernel does not allow IPv4 packets to be routed between interfaces. Most Kubernetes cluster networking implementations will change this setting (if needed), but some might expect the administrator to do it for them. (Some might also expect other sysctl parameters to be set, kernel modules to be loaded, etc; consult the documentation for your specific network implementation.)Enable IPv4 packet forwardingTo manually enable IPv4 packet forwarding:# sysctl params required by setup, params persist across reboots cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.ipv4.ip_forward = 1 EOF # Apply sysctl params without reboot sudo sysctl --system Verify that net.ipv4.ip_forward is set to 1 with:sysctl net.ipv4.ip_forward cgroup driversOn Linux, control groups are used to constrain resources that are allocated to processes.Both the kubelet and the underlying container runtime need to interface with control groups to enforce resource management for pods and containers and set resources such as cpu/memory requests and limits. To interface with control groups, the kubelet and the container runtime need to use a cgroup driver. It's critical that the kubelet and the container runtime use the same cgroup driver and are configured the same.There are two cgroup drivers available:cgroupfssystemdcgroupfs driverThe cgroupfs driver is the default cgroup driver in the kubelet. When the cgroupfs driver is used, the kubelet and the container runtime directly interface with the cgroup filesystem to configure cgroups.The cgroupfs driver is not recommended when systemd is the init system because systemd expects a single cgroup manager on the system. Additionally, if you use cgroup v2, use the systemd cgroup driver instead of cgroupfs.systemd cgroup driverWhen systemd is chosen as the init system for a Linux distribution, the init process generates and consumes a root control group (cgroup) and acts as a cgroup manager.systemd has a tight integration with cgroups and allocates a cgroup per systemd unit. As a result, if you use systemd as the init system with the cgroupfs driver, the system gets two different cgroup managers.Two cgroup managers result in two views of the available and in-use resources in the system. In some cases, nodes that are configured to use cgroupfs for the kubelet and container runtime, but use systemd for the rest of the processes become unstable under resource pressure.The approach to mitigate this instability is to use systemd as the cgroup driver for the kubelet and the container runtime when systemd is the selected init system.To set systemd as the cgroup driver, edit the KubeletConfiguration option of cgroupDriver and set it to systemd. For example:apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfig", "category": "other", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes", "id": "k8s_00784"}
{"instruction": "Write a yaml example for container runtimes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\ncgroupDriver: systemd\n```\n\nContainer Runtimes | If you configure systemd as the cgroup driver for the kubelet, you must also configure systemd as the cgroup driver for the container runtime. Refer to the documentation for your container runtime for", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes", "id": "k8s_00784_code_17900"}
{"instruction": "Write a bash example for container runtimes", "response": "Here's a bash example:\n\n```bash\n# sysctl params required by setup, params persist across reboots\ncat <<EOF | sudo tee /etc/sysctl.d/k8s.conf\nnet.ipv4.ip_forward = 1\nEOF\n\n# Apply sysctl params without reboot\nsudo sysctl --system\n```\n\nContainer Runtimes | Verify that net.ipv4.ip_forward is set to 1 with:", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes", "id": "k8s_00784_code_17901"}
{"instruction": "Write a bash example for container runtimes", "response": "Here's a bash example:\n\n```bash\nsysctl net.ipv4.ip_forward\n```\n\nContainer Runtimes | On Linux, control groups are used to constrain resources that are allocated to processes.", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes", "id": "k8s_00784_code_17902"}
{"instruction": "Write a yaml example for container runtimes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\ncgroupDriver: systemd\n```\n\nContainer Runtimes | If you configure systemd as the cgroup driver for the kubelet, you must also configure systemd as the cgroup driver for the container runtime. Refer to the documentation for your container runtime for", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes", "id": "k8s_00784_code_17903"}
{"instruction": "Write a yaml example for container runtimes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\ncgroupDriver: systemd\n```\n\nContainer Runtimes | If you configure systemd as the cgroup driver for the kubelet, you must also configure systemd as the cgroup driver for the container runtime. Refer to the documentation for your container runtime for", "category": "other_code", "subcategory": "uncategorized", "source": "https://kubernetes.io/docs/setup/production-environment/container-runtimes", "id": "k8s_00784_code_17904"}
{"instruction": "What is the reference documentation for command line tool (kubectl)?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Command line tool (kubectl)1: Introduction to kubectl2: kubectl Quick Reference3: kubectl reference3.1: kubectl3.2: kubectl annotate3.3: kubectl api-resources3.4: kubectl api-versions3.5: kubectl apply3.5.1: kubectl apply edit-last-applied3.5.2: kubectl apply set-last-applied3.5.3: kubectl apply view-last-applied3.6: kubectl attach3.7: kubectl auth3.7.1: kubectl auth can-i3.7.2: kubectl auth reconcile3.7.3: kubectl auth whoami3.8: kubectl autoscale3.9: kubectl certificate3.9.1: kubectl certificate approve3.9.2: kubectl certificate deny3.10: kubectl cluster-info3.10.1: kubectl cluster-info dump3.11: kubectl completion3.12: kubectl config3.12.1: kubectl config current-context3.12.2: kubectl config delete-cluster3.12.3: kubectl config delete-context3.12.4: kubectl config delete-user3.12.5: kubectl config get-clusters3.12.6: kubectl config get-contexts3.12.7: kubectl config get-users3.12.8: kubectl config rename-context3.12.9: kubectl config set3.12.10: kubectl config set-cluster3.12.11: kubectl config set-context3.12.12: kubectl config set-credentials3.12.13: kubectl config unset3.12.14: kubectl config use-context3.12.15: kubectl config view3.13: kubectl cordon3.14: kubectl cp3.15: kubectl create3.15.1: kubectl create clusterrole3.15.2: kubectl create clusterrolebinding3.15.3: kubectl create configmap3.15.4: kubectl create cronjob3.15.5: kubectl create deployment3.15.6: kubectl create ingress3.15.7: kubectl create job3.15.8: kubectl create namespace3.15.9: kubectl create poddisruptionbudget3.15.10: kubectl create priorityclass3.15.11: kubectl create quota3.15.12: kubectl create role3.15.13: kubectl create rolebinding3.15.14: kubectl create secret3.15.15: kubectl create secret docker-registry3.15.16: kubectl create secret generic3.15.17: kubectl create secret tls3.15.18: kubectl create service3.15.19: kubectl create service clusterip3.15.20: kubectl create service externalname3.15.21: kubectl create service loadbalancer3.15.22: kubectl create service nodeport3.15.23: kubectl create serviceaccount3.15.24: kubectl create token3.16: kubectl debug3.17: kubectl delete3.18: kubectl describe3.19: kubectl diff3.20: kubectl drain3.21: kubectl edit3.22: kubectl events3.23: kubectl exec3.24: kubectl explain3.25: kubectl expose3.26: kubectl get3.27: kubectl kustomize3.28: kubectl label3.29: kubectl logs3.30: kubectl options3.31: kubectl patch3.32: kubectl plugin3.32.1: kubectl plugin list3.33: kubectl port-forward3.34: kubectl proxy3.35: kubectl replace3.36: kubectl rollout3.36.1: kubectl rollout history3.36.2: kubectl rollout pause3.36.3: kubectl rollout restart3.36.4: kubectl rollout resume3.36.5: kubectl rollout status3.36.6: kubectl rollout undo3.37: kubectl run3.38: kubectl scale3.39: kubectl set3.39.1: kubectl set env3.39.2: kubectl set image3.39.3: kubectl set resources3.39.4: kubectl set selector3.39.5: kubectl set serviceaccount3.39.6: kubectl set subject3.40: kubectl taint3.41: kubectl top3.41.1: kubectl top node3.41.2: kubectl top pod3.42: kubectl uncordon3.43: kubectl version3.44: kubectl wait4: kubectl Commands5: kubectl6: JSONPath Support7: kubectl for Docker Users8: kubectl Usage Conventions9: Kubectl user preferences (kuberc)Kubernetes provides a command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.This tool is named kubectl.For configuration, kubectl looks for a file named config in the $HOME/.kube directory. You can specify other kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.This overview covers kubectl syntax, describes the command operations, and provides common examples. For details about each command, including all the supported flags and subcommands, see the kubectl reference documentation.For installation instructions, see Installing kubectl; for a quick guide, see the cheat sheet. If you're used to usi", "category": "reference", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] [flags]\n```\n\nCommand line tool (kubectl) | where command, TYPE, NAME, and flags are:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17906"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod1\nkubectl get pods pod1\nkubectl get po pod1\n```\n\nCommand line tool (kubectl) | NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, for example kubectl get pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17907"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<namespace-name>\n```\n\nCommand line tool (kubectl) | The following table includes short descriptions and the general syntax for all of the kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17908"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] -o <output_format>\n```\n\nCommand line tool (kubectl) | Depending on the kubectl operation, the following output formats are supported:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17909"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-pod-13je7 -o yaml\n```\n\nCommand line tool (kubectl) | Remember: See the kubectl reference documentation for details about which output format is supported by each command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17910"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion\n```\n\nCommand line tool (kubectl) | Template file:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17911"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns-file=template.txt\n```\n\nCommand line tool (kubectl) | where the template.txt file contains:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17912"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> --server-print=false\n```\n\nCommand line tool (kubectl) | The output is similar to:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17913"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>\n```\n\nCommand line tool (kubectl) | To print a list of pods sorted by name, you run:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17914"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --sort-by=.metadata.name\n```\n\nCommand line tool (kubectl) | Use the following set of examples to help you familiarize yourself with running the commonly used kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17915"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\n2 - kubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17916"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17917"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17918"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17919"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17920"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17921"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17922"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17923"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17924"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17925"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n2 - kubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17926"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\n2 - kubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17927"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n3.2 - kubectl annotate | Select all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17928"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\n3.3 - kubectl api-resources | Limit to resources in the specified API group.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17929"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply (-f FILENAME | -k DIRECTORY)\n```\n\n3.5 - kubectl apply | Select all resources in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17930"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME)\n```\n\n3.5.1 - kubectl apply edit-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17931"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f FILENAME\n```\n\n3.5.2 - kubectl apply set-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17932"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)\n```\n\n3.5.3 - kubectl apply view-last-applied | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17933"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl attach (POD | TYPE/NAME) -c CONTAINER\n```\n\n3.6 - kubectl attach | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17934"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]\n```\n\n3.7.1 - kubectl auth can-i | If true, check the specified action in all namespaces.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17935"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f FILENAME\n```\n\n3.7.2 - kubectl auth reconcile | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17936"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY]\n```\n\n3.8 - kubectl autoscale | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17937"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND\n```\n\n3.9 - kubectl certificate | help for certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17938"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve (-f FILENAME | NAME)\n```\n\n3.9.1 - kubectl certificate approve | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17939"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny (-f FILENAME | NAME)\n```\n\n3.9.2 - kubectl certificate deny | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17940"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\n3.10 - kubectl cluster-info | help for cluster-info", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17941"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump [flags]\n```\n\n3.10.1 - kubectl cluster-info dump | If true, dump all namespaces. If true, --namespaces is ignored.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17942"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL\n```\n\n3.11 - kubectl completion | help for completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17943"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND\n```\n\n3.12 - kubectl config | help for config", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17944"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context [flags]\n```\n\n3.12.1 - kubectl config current-context | help for current-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17945"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster NAME\n```\n\n3.12.2 - kubectl config delete-cluster | help for delete-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17946"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context NAME\n```\n\n3.12.3 - kubectl config delete-context | help for delete-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17947"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user NAME\n```\n\n3.12.4 - kubectl config delete-user | help for delete-user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17948"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters [flags]\n```\n\n3.12.5 - kubectl config get-clusters | help for get-clusters", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17949"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts [(-o|--output=)name)]\n```\n\n3.12.6 - kubectl config get-contexts | help for get-contexts", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17950"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users [flags]\n```\n\n3.12.7 - kubectl config get-users | help for get-users", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17951"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context CONTEXT_NAME NEW_NAME\n```\n\n3.12.8 - kubectl config rename-context | help for rename-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17952"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set PROPERTY_NAME PROPERTY_VALUE\n```\n\n3.12.9 - kubectl config set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17953"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]\n```\n\n3.12.10 - kubectl config set-cluster | Path to certificate-authority file for the cluster entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17954"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]\n```\n\n3.12.11 - kubectl config set-context | cluster for the context entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17955"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value]\n```\n\n3.12.12 - kubectl config set-credentials | Auth provider for the user entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17956"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config unset PROPERTY_NAME\n```\n\n3.12.13 - kubectl config unset | help for unset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17957"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context CONTEXT_NAME\n```\n\n3.12.14 - kubectl config use-context | help for use-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17958"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config view [flags]\n```\n\n3.12.15 - kubectl config view | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17959"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest>\n```\n\n3.14 - kubectl cp | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17960"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME\n```\n\n3.15 - kubectl create | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17961"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n3.15.1 - kubectl create clusterrole | An aggregation label selector for combining ClusterRoles.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17962"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n3.15.2 - kubectl create clusterrolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17963"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n3.15.3 - kubectl create configmap | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17964"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]\n```\n\n3.15.4 - kubectl create cronjob | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17965"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment NAME --image=image -- [COMMAND] [args...]\n```\n\n3.15.5 - kubectl create deployment | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17966"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]\n```\n\n3.15.6 - kubectl create ingress | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17967"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]\n```\n\n3.15.7 - kubectl create job | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17968"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace NAME [--dry-run=server|client|none]\n```\n\n3.15.8 - kubectl create namespace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17969"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]\n```\n\n3.15.9 - kubectl create poddisruptionbudget | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17970"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]\n```\n\n3.15.10 - kubectl create priorityclass | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17971"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]\n```\n\n3.15.11 - kubectl create quota | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17972"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n3.15.12 - kubectl create role | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17973"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n3.15.13 - kubectl create rolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17974"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret (docker-registry | generic | tls)\n```\n\n3.15.14 - kubectl create secret | help for secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17975"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]\n```\n\n3.15.15 - kubectl create secret docker-registry | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17976"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n3.15.16 - kubectl create secret generic | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17977"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]\n```\n\n3.15.17 - kubectl create secret tls | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17978"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service [flags]\n```\n\n3.15.18 - kubectl create service | help for service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17979"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]\n```\n\n3.15.19 - kubectl create service clusterip | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17980"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname NAME --external-name external.name [--dry-run=server|client|none]\n```\n\n3.15.20 - kubectl create service externalname | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17981"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n3.15.21 - kubectl create service loadbalancer | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17982"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n3.15.22 - kubectl create service nodeport | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17983"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount NAME [--dry-run=server|client|none]\n```\n\n3.15.23 - kubectl create serviceaccount | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17984"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create token SERVICE_ACCOUNT_NAME\n```\n\n3.15.24 - kubectl create token | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17985"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]\n```\n\n3.16 - kubectl debug | If specified, everything after -- will be passed to the new container as Args instead of Command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17986"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])\n```\n\n3.17 - kubectl delete | Delete all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17987"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)\n```\n\n3.18 - kubectl describe | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17988"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME\n```\n\n3.19 - kubectl diff | Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17989"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl edit (RESOURCE/NAME | -f FILENAME)\n```\n\n3.21 - kubectl edit | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17990"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl events [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file] [--for TYPE/NAME] [--watch] [--types=Normal,Warning]\n```\n\n3.22 - kubectl events | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17991"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]\n```\n\n3.23 - kubectl exec | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17992"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2]\n```\n\n3.24 - kubectl explain | Get different explanations for particular API version (API group/version)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17993"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]\n```\n\n3.25 - kubectl expose | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17994"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]\n```\n\n3.26 - kubectl get | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17995"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize DIR [flags]\n```\n\n3.27 - kubectl kustomize | use the uid and gid of the command executor to run the function in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17996"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n3.28 - kubectl label | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17997"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]\n```\n\n3.29 - kubectl logs | Get all containers' logs in the pod(s).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17998"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl options [flags]\n```\n\n3.30 - kubectl options | help for options", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_17999"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]\n```\n\n3.31 - kubectl patch | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18000"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags]\n```\n\n3.32 - kubectl plugin | help for plugin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18001"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl plugin list [flags]\n```\n\n3.32.1 - kubectl plugin list | help for list", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18002"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]\n```\n\n3.33 - kubectl port-forward | Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18003"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]\n```\n\n3.34 - kubectl proxy | Regular expression for hosts that the proxy should accept.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18004"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\n3.35 - kubectl replace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18005"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND\n```\n\n3.36 - kubectl rollout | help for rollout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18006"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history (TYPE NAME | TYPE/NAME) [flags]\n```\n\n3.36.1 - kubectl rollout history | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18007"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause RESOURCE\n```\n\n3.36.2 - kubectl rollout pause | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18008"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart RESOURCE\n```\n\n3.36.3 - kubectl rollout restart | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18009"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume RESOURCE\n```\n\n3.36.4 - kubectl rollout resume | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18010"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status (TYPE NAME | TYPE/NAME) [flags]\n```\n\n3.36.5 - kubectl rollout status | Filename, directory, or URL to files identifying the resource to get from a server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18011"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]\n```\n\n3.36.6 - kubectl rollout undo | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18012"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]\n```\n\n3.37 - kubectl run | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18013"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)\n```\n\n3.38 - kubectl scale | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18014"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND\n```\n\n3.39 - kubectl set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18015"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N\n```\n\n3.39.1 - kubectl set env | If true, select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18016"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N\n```\n\n3.39.2 - kubectl set image | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18017"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS & --requests=REQUESTS]\n```\n\n3.39.3 - kubectl set resources | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18018"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]\n```\n\n3.39.4 - kubectl set selector | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18019"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT\n```\n\n3.39.5 - kubectl set serviceaccount | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18020"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n3.39.6 - kubectl set subject | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18021"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N\n```\n\n3.40 - kubectl taint | Select all nodes in the cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18022"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl top node [NAME | -l label]\n```\n\n3.41.1 - kubectl top node | help for node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18023"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl top pod [NAME | -l label]\n```\n\n3.41.2 - kubectl top pod | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18024"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE\n```\n\n3.42 - kubectl uncordon | Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18025"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl version [flags]\n```\n\n3.43 - kubectl version | If true, shows client version only (no server required).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18026"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]\n```\n\n3.44 - kubectl wait | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18027"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o json\nkubectl get pods -o=jsonpath='{@}'\nkubectl get pods -o=jsonpath='{.items[0]}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.name}'\nkubectl get pods -o=jsonpath=\"{.items[*]['metadata.name', 'status.capacity']}\"\nkubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.startTime}{\"\\n\"}{end}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\\.io/hostname}'\n```\n\n6 - JSONPath Support | Or, with a \"my_pod\" and \"my_namespace\" (adjust these names to your environment):", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18028"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}'\n```\n\n6 - JSONPath Support | On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote aro", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18029"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{'\\t'}{.status.startTime}{'\\n'}{end}\"\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\t\\\"}{.status.startTime}{\\\"\\n\\\"}{end}\"\n```\n\n6 - JSONPath Support | JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as jq.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18030"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18031"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl run [-i] [--tty] --attach <name> --image=<image>\n```\n\n7 - kubectl for Docker Users | Unlike docker run ..., if you specify --attach, then you attach stdin, stdout and stderr. You cannot control which streams are attached (docker -a ...). To detach from the container, you can type the", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18032"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker attach 55c103fa1296\n...\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18033"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it nginx-app-5jyvm\n...\n```\n\n7 - kubectl for Docker Users | To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18034"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker exec 55c103fa1296 cat /etc/hostname\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18035"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx-app-5jyvm -- cat /etc/hostname\n```\n\n7 - kubectl for Docker Users | To use interactive commands.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18036"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker exec -ti 55c103fa1296 /bin/sh\n# exit\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18037"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti nginx-app-5jyvm -- /bin/sh\n# exit\n```\n\n7 - kubectl for Docker Users | For more information, see Get a Shell to a Running Container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18038"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f nginx-app-zibvs\n```\n\n7 - kubectl for Docker Users | There is a slight difference between pods and containers; by default pods do not terminate if their processes exit. Instead the pods restart the process. This is similar to the docker run option --res", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18039"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous nginx-app-zibvs\n```\n\n7 - kubectl for Docker Users | For more information, see Logging Architecture.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18040"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker stop a9ec34d98787\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18041"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker rm a9ec34d98787\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18042"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-app\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18043"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18044"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-app\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18045"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n# Return nothing\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18046"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18047"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18048"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18049"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18050"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18051"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod example-pod1 example-pod2\n```\n\nCommand line tool (kubectl) | To specify multiple resource types individually: TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>.Example: kubectl get pod/example-pod1 replicationcontroller/example-rc1", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18052"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/example-pod1 replicationcontroller/example-rc1\n```\n\nCommand line tool (kubectl) | To specify resources with one or more files: -f file1 -f file2 -f file<#>", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18053"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get -f ./pod.yaml\n```\n\nCommand line tool (kubectl) | flags: Specifies optional flags. For example, you can use the -s or --server flags to specify the address and port of the Kubernetes API server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18054"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\nCommand line tool (kubectl) | Explicit use of --namespace <value> overrides this behavior.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18055"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl alpha SUBCOMMAND [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18056"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18057"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18058"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-versions [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18059"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f FILENAME [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18060"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl attach POD -c CONTAINER [-i] [-t] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18061"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl auth [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18062"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18063"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18064"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18065"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18066"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18067"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f FILENAME [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18068"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cordon NODE [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18069"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest> [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18070"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18071"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18072"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18073"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18074"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl drain NODE [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18075"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18076"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18077"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=false] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18078"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18079"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18080"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <dir> [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18081"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18082"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs POD [-c CONTAINER] [--follow] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18083"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18084"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18085"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18086"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18087"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18088"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18089"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client|none] [--overrides=inline-json] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18090"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18091"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18092"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18093"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl top (POD | NODE) [flags] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18094"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18095"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl version [--client] [flags]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18096"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available] [options]\n```\n\nCommand line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18097"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\nCommand line tool (kubectl) | Use the following sections for information about how you can format or sort the output of certain commands. For details about which commands support the various output options, see the kubectl referen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18098"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl describe node\n```\n\nCommand line tool (kubectl) | kubectl delete - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18099"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nchmod a+x ./kubectl-hello\n\n# and move it to a location in our PATH\nsudo mv ./kubectl-hello /usr/local/bin\nsudo chown root:root /usr/local/bin\n\n# You have now created and \"installed\" a kubectl plugin.\n# You can begin using this plugin by invoking it from kubectl as if it were a regular command\nkubectl hello\n```\n\nCommand line tool (kubectl) | In order to view all of the plugins that are available to kubectl, use the kubectl plugin list subcommand:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18100"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nsource <(kubectl completion bash) # set up autocomplete in bash into the current shell, bash-completion package should be installed first.\necho \"source <(kubectl completion bash)\" >> ~/.bashrc # add autocomplete permanently to your bash shell.\n```\n\n2 - kubectl Quick Reference | You can also use a shorthand alias for kubectl that also works with completion:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18101"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nalias k=kubectl\ncomplete -o default -F __start_kubectl k\n```\n\n2 - kubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18102"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nsource <(kubectl completion zsh)  # set up autocomplete in zsh into the current shell\necho '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell\n```\n\n2 - kubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18103"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\necho 'kubectl completion fish | source' > ~/.config/fish/completions/kubectl.fish && source ~/.config/fish/completions/kubectl.fish\n```\n\n2 - kubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18104"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\n2 - kubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18105"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18106"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\n# Get commands with basic output\nkubectl get services                          # List all services in the namespace\nkubectl get pods --all-namespaces             # List all pods in all namespaces\nkubectl get pods -o wide                      # List all pods in the current namespace, with more details\nkubectl get deployment my-dep                 # List a particular deployment\nkubectl get pods                              # List all pods in the namespace\nkubectl get pod my-pod -o yaml                # Get a pod's YAML\n\n# Describe commands with verbose output\nkubectl describe nodes my-node\nkubectl describe pods my-pod\n\n# List Services Sorted by Name\nkubectl get services --sort-by=.metadata.name\n\n# List pods Sorted by Restart Count\nkubectl get pods --sort-by='.status.containerStatuses[0].restartCount'\n\n# List PersistentVolumes sorted by capacity\nkubectl get pv --sort-by=.spec.capacity.storage\n\n# Get the version label of all pods with label app=cassandra\nkubectl get pods --selector=app=cassandra -o \\\n  jsonpath='{.items[*].metadata.labels.version}'\n\n# Retrieve the value of a key with dots, e.g. 'ca.crt'\nkubectl get configmap myconfig \\\n  -o jsonpath='{.data.ca\\.crt}'\n\n# Retrieve a base64 encoded value with dashes instead of underscores.\nkubectl get secret my-secret --template='{{index .data \"key-name-with-dashes\"}}'\n\n# Get all worker nodes (use a selector to exclude results that have a label\n# named 'node-role.kubernetes.io/control-plane')\nkubectl get node --selector='!node-role.kubernetes.io/control-plane'\n\n# Get all running pods in the namespace\nkubectl get pods --field-selector=status.phase=Running\n\n# Get ExternalIPs of all nodes\nkubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type==\"ExternalIP\")].address}'\n\n# List Names of Pods that belong to Particular RC\n# \"jq\" command useful for transformations that are too complex for jsonpath, it can be found at https://jqlang.github.io/jq/\nsel=${$(kubectl get rc my-rc --output=json | jq -j '.spec.selector | to_entries | .[] | \"\\(.key)=\\(.value),\"')%?}\necho $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name})\n\n# Show labels for all pods (or any other Kubernetes object that supports labelling)\nkubectl get pods --show-labels\n\n# Check which nodes are ready\nJSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \\\n && kubectl get nodes -o jsonpath=\"$JSONPATH\" | grep \"Ready=True\"\n\n# Check which nodes are ready with custom-columns\nkubectl get node -o custom-columns='NODE_NAME:.metadata.name,STATUS:.status.conditions[?(@.type==\"Ready\")].status'\n\n# Output decoded secrets without external tools\nkubectl get secret my-secret -o go-template='{{range $k,$v := .data}}{{\"### \"}}{{$k}}{{\"\\n\"}}{{$v|base64decode}}{{\"\\n\\n\"}}{{end}}'\n\n# List all Secrets currently in use by a pod\nkubectl get pods -o json | jq '.items[].spec.containers[].env[]?.valueFrom.secretKeyRef.name' | grep -v null | sort | uniq\n\n# List all containerIDs of initContainer of all pods\n# Helpful when cleaning up stopped containers, while avoiding removal of initContainers.\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*].status.initContainerStatuses[*]}{.containerID}{\"\\n\"}{end}' | cut -d/ -f3\n\n# List Events sorted by timestamp\nkubectl get events --sort-by=.metadata.creationTimestamp\n\n# List all warning events\nkubectl events --types=Warning\n\n# Compares the current state of the cluster against the state that the cluster would be in if the manifest was applied.\nkubectl diff -f ./my-manifest.yaml\n\n# Produce a period-delimited tree of all keys returned for nodes\n# Helpful when locating a key within a complex nested JSON structure\nkubectl get nodes -o json | jq -c 'paths|join(\".\")'\n\n# Produce a period-delimited tree of all keys returned for pods, etc\nkubectl get pods -o json | jq -c 'paths|join(\".\")'\n\n# Produce ENV for all pods, assuming you have a default container for the pods, default namespace and the `env` command is supported.\n# Helpful when running any supported command across all pods, not just `env`\nfor pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod -- env; done\n\n# Get a deployment's status subresource\nkubectl get deployment nginx-deployment --subresource=status\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18107"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18108"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\n# Partially update a node\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n\n# Update a container's image; spec.containers[*].name is required because it's a merge key\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n\n# Update a container's image using a json patch with positional arrays\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n\n# Disable a deployment livenessProbe using a json patch with positional arrays\nkubectl patch deployment valid-deployment  --type json   -p='[{\"op\": \"remove\", \"path\": \"/spec/template/spec/containers/0/livenessProbe\"}]'\n\n# Add a new element to a positional array\nkubectl patch sa default --type='json' -p='[{\"op\": \"add\", \"path\": \"/secrets/1\", \"value\": {\"name\": \"whatever\" } }]'\n\n# Update a deployment's replica count by patching its scale subresource\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":2}}'\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18109"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18110"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18111"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18112"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18113"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18114"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ntar cf - /tmp/foo | kubectl exec -i -n my-namespace my-pod -- tar xf - -C /tmp/bar           # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl exec -n my-namespace my-pod -- tar cf - /tmp/foo | tar xf - -C /tmp/bar    # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18115"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18116"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18117"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n2 - kubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18118"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\n2 - kubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18119"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\n# All images running in a cluster\nkubectl get pods -A -o=custom-columns='DATA:spec.containers[*].image'\n\n# All images running in namespace: default, grouped by Pod\nkubectl get pods --namespace default --output=custom-columns=\"NAME:.metadata.name,IMAGE:.spec.containers[*].image\"\n\n # All images excluding \"registry.k8s.io/coredns:1.6.2\"\nkubectl get pods -A -o=custom-columns='DATA:spec.containers[?(@.image!=\"registry.k8s.io/coredns:1.6.2\")].image'\n\n# All fields under metadata regardless of name\nkubectl get pods -A -o=custom-columns='DATA:metadata.*'\n```\n\n2 - kubectl Quick Reference | More examples in the kubectl reference documentation.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18120"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n3.2 - kubectl annotate | Select all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18121"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\n3.3 - kubectl api-resources | Limit to resources in the specified API group.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18122"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply (-f FILENAME | -k DIRECTORY)\n```\n\n3.5 - kubectl apply | Select all resources in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18123"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME)\n```\n\n3.5.1 - kubectl apply edit-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18124"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f FILENAME\n```\n\n3.5.2 - kubectl apply set-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18125"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)\n```\n\n3.5.3 - kubectl apply view-last-applied | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18126"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl attach (POD | TYPE/NAME) -c CONTAINER\n```\n\n3.6 - kubectl attach | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18127"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]\n```\n\n3.7.1 - kubectl auth can-i | If true, check the specified action in all namespaces.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18128"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f FILENAME\n```\n\n3.7.2 - kubectl auth reconcile | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18129"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY]\n```\n\n3.8 - kubectl autoscale | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18130"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND\n```\n\n3.9 - kubectl certificate | help for certificate", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18131"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve (-f FILENAME | NAME)\n```\n\n3.9.1 - kubectl certificate approve | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18132"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny (-f FILENAME | NAME)\n```\n\n3.9.2 - kubectl certificate deny | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18133"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\n3.10 - kubectl cluster-info | help for cluster-info", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18134"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump [flags]\n```\n\n3.10.1 - kubectl cluster-info dump | If true, dump all namespaces. If true, --namespaces is ignored.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18135"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL\n```\n\n3.11 - kubectl completion | help for completion", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18136"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND\n```\n\n3.12 - kubectl config | help for config", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18137"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context [flags]\n```\n\n3.12.1 - kubectl config current-context | help for current-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18138"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster NAME\n```\n\n3.12.2 - kubectl config delete-cluster | help for delete-cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18139"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context NAME\n```\n\n3.12.3 - kubectl config delete-context | help for delete-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18140"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user NAME\n```\n\n3.12.4 - kubectl config delete-user | help for delete-user", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18141"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters [flags]\n```\n\n3.12.5 - kubectl config get-clusters | help for get-clusters", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18142"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts [(-o|--output=)name)]\n```\n\n3.12.6 - kubectl config get-contexts | help for get-contexts", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18143"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users [flags]\n```\n\n3.12.7 - kubectl config get-users | help for get-users", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18144"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context CONTEXT_NAME NEW_NAME\n```\n\n3.12.8 - kubectl config rename-context | help for rename-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18145"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set PROPERTY_NAME PROPERTY_VALUE\n```\n\n3.12.9 - kubectl config set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18146"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]\n```\n\n3.12.10 - kubectl config set-cluster | Path to certificate-authority file for the cluster entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18147"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]\n```\n\n3.12.11 - kubectl config set-context | cluster for the context entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18148"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value]\n```\n\n3.12.12 - kubectl config set-credentials | Auth provider for the user entry in kubeconfig", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18149"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config unset PROPERTY_NAME\n```\n\n3.12.13 - kubectl config unset | help for unset", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18150"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context CONTEXT_NAME\n```\n\n3.12.14 - kubectl config use-context | help for use-context", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18151"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config view [flags]\n```\n\n3.12.15 - kubectl config view | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18152"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest>\n```\n\n3.14 - kubectl cp | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18153"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME\n```\n\n3.15 - kubectl create | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18154"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n3.15.1 - kubectl create clusterrole | An aggregation label selector for combining ClusterRoles.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18155"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n3.15.2 - kubectl create clusterrolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18156"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n3.15.3 - kubectl create configmap | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18157"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]\n```\n\n3.15.4 - kubectl create cronjob | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18158"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment NAME --image=image -- [COMMAND] [args...]\n```\n\n3.15.5 - kubectl create deployment | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18159"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]\n```\n\n3.15.6 - kubectl create ingress | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18160"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]\n```\n\n3.15.7 - kubectl create job | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18161"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace NAME [--dry-run=server|client|none]\n```\n\n3.15.8 - kubectl create namespace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18162"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]\n```\n\n3.15.9 - kubectl create poddisruptionbudget | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18163"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]\n```\n\n3.15.10 - kubectl create priorityclass | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18164"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]\n```\n\n3.15.11 - kubectl create quota | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18165"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n3.15.12 - kubectl create role | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18166"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n3.15.13 - kubectl create rolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18167"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret (docker-registry | generic | tls)\n```\n\n3.15.14 - kubectl create secret | help for secret", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18168"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]\n```\n\n3.15.15 - kubectl create secret docker-registry | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18169"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n3.15.16 - kubectl create secret generic | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18170"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]\n```\n\n3.15.17 - kubectl create secret tls | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18171"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service [flags]\n```\n\n3.15.18 - kubectl create service | help for service", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18172"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]\n```\n\n3.15.19 - kubectl create service clusterip | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18173"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname NAME --external-name external.name [--dry-run=server|client|none]\n```\n\n3.15.20 - kubectl create service externalname | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18174"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n3.15.21 - kubectl create service loadbalancer | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18175"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n3.15.22 - kubectl create service nodeport | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18176"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount NAME [--dry-run=server|client|none]\n```\n\n3.15.23 - kubectl create serviceaccount | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18177"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl create token SERVICE_ACCOUNT_NAME\n```\n\n3.15.24 - kubectl create token | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18178"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]\n```\n\n3.16 - kubectl debug | If specified, everything after -- will be passed to the new container as Args instead of Command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18179"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])\n```\n\n3.17 - kubectl delete | Delete all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18180"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)\n```\n\n3.18 - kubectl describe | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18181"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME\n```\n\n3.19 - kubectl diff | Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18182"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl edit (RESOURCE/NAME | -f FILENAME)\n```\n\n3.21 - kubectl edit | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18183"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl events [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file] [--for TYPE/NAME] [--watch] [--types=Normal,Warning]\n```\n\n3.22 - kubectl events | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18184"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]\n```\n\n3.23 - kubectl exec | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18185"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2]\n```\n\n3.24 - kubectl explain | Get different explanations for particular API version (API group/version)", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18186"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]\n```\n\n3.25 - kubectl expose | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18187"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]\n```\n\n3.26 - kubectl get | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18188"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize DIR [flags]\n```\n\n3.27 - kubectl kustomize | use the uid and gid of the command executor to run the function in the container", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18189"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n3.28 - kubectl label | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18190"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]\n```\n\n3.29 - kubectl logs | Get all containers' logs in the pod(s).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18191"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl options [flags]\n```\n\n3.30 - kubectl options | help for options", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18192"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]\n```\n\n3.31 - kubectl patch | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18193"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags]\n```\n\n3.32 - kubectl plugin | help for plugin", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18194"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl plugin list [flags]\n```\n\n3.32.1 - kubectl plugin list | help for list", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18195"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]\n```\n\n3.33 - kubectl port-forward | Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18196"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]\n```\n\n3.34 - kubectl proxy | Regular expression for hosts that the proxy should accept.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18197"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\n3.35 - kubectl replace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18198"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND\n```\n\n3.36 - kubectl rollout | help for rollout", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18199"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history (TYPE NAME | TYPE/NAME) [flags]\n```\n\n3.36.1 - kubectl rollout history | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18200"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause RESOURCE\n```\n\n3.36.2 - kubectl rollout pause | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18201"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart RESOURCE\n```\n\n3.36.3 - kubectl rollout restart | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18202"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume RESOURCE\n```\n\n3.36.4 - kubectl rollout resume | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18203"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status (TYPE NAME | TYPE/NAME) [flags]\n```\n\n3.36.5 - kubectl rollout status | Filename, directory, or URL to files identifying the resource to get from a server.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18204"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]\n```\n\n3.36.6 - kubectl rollout undo | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18205"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]\n```\n\n3.37 - kubectl run | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18206"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)\n```\n\n3.38 - kubectl scale | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18207"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND\n```\n\n3.39 - kubectl set | help for set", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18208"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N\n```\n\n3.39.1 - kubectl set env | If true, select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18209"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N\n```\n\n3.39.2 - kubectl set image | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18210"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS & --requests=REQUESTS]\n```\n\n3.39.3 - kubectl set resources | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18211"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]\n```\n\n3.39.4 - kubectl set selector | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18212"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT\n```\n\n3.39.5 - kubectl set serviceaccount | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18213"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n3.39.6 - kubectl set subject | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18214"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N\n```\n\n3.40 - kubectl taint | Select all nodes in the cluster", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18215"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl top node [NAME | -l label]\n```\n\n3.41.1 - kubectl top node | help for node", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18216"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl top pod [NAME | -l label]\n```\n\n3.41.2 - kubectl top pod | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18217"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE\n```\n\n3.42 - kubectl uncordon | Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18218"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl version [flags]\n```\n\n3.43 - kubectl version | If true, shows client version only (no server required).", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18219"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]\n```\n\n3.44 - kubectl wait | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18220"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl.config.k8s.io/v1beta1\n```\n\n9 - Kubectl user preferences (kuberc) | Within a kuberc configuration, the aliases section allows you to define custom shortcuts for kubectl commands, optionally with preset command line arguments and flags.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18221"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18222"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl getn pods -oyaml\n```\n\n9 - Kubectl user preferences (kuberc) | Full kuberc schema is available here.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18223"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18224"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace test-ns --output json\n```\n\n9 - Kubectl user preferences (kuberc) | This next example, will introduce a mechanism similar to prepending arguments, this time, though, we will append arguments to the end of the kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18225"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18226"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl run test-pod --namespace test-ns --image busybox -- custom-arg\n```\n\n9 - Kubectl user preferences (kuberc) | Within a kuberc configuration, defaults section lets you specify default values for command line arguments.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18227"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18228"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/test-pod\n```\n\n9 - Kubectl user preferences (kuberc) | The kubectl maintainers encourage you to adopt kuberc with the following defaults:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18229"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/test-pod --interactive=false\n```\n\n9 - Kubectl user preferences (kuberc) | The kubectl maintainers encourage you to adopt kuberc with the following defaults:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18230"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18231"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] [flags]\n```\n\nCommand line tool (kubectl) | where command, TYPE, NAME, and flags are:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18232"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod1\nkubectl get pods pod1\nkubectl get po pod1\n```\n\nCommand line tool (kubectl) | NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, for example kubectl get pods.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18233"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<namespace-name>\n```\n\nCommand line tool (kubectl) | The following table includes short descriptions and the general syntax for all of the kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18234"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] -o <output_format>\n```\n\nCommand line tool (kubectl) | Depending on the kubectl operation, the following output formats are supported:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18235"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-pod-13je7 -o yaml\n```\n\nCommand line tool (kubectl) | Remember: See the kubectl reference documentation for details about which output format is supported by each command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18236"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion\n```\n\nCommand line tool (kubectl) | Template file:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18237"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns-file=template.txt\n```\n\nCommand line tool (kubectl) | where the template.txt file contains:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18238"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> --server-print=false\n```\n\nCommand line tool (kubectl) | The output is similar to:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18239"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>\n```\n\nCommand line tool (kubectl) | To print a list of pods sorted by name, you run:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18240"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --sort-by=.metadata.name\n```\n\nCommand line tool (kubectl) | Use the following set of examples to help you familiarize yourself with running the commonly used kubectl operations:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18241"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\n2 - kubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18242"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18243"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\n2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18244"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18245"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18246"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18247"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18248"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18249"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18250"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\n2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18251"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n2 - kubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18252"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\n2 - kubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18253"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o json\nkubectl get pods -o=jsonpath='{@}'\nkubectl get pods -o=jsonpath='{.items[0]}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.name}'\nkubectl get pods -o=jsonpath=\"{.items[*]['metadata.name', 'status.capacity']}\"\nkubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.startTime}{\"\\n\"}{end}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\\.io/hostname}'\n```\n\n6 - JSONPath Support | Or, with a \"my_pod\" and \"my_namespace\" (adjust these names to your environment):", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18254"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}'\n```\n\n6 - JSONPath Support | On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote aro", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18255"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{'\\t'}{.status.startTime}{'\\n'}{end}\"\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\t\\\"}{.status.startTime}{\\\"\\n\\\"}{end}\"\n```\n\n6 - JSONPath Support | JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as jq.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18256"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18257"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl run [-i] [--tty] --attach <name> --image=<image>\n```\n\n7 - kubectl for Docker Users | Unlike docker run ..., if you specify --attach, then you attach stdin, stdout and stderr. You cannot control which streams are attached (docker -a ...). To detach from the container, you can type the", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18258"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker attach 55c103fa1296\n...\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18259"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it nginx-app-5jyvm\n...\n```\n\n7 - kubectl for Docker Users | To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18260"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker exec 55c103fa1296 cat /etc/hostname\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18261"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx-app-5jyvm -- cat /etc/hostname\n```\n\n7 - kubectl for Docker Users | To use interactive commands.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18262"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker exec -ti 55c103fa1296 /bin/sh\n# exit\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18263"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti nginx-app-5jyvm -- /bin/sh\n# exit\n```\n\n7 - kubectl for Docker Users | For more information, see Get a Shell to a Running Container.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18264"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f nginx-app-zibvs\n```\n\n7 - kubectl for Docker Users | There is a slight difference between pods and containers; by default pods do not terminate if their processes exit. Instead the pods restart the process. This is similar to the docker run option --res", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18265"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous nginx-app-zibvs\n```\n\n7 - kubectl for Docker Users | For more information, see Logging Architecture.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18266"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker stop a9ec34d98787\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18267"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\ndocker rm a9ec34d98787\n```\n\n7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18268"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-app\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18269"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18270"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-app\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18271"}
{"instruction": "Write a bash example for command line tool (kubectl)", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n# Return nothing\n```\n\n7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18272"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18273"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18274"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18275"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18276"}
{"instruction": "Write a yaml example for command line tool (kubectl)", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\n9 - Kubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "cli-reference", "source": "https://kubernetes.io/docs/reference/kubectl/_print/", "id": "k8s_00785_code_18277"}
{"instruction": "Explain the Kubernetes concept: Storage Classes", "response": "Storage ClassesThis document describes the concept of a StorageClass in Kubernetes. Familiarity with volumes and persistent volumes is suggested.A StorageClass provides a way for administrators to describe the classes of storage they offer. Different classes might map to quality-of-service levels, or to backup policies, or to arbitrary policies determined by the cluster administrators. Kubernetes itself is unopinionated about what classes represent.The Kubernetes concept of a storage class is similar to “profiles” in some other storage system designs.StorageClass objectsEach StorageClass contains the fields provisioner, parameters, and reclaimPolicy, which are used when a PersistentVolume belonging to the class needs to be dynamically provisioned to satisfy a PersistentVolumeClaim (PVC).The name of a StorageClass object is significant, and is how users can request a particular class. Administrators set the name and other parameters of a class when first creating StorageClass objects.As an administrator, you can specify a default StorageClass that applies to any PVCs that don't request a specific class. For more details, see the PersistentVolumeClaim concept.Here's an example of a StorageClass:storage/storageclass-low-latency.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: low-latency annotations: storageclass.kubernetes.io/is-default-class: \"false\" provisioner: csi-driver.example-vendor.example reclaimPolicy: Retain # default value is Delete allowVolumeExpansion: true mountOptions: - discard # this might enable UNMAP / TRIM at the block storage layer volumeBindingMode: WaitForFirstConsumer parameters: guaranteedReadWriteLatency: \"true\" # provider-specific Default StorageClassYou can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.When a PVC does not specify a storageClassName, the default StorageClass is used.If you set the storageclass.kubernetes.io/is-default-class annotation to true on more than one StorageClass in your cluster, and you then create a PersistentVolumeClaim with no storageClassName set, Kubernetes uses the most recently created default StorageClass.Note:You should try to only have one StorageClass in your cluster that is marked as the default. The reason that Kubernetes allows you to have multiple default StorageClasses is to allow for seamless migration.You can create a PersistentVolumeClaim without specifying a storageClassName for the new PVC, and you can do so even when no default StorageClass exists in your cluster. In this case, the new PVC creates as you defined it, and the storageClassName of that PVC remains unset until a default becomes available.You can have a cluster without any default StorageClass. If you don't mark any StorageClass as default (and one hasn't been set for you by, for example, a cloud provider), then Kubernetes cannot apply that defaulting for PersistentVolumeClaims that need it.If or when a default StorageClass becomes available, the control plane identifies any existing PVCs without storageClassName. For the PVCs that either have an empty value for storageClassName or do not have this key, the control plane then updates those PVCs to set storageClassName to match the new default StorageClass. If you have an existing PVC where the storageClassName is \"\", and you configure a default StorageClass, then this PVC will not get updated.In order to keep binding to PVs with storageClassName set to \"\" (while a default StorageClass is present), you need to set the storageClassName of the associated PVC to \"\".ProvisionerEach StorageClass has a provisioner that determines what volume plugin is used for provisioning PVs. This field must be specified.Volume PluginInternal ProvisionerConfig ExampleAzureFile✓Azure FileCephFS--FC--FlexVolume--iSCSI--Local-LocalNFS-NFSPortworxVolume✓Portworx VolumeRBD-Ceph RBDVsphereVolume✓vSphereYou are not restricted to specifying the \"internal\" ", "category": "concepts", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18279"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18280"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18281"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18282"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18283"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18284"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\nStorage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18285"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\nStorage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18286"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18287"}
{"instruction": "Write a bash example for storage classes", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\nStorage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18288"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18289"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18290"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18291"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18292"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18293"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18294"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18295"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18296"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18297"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\nStorage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18298"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\nStorage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18299"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18300"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18301"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18302"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18303"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass-low-latency.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18304"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: low-latency\n  annotations:\n    storageclass.kubernetes.io/is-default-class: \"false\"\nprovisioner: csi-driver.example-vendor.example\nreclaimPolicy: Retain # default value is Delete\nallowVolumeExpansion: true\nmountOptions:\n  - discard # this might enable UNMAP / TRIM at the block storage layer\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  guaranteedReadWriteLatency: \"true\" # provider-specific\n```\n\nStorage Classes | You can mark a StorageClass as the default for your cluster. For instructions on setting the default StorageClass, see Change the default StorageClass.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18305"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/pod-volume-binding.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18306"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: task-pv-pod\nspec:\n  nodeSelector:\n    kubernetes.io/hostname: kube-01\n  volumes:\n    - name: task-pv-storage\n      persistentVolumeClaim:\n        claimName: task-pv-claim\n  containers:\n    - name: task-pv-container\n      image: nginx\n      ports:\n        - containerPort: 80\n          name: \"http-server\"\n      volumeMounts:\n        - mountPath: \"/usr/share/nginx/html\"\n          name: task-pv-storage\n```\n\nStorage Classes | When a cluster operator specifies the WaitForFirstConsumer volume binding mode, it is no longer necessary to restrict provisioning to specific topologies in most situations. However, if still required", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18307"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-topology.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18308"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: standard\nprovisioner:  example.com/example\nparameters:\n  type: pd-standard\nvolumeBindingMode: WaitForFirstConsumer\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.kubernetes.io/zone\n    values:\n    - us-central-1a\n    - us-central-1b\n```\n\nStorage Classes | StorageClasses have parameters that describe volumes belonging to the storage class. Different parameters may be accepted depending on the provisioner. When a parameter is omitted, some default is use", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18309"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-ebs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18310"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: ebs-sc\nprovisioner: ebs.csi.aws.com\nvolumeBindingMode: WaitForFirstConsumer\nparameters:\n  csi.storage.k8s.io/fstype: xfs\n  type: io1\n  iopsPerGB: \"50\"\n  encrypted: \"true\"\n  tagSpecification_1: \"key1=value1\"\n  tagSpecification_2: \"key2=value2\"\nallowedTopologies:\n- matchLabelExpressions:\n  - key: topology.ebs.csi.aws.com/zone\n    values:\n    - us-east-2c\n```\n\nStorage Classes | tagSpecification: Tags with this prefix are applied to dynamically provisioned EBS volumes.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18311"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-aws-efs.yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18312"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: efs-sc\nprovisioner: efs.csi.aws.com\nparameters:\n  provisioningMode: efs-ap\n  fileSystemId: fs-92107410\n  directoryPerms: \"700\"\n```\n\nStorage Classes | For more details, refer to the AWS_EFS_CSI_Driver Dynamic Provisioning documentation.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18313"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-nfs.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18314"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: example-nfs\nprovisioner: example.com/external-nfs\nparameters:\n  server: nfs-server.example.com\n  path: /share\n  readOnly: \"false\"\n```\n\nStorage Classes | Kubernetes doesn't include an internal NFS provisioner. You need to use an external provisioner to create a StorageClass for NFS. Here are some examples:", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18315"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n```\n\nStorage Classes | diskformat: thin, zeroedthick and eagerzeroedthick. Default: \"thin\".", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18316"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/vsphere-volume\nparameters:\n  diskformat: zeroedthick\n  datastore: VSANDatastore\n```\n\nStorage Classes | datastore: The user can also specify the datastore in the StorageClass. The volume will be created on the datastore specified in the StorageClass, which in this case is VSANDatastore. This field is op", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18317"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-ceph-rbd.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18318"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: fast\nprovisioner: kubernetes.io/rbd # This provisioner is deprecated\nparameters:\n  monitors: 198.19.254.105:6789\n  adminId: kube\n  adminSecretName: ceph-secret\n  adminSecretNamespace: kube-system\n  pool: kube\n  userId: kube\n  userSecretName: ceph-secret-user\n  userSecretNamespace: default\n  fsType: ext4\n  imageFormat: \"2\"\n  imageFeatures: \"layering\"\n```\n\nStorage Classes | monitors: Ceph monitors, comma delimited. This parameter is required.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18319"}
{"instruction": "Write a bash example for storage classes", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic ceph-secret --type=\"kubernetes.io/rbd\" \\\n  --from-literal=key='QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==' \\\n  --namespace=kube-system\n```\n\nStorage Classes | userSecretNamespace: The namespace for userSecretName.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18320"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-azure-file.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18321"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: azurefile\nprovisioner: kubernetes.io/azure-file\nparameters:\n  skuName: Standard_LRS\n  location: eastus\n  storageAccount: azure_storage_account_name # example value\n```\n\nStorage Classes | During storage provisioning, a secret named by secretName is created for the mounting credentials. If the cluster has enabled both RBAC and Controller Roles, add the create permission of resource secr", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18322"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-portworx-volume.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18323"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: portworx-io-priority-high\nprovisioner: kubernetes.io/portworx-volume # This provisioner is deprecated\nparameters:\n  repl: \"1\"\n  snap_interval: \"70\"\n  priority_io: \"high\"\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18324"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\nstorage/storageclass/storageclass-local.yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18325"}
{"instruction": "Write a yaml example for storage classes", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: local-storage\nprovisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning\nvolumeBindingMode: WaitForFirstConsumer\n```\n\nStorage Classes | Local volumes do not support dynamic provisioning in Kubernetes 1.34; however a StorageClass should still be created to delay volume binding until a Pod is actually scheduled to the appropriate node.", "category": "concepts_code", "subcategory": "storage", "source": "https://kubernetes.io/docs/concepts/storage/storage-classes", "id": "k8s_00786_code_18326"}
{"instruction": "Explain the Kubernetes concept: Labels and Selectors", "response": "Labels and SelectorsLabels are key/value pairs that are attached to objects such as Pods. Labels are intended to be used to specify identifying attributes of objects that are meaningful and relevant to users, but do not directly imply semantics to the core system. Labels can be used to organize and to select subsets of objects. Labels can be attached to objects at creation time and subsequently added and modified at any time. Each object can have a set of key/value labels defined. Each Key must be unique for a given object.\"metadata\": { \"labels\": { \"key1\" : \"value1\", \"key2\" : \"value2\" } } Labels allow for efficient queries and watches and are ideal for use in UIs and CLIs. Non-identifying information should be recorded using annotations.MotivationLabels enable users to map their own organizational structures onto system objects in a loosely coupled fashion, without requiring clients to store these mappings.Service deployments and batch processing pipelines are often multi-dimensional entities (e.g., multiple partitions or deployments, multiple release tracks, multiple tiers, multiple micro-services per tier). Management often requires cross-cutting operations, which breaks encapsulation of strictly hierarchical representations, especially rigid hierarchies determined by the infrastructure rather than by users.Example labels:\"release\" : \"stable\", \"release\" : \"canary\"\"environment\" : \"dev\", \"environment\" : \"qa\", \"environment\" : \"production\"\"tier\" : \"frontend\", \"tier\" : \"backend\", \"tier\" : \"cache\"\"partition\" : \"customerA\", \"partition\" : \"customerB\"\"track\" : \"daily\", \"track\" : \"weekly\"These are examples of commonly used labels; you are free to develop your own conventions. Keep in mind that label Key must be unique for a given object.Syntax and character setLabels are key/value pairs. Valid label keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/).If the prefix is omitted, the label Key is presumed to be private to the user. Automated system components (e.g. kube-scheduler, kube-controller-manager, kube-apiserver, kubectl, or other third-party automation) which add labels to end-user objects must specify a prefix.The kubernetes.io/ and k8s.io/ prefixes are reserved for Kubernetes core components.Valid label value:must be 63 characters or less (can be empty),unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),could contain dashes (-), underscores (_), dots (.), and alphanumerics between.For example, here's a manifest for a Pod that has two labels environment: production and app: nginx:apiVersion: v1 kind: Pod metadata: name: label-demo labels: environment: production app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Label selectorsUnlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).Via a label selector, the client/user can identify a set of objects. The label selector is the core grouping primitive in Kubernetes.The API currently supports two types of selectors: equality-based and set-based. A label selector can be made of multiple requirements which are comma-separated. In the case of multiple requirements, all must be satisfied so the comma separator acts as a logical AND (&&) operator.The semantics of empty or non-specified selectors are dependent on the context, and API types that use selectors should document the validity and meaning of them.Note:For some API types, such as ReplicaSets, the label selectors of two instances must not overlap within a namespace, or the controller can see that as", "category": "concepts", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nLabels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18328"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\nLabels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18329"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\nLabels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18330"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\nLabels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18331"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\nLabels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18332"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\nLabels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18333"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18334"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18335"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\nLabels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18336"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\nLabels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18337"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nLabels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18338"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\nLabels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18339"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  component: redis\n```\n\nLabels and Selectors | This selector (respectively in json or yaml format) is equivalent to component=redis or component in (redis).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18340"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nselector:\n  matchLabels:\n    component: redis\n  matchExpressions:\n    - { key: tier, operator: In, values: [cache] }\n    - { key: environment, operator: NotIn, values: [dev] }\n```\n\nLabels and Selectors | matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values a", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18341"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: frontend\n```\n\nLabels and Selectors | while the Redis master and replica would have different tier labels, and perhaps even an additional role label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18342"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: master\n```\n\nLabels and Selectors | and", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18343"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\nlabels:\n  app: guestbook\n  tier: backend\n  role: replica\n```\n\nLabels and Selectors | The labels allow for slicing and dicing the resources along any dimension specified by a label:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18344"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: label-demo\n  labels:\n    environment: production\n    app: nginx\nspec:\n  containers:\n  - name: nginx\n    image: nginx:1.14.2\n    ports:\n    - containerPort: 80\n```\n\nLabels and Selectors | Unlike names and UIDs, labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18345"}
{"instruction": "Write a yaml example for labels and selectors", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-test\nspec:\n  containers:\n    - name: cuda-test\n      image: \"registry.k8s.io/cuda-vector-add:v0.1\"\n      resources:\n        limits:\n          nvidia.com/gpu: 1\n  nodeSelector:\n    accelerator: nvidia-tesla-p100\n```\n\nLabels and Selectors | Set-based label requirements allow filtering keys according to a set of values. Three kinds of operators are supported: in,notin and exists (only the key identifier). For example:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18346"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l environment=production,tier=frontend\n```\n\nLabels and Selectors | or using set-based requirements:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18347"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production),tier in (frontend)'\n```\n\nLabels and Selectors | As already mentioned set-based requirements are more expressive. For instance, they can implement the OR operator on values:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18348"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment in (production, qa)'\n```\n\nLabels and Selectors | or restricting negative matching via notin operator:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18349"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l 'environment,environment notin (frontend)'\n```\n\nLabels and Selectors | Some Kubernetes objects, such as services and replicationcontrollers, also use label selectors to specify sets of other resources, such as pods.", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18350"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f examples/guestbook/all-in-one/guestbook-all-in-one.yaml\nkubectl get pods -Lapp -Ltier -Lrole\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18351"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -lapp=guestbook,role=replica\n```\n\nLabels and Selectors | Sometimes you may want to relabel existing pods and other resources before creating new resources. This can be done with kubectl label. For example, if you want to label all your NGINX Pods as fronten", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18352"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl label pods -l app=nginx tier=fe\n```\n\nLabels and Selectors | This first filters all pods with the label \"app=nginx\", and then labels them with the \"tier=fe\". To see the pods you labeled, run:", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18353"}
{"instruction": "Write a bash example for labels and selectors", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -l app=nginx -L tier\n```\n\nLabels and Selectors | This outputs all \"app=nginx\" pods, with an additional label column of pods' tier (specified with -L or --label-columns).", "category": "concepts_code", "subcategory": "overview-architecture", "source": "https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", "id": "k8s_00787_code_18354"}
{"instruction": "Explain the Kubernetes concept: Container Runtime Interface (CRI)", "response": "Container Runtime Interface (CRI)The CRI is a plugin interface which enables the kubelet to use a wide variety of container runtimes, without having a need to recompile the cluster components.You need a working container runtime on each Node in your cluster, so that the kubelet can launch Pods and their containers.The Container Runtime Interface (CRI) is the main protocol for the communication between the kubelet and Container Runtime.The Kubernetes Container Runtime Interface (CRI) defines the main gRPC protocol for the communication between the node components kubelet and container runtime.The APIFEATURE STATE: Kubernetes v1.23 [stable]The kubelet acts as a client when connecting to the container runtime via gRPC. The runtime and image service endpoints have to be available in the container runtime, which can be configured separately within the kubelet by using the --container-runtime-endpoint command line flag.For Kubernetes v1.26 and later, the kubelet requires that the container runtime supports the v1 CRI API. If a container runtime does not support the v1 API, the kubelet will not register the node.UpgradingWhen upgrading the Kubernetes version on a node, the kubelet restarts. If the container runtime does not support the v1 CRI API, the kubelet will fail to register and report an error. If a gRPC re-dial is required because the container runtime has been upgraded, the runtime must support the v1 CRI API for the connection to succeed. This might require a restart of the kubelet after the container runtime is correctly configured.What's nextLearn more about the CRI protocol definition", "category": "concepts", "subcategory": "workloads-pods", "source": "https://kubernetes.io/docs/concepts/architecture/cri", "id": "k8s_00788"}
{"instruction": "What is the reference documentation for reference?", "response": "This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.Reference1: Glossary2: API Overview2.1: Declarative API Validation2.2: Kubernetes API Concepts2.3: Server-Side Apply2.4: Client Libraries2.5: Common Expression Language in Kubernetes2.6: Kubernetes Deprecation Policy2.7: Deprecated API Migration Guide2.8: Kubernetes API health endpoints3: API Access Control3.1: Authenticating3.2: Authenticating with Bootstrap Tokens3.3: Authorization3.4: Using RBAC Authorization3.5: Using Node Authorization3.6: Webhook Mode3.7: Using ABAC Authorization3.8: Admission Control in Kubernetes3.9: Dynamic Admission Control3.10: Managing Service Accounts3.11: Certificates and Certificate Signing Requests3.12: Mapping PodSecurityPolicies to Pod Security Standards3.13: Kubelet authentication/authorization3.14: TLS bootstrapping3.15: Mutating Admission Policy3.16: Validating Admission Policy4: Well-Known Labels, Annotations and Taints4.1: Audit Annotations5: Kubernetes API5.1: Workload Resources5.1.1: Pod5.1.2: Binding5.1.3: PodTemplate5.1.4: ReplicationController5.1.5: ReplicaSet5.1.6: Deployment5.1.7: StatefulSet5.1.8: ControllerRevision5.1.9: DaemonSet5.1.10: Job5.1.11: CronJob5.1.12: HorizontalPodAutoscaler5.1.13: HorizontalPodAutoscaler5.1.14: PriorityClass5.1.15: DeviceTaintRule v1alpha35.1.16: ResourceClaim5.1.17: ResourceClaimTemplate5.1.18: ResourceSlice5.2: Service Resources5.2.1: Service5.2.2: Endpoints5.2.3: EndpointSlice5.2.4: Ingress5.2.5: IngressClass5.3: Config and Storage Resources5.3.1: ConfigMap5.3.2: Secret5.3.3: CSIDriver5.3.4: CSINode5.3.5: CSIStorageCapacity5.3.6: PersistentVolumeClaim5.3.7: PersistentVolume5.3.8: StorageClass5.3.9: StorageVersionMigration v1alpha15.3.10: Volume5.3.11: VolumeAttachment5.3.12: VolumeAttributesClass5.4: Authentication Resources5.4.1: ServiceAccount5.4.2: TokenRequest5.4.3: TokenReview5.4.4: CertificateSigningRequest5.4.5: ClusterTrustBundle v1beta15.4.6: SelfSubjectReview5.4.7: PodCertificateRequest v1alpha15.5: Authorization Resources5.5.1: LocalSubjectAccessReview5.5.2: SelfSubjectAccessReview5.5.3: SelfSubjectRulesReview5.5.4: SubjectAccessReview5.5.5: ClusterRole5.5.6: ClusterRoleBinding5.5.7: Role5.5.8: RoleBinding5.6: Policy Resources5.6.1: FlowSchema5.6.2: LimitRange5.6.3: ResourceQuota5.6.4: NetworkPolicy5.6.5: PodDisruptionBudget5.6.6: PriorityLevelConfiguration5.6.7: ValidatingAdmissionPolicy5.6.8: ValidatingAdmissionPolicyBinding5.6.9: MutatingAdmissionPolicy v1beta15.6.10: MutatingAdmissionPolicyBinding v1alpha15.7: Extend Resources5.7.1: CustomResourceDefinition5.7.2: DeviceClass5.7.3: MutatingWebhookConfiguration5.7.4: ValidatingWebhookConfiguration5.8: Cluster Resources5.8.1: APIService5.8.2: ComponentStatus5.8.3: Event5.8.4: IPAddress5.8.5: Lease5.8.6: LeaseCandidate v1beta15.8.7: Namespace5.8.8: Node5.8.9: RuntimeClass5.8.10: ServiceCIDR5.9: Common Definitions5.9.1: DeleteOptions5.9.2: LabelSelector5.9.3: ListMeta5.9.4: LocalObjectReference5.9.5: NodeSelectorRequirement5.9.6: ObjectFieldSelector5.9.7: ObjectMeta5.9.8: ObjectReference5.9.9: Patch5.9.10: Quantity5.9.11: ResourceFieldSelector5.9.12: Status5.9.13: TypedLocalObjectReference5.10: Other Resources5.10.1: MutatingAdmissionPolicyBindingList v1beta15.11: Common Parameters6: Instrumentation6.1: Kubernetes Component SLI Metrics6.2: CRI Pod & Container Metrics6.3: Node metrics data6.4: Understand Pressure Stall Information (PSI) Metrics6.5: Kubernetes z-pages6.6: Kubernetes Metrics Reference7: Kubernetes Issues and Security7.1: Kubernetes Issue Tracker7.2: Kubernetes Security and Disclosure Information7.3: Official CVE Feed8: Node Reference Information8.1: Kubelet Checkpoint API8.2: Linux Kernel Version Requirements8.3: Articles on dockershim Removal and on Using CRI-compatible Runtimes8.4: Node Labels Populated By The Kubelet8.5: Local Files And Paths Used By The Kubelet8.6: Kubelet Configuration Directory Merging8.7: Kubelet Device Manager API Versions8.8: Kubelet ", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n200 OK\nContent-Type: application/yaml\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\n  …\n```\n\n2.2 - Kubernetes API Concepts | Kubernetes uses an envelope wrapper to encode Protobuf responses. That wrapper starts with a 4 byte magic number to help identify content in disk or in etcd as Protobuf (as opposed to JSON). The 4 byt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18357"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get services -A -o yaml\n```\n\n2.2 - Kubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18358"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\nitems:\n- apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: \"2021-06-03T14:54:12Z\"\n    labels:\n      component: apiserver\n      provider: kubernetes\n    name: kubernetes\n    namespace: default\n...\n- apiVersion: v1\n  kind: Service\n  metadata:\n    annotations:\n      prometheus.io/port: \"9153\"\n      prometheus.io/scrape: \"true\"\n    creationTimestamp: \"2021-06-03T14:54:14Z\"\n    labels:\n      k8s-app: kube-dns\n      kubernetes.io/cluster-service: \"true\"\n      kubernetes.io/name: CoreDNS\n    name: kube-dns\n    namespace: kube-system\n```\n\n2.2 - Kubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18359"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply # note capitalization: \"Apply\" (or \"Update\")\n    apiVersion: v1\n    time: \"2010-10-10T0:00:00Z\"\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n      f:data:\n        f:key: {}\ndata:\n  key: some value\n```\n\n2.3 - Server-Side Apply | That example ConfigMap object contains a single field management record in .metadata.managedFields. The field management record consists of basic information about the managing entity itself, plus det", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18360"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply\n    time: '2019-03-30T15:00:00.000Z'\n    apiVersion: v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n  - manager: kube-controller-manager\n    operation: Update\n    apiVersion: v1\n    time: '2019-03-30T16:00:00.000Z'\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:data:\n        f:key: {}\ndata:\n  key: new value\n```\n\n2.3 - Server-Side Apply | In this example, a second operation was run as an update by the manager called kube-controller-manager. The update request succeeded and changed a value in the data field, which caused that field's ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18361"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: example.com/v1\nkind: Foo\nmetadata:\n  name: foo-sample\n  managedFields:\n  - manager: \"manager-one\"\n    operation: Apply\n    apiVersion: example.com/v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:spec:\n        f:data: {}\nspec:\n  data:\n    key1: val1\n    key2: val2\n```\n\n2.3 - Server-Side Apply | Before spec.data gets changed from atomic to granular, manager-one owns the field spec.data, and all the fields within it (key1 and key2). When the CRD gets changed to make spec.data granular, manager", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18362"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18363"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/ssa/nginx-deployment.yaml --server-side\n```\n\n2.3 - Server-Side Apply | Then later, automatic scaling is enabled for the Deployment; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18364"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment nginx-deployment --cpu-percent=50 --min=1 --max=10\n```\n\n2.3 - Server-Side Apply | Now, the user would like to remove replicas from their configuration, so they don't accidentally fight with the HorizontalPodAutoscaler (HPA) and its controller. However, there is a race: it might tak", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18365"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Save this file as 'nginx-deployment-replicas-only.yaml'.\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n```\n\n2.3 - Server-Side Apply | The user applies that manifest using a private field manager name. In this example, the user picked handover-to-hpa:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18366"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginx-deployment-replicas-only.yaml \\\n  --server-side --field-manager=handover-to-hpa \\\n  --validate=false\n```\n\n2.3 - Server-Side Apply | If the apply results in a conflict with the HPA controller, then do nothing. The conflict indicates the controller has claimed the field earlier in the process than it sometimes does.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18367"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18368"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side [--dry-run=server]\n```\n\n2.3 - Server-Side Apply | By default, field management of the object transfers from client-side apply to kubectl server-side apply, without encountering conflicts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18369"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\n2.3 - Server-Side Apply | If you manage a resource with kubectl apply --server-side, you can downgrade to client-side apply directly with kubectl apply.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18370"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\n2.3 - Server-Side Apply | The PATCH verb (for an object that supports Server-Side Apply) accepts the unofficial application/apply-patch+yaml content type. Users of Server-Side Apply can send partially specified objects as YAML", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18371"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw='/readyz?verbose'\n```\n\n2.8 - Kubernetes API health endpoints | The output will look like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18372"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1 # this apiVersion is relevant as of Kubernetes 1.9\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  namespace: default\nspec:\n  replicas: 3\n  template:\n    metadata:\n    # ...\n    spec:\n      serviceAccountName: bob-the-bot\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n3.1 - Authenticating | Service account bearer tokens are perfectly valid to use outside the cluster and can be used to create identities for long standing jobs that wish to talk to the Kubernetes API. To manually create a s", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18373"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount jenkins\n```\n\n3.1 - Authenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18374"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create token jenkins\n```\n\n3.1 - Authenticating | The created token is a signed JSON Web Token (JWT).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18375"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\n# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.\n# the maximum number of allowed authenticators is 64.\njwt:\n- issuer:\n    # url must be unique across all authenticators.\n    # url must not conflict with issuer configured in --service-account-issuer.\n    url: https://example.com # Same as --oidc-issuer-url.\n    # discoveryURL, if specified, overrides the URL used to fetch discovery\n    # information instead of using \"{url}/.well-known/openid-configuration\".\n    # The exact value specified is used, so \"/.well-known/openid-configuration\"\n    # must be included in discoveryURL if needed.\n    #\n    # The \"issuer\" field in the fetched discovery information must match the \"issuer.url\" field\n    # in the AuthenticationConfiguration and will be used to validate the \"iss\" claim in the presented JWT.\n    # This is for scenarios where the well-known and jwks endpoints are hosted at a different\n    # location than the issuer (such as locally in the cluster).\n    # discoveryURL must be different from url if specified and must be unique across all authenticators.\n    discoveryURL: https://discovery.example.com/.well-known/openid-configuration\n    # PEM encoded CA certificates used to validate the connection when fetching\n    # discovery information. If not set, the system verifier will be used.\n    # Same value as the content of the file referenced by the --oidc-ca-file command line argument.\n    certificateAuthority: <PEM encoded CA certificates>    \n    # audiences is the set of acceptable audiences the JWT must be issued to.\n    # At least one of the entries must match the \"aud\" claim in presented JWTs.\n    audiences:\n    - my-app # Same as --oidc-client-id.\n    - my-other-app\n    # this is required to be set to \"MatchAny\" when multiple audiences are specified.\n    audienceMatchPolicy: MatchAny\n    # egressSelectorType is an indicator of which egress selection should be used for sending all traffic related\n    # to this issuer (discovery, JWKS, distributed claims, etc).  If unspecified, no custom dialer is used.\n    # The StructuredAuthenticationConfigurationEgressSelector feature gate must be enabled\n    # before you can use the egressSelectorType field.\n    # When specified, the valid choices are \"controlplane\" and \"cluster\".  These correspond to the associated\n    # values in the --egress-selector-config-file.\n    # - controlplane: for traffic intended to go to the control plane.\n    # - cluster: for traffic intended to go to the system being managed by Kubernetes.\n    egressSelectorType: <egress-selector-type>\n  # rules applied to validate token claims to authenticate users.\n  claimValidationRules:\n    # Same as --oidc-required-claim key=value.\n  - claim: hd\n    requiredValue: example.com\n    # Instead of claim and requiredValue, you can use expression to validate the claim.\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for validation to succeed.\n  - expression: 'claims.hd == \"example.com\"'\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: the hd claim must be set to example.com\n  - expression: 'claims.exp - claims.nbf <= 86400'\n    message: total token lifetime must not exceed 24 hours\n  claimMappings:\n    # username represents an option for the username attribute.\n    # This is the only required attribute.\n    username:\n      # Same as --oidc-username-claim. Mutually exclusive with username.expression.\n      claim: \"sub\"\n      # Same as --oidc-username-prefix. Mutually exclusive with username.expression.\n      # if username.claim is set, username.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with username.claim and username.prefix.\n      # expression is a CEL expression that evaluates to a string.\n      #\n      # 1.  If username.expression uses 'claims.email', then 'claims.email_verified' must be used in\n      #     username.expression or extra[*].valueExpression or claimValidationRules[*].expression.\n      #     An example claim validation rule expression that matches the validation automatically\n      #     applied when username.claim is set to 'email' is 'claims.?email_verified.orValue(true) == true'.\n      #     By explicitly comparing the value to true, we let type-checking see the result will be a boolean, and\n      #     to make sure a non-boolean email_verified claim will be caught at runtime.\n      # 2.  If the username asserted based on username.expression is the empty string, the authentication\n      #     request will fail.\n      expression: 'claims.username + \":external-user\"'\n    # groups represents an option for the groups attribute.\n    groups:\n      # Same as --oidc-groups-claim. Mutually exclusive with groups.expression.\n      claim: \"sub\"\n      # Same as --oidc-groups-prefix. Mutually exclusive with groups.expression.\n      # if groups.claim is set, groups.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with groups.claim and groups.prefix.\n      # expression is a CEL expression that evaluates to a string or a list of strings.\n      expression: 'claims.roles.split(\",\")'\n    # uid represents an option for the uid attribute.\n    uid:\n      # Mutually exclusive with uid.expression.\n      claim: 'sub'\n      # Mutually exclusive with uid.claim\n      # expression is a CEL expression that evaluates to a string.\n      expression: 'claims.sub'\n    # extra attributes to be added to the UserInfo object. Keys must be domain-prefix path and must be unique.\n    extra:\n      # key is a string to use as the extra attribute key.\n      # key must be a domain-prefix path (e.g. example.org/foo). All characters before the first \"/\" must be a valid\n      # subdomain as defined by RFC 1123. All characters trailing the first \"/\" must\n      # be valid HTTP Path characters as defined by RFC 3986.\n      # k8s.io, kubernetes.io and their subdomains are reserved for Kubernetes use and cannot be used.\n      # key must be lowercase and unique across all extra attributes.\n    - key: 'example.com/tenant'\n      # valueExpression is a CEL expression that evaluates to a string or a list of strings.\n      valueExpression: 'claims.tenant'\n  # validation rules applied to the final user object.\n  userValidationRules:\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for the user to be valid.\n  - expression: \"!user.username.startsWith('system:')\"\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: 'username cannot used reserved system: prefix'\n  - expression: \"user.groups.all(group, !group.startsWith('system:'))\"\n    message: 'groups cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | Claim validation rule expression", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18376"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18377"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"' # the token below does not have this claim, so validation will fail.\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18378"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"'\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: '\"system:\" + claims.username' # this will prefix the username with \"system:\" and will fail user validation.\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the username will be system:foo and expression will evaluate to false, so validation will fail.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18379"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials USER_NAME \\\n   --auth-provider=oidc \\\n   --auth-provider-arg=idp-issuer-url=( issuer url ) \\\n   --auth-provider-arg=client-id=( your client id ) \\\n   --auth-provider-arg=client-secret=( your client secret ) \\\n   --auth-provider-arg=refresh-token=( your refresh token ) \\\n   --auth-provider-arg=idp-certificate-authority=( path to your ca certificate ) \\\n   --auth-provider-arg=id-token=( your id_token )\n```\n\n3.1 - Authenticating | As an example, running the below command after authenticating to your identity provider:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18380"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials mmosley  \\\n        --auth-provider=oidc  \\\n        --auth-provider-arg=idp-issuer-url=https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP  \\\n        --auth-provider-arg=client-id=kubernetes  \\\n        --auth-provider-arg=client-secret=1db158f6-177d-4d9c-8a8b-d36869918ec5  \\\n        --auth-provider-arg=refresh-token=q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXqHega4GAXlF+ma+vmYpFcHe5eZR+slBFpZKtQA= \\\n        --auth-provider-arg=idp-certificate-authority=/root/ca.pem \\\n        --auth-provider-arg=id-token=eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n```\n\n3.1 - Authenticating | Which would produce the below configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18381"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl --token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL21sYi50cmVtb2xvLmxhbjo4MDQzL2F1dGgvaWRwL29pZGMiLCJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNDc0NTk2NjY5LCJqdGkiOiI2RDUzNXoxUEpFNjJOR3QxaWVyYm9RIiwiaWF0IjoxNDc0NTk2MzY5LCJuYmYiOjE0NzQ1OTYyNDksInN1YiI6Im13aW5kdSIsInVzZXJfcm9sZSI6WyJ1c2VycyIsIm5ldy1uYW1lc3BhY2Utdmlld2VyIl0sImVtYWlsIjoibXdpbmR1QG5vbW9yZWplZGkuY29tIn0.f2As579n9VNoaKzoF-dOQGmXkFKf1FMyNV0-va_B63jn-_n9LGSCca_6IVMP8pO-Zb4KvRqGyTP0r3HkHxYy5c81AnIh8ijarruczl-TK_yF5akjSTHFZD-0gRzlevBDiH8Q79NAr-ky0P4iIXS8lY9Vnjch5MF74Zx0c3alKJHJUnnpjIACByfF2SCaYzbWFMUNat-K1PaUk5-ujMBG7yYnr95xD-63n8CO8teGUAAEMx6zRjzfhnhbzX-ajwZLGwGUBT4WqjMs70-6a7_8gZmLZb2az1cZynkFRj2BaCkVT3A2RrjeEwZEtGXlMqKJ1_I2ulrOVsYx01_yD35-rw get nodes\n```\n\n3.1 - Authenticating | Kubernetes webhook authentication is a mechanism to make an HTTP callout for verifying bearer tokens.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18382"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authn-service\n    cluster:\n      certificate-authority: /path/to/ca.pem         # CA for verifying the remote service.\n      server: https://authn.example.com/authenticate # URL of remote service to query. 'https' recommended for production.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authn-service\n    user: name-of-api-server\n  name: webhook\n```\n\n3.1 - Authenticating | When a client attempts to authenticate with the API server using a bearer token as discussed above, the authentication webhook POSTs a JSON-serialized TokenReview object containing the token to the re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18383"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\nanonymous:\n  enabled: true\n  conditions:\n  - path: /livez\n  - path: /readyz\n  - path: /healthz\n```\n\n3.1 - Authenticating | In the configuration above only the /livez, /readyz and /healthz endpoints are reachable by anonymous requests. Any other endpoints will not be reachable even if it is allowed by RBAC configuration.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18384"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl drain mynode --as=superman --as-group=system:masters\n```\n\n3.1 - Authenticating | To impersonate a user, group, user identifier (UID) or extra fields, the impersonating user must have the ability to perform the impersonate verb on the kind of attribute being impersonated (\"user\", \"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18385"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: impersonator\nrules:\n- apiGroups: [\"\"]\n  resources: [\"users\", \"groups\", \"serviceaccounts\"]\n  verbs: [\"impersonate\"]\n```\n\n3.1 - Authenticating | For impersonation, extra fields and impersonated UIDs are both under the \"authentication.k8s.io\" apiGroup. Extra fields are evaluated as sub-resources of the resource \"userextras\". To allow a user to", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18386"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: scopes-and-uid-impersonator\nrules:\n# Can set \"Impersonate-Extra-scopes\" header and the \"Impersonate-Uid\" header.\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\", \"uids\"]\n  verbs: [\"impersonate\"]\n```\n\n3.1 - Authenticating | The values of impersonation headers can also be restricted by limiting the set of resourceNames a resource can take.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18387"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: limited-impersonator\nrules:\n# Can impersonate the user \"jane.doe@example.com\"\n- apiGroups: [\"\"]\n  resources: [\"users\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"jane.doe@example.com\"]\n\n# Can impersonate the groups \"developers\" and \"admins\"\n- apiGroups: [\"\"]\n  resources: [\"groups\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"developers\",\"admins\"]\n\n# Can impersonate the extras field \"scopes\" with the values \"view\" and \"development\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"view\", \"development\"]\n\n# Can impersonate the uid \"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"uids\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"]\n```\n\n3.1 - Authenticating | k8s.io/client-go and tools using it such as kubectl and kubelet are able to execute an external command to receive user credentials.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18388"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1beta1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Required.\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\n3.1 - Authenticating | apiVersion: v1 kind: Config users: - name: my-user user: exec: # Command to execute. Required. command: \"example-client-go-exec-plugin\" # API version to use when decoding the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18389"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1beta1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Optional.\n      # Defaults to \"IfAvailable\".\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\n3.1 - Authenticating | Relative command paths are interpreted as relative to the directory of the config file. If KUBECONFIG is set to /home/jane/kubeconfig and the exec command is ./bin/example-client-go-exec-plugin, the b", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18390"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n- name: my-user\n  user:\n    exec:\n      # Path relative to the directory of the kubeconfig\n      command: \"./bin/example-client-go-exec-plugin\"\n      apiVersion: \"client.authentication.k8s.io/v1\"\n      interactiveMode: Never\n```\n\n3.1 - Authenticating | The executed command prints an ExecCredential object to stdout. k8s.io/client-go authenticates against the Kubernetes API using the returned credentials in the status. The executed command is passed a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18391"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: SelfSubjectReview\nstatus:\n  userInfo:\n    username: jane.doe\n    uid: b79dbf30-0c6a-11ed-861d-0242ac120002\n    groups:\n    - students\n    - teachers\n    - system:authenticated\n    extra:\n      skills:\n      - reading\n      - learning\n      subjects:\n      - math\n      - sports\n```\n\n3.1 - Authenticating | This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster, for example, if you use webhook token authentication or authenticating proxy.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18392"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Name MUST be of form \"bootstrap-token-<token id>\"\n  name: bootstrap-token-07401b\n  namespace: kube-system\n\n# Type MUST be 'bootstrap.kubernetes.io/token'\ntype: bootstrap.kubernetes.io/token\nstringData:\n  # Human readable description. Optional.\n  description: \"The default bootstrap token generated by 'kubeadm init'.\"\n\n  # Token ID and secret. Required.\n  token-id: 07401b\n  token-secret: f395accd246ae52d\n\n  # Expiration. Optional.\n  expiration: 2017-03-10T03:22:11Z\n\n  # Allowed usages.\n  usage-bootstrap-authentication: \"true\"\n  usage-bootstrap-signing: \"true\"\n\n  # Extra groups to authenticate the token as. Must start with \"system:bootstrappers:\"\n  auth-extra-groups: system:bootstrappers:worker,system:bootstrappers:ingress\n```\n\n3.2 - Authenticating with Bootstrap Tokens | The type of the secret must be bootstrap.kubernetes.io/token and the name must be bootstrap-token-<token id>. It must also exist in the kube-system namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18393"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cluster-info\n  namespace: kube-public\ndata:\n  jws-kubeconfig-07401b: eyJhbGciOiJIUzI1NiIsImtpZCI6IjA3NDAxYiJ9..tYEfbo6zDNo40MQE07aZcQX2m3EB2rO3NuXtxVMYm9U\n  kubeconfig: |\n    apiVersion: v1\n    clusters:\n    - cluster:\n        certificate-authority-data: <really long certificate data>\n        server: https://10.138.0.2:6443\n      name: \"\"\n    contexts: []\n    current-context: \"\"\n    kind: Config\n    preferences: {}\n    users: []\n```\n\n3.2 - Authenticating with Bootstrap Tokens | The kubeconfig member of the ConfigMap is a config file with only the cluster information filled out. The key thing being communicated here is the certificate-authority-data. This may be expanded in t", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18394"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# DO NOT USE THE CONFIG AS IS. THIS IS AN EXAMPLE.\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  - type: Webhook\n    # Name used to describe the authorizer\n    # This is explicitly used in monitoring machinery for metrics\n    # Note:\n    #   - Validation for this field is similar to how K8s labels are validated today.\n    # Required, with no default\n    name: webhook\n    webhook:\n      # The duration to cache 'authorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag\n      # Default: 5m0s\n      authorizedTTL: 30s\n      # If set to false, 'authorized' responses from the webhook are not cached\n      # and the specified authorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag to `0`.\n      # Note: Setting authorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheAuthorizedRequests: true\n      # The duration to cache 'unauthorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag\n      # Default: 30s\n      unauthorizedTTL: 30s\n      # If set to false, 'unauthorized' responses from the webhook are not cached\n      # and the specified unauthorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag to `0`.\n      # Note: Setting unauthorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheUnauthorizedRequests: true\n      # Timeout for the webhook request\n      # Maximum allowed is 30s.\n      # Required, with no default.\n      timeout: 3s\n      # The API version of the authorization.k8s.io SubjectAccessReview to\n      # send to and expect from the webhook.\n      # Same as setting `--authorization-webhook-version` flag\n      # Required, with no default\n      # Valid values: v1beta1, v1\n      subjectAccessReviewVersion: v1\n      # MatchConditionSubjectAccessReviewVersion specifies the SubjectAccessReview\n      # version the CEL expressions are evaluated against\n      # Valid values: v1\n      # Required, no default value\n      matchConditionSubjectAccessReviewVersion: v1\n      # Controls the authorization decision when a webhook request fails to\n      # complete or returns a malformed response or errors evaluating\n      # matchConditions.\n      # Valid values:\n      #   - NoOpinion: continue to subsequent authorizers to see if one of\n      #     them allows the request\n      #   - Deny: reject the request without consulting subsequent authorizers\n      # Required, with no default.\n      failurePolicy: Deny\n      connectionInfo:\n        # Controls how the webhook should communicate with the server.\n        # Valid values:\n        # - KubeConfigFile: use the file specified in kubeConfigFile to locate the\n        #   server.\n        # - InClusterConfig: use the in-cluster configuration to call the\n        #   SubjectAccessReview API hosted by kube-apiserver. This mode is not\n        #   allowed for kube-apiserver.\n        type: KubeConfigFile\n        # Path to KubeConfigFile for connection info\n        # Required, if connectionInfo.Type is KubeConfigFile\n        kubeConfigFile: /kube-system-authz-webhook.yaml\n        # matchConditions is a list of conditions that must be met for a request to be sent to this\n        # webhook. An empty list of matchConditions matches all requests.\n        # There are a maximum of 64 match conditions allowed.\n        #\n        # The exact matching logic is (in order):\n        #   1. If at least one matchCondition evaluates to FALSE, then the webhook is skipped.\n        #   2. If ALL matchConditions evaluate to TRUE, then the webhook is called.\n        #   3. If at least one matchCondition evaluates to an error (but none are FALSE):\n        #      - If failurePolicy=Deny, then the webhook rejects the request\n        #      - If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped\n      matchConditions:\n      # expression represents the expression which will be evaluated by CEL. Must evaluate to bool.\n      # CEL expressions have access to the contents of the SubjectAccessReview in v1 version.\n      # If version specified by subjectAccessReviewVersion in the request variable is v1beta1,\n      # the contents would be converted to the v1 version before evaluating the CEL expression.\n      #\n      # Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n      #\n      # only send resource requests to the webhook\n      - expression: has(request.resourceAttributes)\n      # only intercept requests to kube-system\n      - expression: request.resourceAttributes.namespace == 'kube-system'\n      # don't intercept requests from kube-system service accounts\n      - expression: \"!('system:serviceaccounts:kube-system' in request.groups)\"\n  - type: Node\n    name: node\n  - type: RBAC\n    name: rbac\n  - type: Webhook\n    name: in-cluster-authorizer\n    webhook:\n      authorizedTTL: 5m\n      unauthorizedTTL: 30s\n      timeout: 3s\n      subjectAccessReviewVersion: v1\n      failurePolicy: NoOpinion\n      connectionInfo:\n        type: InClusterConfig\n```\n\n3.3 - Authorization | When configuring the authorizer chain using a configuration file, make sure all the control plane nodes have the same file contents. Take a note of the API server configuration when upgrading / downgr", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18395"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace dev\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18396"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace prod\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18397"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list secrets --namespace dev --as dave\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18398"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list pods \\\n    --namespace target \\\n    --as system:serviceaccount:dev:dev-sa\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18399"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f - -o yaml << EOF\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    verb: create\n    namespace: dev\nEOF\n```\n\n3.3 - Authorization | The generated SelfSubjectAccessReview is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18400"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nmetadata:\n  creationTimestamp: null\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    namespace: dev\n    verb: create\nstatus:\n  allowed: true\n  denied: false\n```\n\n3.3 - Authorization | Role-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within your organization.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18401"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: RBAC\n  ...\n```\n\n3.4 - Using RBAC Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes RBAC; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18402"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18403"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18404"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18405"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18406"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18407"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-and-pod-logs-reader\nrules:\n- apiGroups: [\"\"]\n  resources: [\"pods\", \"pods/log\"]\n  verbs: [\"get\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | You can also refer to resources by name for certain requests through the resourceNames list. When specified, requests can be restricted to individual instances of a resource. Here is an example that r", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18408"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: configmap-updater\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-configmap\"]\n  verbs: [\"update\", \"get\"]\n```\n\n3.4 - Using RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18409"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE\nrules:\n- apiGroups: [\"example.com\"]\n  resources: [\"*\"]\n  verbs: [\"*\"]\n```\n\n3.4 - Using RBAC Authorization | You can aggregate several ClusterRoles into one combined ClusterRole. A controller, running as part of the cluster control plane, watches for ClusterRole objects with an aggregationRule set. The aggre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18410"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring\naggregationRule:\n  clusterRoleSelectors:\n  - matchLabels:\n      rbac.example.com/aggregate-to-monitoring: \"true\"\nrules: [] # The control plane automatically fills in the rules\n```\n\n3.4 - Using RBAC Authorization | If you create a new ClusterRole that matches the label selector of an existing aggregated ClusterRole, that change triggers adding the new rules into the aggregated ClusterRole. Here is an example tha", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18411"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring-endpoints\n  labels:\n    rbac.example.com/aggregate-to-monitoring: \"true\"\n# When you create the \"monitoring-endpoints\" ClusterRole,\n# the rules below will be added to the \"monitoring\" ClusterRole.\nrules:\n- apiGroups: [\"\"]\n  resources: [\"services\", \"endpointslices\", \"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | The default user-facing roles use ClusterRole aggregation. This lets you, as a cluster administrator, include rules for custom resources, such as those served by CustomResourceDefinitions or aggregate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18412"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: aggregate-cron-tabs-edit\n  labels:\n    # Add these permissions to the \"admin\" and \"edit\" default roles.\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: aggregate-cron-tabs-view\n  labels:\n    # Add these permissions to the \"view\" default role.\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | The following examples are excerpts from Role or ClusterRole objects, showing only the rules section.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18413"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: User\n  name: \"alice@example.com\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For a group named frontend-admins:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18414"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: \"frontend-admins\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For the default service account in the \"kube-system\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18415"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: kube-system\n```\n\n3.4 - Using RBAC Authorization | For all service accounts in the \"qa\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18416"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts:qa\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all service accounts in any namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18417"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all authenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18418"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all unauthenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18419"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18420"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | API servers create a set of default ClusterRole and ClusterRoleBinding objects. Many of these are system: prefixed, which indicates that the resource is directly managed by the cluster control plane.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18421"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get clusterroles system:discovery -o yaml\n```\n\n3.4 - Using RBAC Authorization | Some of the default ClusterRoles are not system: prefixed. These are intended to be user-facing roles. They include super-user roles (cluster-admin), roles intended to be granted cluster-wide using Cl", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18422"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: role-grantor\nrules:\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"rolebindings\"]\n  verbs: [\"create\"]\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"clusterroles\"]\n  verbs: [\"bind\"]\n  # omit resourceNames to allow binding any ClusterRole\n  resourceNames: [\"admin\",\"edit\",\"view\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: role-grantor-binding\n  namespace: user-1-namespace\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: role-grantor\nsubjects:\n- apiGroup: rbac.authorization.k8s.io\n  kind: User\n  name: user-1\n```\n\n3.4 - Using RBAC Authorization | When bootstrapping the first roles and role bindings, it is necessary for the initial user to grant permissions they do not yet have. To bootstrap initial roles and role bindings:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18423"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18424"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18425"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=replicasets.apps\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18426"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"my-component-lease-holder\" with permissions to get/update a resource with a specific name:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18427"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role my-component-lease-holder --verb=get,list,watch,update --resource=lease --resource-name=my-component\n```\n\n3.4 - Using RBAC Authorization | Creates a ClusterRole. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18428"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18429"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18430"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=replicasets.apps\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18431"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"foo\" with nonResourceURL specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18432"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"monitoring\" with an aggregationRule specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18433"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\n3.4 - Using RBAC Authorization | Grants a Role or ClusterRole within a specific namespace. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18434"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding bob-admin-binding --clusterrole=admin --user=bob --namespace=acme\n```\n\n3.4 - Using RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to the service account in the namespace \"acme\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18435"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp --namespace=acme\n```\n\n3.4 - Using RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to a service account in the namespace \"myappnamespace\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18436"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myappnamespace-myapp-view-binding --clusterrole=view --serviceaccount=myappnamespace:myapp --namespace=acme\n```\n\n3.4 - Using RBAC Authorization | Grants a ClusterRole across the entire cluster (all namespaces). Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18437"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding root-cluster-admin-binding --clusterrole=cluster-admin --user=root\n```\n\n3.4 - Using RBAC Authorization | Across the entire cluster, grant the permissions in the \"system:node-proxier\" ClusterRole to a user named \"system:kube-proxy\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18438"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding kube-proxy-binding --clusterrole=system:node-proxier --user=system:kube-proxy\n```\n\n3.4 - Using RBAC Authorization | Across the entire cluster, grant the permissions in the \"view\" ClusterRole to a service account named \"myapp\" in the namespace \"acme\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18439"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp\n```\n\n3.4 - Using RBAC Authorization | Creates or updates rbac.authorization.k8s.io/v1 API objects from a manifest file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18440"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --dry-run=client\n```\n\n3.4 - Using RBAC Authorization | Apply a manifest file of RBAC objects, preserving any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18441"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\n3.4 - Using RBAC Authorization | Apply a manifest file of RBAC objects, removing any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18442"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --remove-extra-subjects --remove-extra-permissions\n```\n\n3.4 - Using RBAC Authorization | Default RBAC policies grant scoped permissions to control-plane components, nodes, and controllers, but grant no permissions to service accounts outside the kube-system namespace (beyond the permissio", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18443"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding my-sa-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:my-sa \\\n  --namespace=my-namespace\n```\n\n3.4 - Using RBAC Authorization | Grant a role to the \"default\" service account in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18444"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding default-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:default \\\n  --namespace=my-namespace\n```\n\n3.4 - Using RBAC Authorization | Many add-ons run as the \"default\" service account in the kube-system namespace. To allow those add-ons to run with super-user access, grant cluster-admin permissions to the \"default\" service account i", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18445"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding add-on-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --serviceaccount=kube-system:default\n```\n\n3.4 - Using RBAC Authorization | Grant a role to all service accounts in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18446"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n  --group=system:serviceaccounts:my-namespace \\\n  --namespace=my-namespace\n```\n\n3.4 - Using RBAC Authorization | Grant a limited role to all service accounts cluster-wide (discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18447"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n --group=system:serviceaccounts\n```\n\n3.4 - Using RBAC Authorization | Grant super-user access to all service accounts cluster-wide (strongly discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18448"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --group=system:serviceaccounts\n```\n\n3.4 - Using RBAC Authorization | Kubernetes clusters created before Kubernetes v1.22 include write access to EndpointSlices (and the now-deprecated Endpoints API) in the aggregated \"edit\" and \"admin\" roles. As a mitigation for CVE-20", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18449"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\n3.4 - Using RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18450"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding permissive-binding \\\n  --clusterrole=cluster-admin \\\n  --user=admin \\\n  --user=kubelet \\\n  --group=system:serviceaccounts\n```\n\n3.4 - Using RBAC Authorization | After you have transitioned to use RBAC, you should adjust the access controls for your cluster to ensure that these meet your information security needs.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18451"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: Node\n  ...\n```\n\n3.5 - Using Node Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes Node; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18452"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authz-service\n    cluster:\n      # CA for verifying the remote service.\n      certificate-authority: /path/to/ca.pem\n      # URL of remote service to query. Must use 'https'. May not include parameters.\n      server: https://authz.example.com/authorize\n\n# users refers to the API Server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API Server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authz-service\n    user: name-of-api-server\n  name: webhook\n```\n\n3.6 - Webhook Mode | When faced with an authorization decision, the API Server POSTs a JSON- serialized authorization.k8s.io/v1beta1 SubjectAccessReview object describing the action. This object contains fields describing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18453"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl --v=8 version\n```\n\n3.7 - Using ABAC Authorization | Alice can do anything to all resources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18454"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: EventRateLimit\n    path: eventconfig.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | There are four types of limits that can be specified in the configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18455"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: eventratelimit.admission.k8s.io/v1alpha1\nkind: Configuration\nlimits:\n  - type: Namespace\n    qps: 50\n    burst: 100\n    cacheSize: 2000\n  - type: User\n    qps: 10\n    burst: 50\n```\n\n3.8 - Admission Control in Kubernetes | See the EventRateLimit Config API (v1alpha1) for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18456"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    path: imagepolicyconfig.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | Alternatively, you can embed the configuration directly in the file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18457"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    configuration:\n      imagePolicy:\n        kubeConfigFile: <path-to-kubeconfig-file>\n        allowTTL: 50\n        denyTTL: 50\n        retryBackoff: 500\n        defaultAllow: true\n```\n\n3.8 - Admission Control in Kubernetes | The ImagePolicyWebhook config file must reference a kubeconfig formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18458"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: gluster-vol-default\nprovisioner: kubernetes.io/glusterfs\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n3.8 - Admission Control in Kubernetes | For more information about persistent volume claims, see PersistentVolumeClaims.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18459"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodNodeSelector\n  path: podnodeselector.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | PodNodeSelector uses the annotation key scheduler.alpha.kubernetes.io/node-selector to assign node selectors to namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18460"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  annotations:\n    scheduler.alpha.kubernetes.io/node-selector: name-of-node-selector\n  name: namespace3\n```\n\n3.8 - Admission Control in Kubernetes | This admission controller has the following behavior:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18461"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: apps-that-need-nodes-exclusively\n  annotations:\n    scheduler.alpha.kubernetes.io/defaultTolerations: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n    scheduler.alpha.kubernetes.io/tolerationsWhitelist: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n```\n\n3.8 - Admission Control in Kubernetes | This admission controller is disabled by default.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18462"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nmetadata:\n  name: \"pod-policy.example.com\"\nwebhooks:\n- name: \"pod-policy.example.com\"\n  rules:\n  - apiGroups:   [\"\"]\n    apiVersions: [\"v1\"]\n    operations:  [\"CREATE\"]\n    resources:   [\"pods\"]\n    scope:       \"Namespaced\"\n  clientConfig:\n    service:\n      namespace: \"example-namespace\"\n      name: \"example-service\"\n    caBundle: <CA_BUNDLE>\n  admissionReviewVersions: [\"v1\"]\n  sideEffects: None\n  timeoutSeconds: 5\n```\n\n3.9 - Dynamic Admission Control | The scope field specifies if only cluster-scoped resources (\"Cluster\") or namespace-scoped resources (\"Namespaced\") will match this rule. \"∗\" means that there are no scope restrictions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18463"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\n3.9 - Dynamic Admission Control | # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1 apiVersion: apiserver.k8s.io/v1alpha1 kind: AdmissionConfiguration plugins: - name: ValidatingAdmissionWebhook configuration: # Depre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18464"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1\napiVersion: apiserver.k8s.io/v1alpha1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\n3.9 - Dynamic Admission Control | For more information about AdmissionConfiguration, see the AdmissionConfiguration (v1) reference. See the webhook configuration section for details about each config field.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18465"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n# name should be set to the DNS name of the service or the host (including port) of the URL the webhook is configured to speak to.\n# If a non-443 port is used for services, it must be included in the name when configuring 1.16+ API servers.\n#\n# For a webhook configured to speak to a service on the default port (443), specify the DNS name of the service:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For a webhook configured to speak to a service on non-default port (e.g. 8443), specify the DNS name and port of the service in 1.16+:\n# - name: webhook1.ns1.svc:8443\n#   user: ...\n# and optionally create a second stanza using only the DNS name of the service for compatibility with 1.15 API servers:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For webhooks configured to speak to a URL, match the host (and port) specified in the webhook's URL. Examples:\n# A webhook with `url: https://www.example.com`:\n# - name: www.example.com\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:443`:\n# - name: www.example.com:443\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:8443`:\n# - name: www.example.com:8443\n#   user: ...\n#\n- name: 'webhook1.ns1.svc'\n  user:\n    client-certificate-data: \"<pem encoded certificate>\"\n    client-key-data: \"<pem encoded key>\"\n# The `name` supports using * to wildcard-match prefixing segments.\n- name: '*.webhook-company.org'\n  user:\n    password: \"<password>\"\n    username: \"<name>\"\n# '*' is the default match.\n- name: '*'\n  user:\n    token: \"<token>\"\n```\n\n3.9 - Dynamic Admission Control | Of course you need to set up the webhook server to handle these authentication requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18466"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  admissionReviewVersions: [\"v1\", \"v1beta1\"]\n```\n\n3.9 - Dynamic Admission Control | admissionReviewVersions is a required field when creating webhook configurations. Webhooks are required to support at least one AdmissionReview version understood by the current and previous API serve", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18467"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\n...\nwebhooks:\n- name: my-webhook.example.com\n  rules:\n  - operations: [\"CREATE\", \"UPDATE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\", \"v1beta1\"]\n    resources: [\"deployments\", \"replicasets\"]\n    scope: \"Namespaced\"\n  ...\n```\n\n3.9 - Dynamic Admission Control | Match create requests for all resources (but not subresources) in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18468"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | Match update requests for all status subresources in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18469"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"UPDATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*/status\"]\n        scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | Webhooks may optionally limit which requests are intercepted based on the labels of the objects they would be sent, by specifying an objectSelector. If specified, the objectSelector is evaluated again", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18470"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  objectSelector:\n    matchLabels:\n      foo: bar\n  rules:\n  - operations: [\"CREATE\"]\n    apiGroups: [\"*\"]\n    apiVersions: [\"*\"]\n    resources: [\"*\"]\n    scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18471"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: runlevel\n          operator: NotIn\n          values: [\"0\",\"1\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | This example shows a validating webhook that matches a CREATE of any namespaced resource inside a namespace that is associated with the \"environment\" of \"prod\" or \"staging\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18472"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: environment\n          operator: In\n          values: [\"prod\",\"staging\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18473"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  matchPolicy: Equivalent\n  rules:\n  - operations: [\"CREATE\",\"UPDATE\",\"DELETE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\"]\n    resources: [\"deployments\"]\n    scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | The matchPolicy for an admission webhooks defaults to Equivalent.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18474"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['*']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Ignore' # Fail-open (optional)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'exclude-leases' # Each match condition must have a unique name\n        expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n      - name: 'exclude-kubelet-requests'\n        expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n      - name: 'rbac' # Skip RBAC requests, which are handled by the second webhook.\n        expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  \n  # This example illustrates the use of the 'authorizer'. The authorization check is more expensive\n  # than a simple expression, so in this example it is scoped to only RBAC requests by using a second\n  # webhook. Both webhooks can be served by the same endpoint.\n  - name: rbac.my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['rbac.authorization.k8s.io']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Fail' # Fail-closed (the default)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'breakglass'\n        # Skip requests made by users authorized to 'breakglass' on this webhook.\n        # The 'breakglass' API verb does not need to exist outside this check.\n        expression: '!authorizer.group(\"admissionregistration.k8s.io\").resource(\"validatingwebhookconfigurations\").name(\"my-webhook.example.com\").check(\"breakglass\").allowed()'\n```\n\n3.9 - Dynamic Admission Control | Match conditions have access to the following CEL variables:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18475"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n```\n\n3.9 - Dynamic Admission Control | The service stanza inside clientConfig is a reference to the service for this webhook. If the webhook is running within the cluster, then you should use service instead of url. The service namespace a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18476"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    caBundle: <CA_BUNDLE>\n    service:\n      namespace: my-service-namespace\n      name: my-service-name\n      path: /my-path\n      port: 1234\n```\n\n3.9 - Dynamic Admission Control | Webhooks typically operate only on the content of the AdmissionReview sent to them. Some webhooks, however, make out-of-band changes as part of processing admission requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18477"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    sideEffects: NoneOnDryRun\n```\n\n3.9 - Dynamic Admission Control | Because webhooks add to API request latency, they should evaluate as quickly as possible. timeoutSeconds allows configuring how long the API server should wait for a webhook to respond before treating", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18478"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    timeoutSeconds: 2\n```\n\n3.9 - Dynamic Admission Control | The timeout for an admission webhook defaults to 10 seconds.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18479"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  reinvocationPolicy: IfNeeded\n```\n\n3.9 - Dynamic Admission Control | Mutating webhooks must be idempotent, able to successfully process an object they have already admitted and potentially modified. This is true for all mutating admission webhooks, since any change the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18480"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  failurePolicy: Fail\n```\n\n3.9 - Dynamic Admission Control | The default failurePolicy for an admission webhooks is Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18481"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace examplens\n```\n\n3.10 - Managing Service Accounts | Kubernetes distinguishes between the concept of a user account and a service account for a number of reasons:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18482"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create token my-sa --bound-object-kind=\"Pod\" --bound-object-name=\"test-pod\"\n```\n\n3.10 - Managing Service Accounts | Copy this token into a new file named tokenreview.yaml:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18483"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nspec:\n  token: <token from step 2>\n```\n\n3.10 - Managing Service Accounts | Submit this resource to the apiserver for review:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18484"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nmetadata:\n  creationTimestamp: null\nspec:\n  token: <token>\nstatus:\n  audiences:\n  - https://kubernetes.default.svc.cluster.local\n  authenticated: true\n  user:\n    extra:\n      authentication.kubernetes.io/credential-id:\n      - JTI=7ee52be0-9045-4653-aa5e-0da57b8dccdc\n      authentication.kubernetes.io/node-name:\n      - kind-control-plane\n      authentication.kubernetes.io/node-uid:\n      - 497e9d9a-47aa-4930-b0f6-9f2fb574c8c6\n      authentication.kubernetes.io/pod-name:\n      - test-pod\n      authentication.kubernetes.io/pod-uid:\n      - e87dbbd6-3d7e-45db-aafb-72b24627dff5\n    groups:\n    - system:serviceaccounts\n    - system:serviceaccounts:default\n    - system:authenticated\n    uid: f8b4161b-2e2b-11e9-86b7-2afc33b31a7e\n    username: system:serviceaccount:default:my-sa\n```\n\n3.10 - Managing Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18485"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      sources:\n        - serviceAccountToken:\n            path: token # must match the path the app expects\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\n3.10 - Managing Service Accounts | That manifest snippet defines a projected volume that consists of three sources. In this case, each source also represents a single path within that volume. The three sources are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18486"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\n  namespace: default\nsecrets:\n  - name: build-robot-secret # usually NOT present for a manually generated token\n```\n\n3.10 - Managing Service Accounts | Beginning from version 1.29, legacy ServiceAccount tokens that were generated automatically will be marked as invalid if they remain unused for a certain period of time (set to default at one year). T", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18487"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  namespace: default\n  labels:\n    kubernetes.io/legacy-token-last-used: 2022-10-24\n    kubernetes.io/legacy-token-invalid-since: 2023-10-25\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\n```\n\n3.10 - Managing Service Accounts | A ServiceAccount controller manages the ServiceAccounts inside namespaces, and ensures a ServiceAccount named \"default\" exists in every active namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18488"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      defaultMode: 420 # decimal equivalent of octal 0644\n      sources:\n        - serviceAccountToken:\n            expirationSeconds: 3607\n            path: token\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\n3.10 - Managing Service Accounts | That manifest snippet defines a projected volume that combines information from three sources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18489"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\n3.10 - Managing Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18490"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens create -f https://k8s.io/examples/secret/serviceaccount/mysecretname.yaml\n```\n\n3.10 - Managing Service Accounts | To see the details for that Secret, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18491"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens describe secret mysecretname\n```\n\n3.10 - Managing Service Accounts | The output is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18492"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret name-of-secret\n```\n\n3.10 - Managing Service Accounts | Otherwise, first find the Secret for the ServiceAccount.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18493"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"v1\",\"kind\":\"ServiceAccount\",\"metadata\":{\"annotations\":{},\"name\":\"example-automated-thing\",\"namespace\":\"examplens\"}}      \n  creationTimestamp: \"2019-07-21T07:07:07Z\"\n  name: example-automated-thing\n  namespace: examplens\n  resourceVersion: \"777\"\n  selfLink: /api/v1/namespaces/examplens/serviceaccounts/example-automated-thing\n  uid: f23fd170-66f2-4697-b049-e1e266b7f835\nsecrets:\n  - name: example-automated-thing-token-zyxwv\n```\n\n3.10 - Managing Service Accounts | Then, delete the Secret you now know the name of:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18494"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens delete secret/example-automated-thing-token-zyxwv\n```\n\n3.10 - Managing Service Accounts | Short lived ServiceAccount tokens automatically expire after the time-limit specified during their creation. There is no central record of tokens issued, so there is no way to revoke individual tokens", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18495"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace examplens\n```\n\n3.10 - Managing Service Accounts | Kubernetes certificate and trust bundle APIs enable automation of X.509 credential provisioning by providing a programmatic interface for clients of the Kubernetes API to request and obtain X.509 cert", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18496"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18497"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18498"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\n3.11 - Certificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18499"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  certificate: \"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JS...\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | Before a signer issues a certificate based on a CertificateSigningRequest, the signer typically checks that the issuance for that CSR has been approved.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18500"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <certificate-signing-request-name>\n```\n\n3.11 - Certificates and Certificate Signing Requests | Likewise, to deny a CSR:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18501"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny <certificate-signing-request-name>\n```\n\n3.11 - Certificates and Certificate Signing Requests | Users of the REST API can approve CSRs by submitting an UPDATE request to the approval subresource of the CSR to be approved. For example, you could write an operator that watches for a particular kin", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18502"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Approved by my custom approver controller\n    reason: ApprovedByMyPolicy # You can set this to any string\n    type: Approved\n```\n\n3.11 - Certificates and Certificate Signing Requests | For Denied CSRs:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18503"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Denied by my custom approver controller\n    reason: DeniedByMyPolicy # You can set this to any string\n    type: Denied\n```\n\n3.11 - Certificates and Certificate Signing Requests | It's usual to set status.conditions.reason to a machine-friendly reason code using TitleCase; this is a convention but you can set it to anything you like. If you want to add a note for human consumpt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18504"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get clustertrustbundles --as='system:serviceaccount:mynamespace:default'\n```\n\n3.11 - Certificates and Certificate Signing Requests | Signer-linked ClusterTrustBundles are associated with a signer name, like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18505"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: example.com:mysigner:foo\nspec:\n  signerName: example.com/mysigner\n  trustBundle: \"<... PEM data ...>\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | These ClusterTrustBundles are intended to be maintained by a signer-specific controller in the cluster, so they have several security features:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18506"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: foo\nspec:\n  # no signerName specified, so the field is blank\n  trustBundle: \"<... PEM data ...>\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | They are primarily intended for cluster configuration use cases. Each signer-unlinked ClusterTrustBundle is an independent object, in contrast to the customary grouping behavior of signer-linked Clust", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18507"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# enable bootstrapping nodes to create CSR\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: create-csrs-for-bootstrapping\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:node-bootstrapper\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | While the apiserver receives the requests for certificates from the kubelet and authenticates those requests, the controller-manager is responsible for issuing actual signed certificates.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18508"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Approve all CSRs for the group \"system:bootstrappers\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-csrs-for-group\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:nodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | To enable the kubelet to renew its own client certificate, create a ClusterRoleBinding that binds the group in which the fully functioning node is a member system:nodes to the ClusterRole that grants", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18509"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Approve renewal CSRs for the group \"system:nodes\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-renewals-for-nodes\nsubjects:\n- kind: Group\n  name: system:nodes\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:selfnodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | The csrapproving controller that ships as part of kube-controller-manager and is enabled by default. The controller uses the SubjectAccessReview API to determine if a given user is authorized to reque", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18510"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority: /var/lib/kubernetes/ca.pem\n    server: https://my.server.example.com:6443\n  name: bootstrap\ncontexts:\n- context:\n    cluster: bootstrap\n    user: kubelet-bootstrap\n  name: bootstrap\ncurrent-context: bootstrap\npreferences: {}\nusers:\n- name: kubelet-bootstrap\n  user:\n    token: 07401b.f395accd246ae52d\n```\n\n3.14 - TLS bootstrapping | The important elements to note are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18511"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-cluster bootstrap --server='https://my.server.example.com:6443' --certificate-authority=/var/lib/kubernetes/ca.pem\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-credentials kubelet-bootstrap --token=07401b.f395accd246ae52d\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-context bootstrap --user=kubelet-bootstrap --cluster=bootstrap\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig use-context bootstrap\n```\n\n3.14 - TLS bootstrapping | To indicate to the kubelet to use the bootstrap kubeconfig, use the following kubelet flag:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18512"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\n3.15 - Mutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18513"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp\n  namespace: default\nspec:\n  ...\n  initContainers:\n  - name: mesh-proxy\n    image: mesh/proxy:v1.0.0\n    args: [\"proxy\", \"sidecar\"]\n    restartPolicy: Always\n  - name: myapp-initializer\n    image: example/initializer:v1.0.0\n  ...\n```\n\n3.15 - Mutating Admission Policy | Parameter resources allow a policy configuration to be separate from its definition. A policy can define paramKind, which outlines GVK of the parameter resource, and then a policy binding ties a polic", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18514"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\n3.15 - Mutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18515"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\n3.16 - Validating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18516"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18517"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18518"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18519"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\n3.16 - Validating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18520"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18521"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\n3.16 - Validating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18522"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: example-binding\nspec:\n  policyName: example-policy\n  paramRef:\n    selector:\n      matchLabels:\n        environment: test\n    parameterNotFoundAction: Allow\n  validationActions:\n  - Deny\n```\n\n3.16 - Validating Admission Policy | failurePolicy defines how mis-configurations and CEL expressions evaluating to error from the admission policy are handled. Allowed values are Ignore or Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18523"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\n3.16 - Validating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18524"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\n3.16 - Validating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18525"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\n3.16 - Validating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18526"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18527"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18528"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18529"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\n3.16 - Validating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18530"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create deploy --image=dev.example.com/nginx invalid\n```\n\n3.16 - Validating Admission Policy | The error message is similar to this.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18531"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <node-name> node.kubernetes.io/exclude-from-external-load-balancers=true\n```\n\n4 - Well-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18532"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration: >\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"example\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"matchLabels\":{\"app.kubernetes.io/name\":foo}},\"template\":{\"metadata\":{\"labels\":{\"app.kubernetes.io/name\":\"foo\"}},\"spec\":{\"containers\":[{\"image\":\"container-registry.example/foo-bar:1.42\",\"name\":\"foo-bar\",\"ports\":[{\"containerPort\":42}]}]}}}}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: all objects", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18533"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes <node-name> node-role.kubernetes.io/control-plane:NoSchedule-\n```\n\n4 - Well-Known Labels, Annotations and Taints | Type: Taint", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18534"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/minikube/proxy/stats/summary\"\n```\n\n6.3 - Node metrics data | Here is the same API call using curl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18535"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: cpu-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    args:\n    - \"stress\"\n    - \"--cpus\"\n    - \"1\"\n    resources:\n      limits:\n        cpu: \"500m\"\n      requests:\n        cpu: \"500m\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f cpu-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18536"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-pressure-pod\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | This example creates a Pod that continuously writes to files in the container's writable layer, causing the kernel's page cache to grow and forcing memory reclamation, which generates pressure.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18537"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: memory-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n    - \"i=0; while true; do dd if=/dev/zero of=testfile.$i bs=1M count=50 &>/dev/null; i=$(((i+1)%5)); sleep 0.1; done\"\n    resources:\n      limits:\n        memory: \"200M\"\n      requests:\n        memory: \"200M\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f memory-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18538"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-pressure-pod\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | This Pod generates I/O pressure by repeatedly writing a file to disk and using sync to flush the data from memory, which creates I/O stalls.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18539"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: io-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: io-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n      - \"while true; do dd if=/dev/zero of=testfile bs=1M count=128 &>/dev/null; sync; rm testfile &>/dev/null; done\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply this to your cluster: kubectl apply -f io-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18540"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod io-pressure-pod\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | The task pages for Troubleshooting Clusters discuss how to use a metrics pipeline that rely on these data.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18541"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nauthorization:\n  mode: Webhook\n  webhook:\n    cacheAuthorizedTTL: \"5m\"\n    cacheUnauthorizedTTL: \"30s\"\nserializeImagePulls: false\naddress: \"192.168.0.1\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18542"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18543"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | You can override the slices/lists values of the kubelet configuration. However, the entire list gets overridden during the merging process. For example, you can override the clusterDNS list as follows", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18544"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.9\"\n  - \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18545"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18546"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Individual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden. However, for map[string][]string, the entire list associated with a specific field ge", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18547"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 456\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18548"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18549"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | This page provides details of version compatibility between the Kubernetes device plugin API, and different versions of Kubernetes itself.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18550"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\n8.9 - Node Status | Each section of the output is described below.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18551"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\n8.10 - Seccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18552"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddresses\n```\n\n9.3 - Virtual IPs and Service Proxies | Kubernetes also allow users to dynamically define the available IP ranges for Services using ServiceCIDR objects. During bootstrap, a default ServiceCIDR object named kubernetes is created from the va", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18553"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\n9.3 - Virtual IPs and Service Proxies | Users can create or delete new ServiceCIDR objects to manage the available IP ranges for Services:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18554"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\ncat <<'EOF' | kubectl apply -f -\napiVersion: networking.k8s.io/v1\nkind: ServiceCIDR\nmetadata:\n  name: newservicecidr\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\n9.3 - Virtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18555"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\n9.3 - Virtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18556"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs-default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(i , variables.allowed.exists(j , cidr(j).containsCIDR(i)))\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs-default\"\n  validationActions: [Deny,Audit]\n---\n```\n\n9.3 - Virtual IPs and Service Proxies | Kubernetes divides the ClusterIP range into two bands, based on the size of the configured service-cluster-ip-range by using the following formula min(max(16, cidrSize / 16), 256). That formula means", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18557"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete clusterrolebinding kubeadm:node-autoapprove-bootstrap\n```\n\n10.1.3 - kubeadm join | After that, kubeadm join will block until the admin has manually approved the CSR in flight:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18558"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve node-csr-c69HXe7aYcqkS1bKmH4faEnHAWxn6i2bHZ2mD04jZyQ\n```\n\n10.1.3 - kubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18559"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public get cm cluster-info -o jsonpath='{.data.kubeconfig}' | tee cluster-info.yaml\n```\n\n10.1.3 - kubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18560"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority-data: <ca-cert>\n    server: https://<ip>:<port>\n  name: \"\"\ncontexts: []\ncurrent-context: \"\"\npreferences: {}\nusers: []\n```\n\n10.1.3 - kubeadm join | Use the cluster-info.yaml file as an argument to kubeadm join --discovery-file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18561"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public delete rolebinding kubeadm:bootstrap-signer-clusterinfo\n```\n\n10.1.3 - kubeadm join | These commands should be run after kubeadm init but before kubeadm join.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18562"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker run --privileged --rm registry.k8s.io/kube-proxy:v1.34.0 sh -c \"kube-proxy --cleanup && echo DONE\"\n```\n\n10.1.7 - kubeadm reset | The output of the above command should print DONE at the end. Instead of Docker, you can use your preferred container runtime to start the container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18563"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] [flags]\n```\n\n11 - Command line tool (kubectl) | where command, TYPE, NAME, and flags are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18564"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod1\nkubectl get pods pod1\nkubectl get po pod1\n```\n\n11 - Command line tool (kubectl) | NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, for example kubectl get pods.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18565"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<namespace-name>\n```\n\n11 - Command line tool (kubectl) | The following table includes short descriptions and the general syntax for all of the kubectl operations:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18566"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] -o <output_format>\n```\n\n11 - Command line tool (kubectl) | Depending on the kubectl operation, the following output formats are supported:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18567"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-pod-13je7 -o yaml\n```\n\n11 - Command line tool (kubectl) | Remember: See the kubectl reference documentation for details about which output format is supported by each command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18568"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion\n```\n\n11 - Command line tool (kubectl) | Template file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18569"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns-file=template.txt\n```\n\n11 - Command line tool (kubectl) | where the template.txt file contains:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18570"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> --server-print=false\n```\n\n11 - Command line tool (kubectl) | The output is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18571"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>\n```\n\n11 - Command line tool (kubectl) | To print a list of pods sorted by name, you run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18572"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --sort-by=.metadata.name\n```\n\n11 - Command line tool (kubectl) | Use the following set of examples to help you familiarize yourself with running the commonly used kubectl operations:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18573"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\n11.2 - kubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18574"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18575"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18576"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18577"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18578"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18579"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18580"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18581"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18582"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18583"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n11.2 - kubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18584"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\n11.2 - kubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18585"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n11.3.2 - kubectl annotate | Select all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18586"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\n11.3.3 - kubectl api-resources | Limit to resources in the specified API group.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18587"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply (-f FILENAME | -k DIRECTORY)\n```\n\n11.3.5 - kubectl apply | Select all resources in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18588"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME)\n```\n\n11.3.5.1 - kubectl apply edit-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18589"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f FILENAME\n```\n\n11.3.5.2 - kubectl apply set-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18590"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)\n```\n\n11.3.5.3 - kubectl apply view-last-applied | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18591"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl attach (POD | TYPE/NAME) -c CONTAINER\n```\n\n11.3.6 - kubectl attach | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18592"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]\n```\n\n11.3.7.1 - kubectl auth can-i | If true, check the specified action in all namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18593"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f FILENAME\n```\n\n11.3.7.2 - kubectl auth reconcile | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18594"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY]\n```\n\n11.3.8 - kubectl autoscale | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18595"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND\n```\n\n11.3.9 - kubectl certificate | help for certificate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18596"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve (-f FILENAME | NAME)\n```\n\n11.3.9.1 - kubectl certificate approve | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18597"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny (-f FILENAME | NAME)\n```\n\n11.3.9.2 - kubectl certificate deny | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18598"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\n11.3.10 - kubectl cluster-info | help for cluster-info", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18599"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump [flags]\n```\n\n11.3.10.1 - kubectl cluster-info dump | If true, dump all namespaces. If true, --namespaces is ignored.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18600"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL\n```\n\n11.3.11 - kubectl completion | help for completion", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18601"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND\n```\n\n11.3.12 - kubectl config | help for config", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18602"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context [flags]\n```\n\n11.3.12.1 - kubectl config current-context | help for current-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18603"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster NAME\n```\n\n11.3.12.2 - kubectl config delete-cluster | help for delete-cluster", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18604"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context NAME\n```\n\n11.3.12.3 - kubectl config delete-context | help for delete-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18605"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user NAME\n```\n\n11.3.12.4 - kubectl config delete-user | help for delete-user", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18606"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters [flags]\n```\n\n11.3.12.5 - kubectl config get-clusters | help for get-clusters", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18607"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts [(-o|--output=)name)]\n```\n\n11.3.12.6 - kubectl config get-contexts | help for get-contexts", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18608"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users [flags]\n```\n\n11.3.12.7 - kubectl config get-users | help for get-users", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18609"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context CONTEXT_NAME NEW_NAME\n```\n\n11.3.12.8 - kubectl config rename-context | help for rename-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18610"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set PROPERTY_NAME PROPERTY_VALUE\n```\n\n11.3.12.9 - kubectl config set | help for set", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18611"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]\n```\n\n11.3.12.10 - kubectl config set-cluster | Path to certificate-authority file for the cluster entry in kubeconfig", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18612"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]\n```\n\n11.3.12.11 - kubectl config set-context | cluster for the context entry in kubeconfig", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18613"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value]\n```\n\n11.3.12.12 - kubectl config set-credentials | Auth provider for the user entry in kubeconfig", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18614"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config unset PROPERTY_NAME\n```\n\n11.3.12.13 - kubectl config unset | help for unset", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18615"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context CONTEXT_NAME\n```\n\n11.3.12.14 - kubectl config use-context | help for use-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18616"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view [flags]\n```\n\n11.3.12.15 - kubectl config view | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18617"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest>\n```\n\n11.3.14 - kubectl cp | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18618"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME\n```\n\n11.3.15 - kubectl create | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18619"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n11.3.15.1 - kubectl create clusterrole | An aggregation label selector for combining ClusterRoles.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18620"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n11.3.15.2 - kubectl create clusterrolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18621"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n11.3.15.3 - kubectl create configmap | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18622"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]\n```\n\n11.3.15.4 - kubectl create cronjob | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18623"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment NAME --image=image -- [COMMAND] [args...]\n```\n\n11.3.15.5 - kubectl create deployment | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18624"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]\n```\n\n11.3.15.6 - kubectl create ingress | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18625"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]\n```\n\n11.3.15.7 - kubectl create job | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18626"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace NAME [--dry-run=server|client|none]\n```\n\n11.3.15.8 - kubectl create namespace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18627"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]\n```\n\n11.3.15.9 - kubectl create poddisruptionbudget | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18628"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]\n```\n\n11.3.15.10 - kubectl create priorityclass | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18629"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]\n```\n\n11.3.15.11 - kubectl create quota | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18630"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n11.3.15.12 - kubectl create role | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18631"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n11.3.15.13 - kubectl create rolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18632"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret (docker-registry | generic | tls)\n```\n\n11.3.15.14 - kubectl create secret | help for secret", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18633"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]\n```\n\n11.3.15.15 - kubectl create secret docker-registry | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18634"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n11.3.15.16 - kubectl create secret generic | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18635"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]\n```\n\n11.3.15.17 - kubectl create secret tls | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18636"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service [flags]\n```\n\n11.3.15.18 - kubectl create service | help for service", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18637"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]\n```\n\n11.3.15.19 - kubectl create service clusterip | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18638"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname NAME --external-name external.name [--dry-run=server|client|none]\n```\n\n11.3.15.20 - kubectl create service externalname | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18639"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n11.3.15.21 - kubectl create service loadbalancer | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18640"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n11.3.15.22 - kubectl create service nodeport | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18641"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount NAME [--dry-run=server|client|none]\n```\n\n11.3.15.23 - kubectl create serviceaccount | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18642"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create token SERVICE_ACCOUNT_NAME\n```\n\n11.3.15.24 - kubectl create token | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18643"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]\n```\n\n11.3.16 - kubectl debug | If specified, everything after -- will be passed to the new container as Args instead of Command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18644"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])\n```\n\n11.3.17 - kubectl delete | Delete all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18645"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)\n```\n\n11.3.18 - kubectl describe | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18646"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME\n```\n\n11.3.19 - kubectl diff | Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18647"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit (RESOURCE/NAME | -f FILENAME)\n```\n\n11.3.21 - kubectl edit | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18648"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl events [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file] [--for TYPE/NAME] [--watch] [--types=Normal,Warning]\n```\n\n11.3.22 - kubectl events | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18649"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]\n```\n\n11.3.23 - kubectl exec | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18650"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2]\n```\n\n11.3.24 - kubectl explain | Get different explanations for particular API version (API group/version)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18651"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]\n```\n\n11.3.25 - kubectl expose | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18652"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]\n```\n\n11.3.26 - kubectl get | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18653"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize DIR [flags]\n```\n\n11.3.27 - kubectl kustomize | use the uid and gid of the command executor to run the function in the container", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18654"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n11.3.28 - kubectl label | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18655"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]\n```\n\n11.3.29 - kubectl logs | Get all containers' logs in the pod(s).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18656"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl options [flags]\n```\n\n11.3.30 - kubectl options | help for options", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18657"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]\n```\n\n11.3.31 - kubectl patch | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18658"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags]\n```\n\n11.3.32 - kubectl plugin | help for plugin", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18659"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl plugin list [flags]\n```\n\n11.3.32.1 - kubectl plugin list | help for list", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18660"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]\n```\n\n11.3.33 - kubectl port-forward | Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18661"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]\n```\n\n11.3.34 - kubectl proxy | Regular expression for hosts that the proxy should accept.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18662"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\n11.3.35 - kubectl replace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18663"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND\n```\n\n11.3.36 - kubectl rollout | help for rollout", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18664"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history (TYPE NAME | TYPE/NAME) [flags]\n```\n\n11.3.36.1 - kubectl rollout history | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18665"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause RESOURCE\n```\n\n11.3.36.2 - kubectl rollout pause | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18666"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart RESOURCE\n```\n\n11.3.36.3 - kubectl rollout restart | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18667"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume RESOURCE\n```\n\n11.3.36.4 - kubectl rollout resume | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18668"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status (TYPE NAME | TYPE/NAME) [flags]\n```\n\n11.3.36.5 - kubectl rollout status | Filename, directory, or URL to files identifying the resource to get from a server.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18669"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]\n```\n\n11.3.36.6 - kubectl rollout undo | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18670"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]\n```\n\n11.3.37 - kubectl run | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18671"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)\n```\n\n11.3.38 - kubectl scale | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18672"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND\n```\n\n11.3.39 - kubectl set | help for set", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18673"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N\n```\n\n11.3.39.1 - kubectl set env | If true, select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18674"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N\n```\n\n11.3.39.2 - kubectl set image | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18675"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS & --requests=REQUESTS]\n```\n\n11.3.39.3 - kubectl set resources | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18676"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]\n```\n\n11.3.39.4 - kubectl set selector | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18677"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT\n```\n\n11.3.39.5 - kubectl set serviceaccount | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18678"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n11.3.39.6 - kubectl set subject | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18679"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N\n```\n\n11.3.40 - kubectl taint | Select all nodes in the cluster", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18680"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl top node [NAME | -l label]\n```\n\n11.3.41.1 - kubectl top node | help for node", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18681"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl top pod [NAME | -l label]\n```\n\n11.3.41.2 - kubectl top pod | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18682"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE\n```\n\n11.3.42 - kubectl uncordon | Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18683"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl version [flags]\n```\n\n11.3.43 - kubectl version | If true, shows client version only (no server required).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18684"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]\n```\n\n11.3.44 - kubectl wait | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18685"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o json\nkubectl get pods -o=jsonpath='{@}'\nkubectl get pods -o=jsonpath='{.items[0]}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.name}'\nkubectl get pods -o=jsonpath=\"{.items[*]['metadata.name', 'status.capacity']}\"\nkubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.startTime}{\"\\n\"}{end}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\\.io/hostname}'\n```\n\n11.6 - JSONPath Support | Or, with a \"my_pod\" and \"my_namespace\" (adjust these names to your environment):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18686"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}'\n```\n\n11.6 - JSONPath Support | On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote aro", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18687"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{'\\t'}{.status.startTime}{'\\n'}{end}\"\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\t\\\"}{.status.startTime}{\\\"\\n\\\"}{end}\"\n```\n\n11.6 - JSONPath Support | JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as jq.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18688"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18689"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl run [-i] [--tty] --attach <name> --image=<image>\n```\n\n11.7 - kubectl for Docker Users | Unlike docker run ..., if you specify --attach, then you attach stdin, stdout and stderr. You cannot control which streams are attached (docker -a ...). To detach from the container, you can type the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18690"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker attach 55c103fa1296\n...\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18691"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it nginx-app-5jyvm\n...\n```\n\n11.7 - kubectl for Docker Users | To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18692"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker exec 55c103fa1296 cat /etc/hostname\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18693"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx-app-5jyvm -- cat /etc/hostname\n```\n\n11.7 - kubectl for Docker Users | To use interactive commands.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18694"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker exec -ti 55c103fa1296 /bin/sh\n# exit\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18695"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti nginx-app-5jyvm -- /bin/sh\n# exit\n```\n\n11.7 - kubectl for Docker Users | For more information, see Get a Shell to a Running Container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18696"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f nginx-app-zibvs\n```\n\n11.7 - kubectl for Docker Users | There is a slight difference between pods and containers; by default pods do not terminate if their processes exit. Instead the pods restart the process. This is similar to the docker run option --res", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18697"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous nginx-app-zibvs\n```\n\n11.7 - kubectl for Docker Users | For more information, see Logging Architecture.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18698"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker stop a9ec34d98787\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18699"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker rm a9ec34d98787\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18700"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-app\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18701"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18702"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-app\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18703"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n# Return nothing\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18704"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18705"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18706"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18707"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18708"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18709"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get flowschemas -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\nkubectl get prioritylevelconfigurations -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\n```\n\n13.1 - Flow control | to get a mapping of UIDs to names for both FlowSchemas and PriorityLevelConfigurations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18710"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_priority_levels\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18711"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_queues\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18712"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_requests\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18713"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw '/debug/api_priority_and_fairness/dump_requests?includeRequestDetails=1'\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18714"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - events\n  providers:\n  - identity: {}  # do not encrypt events even though *.* is specified below\n- resources:\n  - secrets\n  - configmaps\n  - pandas.awesome.bears.example\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n- resources:\n  - '*.apps'\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n- resources:\n  - '*.*'\n  providers:\n  - aescbc:\n      keys:\n      - name: key3\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\n14.7 - kube-apiserver Configuration (v1) | resources is a list containing resources, and their corresponding encryption providers.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18715"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: InitConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta3\nkind: ClusterConfiguration\n\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta3\nkind: JoinConfiguration\n```\n\n14.13 - kubeadm Configuration (v1beta3) | To print the defaults for \"init\" and \"join\" actions use the following commands:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18716"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: InitConfiguration\nbootstrapTokens:\n  ...\nnodeRegistration:\n  ...\n```\n\n14.13 - kubeadm Configuration (v1beta3) | The InitConfiguration type should be used to configure runtime settings, that in case of kubeadm init are the configuration of the bootstrap token and all the setting which are specific to the node wh", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18717"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: ClusterConfiguration\nnetworking:\n  ...\netcd:\n  ...\napiServer:\n  extraArgs:\n    ...\n  extraVolumes:\n    ...\n...\n```\n\n14.13 - kubeadm Configuration (v1beta3) | The ClusterConfiguration type should be used to configure cluster-wide settings, including settings for:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18718"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n  ...\n```\n\n14.13 - kubeadm Configuration (v1beta3) | The KubeProxyConfiguration type should be used to change the configuration passed to kube-proxy instances deployed in the cluster. If this object is not provided or provided only partially, kubeadm ap", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18719"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n  ...\n```\n\n14.13 - kubeadm Configuration (v1beta3) | The KubeletConfiguration type should be used to change the configurations that will be passed to all kubelet instances deployed in the cluster. If this object is not provided or provided only partiall", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18720"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: InitConfiguration\nbootstrapTokens:\n  - token: \"9a08jv.c0izixklcxtmnze7\"\n    description: \"kubeadm bootstrap token\"\n    ttl: \"24h\"\n  - token: \"783bde.3f89s0fje9f38fhf\"\n    description: \"another bootstrap token\"\n    usages:\n      - authentication\n      - signing\n    groups:\n      - system:bootstrappers:kubeadm:default-node-token\nnodeRegistration:\n  name: \"ec2-10-100-0-1\"\n  criSocket: \"/var/run/dockershim.sock\"\n  taints:\n    - key: \"kubeadmNode\"\n      value: \"someValue\"\n      effect: \"NoSchedule\"\n  kubeletExtraArgs:\n    v: 4\n  ignorePreflightErrors:\n    - IsPrivilegedUser\n  imagePullPolicy: \"IfNotPresent\"\nlocalAPIEndpoint:\n  advertiseAddress: \"10.100.0.1\"\n  bindPort: 6443\ncertificateKey: \"e6a2eb8581237ab72a4f494f30285ec12a9694d750b9785706a83bfcbbbd2204\"\nskipPhases:\n  - addon/kube-proxy\n---\napiVersion: kubeadm.k8s.io/v1beta3\nkind: ClusterConfiguration\netcd:\n  # one of local or external\n  local:\n    imageRepository: \"registry.k8s.io\"\n    imageTag: \"3.2.24\"\n    dataDir: \"/var/lib/etcd\"\n    extraArgs:\n      listen-client-urls: \"http://10.100.0.1:2379\"\n    serverCertSANs:\n      -  \"ec2-10-100-0-1.compute-1.amazonaws.com\"\n    peerCertSANs:\n      - \"10.100.0.1\"\n  # external:\n    # endpoints:\n    # - \"10.100.0.1:2379\"\n    # - \"10.100.0.2:2379\"\n    # caFile: \"/etcd/kubernetes/pki/etcd/etcd-ca.crt\"\n    # certFile: \"/etcd/kubernetes/pki/etcd/etcd.crt\"\n    # keyFile: \"/etcd/kubernetes/pki/etcd/etcd.key\"\nnetworking:\n  serviceSubnet: \"10.96.0.0/16\"\n  podSubnet: \"10.244.0.0/24\"\n  dnsDomain: \"cluster.local\"\nkubernetesVersion: \"v1.21.0\"\ncontrolPlaneEndpoint: \"10.100.0.1:6443\"\napiServer:\n  extraArgs:\n    authorization-mode: \"Node,RBAC\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n  certSANs:\n    - \"10.100.1.1\"\n    - \"ec2-10-100-0-1.compute-1.amazonaws.com\"\n  timeoutForControlPlane: 4m0s\ncontrollerManager:\n  extraArgs:\n    \"node-cidr-mask-size\": \"20\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\nscheduler:\n  extraArgs:\n    bind-address: \"10.100.0.1\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\ncertificatesDir: \"/etc/kubernetes/pki\"\nimageRepository: \"registry.k8s.io\"\nclusterName: \"example-cluster\"\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n# kubelet specific options here\n---\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n# kube-proxy specific options here\n```\n\n14.13 - kubeadm Configuration (v1beta3) | When executing kubeadm join with the --config option, the JoinConfiguration type should be provided.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18721"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta3\nkind: JoinConfiguration\n  ...\n```\n\n14.13 - kubeadm Configuration (v1beta3) | The JoinConfiguration type should be used to configure runtime settings, that in case of kubeadm join are the discovery method used for accessing the cluster info and all the setting which are specifi", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18722"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\n\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ResetConfiguration\n\napiVersion: kubeadm.k8s.io/v1beta4\nkind: UpgradeConfiguration\n```\n\nMigration from old kubeadm config versions | To print the defaults for init and join actions use the following commands:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18723"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nbootstrapTokens:\n...\nnodeRegistration:\n...\n```\n\nMigration from old kubeadm config versions | The InitConfiguration type should be used to configure runtime settings, that in case of kubeadm init are the configuration of the bootstrap token and all the setting which are specific to the node wh", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18724"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\nnetworking:\n  ...\netcd:\n  ...\napiServer:\n  extraArgs:\n    ...\n  extraVolumes:\n    ...\n...\n```\n\nMigration from old kubeadm config versions | The ClusterConfiguration type should be used to configure cluster-wide settings, including settings for:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18725"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n...\n```\n\nMigration from old kubeadm config versions | The KubeProxyConfiguration type should be used to change the configuration passed to kube-proxy instances deployed in the cluster. If this object is not provided or provided only partially, kubeadm ap", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18726"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n...\n```\n\nMigration from old kubeadm config versions | The KubeletConfiguration type should be used to change the configurations that will be passed to all kubelet instances deployed in the cluster. If this object is not provided or provided only partiall", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18727"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: InitConfiguration\nbootstrapTokens:\n  - token: \"9a08jv.c0izixklcxtmnze7\"\n    description: \"kubeadm bootstrap token\"\n    ttl: \"24h\"\n  - token: \"783bde.3f89s0fje9f38fhf\"\n    description: \"another bootstrap token\"\n    usages:\n  - authentication\n  - signing\n    groups:\n  - system:bootstrappers:kubeadm:default-node-token\n\nnodeRegistration:\n  name: \"ec2-10-100-0-1\"\n  criSocket: \"unix:///var/run/containerd/containerd.sock\"\n  taints:\n    - key: \"kubeadmNode\"\n      value: \"someValue\"\n      effect: \"NoSchedule\"\n  kubeletExtraArgs:\n    - name: v\n      value: \"5\"\n  ignorePreflightErrors:\n    - IsPrivilegedUser\n  imagePullPolicy: \"IfNotPresent\"\n  imagePullSerial: true\n\nlocalAPIEndpoint:\n  advertiseAddress: \"10.100.0.1\"\n  bindPort: 6443\ncertificateKey: \"e6a2eb8581237ab72a4f494f30285ec12a9694d750b9785706a83bfcbbbd2204\"\nskipPhases:\n  - preflight\ntimeouts:\n  controlPlaneComponentHealthCheck: \"60s\"\n  kubenetesAPICall: \"40s\"\n---\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ClusterConfiguration\netcd:\n\n  # one of local or external\n  local:\n    imageRepository: \"registry.k8s.io\"\n    imageTag: \"3.2.24\"\n    dataDir: \"/var/lib/etcd\"\n    extraArgs:\n      - name: listen-client-urls\n        value: http://10.100.0.1:2379\n    extraEnvs:\n      - name: SOME_VAR\n        value: SOME_VALUE\n    serverCertSANs:\n      - ec2-10-100-0-1.compute-1.amazonaws.com\n    peerCertSANs:\n      - 10.100.0.1\n  # external:\n  #   endpoints:\n  #     - 10.100.0.1:2379\n  #     - 10.100.0.2:2379\n  #   caFile: \"/etcd/kubernetes/pki/etcd/etcd-ca.crt\"\n  #   certFile: \"/etcd/kubernetes/pki/etcd/etcd.crt\"\n  #   keyFile: \"/etcd/kubernetes/pki/etcd/etcd.key\"\n\nnetworking:\n  serviceSubnet: \"10.96.0.0/16\"\n  podSubnet: \"10.244.0.0/24\"\n  dnsDomain: \"cluster.local\"\nkubernetesVersion: \"v1.21.0\"\ncontrolPlaneEndpoint: \"10.100.0.1:6443\"\napiServer:\n  extraArgs:\n    - name: authorization-mode\n      value: Node,RBAC\n  extraEnvs:\n    - name: SOME_VAR\n      value: SOME_VALUE\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n  certSANs:\n    - \"10.100.1.1\"\n    - \"ec2-10-100-0-1.compute-1.amazonaws.com\"\n\ncontrollerManager:\n  extraArgs:\n    - name: node-cidr-mask-size\n      value: \"20\"\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n\nscheduler:\n  extraArgs:\n    - name: address\n      value: 10.100.0.1\n  extraVolumes:\n    - name: \"some-volume\"\n      hostPath: \"/etc/some-path\"\n      mountPath: \"/etc/some-pod-path\"\n      readOnly: false\n      pathType: File\n\ncertificatesDir: \"/etc/kubernetes/pki\"\nimageRepository: \"registry.k8s.io\"\nclusterName: \"example-cluster\"\nencryptionAlgorithm: ECDSA-P256\ndns:\n  disabled: true  # disable CoreDNS\nproxy:\n  disabled: true   # disable kube-proxy\n\n---\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\n# kubelet specific options here\n---\napiVersion: kubeproxy.config.k8s.io/v1alpha1\nkind: KubeProxyConfiguration\n# kube-proxy specific options here\n```\n\nMigration from old kubeadm config versions | When executing kubeadm join with the --config option, the JoinConfiguration type should be provided.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18728"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: JoinConfiguration\ndiscovery:\n  bootstrapToken:\n    apiServerEndpoint: some-address:6443\n    token: abcdef.0123456789abcdef\n    unsafeSkipCAVerification: true\n  tlsBootstrapToken: abcdef.0123456789abcdef\n```\n\nMigration from old kubeadm config versions | The JoinConfiguration type should be used to configure runtime settings, that in case of kubeadm join are the discovery method used for accessing the cluster info and all the setting which are specifi", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18729"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: ResetConfiguration\n...\n```\n\nMigration from old kubeadm config versions | When executing kubeadm upgrade with the --config option, the UpgradeConfiguration type should be provided.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18730"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubeadm.k8s.io/v1beta4\nkind: UpgradeConfiguration\napply:\n  ...\ndiff:\n  ...\nnode:\n  ...\nplan:\n  ...\n```\n\nMigration from old kubeadm config versions | The UpgradeConfiguration structure includes a few substructures that only apply to different subcommands of kubeadm upgrade. For example, the apply substructure will be used with the kubeadm upgrade a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18731"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nclientConnection:\n  kubeconfig: /etc/srv/kubernetes/kube-scheduler/kubeconfig\n```\n\n16.1 - Scheduler Configuration | A scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18732"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - plugins:\n      score:\n        disabled:\n        - name: PodTopologySpread\n        enabled:\n        - name: MyCustomPluginA\n          weight: 2\n        - name: MyCustomPluginB\n          weight: 1\n```\n\n16.1 - Scheduler Configuration | You can use * as name in the disabled array to disable all default plugins for that extension point. This can also be used to rearrange plugins order, if desired.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18733"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: no-scoring-scheduler\n    plugins:\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\n16.1 - Scheduler Configuration | Pods that want to be scheduled according to a specific profile can include the corresponding scheduler name in its .spec.schedulerName.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18734"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: MyPlugin\n```\n\n16.1 - Scheduler Configuration | This would equate to manually enabling MyPlugin for all of its extension points, like so:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18735"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      preScore:\n        enabled:\n        - name: MyPlugin\n      score:\n        enabled:\n        - name: MyPlugin\n      preFilter:\n        enabled:\n        - name: MyPlugin\n      filter:\n        enabled:\n        - name: MyPlugin\n```\n\n16.1 - Scheduler Configuration | One benefit of using multiPoint here is that if MyPlugin implements another extension point in the future, the multiPoint config will automatically enable it for the new extension.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18736"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'MyPlugin'\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\n16.1 - Scheduler Configuration | Starting from kubescheduler.config.k8s.io/v1beta3, all default plugins are enabled internally through MultiPoint. However, individual extension points are still available to allow flexible reconfigura", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18737"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      score:\n        enabled:\n        - name: 'DefaultScore2'\n          weight: 5\n```\n\n16.1 - Scheduler Configuration | In this example, it's unnecessary to specify the plugins in MultiPoint explicitly because they are default plugins. And the only plugin specified in Score is DefaultScore2. This is because plugins set", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18738"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'CustomQueueSort'\n        - name: 'CustomPlugin1'\n          weight: 3\n        - name: 'CustomPlugin2'\n        disabled:\n        - name: 'DefaultQueueSort'\n      filter:\n        disabled:\n        - name: 'DefaultPlugin1'\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n```\n\n16.1 - Scheduler Configuration | Note that there is no error for re-declaring a MultiPoint plugin in a specific extension point. The re-declaration is ignored (and logged), as specific extension points take precedence.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18739"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n\n      # Disable the default QueueSort plugin\n      queueSort:\n        enabled:\n        - name: 'CustomQueueSort'\n        disabled:\n        - name: 'DefaultQueueSort'\n\n      # Enable custom Filter plugins\n      filter:\n        enabled:\n        - name: 'CustomPlugin1'\n        - name: 'CustomPlugin2'\n        - name: 'DefaultPlugin2'\n        disabled:\n        - name: 'DefaultPlugin1'\n\n      # Enable and reorder custom score plugins\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n          weight: 1\n        - name: 'DefaultPlugin1'\n          weight: 3\n```\n\n16.1 - Scheduler Configuration | While this is a complicated example, it demonstrates the flexibility of MultiPoint config as well as its seamless integration with the existing methods for configuring extension points.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18740"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\n16.1 - Scheduler Configuration | The scheduler plugin NodeLabel is deprecated; instead, use the NodeAffinity plugin (enabled by default) to achieve similar behavior.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18741"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: $GROUP_NAME/$VERSION\n```\n\n2 - API Overview | Certain resources and API groups are enabled by default. You can enable or disable them by setting --runtime-config on the API server. The --runtime-config flag accepts comma separated <key>[=<value>]", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18742"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n200 OK\nContent-Type: application/yaml\n\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\n  …\n```\n\n2.2 - Kubernetes API Concepts | Kubernetes uses an envelope wrapper to encode Protobuf responses. That wrapper starts with a 4 byte magic number to help identify content in disk or in etcd as Protobuf (as opposed to JSON). The 4 byt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18743"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"kind\": \"ServiceList\",\n  \"apiVersion\": \"v1\",\n  \"metadata\": {\n    \"resourceVersion\": \"2947301\"\n  },\n  \"items\": [\n    {\n      \"metadata\": {\n        \"name\": \"kubernetes\",\n        \"namespace\": \"default\",\n...\n      \"metadata\": {\n        \"name\": \"kube-dns\",\n        \"namespace\": \"kube-system\",\n...\n```\n\n2.2 - Kubernetes API Concepts | There are dozens of collection types (such as PodList, ServiceList, and NodeList) defined in the Kubernetes API. You can get more information about each collection type from the Kubernetes API documen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18744"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\nitems:\n- apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: \"2021-06-03T14:54:12Z\"\n    labels:\n      component: apiserver\n      provider: kubernetes\n    name: kubernetes\n    namespace: default\n...\n- apiVersion: v1\n  kind: Service\n  metadata:\n    annotations:\n      prometheus.io/port: \"9153\"\n      prometheus.io/scrape: \"true\"\n    creationTimestamp: \"2021-06-03T14:54:14Z\"\n    labels:\n      k8s-app: kube-dns\n      kubernetes.io/cluster-service: \"true\"\n      kubernetes.io/name: CoreDNS\n    name: kube-dns\n    namespace: kube-system\n```\n\n2.2 - Kubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18745"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"kind\": \"ConfigMap\",\n  \"apiVersion\": \"v1\",\n  \"metadata\": {\n    \"finalizers\": [\"url.io/neat-finalization\", \"other-url.io/my-finalizer\"],\n    \"deletionTimestamp\": nil,\n  }\n}\n```\n\n2.2 - Kubernetes API Concepts | When a client first sends a delete to request the removal of a resource, the .metadata.deletionTimestamp is set to the current time. Once the .metadata.deletionTimestamp is set, external controllers t", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18746"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"apps\"]\n  resources: [\"deployments\"]\n  verbs: [\"patch\"]\n```\n\n2.2 - Kubernetes API Concepts | See Authorization Overview.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18747"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration\n```\n\n2.3 - Server-Side Apply | A simple example of an object created using Server-Side Apply could look like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18748"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply # note capitalization: \"Apply\" (or \"Update\")\n    apiVersion: v1\n    time: \"2010-10-10T0:00:00Z\"\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n      f:data:\n        f:key: {}\ndata:\n  key: some value\n```\n\n2.3 - Server-Side Apply | That example ConfigMap object contains a single field management record in .metadata.managedFields. The field management record consists of basic information about the managing entity itself, plus det", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18749"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"v1\",\n  \"kind\": \"ConfigMap\"\n}\n```\n\n2.3 - Server-Side Apply | (this would make a no-change update, provided that it was sent as the body of a patch request to a valid v1/configmaps resource, and with the appropriate request Content-Type).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18750"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply\n    time: '2019-03-30T15:00:00.000Z'\n    apiVersion: v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n  - manager: kube-controller-manager\n    operation: Update\n    apiVersion: v1\n    time: '2019-03-30T16:00:00.000Z'\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:data:\n        f:key: {}\ndata:\n  key: new value\n```\n\n2.3 - Server-Side Apply | In this example, a second operation was run as an update by the manager called kube-controller-manager. The update request succeeded and changed a value in the data field, which caused that field's ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18751"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: example.com/v1\nkind: Foo\nmetadata:\n  name: foo-sample\n  managedFields:\n  - manager: \"manager-one\"\n    operation: Apply\n    apiVersion: example.com/v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:spec:\n        f:data: {}\nspec:\n  data:\n    key1: val1\n    key2: val2\n```\n\n2.3 - Server-Side Apply | Before spec.data gets changed from atomic to granular, manager-one owns the field spec.data, and all the fields within it (key1 and key2). When the CRD gets changed to make spec.data granular, manager", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18752"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18753"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Save this file as 'nginx-deployment-replicas-only.yaml'.\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n```\n\n2.3 - Server-Side Apply | The user applies that manifest using a private field manager name. In this example, the user picked handover-to-hpa:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18754"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18755"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side\n```\n\n2.3 - Server-Side Apply | This behavior applies to server-side apply with the kubectl field manager. As an exception, you can opt-out of this behavior by specifying a different, non-default field manager, as seen in the follow", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18756"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side\n```\n\n2.3 - Server-Side Apply | Downgrading works because kubectl Server-Side Apply keeps the last-applied-configuration annotation up-to-date if you use kubectl apply.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18757"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f <file> --output-version <group>/<version>\n```\n\n2.7 - Deprecated API Migration Guide | For example, to convert an older Deployment to apps/v1, you can run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18758"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f ./my-deployment.yaml --output-version apps/v1\n```\n\n2.7 - Deprecated API Migration Guide | This conversion may use non-ideal default values. To learn more about a specific resource, check the Kubernetes API reference.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18759"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nopenssl req -new -key jbeda.pem -out jbeda-csr.pem -subj \"/CN=jbeda/O=app1/O=app2\"\n```\n\n3.1 - Authenticating | This would create a CSR for the username \"jbeda\", belonging to two groups, \"app1\" and \"app2\".", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18760"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1 # this apiVersion is relevant as of Kubernetes 1.9\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  namespace: default\nspec:\n  replicas: 3\n  template:\n    metadata:\n    # ...\n    spec:\n      serviceAccountName: bob-the-bot\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n3.1 - Authenticating | Service account bearer tokens are perfectly valid to use outside the cluster and can be used to create identities for long standing jobs that wish to talk to the Kubernetes API. To manually create a s", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18761"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount (NAME)\n```\n\n3.1 - Authenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18762"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount jenkins\n```\n\n3.1 - Authenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18763"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create token jenkins\n```\n\n3.1 - Authenticating | The created token is a signed JSON Web Token (JWT).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18764"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\n# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.\n# the maximum number of allowed authenticators is 64.\njwt:\n- issuer:\n    # url must be unique across all authenticators.\n    # url must not conflict with issuer configured in --service-account-issuer.\n    url: https://example.com # Same as --oidc-issuer-url.\n    # discoveryURL, if specified, overrides the URL used to fetch discovery\n    # information instead of using \"{url}/.well-known/openid-configuration\".\n    # The exact value specified is used, so \"/.well-known/openid-configuration\"\n    # must be included in discoveryURL if needed.\n    #\n    # The \"issuer\" field in the fetched discovery information must match the \"issuer.url\" field\n    # in the AuthenticationConfiguration and will be used to validate the \"iss\" claim in the presented JWT.\n    # This is for scenarios where the well-known and jwks endpoints are hosted at a different\n    # location than the issuer (such as locally in the cluster).\n    # discoveryURL must be different from url if specified and must be unique across all authenticators.\n    discoveryURL: https://discovery.example.com/.well-known/openid-configuration\n    # PEM encoded CA certificates used to validate the connection when fetching\n    # discovery information. If not set, the system verifier will be used.\n    # Same value as the content of the file referenced by the --oidc-ca-file command line argument.\n    certificateAuthority: <PEM encoded CA certificates>    \n    # audiences is the set of acceptable audiences the JWT must be issued to.\n    # At least one of the entries must match the \"aud\" claim in presented JWTs.\n    audiences:\n    - my-app # Same as --oidc-client-id.\n    - my-other-app\n    # this is required to be set to \"MatchAny\" when multiple audiences are specified.\n    audienceMatchPolicy: MatchAny\n    # egressSelectorType is an indicator of which egress selection should be used for sending all traffic related\n    # to this issuer (discovery, JWKS, distributed claims, etc).  If unspecified, no custom dialer is used.\n    # The StructuredAuthenticationConfigurationEgressSelector feature gate must be enabled\n    # before you can use the egressSelectorType field.\n    # When specified, the valid choices are \"controlplane\" and \"cluster\".  These correspond to the associated\n    # values in the --egress-selector-config-file.\n    # - controlplane: for traffic intended to go to the control plane.\n    # - cluster: for traffic intended to go to the system being managed by Kubernetes.\n    egressSelectorType: <egress-selector-type>\n  # rules applied to validate token claims to authenticate users.\n  claimValidationRules:\n    # Same as --oidc-required-claim key=value.\n  - claim: hd\n    requiredValue: example.com\n    # Instead of claim and requiredValue, you can use expression to validate the claim.\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for validation to succeed.\n  - expression: 'claims.hd == \"example.com\"'\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: the hd claim must be set to example.com\n  - expression: 'claims.exp - claims.nbf <= 86400'\n    message: total token lifetime must not exceed 24 hours\n  claimMappings:\n    # username represents an option for the username attribute.\n    # This is the only required attribute.\n    username:\n      # Same as --oidc-username-claim. Mutually exclusive with username.expression.\n      claim: \"sub\"\n      # Same as --oidc-username-prefix. Mutually exclusive with username.expression.\n      # if username.claim is set, username.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with username.claim and username.prefix.\n      # expression is a CEL expression that evaluates to a string.\n      #\n      # 1.  If username.expression uses 'claims.email', then 'claims.email_verified' must be used in\n      #     username.expression or extra[*].valueExpression or claimValidationRules[*].expression.\n      #     An example claim validation rule expression that matches the validation automatically\n      #     applied when username.claim is set to 'email' is 'claims.?email_verified.orValue(true) == true'.\n      #     By explicitly comparing the value to true, we let type-checking see the result will be a boolean, and\n      #     to make sure a non-boolean email_verified claim will be caught at runtime.\n      # 2.  If the username asserted based on username.expression is the empty string, the authentication\n      #     request will fail.\n      expression: 'claims.username + \":external-user\"'\n    # groups represents an option for the groups attribute.\n    groups:\n      # Same as --oidc-groups-claim. Mutually exclusive with groups.expression.\n      claim: \"sub\"\n      # Same as --oidc-groups-prefix. Mutually exclusive with groups.expression.\n      # if groups.claim is set, groups.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with groups.claim and groups.prefix.\n      # expression is a CEL expression that evaluates to a string or a list of strings.\n      expression: 'claims.roles.split(\",\")'\n    # uid represents an option for the uid attribute.\n    uid:\n      # Mutually exclusive with uid.expression.\n      claim: 'sub'\n      # Mutually exclusive with uid.claim\n      # expression is a CEL expression that evaluates to a string.\n      expression: 'claims.sub'\n    # extra attributes to be added to the UserInfo object. Keys must be domain-prefix path and must be unique.\n    extra:\n      # key is a string to use as the extra attribute key.\n      # key must be a domain-prefix path (e.g. example.org/foo). All characters before the first \"/\" must be a valid\n      # subdomain as defined by RFC 1123. All characters trailing the first \"/\" must\n      # be valid HTTP Path characters as defined by RFC 3986.\n      # k8s.io, kubernetes.io and their subdomains are reserved for Kubernetes use and cannot be used.\n      # key must be lowercase and unique across all extra attributes.\n    - key: 'example.com/tenant'\n      # valueExpression is a CEL expression that evaluates to a string or a list of strings.\n      valueExpression: 'claims.tenant'\n  # validation rules applied to the final user object.\n  userValidationRules:\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for the user to be valid.\n  - expression: \"!user.username.startsWith('system:')\"\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: 'username cannot used reserved system: prefix'\n  - expression: \"user.groups.all(group, !group.startsWith('system:'))\"\n    message: 'groups cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | Claim validation rule expression", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18765"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18766"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nTOKEN=eyJhbGciOiJSUzI1NiIsImtpZCI6ImY3dF9tOEROWmFTQk1oWGw5QXZTWGhBUC04Y0JmZ0JVbFVpTG5oQkgxdXMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNzAzMjMyOTQ5LCJpYXQiOjE3MDExMDcyMzMsImlzcyI6Imh0dHBzOi8vZXhhbXBsZS5jb20iLCJqdGkiOiI3YzMzNzk0MjgwN2U3M2NhYTJjMzBjODY4YWMwY2U5MTBiY2UwMmRkY2JmZWJlOGMyM2I4YjVmMjdhZDYyODczIiwibmJmIjoxNzAxMTA3MjMzLCJyb2xlcyI6InVzZXIsYWRtaW4iLCJzdWIiOiJhdXRoIiwidGVuYW50IjoiNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjRhIiwidXNlcm5hbWUiOiJmb28ifQ.TBWF2RkQHm4QQz85AYPcwLxSk-VLvQW-mNDHx7SEOSv9LVwcPYPuPajJpuQn9C_gKq1R94QKSQ5F6UgHMILz8OfmPKmX_00wpwwNVGeevJ79ieX2V-__W56iNR5gJ-i9nn6FYk5pwfVREB0l4HSlpTOmu80gbPWAXY5hLW0ZtcE1JTEEmefORHV2ge8e3jp1xGafNy6LdJWabYuKiw8d7Qga__HxtKB-t0kRMNzLRS7rka_SfQg0dSYektuxhLbiDkqhmRffGlQKXGVzUsuvFw7IGM5ZWnZgEMDzCI357obHeM3tRqpn5WRjtB8oM7JgnCymaJi-P3iCd88iu1xnzA\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18767"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"' # the token below does not have this claim, so validation will fail.\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18768"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nTOKEN=eyJhbGciOiJSUzI1NiIsImtpZCI6ImY3dF9tOEROWmFTQk1oWGw5QXZTWGhBUC04Y0JmZ0JVbFVpTG5oQkgxdXMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNzAzMjMyOTQ5LCJpYXQiOjE3MDExMDcyMzMsImlzcyI6Imh0dHBzOi8vZXhhbXBsZS5jb20iLCJqdGkiOiI3YzMzNzk0MjgwN2U3M2NhYTJjMzBjODY4YWMwY2U5MTBiY2UwMmRkY2JmZWJlOGMyM2I4YjVmMjdhZDYyODczIiwibmJmIjoxNzAxMTA3MjMzLCJyb2xlcyI6InVzZXIsYWRtaW4iLCJzdWIiOiJhdXRoIiwidGVuYW50IjoiNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjRhIiwidXNlcm5hbWUiOiJmb28ifQ.TBWF2RkQHm4QQz85AYPcwLxSk-VLvQW-mNDHx7SEOSv9LVwcPYPuPajJpuQn9C_gKq1R94QKSQ5F6UgHMILz8OfmPKmX_00wpwwNVGeevJ79ieX2V-__W56iNR5gJ-i9nn6FYk5pwfVREB0l4HSlpTOmu80gbPWAXY5hLW0ZtcE1JTEEmefORHV2ge8e3jp1xGafNy6LdJWabYuKiw8d7Qga__HxtKB-t0kRMNzLRS7rka_SfQg0dSYektuxhLbiDkqhmRffGlQKXGVzUsuvFw7IGM5ZWnZgEMDzCI357obHeM3tRqpn5WRjtB8oM7JgnCymaJi-P3iCd88iu1xnzA\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18769"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"'\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: '\"system:\" + claims.username' # this will prefix the username with \"system:\" and will fail user validation.\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the username will be system:foo and expression will evaluate to false, so validation will fail.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18770"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nTOKEN=eyJhbGciOiJSUzI1NiIsImtpZCI6ImY3dF9tOEROWmFTQk1oWGw5QXZTWGhBUC04Y0JmZ0JVbFVpTG5oQkgxdXMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNzAzMjMyOTQ5LCJoZCI6ImV4YW1wbGUuY29tIiwiaWF0IjoxNzAxMTEzMTAxLCJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwianRpIjoiYjViMDY1MjM3MmNkMjBlMzQ1YjZmZGZmY2RjMjE4MWY0YWZkNmYyNTlhYWI0YjdlMzU4ODEyMzdkMjkyMjBiYyIsIm5iZiI6MTcwMTExMzEwMSwicm9sZXMiOiJ1c2VyLGFkbWluIiwic3ViIjoiYXV0aCIsInRlbmFudCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0YSIsInVzZXJuYW1lIjoiZm9vIn0.FgPJBYLobo9jnbHreooBlvpgEcSPWnKfX6dc0IvdlRB-F0dCcgy91oCJeK_aBk-8zH5AKUXoFTlInfLCkPivMOJqMECA1YTrMUwt_IVqwb116AqihfByUYIIqzMjvUbthtbpIeHQm2fF0HbrUqa_Q0uaYwgy8mD807h7sBcUMjNd215ff_nFIHss-9zegH8GI1d9fiBf-g6zjkR1j987EP748khpQh9IxPjMJbSgG_uH5x80YFuqgEWwq-aYJPQxXX6FatP96a2EAn7wfPpGlPRt0HcBOvq5pCnudgCgfVgiOJiLr_7robQu4T1bis0W75VPEvwWtgFcLnvcQx0JWg\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18771"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials USER_NAME \\\n   --auth-provider=oidc \\\n   --auth-provider-arg=idp-issuer-url=( issuer url ) \\\n   --auth-provider-arg=client-id=( your client id ) \\\n   --auth-provider-arg=client-secret=( your client secret ) \\\n   --auth-provider-arg=refresh-token=( your refresh token ) \\\n   --auth-provider-arg=idp-certificate-authority=( path to your ca certificate ) \\\n   --auth-provider-arg=id-token=( your id_token )\n```\n\n3.1 - Authenticating | As an example, running the below command after authenticating to your identity provider:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18772"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials mmosley  \\\n        --auth-provider=oidc  \\\n        --auth-provider-arg=idp-issuer-url=https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP  \\\n        --auth-provider-arg=client-id=kubernetes  \\\n        --auth-provider-arg=client-secret=1db158f6-177d-4d9c-8a8b-d36869918ec5  \\\n        --auth-provider-arg=refresh-token=q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXqHega4GAXlF+ma+vmYpFcHe5eZR+slBFpZKtQA= \\\n        --auth-provider-arg=idp-certificate-authority=/root/ca.pem \\\n        --auth-provider-arg=id-token=eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n```\n\n3.1 - Authenticating | Which would produce the below configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18773"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nusers:\n- name: mmosley\n  user:\n    auth-provider:\n      config:\n        client-id: kubernetes\n        client-secret: 1db158f6-177d-4d9c-8a8b-d36869918ec5\n        id-token: eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n        idp-certificate-authority: /root/ca.pem\n        idp-issuer-url: https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP\n        refresh-token: q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXq\n      name: oidc\n```\n\n3.1 - Authenticating | Once your id_token expires, kubectl will attempt to refresh your id_token using your refresh_token and client_secret storing the new values for the refresh_token and id_token in your .kube/config.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18774"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl --token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL21sYi50cmVtb2xvLmxhbjo4MDQzL2F1dGgvaWRwL29pZGMiLCJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNDc0NTk2NjY5LCJqdGkiOiI2RDUzNXoxUEpFNjJOR3QxaWVyYm9RIiwiaWF0IjoxNDc0NTk2MzY5LCJuYmYiOjE0NzQ1OTYyNDksInN1YiI6Im13aW5kdSIsInVzZXJfcm9sZSI6WyJ1c2VycyIsIm5ldy1uYW1lc3BhY2Utdmlld2VyIl0sImVtYWlsIjoibXdpbmR1QG5vbW9yZWplZGkuY29tIn0.f2As579n9VNoaKzoF-dOQGmXkFKf1FMyNV0-va_B63jn-_n9LGSCca_6IVMP8pO-Zb4KvRqGyTP0r3HkHxYy5c81AnIh8ijarruczl-TK_yF5akjSTHFZD-0gRzlevBDiH8Q79NAr-ky0P4iIXS8lY9Vnjch5MF74Zx0c3alKJHJUnnpjIACByfF2SCaYzbWFMUNat-K1PaUk5-ujMBG7yYnr95xD-63n8CO8teGUAAEMx6zRjzfhnhbzX-ajwZLGwGUBT4WqjMs70-6a7_8gZmLZb2az1cZynkFRj2BaCkVT3A2RrjeEwZEtGXlMqKJ1_I2ulrOVsYx01_yD35-rw get nodes\n```\n\n3.1 - Authenticating | Kubernetes webhook authentication is a mechanism to make an HTTP callout for verifying bearer tokens.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18775"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authn-service\n    cluster:\n      certificate-authority: /path/to/ca.pem         # CA for verifying the remote service.\n      server: https://authn.example.com/authenticate # URL of remote service to query. 'https' recommended for production.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authn-service\n    user: name-of-api-server\n  name: webhook\n```\n\n3.1 - Authenticating | When a client attempts to authenticate with the API server using a bearer token as discussed above, the authentication webhook POSTs a JSON-serialized TokenReview object containing the token to the re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18776"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1\",\n  \"kind\": \"TokenReview\",\n  \"spec\": {\n    # Opaque bearer token sent to the API server\n    \"token\": \"014fbff9a07c...\",\n\n    # Optional list of the audience identifiers for the server the token was presented to.\n    # Audience-aware token authenticators (for example, OIDC token authenticators)\n    # should verify the token was intended for at least one of the audiences in this list,\n    # and return the intersection of this list and the valid audiences for the token in the response status.\n    # This ensures the token is valid to authenticate to the server it was presented to.\n    # If no audiences are provided, the token should be validated to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\", \"https://myserver.internal.example.com\"]\n  }\n}\n```\n\n3.1 - Authenticating | { \"apiVersion\": \"authentication.k8s.io/v1beta1\", \"kind\": \"TokenReview\", \"spec\": { # Opaque bearer token sent to the API server \"token\": \"014fbff9a07c...\", # Optional list of the aud", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18777"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1beta1\",\n  \"kind\": \"TokenReview\",\n  \"spec\": {\n    # Opaque bearer token sent to the API server\n    \"token\": \"014fbff9a07c...\",\n\n    # Optional list of the audience identifiers for the server the token was presented to.\n    # Audience-aware token authenticators (for example, OIDC token authenticators)\n    # should verify the token was intended for at least one of the audiences in this list,\n    # and return the intersection of this list and the valid audiences for the token in the response status.\n    # This ensures the token is valid to authenticate to the server it was presented to.\n    # If no audiences are provided, the token should be validated to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\", \"https://myserver.internal.example.com\"]\n  }\n}\n```\n\n3.1 - Authenticating | The remote service is expected to fill the status field of the request to indicate the success of the login. The response body's spec field is ignored and may be omitted. The remote service must retur", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18778"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": true,\n    \"user\": {\n      # Required\n      \"username\": \"janedoe@example.com\",\n      # Optional\n      \"uid\": \"42\",\n      # Optional group memberships\n      \"groups\": [\"developers\", \"qa\"],\n      # Optional additional information provided by the authenticator.\n      # This should not contain confidential data, as it can be recorded in logs\n      # or API objects, and is made available to admission webhooks.\n      \"extra\": {\n        \"extrafield1\": [\n          \"extravalue1\",\n          \"extravalue2\"\n        ]\n      }\n    },\n    # Optional list audience-aware token authenticators can return,\n    # containing the audiences from the `spec.audiences` list for which the provided token was valid.\n    # If this is omitted, the token is considered to be valid to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\"]\n  }\n}\n```\n\n3.1 - Authenticating | { \"apiVersion\": \"authentication.k8s.io/v1beta1\", \"kind\": \"TokenReview\", \"status\": { \"authenticated\": true, \"user\": { # Required \"username\": \"janedoe@example.com\", # Opt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18779"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1beta1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": true,\n    \"user\": {\n      # Required\n      \"username\": \"janedoe@example.com\",\n      # Optional\n      \"uid\": \"42\",\n      # Optional group memberships\n      \"groups\": [\"developers\", \"qa\"],\n      # Optional additional information provided by the authenticator.\n      # This should not contain confidential data, as it can be recorded in logs\n      # or API objects, and is made available to admission webhooks.\n      \"extra\": {\n        \"extrafield1\": [\n          \"extravalue1\",\n          \"extravalue2\"\n        ]\n      }\n    },\n    # Optional list audience-aware token authenticators can return,\n    # containing the audiences from the `spec.audiences` list for which the provided token was valid.\n    # If this is omitted, the token is considered to be valid to authenticate to the Kubernetes API server.\n    \"audiences\": [\"https://myserver.example.com\"]\n  }\n}\n```\n\n3.1 - Authenticating | An unsuccessful request would return:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18780"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": false,\n    # Optionally include details about why authentication failed.\n    # If no error is provided, the API will return a generic Unauthorized message.\n    # The error field is ignored when authenticated=true.\n    \"error\": \"Credentials are expired\"\n  }\n}\n```\n\n3.1 - Authenticating | { \"apiVersion\": \"authentication.k8s.io/v1beta1\", \"kind\": \"TokenReview\", \"status\": { \"authenticated\": false, # Optionally include details about why authentication failed. # If no erro", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18781"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"authentication.k8s.io/v1beta1\",\n  \"kind\": \"TokenReview\",\n  \"status\": {\n    \"authenticated\": false,\n    # Optionally include details about why authentication failed.\n    # If no error is provided, the API will return a generic Unauthorized message.\n    # The error field is ignored when authenticated=true.\n    \"error\": \"Credentials are expired\"\n  }\n}\n```\n\n3.1 - Authenticating | The API server can be configured to identify users from request header values, such as X-Remote-User. It is designed for use in combination with an authenticating proxy that sets these headers.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18782"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nname: fido\ngroups:\n- dogs\n- dachshunds\nextra:\n  acme.com/project:\n  - some-project\n  scopes:\n  - openid\n  - profile\n```\n\n3.1 - Authenticating | In order to prevent header spoofing, the authenticating proxy is required to present a valid client certificate to the API server for validation against the specified CA before the request headers are", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18783"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\nanonymous:\n  enabled: true\n  conditions:\n  - path: /livez\n  - path: /readyz\n  - path: /healthz\n```\n\n3.1 - Authenticating | In the configuration above only the /livez, /readyz and /healthz endpoints are reachable by anonymous requests. Any other endpoints will not be reachable even if it is allowed by RBAC configuration.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18784"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl drain mynode --as=superman --as-group=system:masters\n```\n\n3.1 - Authenticating | To impersonate a user, group, user identifier (UID) or extra fields, the impersonating user must have the ability to perform the impersonate verb on the kind of attribute being impersonated (\"user\", \"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18785"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: impersonator\nrules:\n- apiGroups: [\"\"]\n  resources: [\"users\", \"groups\", \"serviceaccounts\"]\n  verbs: [\"impersonate\"]\n```\n\n3.1 - Authenticating | For impersonation, extra fields and impersonated UIDs are both under the \"authentication.k8s.io\" apiGroup. Extra fields are evaluated as sub-resources of the resource \"userextras\". To allow a user to", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18786"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: scopes-and-uid-impersonator\nrules:\n# Can set \"Impersonate-Extra-scopes\" header and the \"Impersonate-Uid\" header.\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\", \"uids\"]\n  verbs: [\"impersonate\"]\n```\n\n3.1 - Authenticating | The values of impersonation headers can also be restricted by limiting the set of resourceNames a resource can take.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18787"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: limited-impersonator\nrules:\n# Can impersonate the user \"jane.doe@example.com\"\n- apiGroups: [\"\"]\n  resources: [\"users\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"jane.doe@example.com\"]\n\n# Can impersonate the groups \"developers\" and \"admins\"\n- apiGroups: [\"\"]\n  resources: [\"groups\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"developers\",\"admins\"]\n\n# Can impersonate the extras field \"scopes\" with the values \"view\" and \"development\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"view\", \"development\"]\n\n# Can impersonate the uid \"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"uids\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"]\n```\n\n3.1 - Authenticating | k8s.io/client-go and tools using it such as kubectl and kubelet are able to execute an external command to receive user credentials.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18788"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1beta1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Required.\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\n3.1 - Authenticating | apiVersion: v1 kind: Config users: - name: my-user user: exec: # Command to execute. Required. command: \"example-client-go-exec-plugin\" # API version to use when decoding the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18789"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1beta1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Optional.\n      # Defaults to \"IfAvailable\".\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\n3.1 - Authenticating | Relative command paths are interpreted as relative to the directory of the config file. If KUBECONFIG is set to /home/jane/kubeconfig and the exec command is ./bin/example-client-go-exec-plugin, the b", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18790"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n- name: my-user\n  user:\n    exec:\n      # Path relative to the directory of the kubeconfig\n      command: \"./bin/example-client-go-exec-plugin\"\n      apiVersion: \"client.authentication.k8s.io/v1\"\n      interactiveMode: Never\n```\n\n3.1 - Authenticating | The executed command prints an ExecCredential object to stdout. k8s.io/client-go authenticates against the Kubernetes API using the returned credentials in the status. The executed command is passed a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18791"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: SelfSubjectReview\nstatus:\n  userInfo:\n    username: jane.doe\n    uid: b79dbf30-0c6a-11ed-861d-0242ac120002\n    groups:\n    - students\n    - teachers\n    - system:authenticated\n    extra:\n      skills:\n      - reading\n      - learning\n      subjects:\n      - math\n      - sports\n```\n\n3.1 - Authenticating | This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster, for example, if you use webhook token authentication or authenticating proxy.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18792"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Name MUST be of form \"bootstrap-token-<token id>\"\n  name: bootstrap-token-07401b\n  namespace: kube-system\n\n# Type MUST be 'bootstrap.kubernetes.io/token'\ntype: bootstrap.kubernetes.io/token\nstringData:\n  # Human readable description. Optional.\n  description: \"The default bootstrap token generated by 'kubeadm init'.\"\n\n  # Token ID and secret. Required.\n  token-id: 07401b\n  token-secret: f395accd246ae52d\n\n  # Expiration. Optional.\n  expiration: 2017-03-10T03:22:11Z\n\n  # Allowed usages.\n  usage-bootstrap-authentication: \"true\"\n  usage-bootstrap-signing: \"true\"\n\n  # Extra groups to authenticate the token as. Must start with \"system:bootstrappers:\"\n  auth-extra-groups: system:bootstrappers:worker,system:bootstrappers:ingress\n```\n\n3.2 - Authenticating with Bootstrap Tokens | The type of the secret must be bootstrap.kubernetes.io/token and the name must be bootstrap-token-<token id>. It must also exist in the kube-system namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18793"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cluster-info\n  namespace: kube-public\ndata:\n  jws-kubeconfig-07401b: eyJhbGciOiJIUzI1NiIsImtpZCI6IjA3NDAxYiJ9..tYEfbo6zDNo40MQE07aZcQX2m3EB2rO3NuXtxVMYm9U\n  kubeconfig: |\n    apiVersion: v1\n    clusters:\n    - cluster:\n        certificate-authority-data: <really long certificate data>\n        server: https://10.138.0.2:6443\n      name: \"\"\n    contexts: []\n    current-context: \"\"\n    kind: Config\n    preferences: {}\n    users: []\n```\n\n3.2 - Authenticating with Bootstrap Tokens | The kubeconfig member of the ConfigMap is a config file with only the cluster information filled out. The key thing being communicated here is the certificate-authority-data. This may be expanded in t", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18794"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# DO NOT USE THE CONFIG AS IS. THIS IS AN EXAMPLE.\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  - type: Webhook\n    # Name used to describe the authorizer\n    # This is explicitly used in monitoring machinery for metrics\n    # Note:\n    #   - Validation for this field is similar to how K8s labels are validated today.\n    # Required, with no default\n    name: webhook\n    webhook:\n      # The duration to cache 'authorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag\n      # Default: 5m0s\n      authorizedTTL: 30s\n      # If set to false, 'authorized' responses from the webhook are not cached\n      # and the specified authorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag to `0`.\n      # Note: Setting authorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheAuthorizedRequests: true\n      # The duration to cache 'unauthorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag\n      # Default: 30s\n      unauthorizedTTL: 30s\n      # If set to false, 'unauthorized' responses from the webhook are not cached\n      # and the specified unauthorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag to `0`.\n      # Note: Setting unauthorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheUnauthorizedRequests: true\n      # Timeout for the webhook request\n      # Maximum allowed is 30s.\n      # Required, with no default.\n      timeout: 3s\n      # The API version of the authorization.k8s.io SubjectAccessReview to\n      # send to and expect from the webhook.\n      # Same as setting `--authorization-webhook-version` flag\n      # Required, with no default\n      # Valid values: v1beta1, v1\n      subjectAccessReviewVersion: v1\n      # MatchConditionSubjectAccessReviewVersion specifies the SubjectAccessReview\n      # version the CEL expressions are evaluated against\n      # Valid values: v1\n      # Required, no default value\n      matchConditionSubjectAccessReviewVersion: v1\n      # Controls the authorization decision when a webhook request fails to\n      # complete or returns a malformed response or errors evaluating\n      # matchConditions.\n      # Valid values:\n      #   - NoOpinion: continue to subsequent authorizers to see if one of\n      #     them allows the request\n      #   - Deny: reject the request without consulting subsequent authorizers\n      # Required, with no default.\n      failurePolicy: Deny\n      connectionInfo:\n        # Controls how the webhook should communicate with the server.\n        # Valid values:\n        # - KubeConfigFile: use the file specified in kubeConfigFile to locate the\n        #   server.\n        # - InClusterConfig: use the in-cluster configuration to call the\n        #   SubjectAccessReview API hosted by kube-apiserver. This mode is not\n        #   allowed for kube-apiserver.\n        type: KubeConfigFile\n        # Path to KubeConfigFile for connection info\n        # Required, if connectionInfo.Type is KubeConfigFile\n        kubeConfigFile: /kube-system-authz-webhook.yaml\n        # matchConditions is a list of conditions that must be met for a request to be sent to this\n        # webhook. An empty list of matchConditions matches all requests.\n        # There are a maximum of 64 match conditions allowed.\n        #\n        # The exact matching logic is (in order):\n        #   1. If at least one matchCondition evaluates to FALSE, then the webhook is skipped.\n        #   2. If ALL matchConditions evaluate to TRUE, then the webhook is called.\n        #   3. If at least one matchCondition evaluates to an error (but none are FALSE):\n        #      - If failurePolicy=Deny, then the webhook rejects the request\n        #      - If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped\n      matchConditions:\n      # expression represents the expression which will be evaluated by CEL. Must evaluate to bool.\n      # CEL expressions have access to the contents of the SubjectAccessReview in v1 version.\n      # If version specified by subjectAccessReviewVersion in the request variable is v1beta1,\n      # the contents would be converted to the v1 version before evaluating the CEL expression.\n      #\n      # Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n      #\n      # only send resource requests to the webhook\n      - expression: has(request.resourceAttributes)\n      # only intercept requests to kube-system\n      - expression: request.resourceAttributes.namespace == 'kube-system'\n      # don't intercept requests from kube-system service accounts\n      - expression: \"!('system:serviceaccounts:kube-system' in request.groups)\"\n  - type: Node\n    name: node\n  - type: RBAC\n    name: rbac\n  - type: Webhook\n    name: in-cluster-authorizer\n    webhook:\n      authorizedTTL: 5m\n      unauthorizedTTL: 30s\n      timeout: 3s\n      subjectAccessReviewVersion: v1\n      failurePolicy: NoOpinion\n      connectionInfo:\n        type: InClusterConfig\n```\n\n3.3 - Authorization | When configuring the authorizer chain using a configuration file, make sure all the control plane nodes have the same file contents. Take a note of the API server configuration when upgrading / downgr", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18795"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace dev\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18796"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list secrets --namespace dev --as dave\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18797"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list pods \\\n    --namespace target \\\n    --as system:serviceaccount:dev:dev-sa\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18798"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create -f - -o yaml << EOF\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    verb: create\n    namespace: dev\nEOF\n```\n\n3.3 - Authorization | The generated SelfSubjectAccessReview is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18799"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nmetadata:\n  creationTimestamp: null\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    namespace: dev\n    verb: create\nstatus:\n  allowed: true\n  denied: false\n```\n\n3.3 - Authorization | Role-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within your organization.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18800"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: RBAC\n  ...\n```\n\n3.4 - Using RBAC Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes RBAC; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18801"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18802"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --all-namespaces\n```\n\n3.4 - Using RBAC Authorization | Here is an example of a ClusterRole that can be used to grant read access to secrets in any particular namespace, or across all namespaces (depending on how it is bound):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18803"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18804"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18805"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18806"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18807"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile\n```\n\n3.4 - Using RBAC Authorization | In the Kubernetes API, most resources are represented and accessed using a string representation of their object name, such as pods for a Pod. RBAC refers to resources using exactly the same name that", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18808"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-and-pod-logs-reader\nrules:\n- apiGroups: [\"\"]\n  resources: [\"pods\", \"pods/log\"]\n  verbs: [\"get\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | You can also refer to resources by name for certain requests through the resourceNames list. When specified, requests can be restricted to individual instances of a resource. Here is an example that r", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18809"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: configmap-updater\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-configmap\"]\n  verbs: [\"update\", \"get\"]\n```\n\n3.4 - Using RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18810"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get configmaps --field-selector=metadata.name=my-configmap\n```\n\n3.4 - Using RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18811"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE\nrules:\n- apiGroups: [\"example.com\"]\n  resources: [\"*\"]\n  verbs: [\"*\"]\n```\n\n3.4 - Using RBAC Authorization | You can aggregate several ClusterRoles into one combined ClusterRole. A controller, running as part of the cluster control plane, watches for ClusterRole objects with an aggregationRule set. The aggre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18812"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring\naggregationRule:\n  clusterRoleSelectors:\n  - matchLabels:\n      rbac.example.com/aggregate-to-monitoring: \"true\"\nrules: [] # The control plane automatically fills in the rules\n```\n\n3.4 - Using RBAC Authorization | If you create a new ClusterRole that matches the label selector of an existing aggregated ClusterRole, that change triggers adding the new rules into the aggregated ClusterRole. Here is an example tha", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18813"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring-endpoints\n  labels:\n    rbac.example.com/aggregate-to-monitoring: \"true\"\n# When you create the \"monitoring-endpoints\" ClusterRole,\n# the rules below will be added to the \"monitoring\" ClusterRole.\nrules:\n- apiGroups: [\"\"]\n  resources: [\"services\", \"endpointslices\", \"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | The default user-facing roles use ClusterRole aggregation. This lets you, as a cluster administrator, include rules for custom resources, such as those served by CustomResourceDefinitions or aggregate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18814"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: aggregate-cron-tabs-edit\n  labels:\n    # Add these permissions to the \"admin\" and \"edit\" default roles.\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: aggregate-cron-tabs-view\n  labels:\n    # Add these permissions to the \"view\" default role.\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | The following examples are excerpts from Role or ClusterRole objects, showing only the rules section.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18815"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Pod\n  # objects is \"pods\"\n  resources: [\"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | Allow reading/writing Deployments (at the HTTP level: objects with \"deployments\" in the resource part of their URL) in the \"apps\" API groups:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18816"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"apps\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Deployment\n  # objects is \"deployments\"\n  resources: [\"deployments\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\n3.4 - Using RBAC Authorization | Allow reading Pods in the core API group, as well as reading or writing Job resources in the \"batch\" API group:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18817"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Pod\n  # objects is \"pods\"\n  resources: [\"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n- apiGroups: [\"batch\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Job\n  # objects is \"jobs\"\n  resources: [\"jobs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n```\n\n3.4 - Using RBAC Authorization | Allow reading a ConfigMap named \"my-config\" (must be bound with a RoleBinding to limit to a single ConfigMap in a single namespace):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18818"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-config\"]\n  verbs: [\"get\"]\n```\n\n3.4 - Using RBAC Authorization | Allow reading the resource \"nodes\" in the core group (because a Node is cluster-scoped, this must be in a ClusterRole bound with a ClusterRoleBinding to be effective):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18819"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Node\n  # objects is \"nodes\"\n  resources: [\"nodes\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | Allow GET and POST requests to the non-resource endpoint /healthz and all subpaths (must be in a ClusterRole bound with a ClusterRoleBinding to be effective):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18820"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrules:\n- nonResourceURLs: [\"/healthz\", \"/healthz/*\"] # '*' in a nonResourceURL is a suffix glob match\n  verbs: [\"get\", \"post\"]\n```\n\n3.4 - Using RBAC Authorization | A RoleBinding or ClusterRoleBinding binds a role to subjects. Subjects can be groups, users or ServiceAccounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18821"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: User\n  name: \"alice@example.com\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For a group named frontend-admins:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18822"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: \"frontend-admins\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For the default service account in the \"kube-system\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18823"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: kube-system\n```\n\n3.4 - Using RBAC Authorization | For all service accounts in the \"qa\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18824"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts:qa\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all service accounts in any namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18825"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all authenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18826"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all unauthenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18827"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18828"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | API servers create a set of default ClusterRole and ClusterRoleBinding objects. Many of these are system: prefixed, which indicates that the resource is directly managed by the cluster control plane.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18829"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nmetadata:\n  labels:\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\n```\n\n3.4 - Using RBAC Authorization | If used in a RoleBinding, allows read/write access to most resources in a namespace, including the ability to create roles and role bindings within the namespace. This role does not allow write access", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18830"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: role-grantor\nrules:\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"rolebindings\"]\n  verbs: [\"create\"]\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"clusterroles\"]\n  verbs: [\"bind\"]\n  # omit resourceNames to allow binding any ClusterRole\n  resourceNames: [\"admin\",\"edit\",\"view\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: role-grantor-binding\n  namespace: user-1-namespace\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: role-grantor\nsubjects:\n- apiGroup: rbac.authorization.k8s.io\n  kind: User\n  name: user-1\n```\n\n3.4 - Using RBAC Authorization | When bootstrapping the first roles and role bindings, it is necessary for the initial user to grant permissions they do not yet have. To bootstrap initial roles and role bindings:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18831"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole\n```\n\n3.4 - Using RBAC Authorization | Creates a ClusterRole. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18832"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding\n```\n\n3.4 - Using RBAC Authorization | Grants a Role or ClusterRole within a specific namespace. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18833"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding\n```\n\n3.4 - Using RBAC Authorization | Grants a ClusterRole across the entire cluster (all namespaces). Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18834"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile\n```\n\n3.4 - Using RBAC Authorization | Creates or updates rbac.authorization.k8s.io/v1 API objects from a manifest file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18835"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount\n```\n\n3.4 - Using RBAC Authorization | For example, grant read-only permission within \"my-namespace\" to the \"my-sa\" service account:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18836"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\n3.4 - Using RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18837"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: Node\n  ...\n```\n\n3.5 - Using Node Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes Node; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18838"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authz-service\n    cluster:\n      # CA for verifying the remote service.\n      certificate-authority: /path/to/ca.pem\n      # URL of remote service to query. Must use 'https'. May not include parameters.\n      server: https://authz.example.com/authorize\n\n# users refers to the API Server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API Server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authz-service\n    user: name-of-api-server\n  name: webhook\n```\n\n3.6 - Webhook Mode | When faced with an authorization decision, the API Server POSTs a JSON- serialized authorization.k8s.io/v1beta1 SubjectAccessReview object describing the action. This object contains fields describing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18839"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: EventRateLimit\n    path: eventconfig.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | There are four types of limits that can be specified in the configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18840"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: eventratelimit.admission.k8s.io/v1alpha1\nkind: Configuration\nlimits:\n  - type: Namespace\n    qps: 50\n    burst: 100\n    cacheSize: 2000\n  - type: User\n    qps: 10\n    burst: 50\n```\n\n3.8 - Admission Control in Kubernetes | See the EventRateLimit Config API (v1alpha1) for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18841"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nimagePolicy:\n  kubeConfigFile: /path/to/kubeconfig/for/backend\n  # time in s to cache approval\n  allowTTL: 50\n  # time in s to cache denial\n  denyTTL: 50\n  # time in ms to wait between retries\n  retryBackoff: 500\n  # determines behavior if the webhook backend fails\n  defaultAllow: true\n```\n\n3.8 - Admission Control in Kubernetes | Reference the ImagePolicyWebhook configuration file from the file provided to the API server's command line flag --admission-control-config-file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18842"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    path: imagepolicyconfig.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | Alternatively, you can embed the configuration directly in the file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18843"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    configuration:\n      imagePolicy:\n        kubeConfigFile: <path-to-kubeconfig-file>\n        allowTTL: 50\n        denyTTL: 50\n        retryBackoff: 500\n        defaultAllow: true\n```\n\n3.8 - Admission Control in Kubernetes | The ImagePolicyWebhook config file must reference a kubeconfig formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18844"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-imagepolicy-service\n    cluster:\n      certificate-authority: /path/to/ca.pem    # CA for verifying the remote service.\n      server: https://images.example.com/policy # URL of remote service to query. Must use 'https'.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook admission controller to use\n      client-key: /path/to/key.pem          # key matching the cert\n```\n\n3.8 - Admission Control in Kubernetes | For additional HTTP configuration, refer to the kubeconfig documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18845"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: gluster-vol-default\nprovisioner: kubernetes.io/glusterfs\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n3.8 - Admission Control in Kubernetes | For more information about persistent volume claims, see PersistentVolumeClaims.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18846"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\npodNodeSelectorPluginConfig:\n  clusterDefaultNodeSelector: name-of-node-selector\n  namespace1: name-of-node-selector\n  namespace2: name-of-node-selector\n```\n\n3.8 - Admission Control in Kubernetes | Reference the PodNodeSelector configuration file from the file provided to the API server's command line flag --admission-control-config-file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18847"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodNodeSelector\n  path: podnodeselector.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | PodNodeSelector uses the annotation key scheduler.alpha.kubernetes.io/node-selector to assign node selectors to namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18848"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  annotations:\n    scheduler.alpha.kubernetes.io/node-selector: name-of-node-selector\n  name: namespace3\n```\n\n3.8 - Admission Control in Kubernetes | This admission controller has the following behavior:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18849"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: apps-that-need-nodes-exclusively\n  annotations:\n    scheduler.alpha.kubernetes.io/defaultTolerations: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n    scheduler.alpha.kubernetes.io/tolerationsWhitelist: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n```\n\n3.8 - Admission Control in Kubernetes | This admission controller is disabled by default.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18850"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nmetadata:\n  name: \"pod-policy.example.com\"\nwebhooks:\n- name: \"pod-policy.example.com\"\n  rules:\n  - apiGroups:   [\"\"]\n    apiVersions: [\"v1\"]\n    operations:  [\"CREATE\"]\n    resources:   [\"pods\"]\n    scope:       \"Namespaced\"\n  clientConfig:\n    service:\n      namespace: \"example-namespace\"\n      name: \"example-service\"\n    caBundle: <CA_BUNDLE>\n  admissionReviewVersions: [\"v1\"]\n  sideEffects: None\n  timeoutSeconds: 5\n```\n\n3.9 - Dynamic Admission Control | The scope field specifies if only cluster-scoped resources (\"Cluster\") or namespace-scoped resources (\"Namespaced\") will match this rule. \"∗\" means that there are no scope restrictions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18851"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\n3.9 - Dynamic Admission Control | # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1 apiVersion: apiserver.k8s.io/v1alpha1 kind: AdmissionConfiguration plugins: - name: ValidatingAdmissionWebhook configuration: # Depre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18852"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1\napiVersion: apiserver.k8s.io/v1alpha1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\n3.9 - Dynamic Admission Control | For more information about AdmissionConfiguration, see the AdmissionConfiguration (v1) reference. See the webhook configuration section for details about each config field.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18853"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n# name should be set to the DNS name of the service or the host (including port) of the URL the webhook is configured to speak to.\n# If a non-443 port is used for services, it must be included in the name when configuring 1.16+ API servers.\n#\n# For a webhook configured to speak to a service on the default port (443), specify the DNS name of the service:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For a webhook configured to speak to a service on non-default port (e.g. 8443), specify the DNS name and port of the service in 1.16+:\n# - name: webhook1.ns1.svc:8443\n#   user: ...\n# and optionally create a second stanza using only the DNS name of the service for compatibility with 1.15 API servers:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For webhooks configured to speak to a URL, match the host (and port) specified in the webhook's URL. Examples:\n# A webhook with `url: https://www.example.com`:\n# - name: www.example.com\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:443`:\n# - name: www.example.com:443\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:8443`:\n# - name: www.example.com:8443\n#   user: ...\n#\n- name: 'webhook1.ns1.svc'\n  user:\n    client-certificate-data: \"<pem encoded certificate>\"\n    client-key-data: \"<pem encoded key>\"\n# The `name` supports using * to wildcard-match prefixing segments.\n- name: '*.webhook-company.org'\n  user:\n    password: \"<password>\"\n    username: \"<name>\"\n# '*' is the default match.\n- name: '*'\n  user:\n    token: \"<token>\"\n```\n\n3.9 - Dynamic Admission Control | Of course you need to set up the webhook server to handle these authentication requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18854"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  admissionReviewVersions: [\"v1\", \"v1beta1\"]\n```\n\n3.9 - Dynamic Admission Control | admissionReviewVersions is a required field when creating webhook configurations. Webhooks are required to support at least one AdmissionReview version understood by the current and previous API serve", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18855"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n{\n  \"apiVersion\": \"admission.k8s.io/v1\",\n  \"kind\": \"AdmissionReview\",\n  \"request\": {\n    # Random uid uniquely identifying this admission call\n    \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n\n    # Fully-qualified group/version/kind of the incoming object\n    \"kind\": {\n      \"group\": \"autoscaling\",\n      \"version\": \"v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # Fully-qualified group/version/kind of the resource being modified\n    \"resource\": {\n      \"group\": \"apps\",\n      \"version\": \"v1\",\n      \"resource\": \"deployments\"\n    },\n\n    # Subresource, if the request is to a subresource\n    \"subResource\": \"scale\",\n\n    # Fully-qualified group/version/kind of the incoming object in the original request to the API server\n    # This only differs from `kind` if the webhook specified `matchPolicy: Equivalent` and the original\n    # request to the API server was converted to a version the webhook registered for\n    \"requestKind\": {\n      \"group\": \"autoscaling\",\n      \"version\": \"v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # Fully-qualified group/version/kind of the resource being modified in the original request to the API server\n    # This only differs from `resource` if the webhook specified `matchPolicy: Equivalent` and the original\n    # request to the API server was converted to a version the webhook registered for\n    \"requestResource\": {\n      \"group\": \"apps\",\n      \"version\": \"v1\",\n      \"resource\": \"deployments\"\n    },\n\n    # Subresource, if the request is to a subresource\n    # This only differs from `subResource` if the webhook specified `matchPolicy: Equivalent` and the original\n    # request to the API server was converted to a version the webhook registered for\n    \"requestSubResource\": \"scale\",\n\n    # Name of the resource being modified\n    \"name\": \"my-deployment\",\n\n    # Namespace of the resource being modified, if the resource is namespaced (or is a Namespace object)\n    \"namespace\": \"my-namespace\",\n\n    # operation can be CREATE, UPDATE, DELETE, or CONNECT\n    \"operation\": \"UPDATE\",\n\n    \"userInfo\": {\n      # Username of the authenticated user making the request to the API server\n      \"username\": \"admin\",\n\n      # UID of the authenticated user making the request to the API server\n      \"uid\": \"014fbff9a07c\",\n\n      # Group memberships of the authenticated user making the request to the API server\n      \"groups\": [\n        \"system:authenticated\",\n        \"my-admin-group\"\n      ],\n\n      # Arbitrary extra info associated with the user making the request to the API server\n      # This is populated by the API server authentication layer\n      \"extra\": {\n        \"some-key\": [\n          \"some-value1\",\n          \"some-value2\"\n        ]\n      }\n    },\n\n    # object is the new object being admitted. It is null for DELETE operations\n    \"object\": {\n      \"apiVersion\": \"autoscaling/v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # oldObject is the existing object. It is null for CREATE and CONNECT operations\n    \"oldObject\": {\n      \"apiVersion\": \"autoscaling/v1\",\n      \"kind\": \"Scale\"\n    },\n\n    # options contain the options for the operation being admitted, like meta.k8s.io/v1 CreateOptions,\n    # UpdateOptions, or DeleteOptions. It is null for CONNECT operations\n    \"options\": {\n      \"apiVersion\": \"meta.k8s.io/v1\",\n      \"kind\": \"UpdateOptions\"\n    },\n\n    # dryRun indicates the API request is running in dry run mode and will not be persisted\n    # Webhooks with side effects should avoid actuating those side effects when dryRun is true\n    \"dryRun\": false\n  }\n}\n```\n\n3.9 - Dynamic Admission Control | Webhooks respond with a 200 HTTP status code, Content-Type: application/json, and a body containing an AdmissionReview object (in the same version they were sent), with the response stanza populated,", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18856"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\n...\nwebhooks:\n- name: my-webhook.example.com\n  rules:\n  - operations: [\"CREATE\", \"UPDATE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\", \"v1beta1\"]\n    resources: [\"deployments\", \"replicasets\"]\n    scope: \"Namespaced\"\n  ...\n```\n\n3.9 - Dynamic Admission Control | Match create requests for all resources (but not subresources) in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18857"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | Match update requests for all status subresources in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18858"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"UPDATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*/status\"]\n        scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | Webhooks may optionally limit which requests are intercepted based on the labels of the objects they would be sent, by specifying an objectSelector. If specified, the objectSelector is evaluated again", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18859"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  objectSelector:\n    matchLabels:\n      foo: bar\n  rules:\n  - operations: [\"CREATE\"]\n    apiGroups: [\"*\"]\n    apiVersions: [\"*\"]\n    resources: [\"*\"]\n    scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18860"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: runlevel\n          operator: NotIn\n          values: [\"0\",\"1\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | This example shows a validating webhook that matches a CREATE of any namespaced resource inside a namespace that is associated with the \"environment\" of \"prod\" or \"staging\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18861"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: environment\n          operator: In\n          values: [\"prod\",\"staging\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18862"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  matchPolicy: Equivalent\n  rules:\n  - operations: [\"CREATE\",\"UPDATE\",\"DELETE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\"]\n    resources: [\"deployments\"]\n    scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | The matchPolicy for an admission webhooks defaults to Equivalent.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18863"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['*']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Ignore' # Fail-open (optional)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'exclude-leases' # Each match condition must have a unique name\n        expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n      - name: 'exclude-kubelet-requests'\n        expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n      - name: 'rbac' # Skip RBAC requests, which are handled by the second webhook.\n        expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  \n  # This example illustrates the use of the 'authorizer'. The authorization check is more expensive\n  # than a simple expression, so in this example it is scoped to only RBAC requests by using a second\n  # webhook. Both webhooks can be served by the same endpoint.\n  - name: rbac.my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['rbac.authorization.k8s.io']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Fail' # Fail-closed (the default)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'breakglass'\n        # Skip requests made by users authorized to 'breakglass' on this webhook.\n        # The 'breakglass' API verb does not need to exist outside this check.\n        expression: '!authorizer.group(\"admissionregistration.k8s.io\").resource(\"validatingwebhookconfigurations\").name(\"my-webhook.example.com\").check(\"breakglass\").allowed()'\n```\n\n3.9 - Dynamic Admission Control | Match conditions have access to the following CEL variables:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18864"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n```\n\n3.9 - Dynamic Admission Control | The service stanza inside clientConfig is a reference to the service for this webhook. If the webhook is running within the cluster, then you should use service instead of url. The service namespace a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18865"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    caBundle: <CA_BUNDLE>\n    service:\n      namespace: my-service-namespace\n      name: my-service-name\n      path: /my-path\n      port: 1234\n```\n\n3.9 - Dynamic Admission Control | Webhooks typically operate only on the content of the AdmissionReview sent to them. Some webhooks, however, make out-of-band changes as part of processing admission requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18866"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    sideEffects: NoneOnDryRun\n```\n\n3.9 - Dynamic Admission Control | Because webhooks add to API request latency, they should evaluate as quickly as possible. timeoutSeconds allows configuring how long the API server should wait for a webhook to respond before treating", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18867"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    timeoutSeconds: 2\n```\n\n3.9 - Dynamic Admission Control | The timeout for an admission webhook defaults to 10 seconds.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18868"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  reinvocationPolicy: IfNeeded\n```\n\n3.9 - Dynamic Admission Control | Mutating webhooks must be idempotent, able to successfully process an object they have already admitted and potentially modified. This is true for all mutating admission webhooks, since any change the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18869"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  failurePolicy: Fail\n```\n\n3.9 - Dynamic Admission Control | The default failurePolicy for an admission webhooks is Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18870"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# the audit event recorded\n{\n    \"kind\": \"Event\",\n    \"apiVersion\": \"audit.k8s.io/v1\",\n    \"annotations\": {\n        \"mutation.webhook.admission.k8s.io/round_1_index_2\": \"{\\\"configuration\\\":\\\"my-mutating-webhook-configuration.example.com\\\",\\\"webhook\\\":\\\"my-webhook.example.com\\\",\\\"mutated\\\": false}\"\n        # other annotations\n        ...\n    }\n    # other fields\n    ...\n}\n```\n\n3.9 - Dynamic Admission Control | The following annotation gets recorded for a webhook being invoked in the first round. The webhook is ordered the first in the mutating webhook chain, and mutated the request object during the invocat", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18871"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# the annotation value deserialized\n{\n    \"configuration\": \"my-mutating-webhook-configuration.example.com\",\n    \"webhook\": \"my-webhook.example.com\",\n    \"mutated\": false\n}\n```\n\n3.9 - Dynamic Admission Control | The following annotation gets recorded for a webhook being invoked in the first round. The webhook is ordered the first in the mutating webhook chain, and mutated the request object during the invocat", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18872"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# the audit event recorded\n{\n    \"kind\": \"Event\",\n    \"apiVersion\": \"audit.k8s.io/v1\",\n    \"annotations\": {\n        \"mutation.webhook.admission.k8s.io/round_0_index_0\": \"{\\\"configuration\\\":\\\"my-mutating-webhook-configuration.example.com\\\",\\\"webhook\\\":\\\"my-webhook-always-mutate.example.com\\\",\\\"mutated\\\": true}\"\n        # other annotations\n        ...\n    }\n    # other fields\n    ...\n}\n```\n\n3.9 - Dynamic Admission Control | At Request audit level or higher, an annotation with key patch.webhook.admission.k8s.io/round_{round idx}_index_{order idx} gets logged with JSON payload indicating a webhook gets invoked for given re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18873"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# the annotation value deserialized\n{\n    \"configuration\": \"my-mutating-webhook-configuration.example.com\",\n    \"webhook\": \"my-webhook-always-mutate.example.com\",\n    \"mutated\": true\n}\n```\n\n3.9 - Dynamic Admission Control | At Request audit level or higher, an annotation with key patch.webhook.admission.k8s.io/round_{round idx}_index_{order idx} gets logged with JSON payload indicating a webhook gets invoked for given re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18874"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# the audit event recorded\n{\n    \"kind\": \"Event\",\n    \"apiVersion\": \"audit.k8s.io/v1\",\n    \"annotations\": {\n        \"patch.webhook.admission.k8s.io/round_1_index_3\": \"{\\\"configuration\\\":\\\"my-other-mutating-webhook-configuration.example.com\\\",\\\"webhook\\\":\\\"my-webhook-always-mutate.example.com\\\",\\\"patch\\\":[{\\\"op\\\":\\\"add\\\",\\\"path\\\":\\\"/data/mutation-stage\\\",\\\"value\\\":\\\"yes\\\"}],\\\"patchType\\\":\\\"JSONPatch\\\"}\"\n        # other annotations\n        ...\n    }\n    # other fields\n    ...\n}\n```\n\n3.9 - Dynamic Admission Control | The API server exposes Prometheus metrics from the /metrics endpoint, which can be used for monitoring and diagnosing API server status. The following metrics record status related to admission webhoo", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18875"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# the annotation value deserialized\n{\n    \"configuration\": \"my-other-mutating-webhook-configuration.example.com\",\n    \"webhook\": \"my-webhook-always-mutate.example.com\",\n    \"patchType\": \"JSONPatch\",\n    \"patch\": [\n        {\n            \"op\": \"add\",\n            \"path\": \"/data/mutation-stage\",\n            \"value\": \"yes\"\n        }\n    ]\n}\n```\n\n3.9 - Dynamic Admission Control | The API server exposes Prometheus metrics from the /metrics endpoint, which can be used for monitoring and diagnosing API server status. The following metrics record status related to admission webhoo", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18876"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nspec:\n  token: <token from step 2>\n```\n\n3.10 - Managing Service Accounts | Submit this resource to the apiserver for review:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18877"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nmetadata:\n  creationTimestamp: null\nspec:\n  token: <token>\nstatus:\n  audiences:\n  - https://kubernetes.default.svc.cluster.local\n  authenticated: true\n  user:\n    extra:\n      authentication.kubernetes.io/credential-id:\n      - JTI=7ee52be0-9045-4653-aa5e-0da57b8dccdc\n      authentication.kubernetes.io/node-name:\n      - kind-control-plane\n      authentication.kubernetes.io/node-uid:\n      - 497e9d9a-47aa-4930-b0f6-9f2fb574c8c6\n      authentication.kubernetes.io/pod-name:\n      - test-pod\n      authentication.kubernetes.io/pod-uid:\n      - e87dbbd6-3d7e-45db-aafb-72b24627dff5\n    groups:\n    - system:serviceaccounts\n    - system:serviceaccounts:default\n    - system:authenticated\n    uid: f8b4161b-2e2b-11e9-86b7-2afc33b31a7e\n    username: system:serviceaccount:default:my-sa\n```\n\n3.10 - Managing Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18878"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get tokenreview\n```\n\n3.10 - Managing Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18879"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      sources:\n        - serviceAccountToken:\n            path: token # must match the path the app expects\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\n3.10 - Managing Service Accounts | That manifest snippet defines a projected volume that consists of three sources. In this case, each source also represents a single path within that volume. The three sources are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18880"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\n  namespace: default\nsecrets:\n  - name: build-robot-secret # usually NOT present for a manually generated token\n```\n\n3.10 - Managing Service Accounts | Beginning from version 1.29, legacy ServiceAccount tokens that were generated automatically will be marked as invalid if they remain unused for a certain period of time (set to default at one year). T", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18881"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  namespace: default\n  labels:\n    kubernetes.io/legacy-token-last-used: 2022-10-24\n    kubernetes.io/legacy-token-invalid-since: 2023-10-25\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\n```\n\n3.10 - Managing Service Accounts | A ServiceAccount controller manages the ServiceAccounts inside namespaces, and ensures a ServiceAccount named \"default\" exists in every active namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18882"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      defaultMode: 420 # decimal equivalent of octal 0644\n      sources:\n        - serviceAccountToken:\n            expirationSeconds: 3607\n            path: token\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\n3.10 - Managing Service Accounts | That manifest snippet defines a projected volume that combines information from three sources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18883"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\n3.10 - Managing Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18884"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"v1\",\"kind\":\"ServiceAccount\",\"metadata\":{\"annotations\":{},\"name\":\"example-automated-thing\",\"namespace\":\"examplens\"}}      \n  creationTimestamp: \"2019-07-21T07:07:07Z\"\n  name: example-automated-thing\n  namespace: examplens\n  resourceVersion: \"777\"\n  selfLink: /api/v1/namespaces/examplens/serviceaccounts/example-automated-thing\n  uid: f23fd170-66f2-4697-b049-e1e266b7f835\nsecrets:\n  - name: example-automated-thing-token-zyxwv\n```\n\n3.10 - Managing Service Accounts | Then, delete the Secret you now know the name of:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18885"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\n3.11 - Certificates and Certificate Signing Requests | For certificates that have been approved, the next step is signing. The relevant signing controller first validates that the signing conditions are met and then creates a certificate. The signing cont", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18886"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18887"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18888"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\n3.11 - Certificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18889"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  certificate: \"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JS...\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | Before a signer issues a certificate based on a CertificateSigningRequest, the signer typically checks that the issuance for that CSR has been approved.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18890"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\n3.11 - Certificates and Certificate Signing Requests | To approve a CSR with kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18891"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny\n```\n\n3.11 - Certificates and Certificate Signing Requests | To approve a CSR with kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18892"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Approved by my custom approver controller\n    reason: ApprovedByMyPolicy # You can set this to any string\n    type: Approved\n```\n\n3.11 - Certificates and Certificate Signing Requests | For Denied CSRs:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18893"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Denied by my custom approver controller\n    reason: DeniedByMyPolicy # You can set this to any string\n    type: Denied\n```\n\n3.11 - Certificates and Certificate Signing Requests | It's usual to set status.conditions.reason to a machine-friendly reason code using TitleCase; this is a convention but you can set it to anything you like. If you want to add a note for human consumpt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18894"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get clustertrustbundles --as='system:serviceaccount:mynamespace:default'\n```\n\n3.11 - Certificates and Certificate Signing Requests | Signer-linked ClusterTrustBundles are associated with a signer name, like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18895"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: example.com:mysigner:foo\nspec:\n  signerName: example.com/mysigner\n  trustBundle: \"<... PEM data ...>\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | These ClusterTrustBundles are intended to be maintained by a signer-specific controller in the cluster, so they have several security features:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18896"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: foo\nspec:\n  # no signerName specified, so the field is blank\n  trustBundle: \"<... PEM data ...>\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | They are primarily intended for cluster configuration use cases. Each signer-unlinked ClusterTrustBundle is an independent object, in contrast to the customary grouping behavior of signer-linked Clust", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18897"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# enable bootstrapping nodes to create CSR\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: create-csrs-for-bootstrapping\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:node-bootstrapper\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | While the apiserver receives the requests for certificates from the kubelet and authenticates those requests, the controller-manager is responsible for issuing actual signed certificates.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18898"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Approve all CSRs for the group \"system:bootstrappers\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-csrs-for-group\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:nodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | To enable the kubelet to renew its own client certificate, create a ClusterRoleBinding that binds the group in which the fully functioning node is a member system:nodes to the ClusterRole that grants", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18899"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Approve renewal CSRs for the group \"system:nodes\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-renewals-for-nodes\nsubjects:\n- kind: Group\n  name: system:nodes\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:selfnodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | The csrapproving controller that ships as part of kube-controller-manager and is enabled by default. The controller uses the SubjectAccessReview API to determine if a given user is authorized to reque", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18900"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority: /var/lib/kubernetes/ca.pem\n    server: https://my.server.example.com:6443\n  name: bootstrap\ncontexts:\n- context:\n    cluster: bootstrap\n    user: kubelet-bootstrap\n  name: bootstrap\ncurrent-context: bootstrap\npreferences: {}\nusers:\n- name: kubelet-bootstrap\n  user:\n    token: 07401b.f395accd246ae52d\n```\n\n3.14 - TLS bootstrapping | The important elements to note are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18901"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-cluster bootstrap --server='https://my.server.example.com:6443' --certificate-authority=/var/lib/kubernetes/ca.pem\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-credentials kubelet-bootstrap --token=07401b.f395accd246ae52d\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig set-context bootstrap --user=kubelet-bootstrap --cluster=bootstrap\nkubectl config --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig use-context bootstrap\n```\n\n3.14 - TLS bootstrapping | To indicate to the kubelet to use the bootstrap kubeconfig, use the following kubelet flag:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18902"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl describe csr <name>\n```\n\n3.14 - TLS bootstrapping | This page provides an overview of MutatingAdmissionPolicies. MutatingAdmissionPolicies allow you change what happens when someone writes a change to the Kubernetes API. If you want to use declarative", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18903"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <name>\n```\n\n3.14 - TLS bootstrapping | This page provides an overview of MutatingAdmissionPolicies. MutatingAdmissionPolicies allow you change what happens when someone writes a change to the Kubernetes API. If you want to use declarative", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18904"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny <name>\n```\n\n3.14 - TLS bootstrapping | This page provides an overview of MutatingAdmissionPolicies. MutatingAdmissionPolicies allow you change what happens when someone writes a change to the Kubernetes API. If you want to use declarative", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18905"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\n3.15 - Mutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18906"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp\n  namespace: default\nspec:\n  ...\n  initContainers:\n  - name: mesh-proxy\n    image: mesh/proxy:v1.0.0\n    args: [\"proxy\", \"sidecar\"]\n    restartPolicy: Always\n  - name: myapp-initializer\n    image: example/initializer:v1.0.0\n  ...\n```\n\n3.15 - Mutating Admission Policy | Parameter resources allow a policy configuration to be separate from its definition. A policy can define paramKind, which outlines GVK of the parameter resource, and then a policy binding ties a polic", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18907"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\n3.15 - Mutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18908"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\n3.16 - Validating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18909"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18910"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidationActions: [Warn, Audit]\n```\n\n3.16 - Validating Admission Policy | Deny and Warn may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18911"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18912"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18913"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\n3.16 - Validating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18914"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18915"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\n3.16 - Validating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18916"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: example-binding\nspec:\n  policyName: example-policy\n  paramRef:\n    selector:\n      matchLabels:\n        environment: test\n    parameterNotFoundAction: Allow\n  validationActions:\n  - Deny\n```\n\n3.16 - Validating Admission Policy | failurePolicy defines how mis-configurations and CEL expressions evaluating to error from the admission policy are handled. Allowed values are Ignore or Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18917"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\n3.16 - Validating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18918"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\n3.16 - Validating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18919"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\n3.16 - Validating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18920"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18921"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18922"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n  typeChecking:\n    expressionWarnings:\n    - fieldRef: spec.validations[0].expression\n      warning: |-\n        apps/v1, Kind=Deployment: ERROR: <input>:1:7: undefined field 'replicas'\n         | object.replicas > 1\n         | ......^\n```\n\n3.16 - Validating Admission Policy | If multiple resources are matched in spec.matchConstraints, all of matched resources will be checked against. For example, the following policy definition", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18923"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18924"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nstatus:\n  typeChecking:\n    expressionWarnings:\n    - fieldRef: spec.validations[0].expression\n      warning: |-\n        apps/v1, Kind=Deployment: ERROR: <input>:1:7: undefined field 'replicas'\n         | object.replicas > 1\n         | ......^\n        apps/v1, Kind=ReplicaSet: ERROR: <input>:1:7: undefined field 'replicas'\n         | object.replicas > 1\n         | ......^\n```\n\n3.16 - Validating Admission Policy | Type Checking has the following limitation:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18925"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nspec:\n  variables:\n    - name: foo\n      expression: \"'foo' in object.spec.metadata.labels ? object.spec.metadata.labels['foo'] : 'default'\"\n  validations:\n    - expression: variables.foo == 'bar'\n```\n\n3.16 - Validating Admission Policy | A variable is lazily evaluated when it is first referred. Any error that occurs during the evaluation will be reported during the evaluation of the referring expression. Both the result and potential", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18926"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\n3.16 - Validating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18927"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/filter-result: >-\n      {\"node-282x7\":{\"AzureDiskLimits\":\"passed\",\"EBSLimits\":\"passed\",\"GCEPDLimits\":\"passed\",\"InterPodAffinity\":\"passed\",\"NodeAffinity\":\"passed\",\"NodeName\":\"passed\",\"NodePorts\":\"passed\",\"NodeResourcesFit\":\"passed\",\"NodeUnschedulable\":\"passed\",\"NodeVolumeLimits\":\"passed\",\"PodTopologySpread\":\"passed\",\"TaintToleration\":\"passed\",\"VolumeBinding\":\"passed\",\"VolumeRestrictions\":\"passed\",\"VolumeZone\":\"passed\"},\"node-gp9t4\":{\"AzureDiskLimits\":\"passed\",\"EBSLimits\":\"passed\",\"GCEPDLimits\":\"passed\",\"InterPodAffinity\":\"passed\",\"NodeAffinity\":\"passed\",\"NodeName\":\"passed\",\"NodePorts\":\"passed\",\"NodeResourcesFit\":\"passed\",\"NodeUnschedulable\":\"passed\",\"NodeVolumeLimits\":\"passed\",\"PodTopologySpread\":\"passed\",\"TaintToleration\":\"passed\",\"VolumeBinding\":\"passed\",\"VolumeRestrictions\":\"passed\",\"VolumeZone\":\"passed\"}}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18928"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/finalscore-result: >-\n      {\"node-282x7\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"200\",\"TaintToleration\":\"300\",\"VolumeBinding\":\"0\"},\"node-gp9t4\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"200\",\"TaintToleration\":\"300\",\"VolumeBinding\":\"0\"}}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18929"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/prefilter-result-status: >-\n      {\"InterPodAffinity\":\"success\",\"NodeAffinity\":\"success\",\"NodePorts\":\"success\",\"NodeResourcesFit\":\"success\",\"PodTopologySpread\":\"success\",\"VolumeBinding\":\"success\",\"VolumeRestrictions\":\"success\"}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18930"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/prescore-result: >-\n      {\"InterPodAffinity\":\"success\",\"NodeAffinity\":\"success\",\"NodeNumber\":\"success\",\"PodTopologySpread\":\"success\",\"TaintToleration\":\"success\"}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18931"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkube-scheduler-simulator.sigs.k8s.io/score-result: >-\n      {\"node-282x7\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"0\",\"TaintToleration\":\"0\",\"VolumeBinding\":\"0\"},\"node-gp9t4\":{\"ImageLocality\":\"0\",\"InterPodAffinity\":\"0\",\"NodeAffinity\":\"0\",\"NodeNumber\":\"0\",\"NodeResourcesBalancedAllocation\":\"76\",\"NodeResourcesFit\":\"73\",\"PodTopologySpread\":\"0\",\"TaintToleration\":\"0\",\"VolumeBinding\":\"0\"}}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18932"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/default-container: \"front-end-app\"\n```\n\n4 - Well-Known Labels, Annotations and Taints | The value of the annotation is the container name that is default for this Pod. For example, kubectl logs or kubectl exec without -c or --container flag will use this default container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18933"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/default-logs-container: \"front-end-app\"\n```\n\n4 - Well-Known Labels, Annotations and Taints | The value of the annotation is the container name that is the default logging container for this Pod. For example, kubectl logs without -c or --container flag will use this default container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18934"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/default-container\n```\n\n4 - Well-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18935"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkubectl.kubernetes.io/last-applied-configuration: >\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"example\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"matchLabels\":{\"app.kubernetes.io/name\":foo}},\"template\":{\"metadata\":{\"labels\":{\"app.kubernetes.io/name\":\"foo\"}},\"spec\":{\"containers\":[{\"image\":\"container-registry.example/foo-bar:1.42\",\"name\":\"foo-bar\",\"ports\":[{\"containerPort\":42}]}]}}}}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: all objects", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18936"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/restartedAt: \"2024-06-21T17:27:41Z\"\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: Deployment, ReplicaSet, StatefulSet, DaemonSet, Pod", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18937"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart <RESOURCE>\n```\n\n4 - Well-Known Labels, Annotations and Taints | You should not assume that this annotation represents the date / time of the most recent update; a separate change could have been made since the last manually triggered rollout.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18938"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile\n```\n\n4 - Well-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18939"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v1\n```\n\n5.1.12 - HorizontalPodAutoscaler | import \"k8s.io/api/autoscaling/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18940"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: autoscaling/v2\n```\n\n5.1.13 - HorizontalPodAutoscaler | import \"k8s.io/api/autoscaling/v2\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18941"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: scheduling.k8s.io/v1\n```\n\n5.1.14 - PriorityClass | import \"k8s.io/api/scheduling/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18942"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1alpha3\n```\n\n5.1.15 - DeviceTaintRule v1alpha3 | import \"k8s.io/api/resource/v1alpha3\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18943"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n5.1.16 - ResourceClaim | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18944"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n5.1.17 - ResourceClaimTemplate | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18945"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n5.1.18 - ResourceSlice | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18946"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: discovery.k8s.io/v1\n```\n\n5.2.3 - EndpointSlice | import \"k8s.io/api/discovery/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18947"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n5.2.4 - Ingress | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18948"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n5.2.5 - IngressClass | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18949"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n5.3.3 - CSIDriver | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18950"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n5.3.4 - CSINode | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18951"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n5.3.5 - CSIStorageCapacity | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18952"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n5.3.8 - StorageClass | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18953"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storagemigration.k8s.io/v1alpha1\n```\n\n5.3.9 - StorageVersionMigration v1alpha1 | import \"k8s.io/api/storagemigration/v1alpha1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18954"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n5.3.11 - VolumeAttachment | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18955"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\n```\n\n5.3.12 - VolumeAttributesClass | import \"k8s.io/api/storage/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18956"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\n5.4.2 - TokenRequest | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18957"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\n5.4.3 - TokenReview | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18958"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\n```\n\n5.4.4 - CertificateSigningRequest | import \"k8s.io/api/certificates/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18959"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1beta1\n```\n\n5.4.5 - ClusterTrustBundle v1beta1 | import \"k8s.io/api/certificates/v1beta1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18960"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\n```\n\n5.4.6 - SelfSubjectReview | import \"k8s.io/api/authentication/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18961"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\n```\n\n5.4.7 - PodCertificateRequest v1alpha1 | import \"k8s.io/api/certificates/v1alpha1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18962"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.5.1 - LocalSubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18963"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.5.2 - SelfSubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18964"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.5.3 - SelfSubjectRulesReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18965"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\n```\n\n5.5.4 - SubjectAccessReview | import \"k8s.io/api/authorization/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18966"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.5.5 - ClusterRole | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18967"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.5.6 - ClusterRoleBinding | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18968"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.5.7 - Role | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18969"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n```\n\n5.5.8 - RoleBinding | import \"k8s.io/api/rbac/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18970"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\n```\n\n5.6.1 - FlowSchema | import \"k8s.io/api/flowcontrol/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18971"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n5.6.4 - NetworkPolicy | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18972"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: policy/v1\n```\n\n5.6.5 - PodDisruptionBudget | import \"k8s.io/api/policy/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18973"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: flowcontrol.apiserver.k8s.io/v1\n```\n\n5.6.6 - PriorityLevelConfiguration | import \"k8s.io/api/flowcontrol/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18974"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n5.6.7 - ValidatingAdmissionPolicy | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18975"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n5.6.8 - ValidatingAdmissionPolicyBinding | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18976"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\n```\n\n5.6.9 - MutatingAdmissionPolicy v1beta1 | import \"k8s.io/api/admissionregistration/v1beta1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18977"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\n```\n\n5.6.10 - MutatingAdmissionPolicyBinding v1alpha1 | import \"k8s.io/api/admissionregistration/v1alpha1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18978"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\n```\n\n5.7.1 - CustomResourceDefinition | import \"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18979"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get \\<shortname>\n```\n\n5.7.1 - CustomResourceDefinition | names.singular (string)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18980"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get \\<shortname>\n```\n\n5.7.1 - CustomResourceDefinition | acceptedNames.singular (string)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18981"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: resource.k8s.io/v1\n```\n\n5.7.2 - DeviceClass | import \"k8s.io/api/resource/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18982"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n5.7.3 - MutatingWebhookConfiguration | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18983"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\n```\n\n5.7.4 - ValidatingWebhookConfiguration | import \"k8s.io/api/admissionregistration/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18984"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiregistration.k8s.io/v1\n```\n\n5.8.1 - APIService | import \"k8s.io/kube-aggregator/pkg/apis/apiregistration/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18985"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: events.k8s.io/v1\n```\n\n5.8.3 - Event | import \"k8s.io/api/events/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18986"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n5.8.4 - IPAddress | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18987"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1\n```\n\n5.8.5 - Lease | import \"k8s.io/api/coordination/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18988"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: coordination.k8s.io/v1beta1\n```\n\n5.8.6 - LeaseCandidate v1beta1 | import \"k8s.io/api/coordination/v1beta1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18989"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: node.k8s.io/v1\n```\n\n5.8.9 - RuntimeClass | import \"k8s.io/api/node/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18990"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: networking.k8s.io/v1\n```\n\n5.8.10 - ServiceCIDR | import \"k8s.io/api/networking/v1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18991"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\n```\n\n5.10.1 - MutatingAdmissionPolicyBindingList v1beta1 | import \"k8s.io/api/admissionregistration/v1beta1\"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18992"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: cpu-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    args:\n    - \"stress\"\n    - \"--cpus\"\n    - \"1\"\n    resources:\n      limits:\n        cpu: \"500m\"\n      requests:\n        cpu: \"500m\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f cpu-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18993"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f cpu-pressure-pod.yaml\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | After the Pod is running, you can observe the CPU pressure through either the Summary API or the Prometheus metrics endpoint.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18994"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: memory-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n    - \"i=0; while true; do dd if=/dev/zero of=testfile.$i bs=1M count=50 &>/dev/null; i=$(((i+1)%5)); sleep 0.1; done\"\n    resources:\n      limits:\n        memory: \"200M\"\n      requests:\n        memory: \"200M\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f memory-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18995"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f memory-pressure-pod.yaml\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Using the Summary API:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18996"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: io-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: io-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n      - \"while true; do dd if=/dev/zero of=testfile bs=1M count=128 &>/dev/null; sync; rm testfile &>/dev/null; done\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply this to your cluster: kubectl apply -f io-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18997"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f io-pressure-pod.yaml\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Using the Summary API:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18998"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nauthorization:\n  mode: Webhook\n  webhook:\n    cacheAuthorizedTTL: \"5m\"\n    cacheUnauthorizedTTL: \"30s\"\nserializeImagePulls: false\naddress: \"192.168.0.1\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_18999"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19000"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | You can override the slices/lists values of the kubelet configuration. However, the entire list gets overridden during the merging process. For example, you can override the clusterDNS list as follows", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19001"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.9\"\n  - \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19002"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19003"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Individual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden. However, for map[string][]string, the entire list associated with a specific field ge", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19004"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 456\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19005"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19006"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | This page provides details of version compatibility between the Kubernetes device plugin API, and different versions of Kubernetes itself.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19007"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\n8.10 - Seccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19008"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n...\niptables:\n  minSyncPeriod: 1s\n  syncPeriod: 30s\n...\n```\n\n9.3 - Virtual IPs and Service Proxies | The minSyncPeriod parameter sets the minimum duration between attempts to resynchronize iptables rules with the kernel. If it is 0s, then kube-proxy will always immediately synchronize the rules every", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19009"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs-default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(i , variables.allowed.exists(j , cidr(j).containsCIDR(i)))\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs-default\"\n  validationActions: [Deny,Audit]\n---\n```\n\n9.3 - Virtual IPs and Service Proxies | Kubernetes divides the ClusterIP range into two bands, based on the size of the configured service-cluster-ip-range by using the following formula min(max(16, cidrSize / 16), 256). That formula means", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19010"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\n10.1.3 - kubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19011"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve\n```\n\n10.1.3 - kubeadm join | In order to achieve the joining flow using the token as the only piece of validation information, a ConfigMap with some data needed for validation of the control-plane node's identity is exposed publi", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19012"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority-data: <ca-cert>\n    server: https://<ip>:<port>\n  name: \"\"\ncontexts: []\ncurrent-context: \"\"\npreferences: {}\nusers: []\n```\n\n10.1.3 - kubeadm join | Use the cluster-info.yaml file as an argument to kubeadm join --discovery-file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19013"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\netcdctl del \"\" --prefix\n```\n\n10.1.7 - kubeadm reset | See the etcd documentation for more information.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19014"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nsudo rm -rf /etc/cni/net.d\n```\n\n10.1.7 - kubeadm reset | The kubeadm reset command does not clean any iptables, nftables or IPVS rules applied to the host by kube-proxy. A control loop in kube-proxy ensures that the rules on each node host are synchronized.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19015"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker run --privileged --rm registry.k8s.io/kube-proxy:v1.34.0 sh -c \"kube-proxy --cleanup && echo DONE\"\n```\n\n10.1.7 - kubeadm reset | The output of the above command should print DONE at the end. Instead of Docker, you can use your preferred container runtime to start the container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19016"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nyq eval -i '.spec.containers[0].command = []' /etc/kubernetes/manifests/kube-apiserver.yaml\ntimeout 60 sh -c 'while pgrep kube-apiserver >/dev/null; do sleep 1; done' || true\n```\n\n10.1.7 - kubeadm reset | Bootstrap tokens are used for establishing bidirectional trust between a node joining the cluster and a control-plane node, as described in authenticating with bootstrap tokens.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19017"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f <network-plugin-of-choice.yaml>\n```\n\n10.1.16 - Implementation details | In order to reduce complexity and to simplify development of higher level tools that build on top of kubeadm, it uses a limited set of constant values for well-known paths and file names.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19018"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod example-pod1 example-pod2\n```\n\n11 - Command line tool (kubectl) | To specify multiple resource types individually: TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>.Example: kubectl get pod/example-pod1 replicationcontroller/example-rc1", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19019"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/example-pod1 replicationcontroller/example-rc1\n```\n\n11 - Command line tool (kubectl) | To specify resources with one or more files: -f file1 -f file2 -f file<#>", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19020"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get -f ./pod.yaml\n```\n\n11 - Command line tool (kubectl) | flags: Specifies optional flags. For example, you can use the -s or --server flags to specify the address and port of the Kubernetes API server.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19021"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n11 - Command line tool (kubectl) | Explicit use of --namespace <value> overrides this behavior.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19022"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl alpha SUBCOMMAND [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19023"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19024"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19025"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-versions [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19026"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f FILENAME [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19027"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl attach POD -c CONTAINER [-i] [-t] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19028"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth [flags] [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19029"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19030"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19031"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19032"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19033"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19034"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl convert -f FILENAME [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19035"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cordon NODE [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19036"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest> [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19037"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19038"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19039"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19040"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19041"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl drain NODE [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19042"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19043"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19044"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=false] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19045"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19046"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19047"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize <dir> [flags] [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19048"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19049"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs POD [-c CONTAINER] [--follow] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19050"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19051"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags] [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19052"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19053"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19054"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19055"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19056"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client|none] [--overrides=inline-json] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19057"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19058"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19059"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19060"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl top (POD | NODE) [flags] [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19061"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19062"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl version [--client] [flags]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19063"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available] [options]\n```\n\n11 - Command line tool (kubectl) | To learn more about command operations, see the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19064"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n11 - Command line tool (kubectl) | Use the following sections for information about how you can format or sort the output of certain commands. For details about which commands support the various output options, see the kubectl referen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19065"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl describe node\n```\n\n11 - Command line tool (kubectl) | kubectl delete - Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19066"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nchmod a+x ./kubectl-hello\n\n# and move it to a location in our PATH\nsudo mv ./kubectl-hello /usr/local/bin\nsudo chown root:root /usr/local/bin\n\n# You have now created and \"installed\" a kubectl plugin.\n# You can begin using this plugin by invoking it from kubectl as if it were a regular command\nkubectl hello\n```\n\n11 - Command line tool (kubectl) | In order to view all of the plugins that are available to kubectl, use the kubectl plugin list subcommand:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19067"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nsource <(kubectl completion bash) # set up autocomplete in bash into the current shell, bash-completion package should be installed first.\necho \"source <(kubectl completion bash)\" >> ~/.bashrc # add autocomplete permanently to your bash shell.\n```\n\n11.2 - kubectl Quick Reference | You can also use a shorthand alias for kubectl that also works with completion:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19068"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nalias k=kubectl\ncomplete -o default -F __start_kubectl k\n```\n\n11.2 - kubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19069"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nsource <(kubectl completion zsh)  # set up autocomplete in zsh into the current shell\necho '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell\n```\n\n11.2 - kubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19070"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\necho 'kubectl completion fish | source' > ~/.config/fish/completions/kubectl.fish && source ~/.config/fish/completions/kubectl.fish\n```\n\n11.2 - kubectl Quick Reference | Appending --all-namespaces happens frequently enough that you should be aware of the shorthand for --all-namespaces:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19071"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\n11.2 - kubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19072"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19073"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\n# Get commands with basic output\nkubectl get services                          # List all services in the namespace\nkubectl get pods --all-namespaces             # List all pods in all namespaces\nkubectl get pods -o wide                      # List all pods in the current namespace, with more details\nkubectl get deployment my-dep                 # List a particular deployment\nkubectl get pods                              # List all pods in the namespace\nkubectl get pod my-pod -o yaml                # Get a pod's YAML\n\n# Describe commands with verbose output\nkubectl describe nodes my-node\nkubectl describe pods my-pod\n\n# List Services Sorted by Name\nkubectl get services --sort-by=.metadata.name\n\n# List pods Sorted by Restart Count\nkubectl get pods --sort-by='.status.containerStatuses[0].restartCount'\n\n# List PersistentVolumes sorted by capacity\nkubectl get pv --sort-by=.spec.capacity.storage\n\n# Get the version label of all pods with label app=cassandra\nkubectl get pods --selector=app=cassandra -o \\\n  jsonpath='{.items[*].metadata.labels.version}'\n\n# Retrieve the value of a key with dots, e.g. 'ca.crt'\nkubectl get configmap myconfig \\\n  -o jsonpath='{.data.ca\\.crt}'\n\n# Retrieve a base64 encoded value with dashes instead of underscores.\nkubectl get secret my-secret --template='{{index .data \"key-name-with-dashes\"}}'\n\n# Get all worker nodes (use a selector to exclude results that have a label\n# named 'node-role.kubernetes.io/control-plane')\nkubectl get node --selector='!node-role.kubernetes.io/control-plane'\n\n# Get all running pods in the namespace\nkubectl get pods --field-selector=status.phase=Running\n\n# Get ExternalIPs of all nodes\nkubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type==\"ExternalIP\")].address}'\n\n# List Names of Pods that belong to Particular RC\n# \"jq\" command useful for transformations that are too complex for jsonpath, it can be found at https://jqlang.github.io/jq/\nsel=${$(kubectl get rc my-rc --output=json | jq -j '.spec.selector | to_entries | .[] | \"\\(.key)=\\(.value),\"')%?}\necho $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name})\n\n# Show labels for all pods (or any other Kubernetes object that supports labelling)\nkubectl get pods --show-labels\n\n# Check which nodes are ready\nJSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \\\n && kubectl get nodes -o jsonpath=\"$JSONPATH\" | grep \"Ready=True\"\n\n# Check which nodes are ready with custom-columns\nkubectl get node -o custom-columns='NODE_NAME:.metadata.name,STATUS:.status.conditions[?(@.type==\"Ready\")].status'\n\n# Output decoded secrets without external tools\nkubectl get secret my-secret -o go-template='{{range $k,$v := .data}}{{\"### \"}}{{$k}}{{\"\\n\"}}{{$v|base64decode}}{{\"\\n\\n\"}}{{end}}'\n\n# List all Secrets currently in use by a pod\nkubectl get pods -o json | jq '.items[].spec.containers[].env[]?.valueFrom.secretKeyRef.name' | grep -v null | sort | uniq\n\n# List all containerIDs of initContainer of all pods\n# Helpful when cleaning up stopped containers, while avoiding removal of initContainers.\nkubectl get pods --all-namespaces -o jsonpath='{range .items[*].status.initContainerStatuses[*]}{.containerID}{\"\\n\"}{end}' | cut -d/ -f3\n\n# List Events sorted by timestamp\nkubectl get events --sort-by=.metadata.creationTimestamp\n\n# List all warning events\nkubectl events --types=Warning\n\n# Compares the current state of the cluster against the state that the cluster would be in if the manifest was applied.\nkubectl diff -f ./my-manifest.yaml\n\n# Produce a period-delimited tree of all keys returned for nodes\n# Helpful when locating a key within a complex nested JSON structure\nkubectl get nodes -o json | jq -c 'paths|join(\".\")'\n\n# Produce a period-delimited tree of all keys returned for pods, etc\nkubectl get pods -o json | jq -c 'paths|join(\".\")'\n\n# Produce ENV for all pods, assuming you have a default container for the pods, default namespace and the `env` command is supported.\n# Helpful when running any supported command across all pods, not just `env`\nfor pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod -- env; done\n\n# Get a deployment's status subresource\nkubectl get deployment nginx-deployment --subresource=status\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19074"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19075"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\n# Partially update a node\nkubectl patch node k8s-node-1 -p '{\"spec\":{\"unschedulable\":true}}'\n\n# Update a container's image; spec.containers[*].name is required because it's a merge key\nkubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\",\"image\":\"new image\"}]}}'\n\n# Update a container's image using a json patch with positional arrays\nkubectl patch pod valid-pod --type='json' -p='[{\"op\": \"replace\", \"path\": \"/spec/containers/0/image\", \"value\":\"new image\"}]'\n\n# Disable a deployment livenessProbe using a json patch with positional arrays\nkubectl patch deployment valid-deployment  --type json   -p='[{\"op\": \"remove\", \"path\": \"/spec/template/spec/containers/0/livenessProbe\"}]'\n\n# Add a new element to a positional array\nkubectl patch sa default --type='json' -p='[{\"op\": \"add\", \"path\": \"/secrets/1\", \"value\": {\"name\": \"whatever\" } }]'\n\n# Update a deployment's replica count by patching its scale subresource\nkubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{\"spec\":{\"replicas\":2}}'\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19076"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19077"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19078"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19079"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19080"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19081"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ntar cf - /tmp/foo | kubectl exec -i -n my-namespace my-pod -- tar xf - -C /tmp/bar           # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl exec -n my-namespace my-pod -- tar cf - /tmp/foo | tar xf - -C /tmp/bar    # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19082"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19083"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19084"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n11.2 - kubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19085"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\n11.2 - kubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19086"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\n# All images running in a cluster\nkubectl get pods -A -o=custom-columns='DATA:spec.containers[*].image'\n\n# All images running in namespace: default, grouped by Pod\nkubectl get pods --namespace default --output=custom-columns=\"NAME:.metadata.name,IMAGE:.spec.containers[*].image\"\n\n # All images excluding \"registry.k8s.io/coredns:1.6.2\"\nkubectl get pods -A -o=custom-columns='DATA:spec.containers[?(@.image!=\"registry.k8s.io/coredns:1.6.2\")].image'\n\n# All fields under metadata regardless of name\nkubectl get pods -A -o=custom-columns='DATA:metadata.*'\n```\n\n11.2 - kubectl Quick Reference | More examples in the kubectl reference documentation.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19087"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n11.3.2 - kubectl annotate | Select all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19088"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources [flags]\n```\n\n11.3.3 - kubectl api-resources | Limit to resources in the specified API group.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19089"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply (-f FILENAME | -k DIRECTORY)\n```\n\n11.3.5 - kubectl apply | Select all resources in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19090"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME)\n```\n\n11.3.5.1 - kubectl apply edit-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19091"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply set-last-applied -f FILENAME\n```\n\n11.3.5.2 - kubectl apply set-last-applied | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19092"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)\n```\n\n11.3.5.3 - kubectl apply view-last-applied | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19093"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl attach (POD | TYPE/NAME) -c CONTAINER\n```\n\n11.3.6 - kubectl attach | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19094"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]\n```\n\n11.3.7.1 - kubectl auth can-i | If true, check the specified action in all namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19095"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f FILENAME\n```\n\n11.3.7.2 - kubectl auth reconcile | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19096"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY]\n```\n\n11.3.8 - kubectl autoscale | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19097"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate SUBCOMMAND\n```\n\n11.3.9 - kubectl certificate | help for certificate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19098"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve (-f FILENAME | NAME)\n```\n\n11.3.9.1 - kubectl certificate approve | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19099"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny (-f FILENAME | NAME)\n```\n\n11.3.9.2 - kubectl certificate deny | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19100"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info [flags]\n```\n\n11.3.10 - kubectl cluster-info | help for cluster-info", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19101"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cluster-info dump [flags]\n```\n\n11.3.10.1 - kubectl cluster-info dump | If true, dump all namespaces. If true, --namespaces is ignored.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19102"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl completion SHELL\n```\n\n11.3.11 - kubectl completion | help for completion", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19103"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config SUBCOMMAND\n```\n\n11.3.12 - kubectl config | help for config", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19104"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config current-context [flags]\n```\n\n11.3.12.1 - kubectl config current-context | help for current-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19105"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-cluster NAME\n```\n\n11.3.12.2 - kubectl config delete-cluster | help for delete-cluster", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19106"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-context NAME\n```\n\n11.3.12.3 - kubectl config delete-context | help for delete-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19107"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config delete-user NAME\n```\n\n11.3.12.4 - kubectl config delete-user | help for delete-user", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19108"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config get-clusters [flags]\n```\n\n11.3.12.5 - kubectl config get-clusters | help for get-clusters", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19109"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config get-contexts [(-o|--output=)name)]\n```\n\n11.3.12.6 - kubectl config get-contexts | help for get-contexts", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19110"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config get-users [flags]\n```\n\n11.3.12.7 - kubectl config get-users | help for get-users", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19111"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config rename-context CONTEXT_NAME NEW_NAME\n```\n\n11.3.12.8 - kubectl config rename-context | help for rename-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19112"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set PROPERTY_NAME PROPERTY_VALUE\n```\n\n11.3.12.9 - kubectl config set | help for set", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19113"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]\n```\n\n11.3.12.10 - kubectl config set-cluster | Path to certificate-authority file for the cluster entry in kubeconfig", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19114"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]\n```\n\n11.3.12.11 - kubectl config set-context | cluster for the context entry in kubeconfig", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19115"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials NAME [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value]\n```\n\n11.3.12.12 - kubectl config set-credentials | Auth provider for the user entry in kubeconfig", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19116"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config unset PROPERTY_NAME\n```\n\n11.3.12.13 - kubectl config unset | help for unset", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19117"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config use-context CONTEXT_NAME\n```\n\n11.3.12.14 - kubectl config use-context | help for use-context", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19118"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view [flags]\n```\n\n11.3.12.15 - kubectl config view | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19119"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp <file-spec-src> <file-spec-dest>\n```\n\n11.3.14 - kubectl cp | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19120"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create -f FILENAME\n```\n\n11.3.15 - kubectl create | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19121"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n11.3.15.1 - kubectl create clusterrole | An aggregation label selector for combining ClusterRoles.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19122"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n11.3.15.2 - kubectl create clusterrolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19123"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n11.3.15.3 - kubectl create configmap | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19124"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]\n```\n\n11.3.15.4 - kubectl create cronjob | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19125"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create deployment NAME --image=image -- [COMMAND] [args...]\n```\n\n11.3.15.5 - kubectl create deployment | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19126"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]\n```\n\n11.3.15.6 - kubectl create ingress | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19127"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]\n```\n\n11.3.15.7 - kubectl create job | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19128"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace NAME [--dry-run=server|client|none]\n```\n\n11.3.15.8 - kubectl create namespace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19129"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]\n```\n\n11.3.15.9 - kubectl create poddisruptionbudget | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19130"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run=server|client|none]\n```\n\n11.3.15.10 - kubectl create priorityclass | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19131"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]\n```\n\n11.3.15.11 - kubectl create quota | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19132"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]\n```\n\n11.3.15.12 - kubectl create role | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19133"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n11.3.15.13 - kubectl create rolebinding | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19134"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret (docker-registry | generic | tls)\n```\n\n11.3.15.14 - kubectl create secret | help for secret", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19135"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]\n```\n\n11.3.15.15 - kubectl create secret docker-registry | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19136"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]\n```\n\n11.3.15.16 - kubectl create secret generic | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19137"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]\n```\n\n11.3.15.17 - kubectl create secret tls | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19138"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service [flags]\n```\n\n11.3.15.18 - kubectl create service | help for service", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19139"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]\n```\n\n11.3.15.19 - kubectl create service clusterip | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19140"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service externalname NAME --external-name external.name [--dry-run=server|client|none]\n```\n\n11.3.15.20 - kubectl create service externalname | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19141"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n11.3.15.21 - kubectl create service loadbalancer | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19142"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]\n```\n\n11.3.15.22 - kubectl create service nodeport | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19143"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount NAME [--dry-run=server|client|none]\n```\n\n11.3.15.23 - kubectl create serviceaccount | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19144"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create token SERVICE_ACCOUNT_NAME\n```\n\n11.3.15.24 - kubectl create token | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19145"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND [args...] ]\n```\n\n11.3.16 - kubectl debug | If specified, everything after -- will be passed to the new container as Args instead of Command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19146"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])\n```\n\n11.3.17 - kubectl delete | Delete all resources, in the namespace of the specified resource types.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19147"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)\n```\n\n11.3.18 - kubectl describe | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19148"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl diff -f FILENAME\n```\n\n11.3.19 - kubectl diff | Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19149"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit (RESOURCE/NAME | -f FILENAME)\n```\n\n11.3.21 - kubectl edit | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19150"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl events [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file] [--for TYPE/NAME] [--watch] [--types=Normal,Warning]\n```\n\n11.3.22 - kubectl events | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19151"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]\n```\n\n11.3.23 - kubectl exec | Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19152"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [-o|--output=plaintext|plaintext-openapiv2]\n```\n\n11.3.24 - kubectl explain | Get different explanations for particular API version (API group/version)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19153"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]\n```\n\n11.3.25 - kubectl expose | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19154"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]\n```\n\n11.3.26 - kubectl get | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19155"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl kustomize DIR [flags]\n```\n\n11.3.27 - kubectl kustomize | use the uid and gid of the command executor to run the function in the container", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19156"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]\n```\n\n11.3.28 - kubectl label | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19157"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]\n```\n\n11.3.29 - kubectl logs | Get all containers' logs in the pod(s).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19158"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl options [flags]\n```\n\n11.3.30 - kubectl options | help for options", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19159"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]\n```\n\n11.3.31 - kubectl patch | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19160"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl plugin [flags]\n```\n\n11.3.32 - kubectl plugin | help for plugin", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19161"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl plugin list [flags]\n```\n\n11.3.32.1 - kubectl plugin list | help for list", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19162"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]\n```\n\n11.3.33 - kubectl port-forward | Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19163"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]\n```\n\n11.3.34 - kubectl proxy | Regular expression for hosts that the proxy should accept.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19164"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl replace -f FILENAME\n```\n\n11.3.35 - kubectl replace | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19165"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout SUBCOMMAND\n```\n\n11.3.36 - kubectl rollout | help for rollout", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19166"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout history (TYPE NAME | TYPE/NAME) [flags]\n```\n\n11.3.36.1 - kubectl rollout history | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19167"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout pause RESOURCE\n```\n\n11.3.36.2 - kubectl rollout pause | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19168"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout restart RESOURCE\n```\n\n11.3.36.3 - kubectl rollout restart | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19169"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout resume RESOURCE\n```\n\n11.3.36.4 - kubectl rollout resume | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19170"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout status (TYPE NAME | TYPE/NAME) [flags]\n```\n\n11.3.36.5 - kubectl rollout status | Filename, directory, or URL to files identifying the resource to get from a server.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19171"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]\n```\n\n11.3.36.6 - kubectl rollout undo | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19172"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl run NAME --image=image [--env=\"key=value\"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]\n```\n\n11.3.37 - kubectl run | If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19173"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)\n```\n\n11.3.38 - kubectl scale | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19174"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set SUBCOMMAND\n```\n\n11.3.39 - kubectl set | help for set", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19175"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N\n```\n\n11.3.39.1 - kubectl set env | If true, select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19176"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N\n```\n\n11.3.39.2 - kubectl set image | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19177"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS & --requests=REQUESTS]\n```\n\n11.3.39.3 - kubectl set resources | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19178"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]\n```\n\n11.3.39.4 - kubectl set selector | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19179"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT\n```\n\n11.3.39.5 - kubectl set serviceaccount | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19180"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]\n```\n\n11.3.39.6 - kubectl set subject | Select all resources, in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19181"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N\n```\n\n11.3.40 - kubectl taint | Select all nodes in the cluster", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19182"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl top node [NAME | -l label]\n```\n\n11.3.41.1 - kubectl top node | help for node", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19183"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl top pod [NAME | -l label]\n```\n\n11.3.41.2 - kubectl top pod | If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19184"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl uncordon NODE\n```\n\n11.3.42 - kubectl uncordon | Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19185"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl version [flags]\n```\n\n11.3.43 - kubectl version | If true, shows client version only (no server required).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19186"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]\n```\n\n11.3.44 - kubectl wait | Select all resources in the namespace of the specified resource types", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19187"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.config.k8s.io/v1beta1\n```\n\n11.9 - Kubectl user preferences (kuberc) | Within a kuberc configuration, the aliases section allows you to define custom shortcuts for kubectl commands, optionally with preset command line arguments and flags.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19188"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19189"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl getn pods -oyaml\n```\n\n11.9 - Kubectl user preferences (kuberc) | Full kuberc schema is available here.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19190"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19191"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get namespace test-ns --output json\n```\n\n11.9 - Kubectl user preferences (kuberc) | This next example, will introduce a mechanism similar to prepending arguments, this time, though, we will append arguments to the end of the kubectl command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19192"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19193"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl run test-pod --namespace test-ns --image busybox -- custom-arg\n```\n\n11.9 - Kubectl user preferences (kuberc) | Within a kuberc configuration, defaults section lets you specify default values for command line arguments.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19194"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19195"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/test-pod\n```\n\n11.9 - Kubectl user preferences (kuberc) | The kubectl maintainers encourage you to adopt kuberc with the following defaults:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19196"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod/test-pod --interactive=false\n```\n\n11.9 - Kubectl user preferences (kuberc) | The kubectl maintainers encourage you to adopt kuberc with the following defaults:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19197"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19198"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkind: {group:\"apps\", version:\"v1\", kind:\"Deployment\"}\n```\n\n14.5 - kube-apiserver Admission (v1) | See documentation for the \"matchPolicy\" field in the webhook configuration type for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19199"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nrequestKind: {group:\"apps\", version:\"v1beta1\", kind:\"Deployment\"}\n```\n\n14.5 - kube-apiserver Admission (v1) | See documentation for the \"matchPolicy\" field in the webhook configuration type for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19200"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkind: EncryptionConfiguration\napiVersion: apiserver.config.k8s.io/v1\nresources:\n- resources:\n  - events\n  providers:\n  - identity: {}  # do not encrypt events even though *.* is specified below\n- resources:\n  - secrets\n  - configmaps\n  - pandas.awesome.bears.example\n  providers:\n  - aescbc:\n      keys:\n      - name: key1\n        secret: c2VjcmV0IGlzIHNlY3VyZQ==\n- resources:\n  - '*.apps'\n  providers:\n  - aescbc:\n      keys:\n      - name: key2\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgb3IgaXMgaXQ/Cg==\n- resources:\n  - '*.*'\n  providers:\n  - aescbc:\n      keys:\n      - name: key3\n        secret: c2VjcmV0IGlzIHNlY3VyZSwgSSB0aGluaw==\n```\n\n14.7 - kube-apiserver Configuration (v1) | resources is a list containing resources, and their corresponding encryption providers.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19201"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.config.k8s.io/v1alpha1\n```\n\n14.20 - kuberc (v1alpha1) | overrides allows changing default flag values of commands. This is especially useful, when user doesn't want to explicitly set flags each time.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19202"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nclientConnection:\n  kubeconfig: /etc/srv/kubernetes/kube-scheduler/kubeconfig\n```\n\n16.1 - Scheduler Configuration | A scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19203"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - plugins:\n      score:\n        disabled:\n        - name: PodTopologySpread\n        enabled:\n        - name: MyCustomPluginA\n          weight: 2\n        - name: MyCustomPluginB\n          weight: 1\n```\n\n16.1 - Scheduler Configuration | You can use * as name in the disabled array to disable all default plugins for that extension point. This can also be used to rearrange plugins order, if desired.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19204"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: no-scoring-scheduler\n    plugins:\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\n16.1 - Scheduler Configuration | Pods that want to be scheduled according to a specific profile can include the corresponding scheduler name in its .spec.schedulerName.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19205"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: MyPlugin\n```\n\n16.1 - Scheduler Configuration | This would equate to manually enabling MyPlugin for all of its extension points, like so:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19206"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      preScore:\n        enabled:\n        - name: MyPlugin\n      score:\n        enabled:\n        - name: MyPlugin\n      preFilter:\n        enabled:\n        - name: MyPlugin\n      filter:\n        enabled:\n        - name: MyPlugin\n```\n\n16.1 - Scheduler Configuration | One benefit of using multiPoint here is that if MyPlugin implements another extension point in the future, the multiPoint config will automatically enable it for the new extension.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19207"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'MyPlugin'\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\n16.1 - Scheduler Configuration | Starting from kubescheduler.config.k8s.io/v1beta3, all default plugins are enabled internally through MultiPoint. However, individual extension points are still available to allow flexible reconfigura", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19208"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      score:\n        enabled:\n        - name: 'DefaultScore2'\n          weight: 5\n```\n\n16.1 - Scheduler Configuration | In this example, it's unnecessary to specify the plugins in MultiPoint explicitly because they are default plugins. And the only plugin specified in Score is DefaultScore2. This is because plugins set", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19209"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'CustomQueueSort'\n        - name: 'CustomPlugin1'\n          weight: 3\n        - name: 'CustomPlugin2'\n        disabled:\n        - name: 'DefaultQueueSort'\n      filter:\n        disabled:\n        - name: 'DefaultPlugin1'\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n```\n\n16.1 - Scheduler Configuration | Note that there is no error for re-declaring a MultiPoint plugin in a specific extension point. The re-declaration is ignored (and logged), as specific extension points take precedence.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19210"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n\n      # Disable the default QueueSort plugin\n      queueSort:\n        enabled:\n        - name: 'CustomQueueSort'\n        disabled:\n        - name: 'DefaultQueueSort'\n\n      # Enable custom Filter plugins\n      filter:\n        enabled:\n        - name: 'CustomPlugin1'\n        - name: 'CustomPlugin2'\n        - name: 'DefaultPlugin2'\n        disabled:\n        - name: 'DefaultPlugin1'\n\n      # Enable and reorder custom score plugins\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n          weight: 1\n        - name: 'DefaultPlugin1'\n          weight: 3\n```\n\n16.1 - Scheduler Configuration | While this is a complicated example, it demonstrates the flexibility of MultiPoint config as well as its seamless integration with the existing methods for configuring extension points.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19211"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\n16.1 - Scheduler Configuration | The scheduler plugin NodeLabel is deprecated; instead, use the NodeAffinity plugin (enabled by default) to achieve similar behavior.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19212"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get services -A -o yaml\n```\n\n2.2 - Kubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19213"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: List\nmetadata:\n  resourceVersion: \"\"\n  selfLink: \"\"\nitems:\n- apiVersion: v1\n  kind: Service\n  metadata:\n    creationTimestamp: \"2021-06-03T14:54:12Z\"\n    labels:\n      component: apiserver\n      provider: kubernetes\n    name: kubernetes\n    namespace: default\n...\n- apiVersion: v1\n  kind: Service\n  metadata:\n    annotations:\n      prometheus.io/port: \"9153\"\n      prometheus.io/scrape: \"true\"\n    creationTimestamp: \"2021-06-03T14:54:14Z\"\n    labels:\n      k8s-app: kube-dns\n      kubernetes.io/cluster-service: \"true\"\n      kubernetes.io/name: CoreDNS\n    name: kube-dns\n    namespace: kube-system\n```\n\n2.2 - Kubernetes API Concepts | Keep in mind that the Kubernetes API does not have a kind named List.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19214"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply # note capitalization: \"Apply\" (or \"Update\")\n    apiVersion: v1\n    time: \"2010-10-10T0:00:00Z\"\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n      f:data:\n        f:key: {}\ndata:\n  key: some value\n```\n\n2.3 - Server-Side Apply | That example ConfigMap object contains a single field management record in .metadata.managedFields. The field management record consists of basic information about the managing entity itself, plus det", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19215"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: test-cm\n  namespace: default\n  labels:\n    test-label: test\n  managedFields:\n  - manager: kubectl\n    operation: Apply\n    time: '2019-03-30T15:00:00.000Z'\n    apiVersion: v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:metadata:\n        f:labels:\n          f:test-label: {}\n  - manager: kube-controller-manager\n    operation: Update\n    apiVersion: v1\n    time: '2019-03-30T16:00:00.000Z'\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:data:\n        f:key: {}\ndata:\n  key: new value\n```\n\n2.3 - Server-Side Apply | In this example, a second operation was run as an update by the manager called kube-controller-manager. The update request succeeded and changed a value in the data field, which caused that field's ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19216"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: example.com/v1\nkind: Foo\nmetadata:\n  name: foo-sample\n  managedFields:\n  - manager: \"manager-one\"\n    operation: Apply\n    apiVersion: example.com/v1\n    fieldsType: FieldsV1\n    fieldsV1:\n      f:spec:\n        f:data: {}\nspec:\n  data:\n    key1: val1\n    key2: val2\n```\n\n2.3 - Server-Side Apply | Before spec.data gets changed from atomic to granular, manager-one owns the field spec.data, and all the fields within it (key1 and key2). When the CRD gets changed to make spec.data granular, manager", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19217"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napplication/ssa/nginx-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19218"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | And the user has created the Deployment using Server-Side Apply, like so:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19219"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f https://k8s.io/examples/application/ssa/nginx-deployment.yaml --server-side\n```\n\n2.3 - Server-Side Apply | Then later, automatic scaling is enabled for the Deployment; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19220"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl autoscale deployment nginx-deployment --cpu-percent=50 --min=1 --max=10\n```\n\n2.3 - Server-Side Apply | Now, the user would like to remove replicas from their configuration, so they don't accidentally fight with the HorizontalPodAutoscaler (HPA) and its controller. However, there is a race: it might tak", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19221"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Save this file as 'nginx-deployment-replicas-only.yaml'.\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n```\n\n2.3 - Server-Side Apply | The user applies that manifest using a private field manager name. In this example, the user picked handover-to-hpa:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19222"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply -f nginx-deployment-replicas-only.yaml \\\n  --server-side --field-manager=handover-to-hpa \\\n  --validate=false\n```\n\n2.3 - Server-Side Apply | If the apply results in a conflict with the HPA controller, then do nothing. The conflict indicates the controller has claimed the field earlier in the process than it sometimes does.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19223"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napplication/ssa/nginx-deployment-no-replicas.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19224"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n2.3 - Server-Side Apply | Note that whenever the HPA controller sets the replicas field to a new value, the temporary field manager will no longer own any fields and will be automatically deleted. No further clean up is requir", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19225"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side [--dry-run=server]\n```\n\n2.3 - Server-Side Apply | By default, field management of the object transfers from client-side apply to kubectl server-side apply, without encountering conflicts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19226"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\n2.3 - Server-Side Apply | If you manage a resource with kubectl apply --server-side, you can downgrade to client-side apply directly with kubectl apply.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19227"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl apply --server-side --field-manager=my-manager [--dry-run=server]\n```\n\n2.3 - Server-Side Apply | The PATCH verb (for an object that supports Server-Side Apply) accepts the unofficial application/apply-patch+yaml content type. Users of Server-Side Apply can send partially specified objects as YAML", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19228"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw='/readyz?verbose'\n```\n\n2.8 - Kubernetes API health endpoints | The output will look like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19229"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1 # this apiVersion is relevant as of Kubernetes 1.9\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  namespace: default\nspec:\n  replicas: 3\n  template:\n    metadata:\n    # ...\n    spec:\n      serviceAccountName: bob-the-bot\n      containers:\n      - name: nginx\n        image: nginx:1.14.2\n```\n\n3.1 - Authenticating | Service account bearer tokens are perfectly valid to use outside the cluster and can be used to create identities for long standing jobs that wish to talk to the Kubernetes API. To manually create a s", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19230"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create serviceaccount jenkins\n```\n\n3.1 - Authenticating | You can manually create an associated token:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19231"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create token jenkins\n```\n\n3.1 - Authenticating | The created token is a signed JSON Web Token (JWT).", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19232"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\n# list of authenticators to authenticate Kubernetes users using JWT compliant tokens.\n# the maximum number of allowed authenticators is 64.\njwt:\n- issuer:\n    # url must be unique across all authenticators.\n    # url must not conflict with issuer configured in --service-account-issuer.\n    url: https://example.com # Same as --oidc-issuer-url.\n    # discoveryURL, if specified, overrides the URL used to fetch discovery\n    # information instead of using \"{url}/.well-known/openid-configuration\".\n    # The exact value specified is used, so \"/.well-known/openid-configuration\"\n    # must be included in discoveryURL if needed.\n    #\n    # The \"issuer\" field in the fetched discovery information must match the \"issuer.url\" field\n    # in the AuthenticationConfiguration and will be used to validate the \"iss\" claim in the presented JWT.\n    # This is for scenarios where the well-known and jwks endpoints are hosted at a different\n    # location than the issuer (such as locally in the cluster).\n    # discoveryURL must be different from url if specified and must be unique across all authenticators.\n    discoveryURL: https://discovery.example.com/.well-known/openid-configuration\n    # PEM encoded CA certificates used to validate the connection when fetching\n    # discovery information. If not set, the system verifier will be used.\n    # Same value as the content of the file referenced by the --oidc-ca-file command line argument.\n    certificateAuthority: <PEM encoded CA certificates>    \n    # audiences is the set of acceptable audiences the JWT must be issued to.\n    # At least one of the entries must match the \"aud\" claim in presented JWTs.\n    audiences:\n    - my-app # Same as --oidc-client-id.\n    - my-other-app\n    # this is required to be set to \"MatchAny\" when multiple audiences are specified.\n    audienceMatchPolicy: MatchAny\n    # egressSelectorType is an indicator of which egress selection should be used for sending all traffic related\n    # to this issuer (discovery, JWKS, distributed claims, etc).  If unspecified, no custom dialer is used.\n    # The StructuredAuthenticationConfigurationEgressSelector feature gate must be enabled\n    # before you can use the egressSelectorType field.\n    # When specified, the valid choices are \"controlplane\" and \"cluster\".  These correspond to the associated\n    # values in the --egress-selector-config-file.\n    # - controlplane: for traffic intended to go to the control plane.\n    # - cluster: for traffic intended to go to the system being managed by Kubernetes.\n    egressSelectorType: <egress-selector-type>\n  # rules applied to validate token claims to authenticate users.\n  claimValidationRules:\n    # Same as --oidc-required-claim key=value.\n  - claim: hd\n    requiredValue: example.com\n    # Instead of claim and requiredValue, you can use expression to validate the claim.\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for validation to succeed.\n  - expression: 'claims.hd == \"example.com\"'\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: the hd claim must be set to example.com\n  - expression: 'claims.exp - claims.nbf <= 86400'\n    message: total token lifetime must not exceed 24 hours\n  claimMappings:\n    # username represents an option for the username attribute.\n    # This is the only required attribute.\n    username:\n      # Same as --oidc-username-claim. Mutually exclusive with username.expression.\n      claim: \"sub\"\n      # Same as --oidc-username-prefix. Mutually exclusive with username.expression.\n      # if username.claim is set, username.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with username.claim and username.prefix.\n      # expression is a CEL expression that evaluates to a string.\n      #\n      # 1.  If username.expression uses 'claims.email', then 'claims.email_verified' must be used in\n      #     username.expression or extra[*].valueExpression or claimValidationRules[*].expression.\n      #     An example claim validation rule expression that matches the validation automatically\n      #     applied when username.claim is set to 'email' is 'claims.?email_verified.orValue(true) == true'.\n      #     By explicitly comparing the value to true, we let type-checking see the result will be a boolean, and\n      #     to make sure a non-boolean email_verified claim will be caught at runtime.\n      # 2.  If the username asserted based on username.expression is the empty string, the authentication\n      #     request will fail.\n      expression: 'claims.username + \":external-user\"'\n    # groups represents an option for the groups attribute.\n    groups:\n      # Same as --oidc-groups-claim. Mutually exclusive with groups.expression.\n      claim: \"sub\"\n      # Same as --oidc-groups-prefix. Mutually exclusive with groups.expression.\n      # if groups.claim is set, groups.prefix is required.\n      # Explicitly set it to \"\" if no prefix is desired.\n      prefix: \"\"\n      # Mutually exclusive with groups.claim and groups.prefix.\n      # expression is a CEL expression that evaluates to a string or a list of strings.\n      expression: 'claims.roles.split(\",\")'\n    # uid represents an option for the uid attribute.\n    uid:\n      # Mutually exclusive with uid.expression.\n      claim: 'sub'\n      # Mutually exclusive with uid.claim\n      # expression is a CEL expression that evaluates to a string.\n      expression: 'claims.sub'\n    # extra attributes to be added to the UserInfo object. Keys must be domain-prefix path and must be unique.\n    extra:\n      # key is a string to use as the extra attribute key.\n      # key must be a domain-prefix path (e.g. example.org/foo). All characters before the first \"/\" must be a valid\n      # subdomain as defined by RFC 1123. All characters trailing the first \"/\" must\n      # be valid HTTP Path characters as defined by RFC 3986.\n      # k8s.io, kubernetes.io and their subdomains are reserved for Kubernetes use and cannot be used.\n      # key must be lowercase and unique across all extra attributes.\n    - key: 'example.com/tenant'\n      # valueExpression is a CEL expression that evaluates to a string or a list of strings.\n      valueExpression: 'claims.tenant'\n  # validation rules applied to the final user object.\n  userValidationRules:\n    # expression is a CEL expression that evaluates to a boolean.\n    # all the expressions must evaluate to true for the user to be valid.\n  - expression: \"!user.username.startsWith('system:')\"\n    # Message customizes the error message seen in the API server logs when the validation fails.\n    message: 'username cannot used reserved system: prefix'\n  - expression: \"user.groups.all(group, !group.startsWith('system:'))\"\n    message: 'groups cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | Claim validation rule expression", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19233"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19234"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"' # the token below does not have this claim, so validation will fail.\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: 'claims.username + \":external-user\"'\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the expression will evaluate to true, so validation will succeed.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19235"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\njwt:\n- issuer:\n    url: https://example.com\n    audiences:\n    - my-app\n  claimValidationRules:\n  - expression: 'claims.hd == \"example.com\"'\n    message: the hd claim must be set to example.com\n  claimMappings:\n    username:\n      expression: '\"system:\" + claims.username' # this will prefix the username with \"system:\" and will fail user validation.\n    groups:\n      expression: 'claims.roles.split(\",\")'\n    uid:\n      expression: 'claims.sub'\n    extra:\n    - key: 'example.com/tenant'\n      valueExpression: 'claims.tenant'\n  userValidationRules:\n  - expression: \"!user.username.startsWith('system:')\" # the username will be system:foo and expression will evaluate to false, so validation will fail.\n    message: 'username cannot used reserved system: prefix'\n```\n\n3.1 - Authenticating | where the token payload is:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19236"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials USER_NAME \\\n   --auth-provider=oidc \\\n   --auth-provider-arg=idp-issuer-url=( issuer url ) \\\n   --auth-provider-arg=client-id=( your client id ) \\\n   --auth-provider-arg=client-secret=( your client secret ) \\\n   --auth-provider-arg=refresh-token=( your refresh token ) \\\n   --auth-provider-arg=idp-certificate-authority=( path to your ca certificate ) \\\n   --auth-provider-arg=id-token=( your id_token )\n```\n\n3.1 - Authenticating | As an example, running the below command after authenticating to your identity provider:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19237"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-credentials mmosley  \\\n        --auth-provider=oidc  \\\n        --auth-provider-arg=idp-issuer-url=https://oidcidp.tremolo.lan:8443/auth/idp/OidcIdP  \\\n        --auth-provider-arg=client-id=kubernetes  \\\n        --auth-provider-arg=client-secret=1db158f6-177d-4d9c-8a8b-d36869918ec5  \\\n        --auth-provider-arg=refresh-token=q1bKLFOyUiosTfawzA93TzZIDzH2TNa2SMm0zEiPKTUwME6BkEo6Sql5yUWVBSWpKUGphaWpxSVAfekBOZbBhaEW+VlFUeVRGcluyVF5JT4+haZmPsluFoFu5XkpXk5BXqHega4GAXlF+ma+vmYpFcHe5eZR+slBFpZKtQA= \\\n        --auth-provider-arg=idp-certificate-authority=/root/ca.pem \\\n        --auth-provider-arg=id-token=eyJraWQiOiJDTj1vaWRjaWRwLnRyZW1vbG8ubGFuLCBPVT1EZW1vLCBPPVRybWVvbG8gU2VjdXJpdHksIEw9QXJsaW5ndG9uLCBTVD1WaXJnaW5pYSwgQz1VUy1DTj1rdWJlLWNhLTEyMDIxNDc5MjEwMzYwNzMyMTUyIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL29pZGNpZHAudHJlbW9sby5sYW46ODQ0My9hdXRoL2lkcC9PaWRjSWRQIiwiYXVkIjoia3ViZXJuZXRlcyIsImV4cCI6MTQ4MzU0OTUxMSwianRpIjoiMm96US15TXdFcHV4WDlHZUhQdy1hZyIsImlhdCI6MTQ4MzU0OTQ1MSwibmJmIjoxNDgzNTQ5MzMxLCJzdWIiOiI0YWViMzdiYS1iNjQ1LTQ4ZmQtYWIzMC0xYTAxZWU0MWUyMTgifQ.w6p4J_6qQ1HzTG9nrEOrubxIMb9K5hzcMPxc9IxPx2K4xO9l-oFiUw93daH3m5pluP6K7eOE6txBuRVfEcpJSwlelsOsW8gb8VJcnzMS9EnZpeA0tW_p-mnkFc3VcfyXuhe5R3G7aa5d8uHv70yJ9Y3-UhjiN9EhpMdfPAoEB9fYKKkJRzF7utTTIPGrSaSU6d2pcpfYKaxIwePzEkT4DfcQthoZdy9ucNvvLoi1DIC-UocFD8HLs8LYKEqSxQvOcvnThbObJ9af71EwmuE21fO5KzMW20KtAeget1gnldOosPtz1G5EwvaQ401-RPQzPGMVBld0_zMCAwZttJ4knw\n```\n\n3.1 - Authenticating | Which would produce the below configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19238"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl --token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL21sYi50cmVtb2xvLmxhbjo4MDQzL2F1dGgvaWRwL29pZGMiLCJhdWQiOiJrdWJlcm5ldGVzIiwiZXhwIjoxNDc0NTk2NjY5LCJqdGkiOiI2RDUzNXoxUEpFNjJOR3QxaWVyYm9RIiwiaWF0IjoxNDc0NTk2MzY5LCJuYmYiOjE0NzQ1OTYyNDksInN1YiI6Im13aW5kdSIsInVzZXJfcm9sZSI6WyJ1c2VycyIsIm5ldy1uYW1lc3BhY2Utdmlld2VyIl0sImVtYWlsIjoibXdpbmR1QG5vbW9yZWplZGkuY29tIn0.f2As579n9VNoaKzoF-dOQGmXkFKf1FMyNV0-va_B63jn-_n9LGSCca_6IVMP8pO-Zb4KvRqGyTP0r3HkHxYy5c81AnIh8ijarruczl-TK_yF5akjSTHFZD-0gRzlevBDiH8Q79NAr-ky0P4iIXS8lY9Vnjch5MF74Zx0c3alKJHJUnnpjIACByfF2SCaYzbWFMUNat-K1PaUk5-ujMBG7yYnr95xD-63n8CO8teGUAAEMx6zRjzfhnhbzX-ajwZLGwGUBT4WqjMs70-6a7_8gZmLZb2az1cZynkFRj2BaCkVT3A2RrjeEwZEtGXlMqKJ1_I2ulrOVsYx01_yD35-rw get nodes\n```\n\n3.1 - Authenticating | Kubernetes webhook authentication is a mechanism to make an HTTP callout for verifying bearer tokens.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19239"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authn-service\n    cluster:\n      certificate-authority: /path/to/ca.pem         # CA for verifying the remote service.\n      server: https://authn.example.com/authenticate # URL of remote service to query. 'https' recommended for production.\n\n# users refers to the API server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authn-service\n    user: name-of-api-server\n  name: webhook\n```\n\n3.1 - Authenticating | When a client attempts to authenticate with the API server using a bearer token as discussed above, the authentication webhook POSTs a JSON-serialized TokenReview object containing the token to the re", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19240"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# CAUTION: this is an example configuration.\n#          Do not use this for your own cluster!\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthenticationConfiguration\nanonymous:\n  enabled: true\n  conditions:\n  - path: /livez\n  - path: /readyz\n  - path: /healthz\n```\n\n3.1 - Authenticating | In the configuration above only the /livez, /readyz and /healthz endpoints are reachable by anonymous requests. Any other endpoints will not be reachable even if it is allowed by RBAC configuration.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19241"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl drain mynode --as=superman --as-group=system:masters\n```\n\n3.1 - Authenticating | To impersonate a user, group, user identifier (UID) or extra fields, the impersonating user must have the ability to perform the impersonate verb on the kind of attribute being impersonated (\"user\", \"", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19242"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: impersonator\nrules:\n- apiGroups: [\"\"]\n  resources: [\"users\", \"groups\", \"serviceaccounts\"]\n  verbs: [\"impersonate\"]\n```\n\n3.1 - Authenticating | For impersonation, extra fields and impersonated UIDs are both under the \"authentication.k8s.io\" apiGroup. Extra fields are evaluated as sub-resources of the resource \"userextras\". To allow a user to", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19243"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: scopes-and-uid-impersonator\nrules:\n# Can set \"Impersonate-Extra-scopes\" header and the \"Impersonate-Uid\" header.\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\", \"uids\"]\n  verbs: [\"impersonate\"]\n```\n\n3.1 - Authenticating | The values of impersonation headers can also be restricted by limiting the set of resourceNames a resource can take.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19244"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: limited-impersonator\nrules:\n# Can impersonate the user \"jane.doe@example.com\"\n- apiGroups: [\"\"]\n  resources: [\"users\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"jane.doe@example.com\"]\n\n# Can impersonate the groups \"developers\" and \"admins\"\n- apiGroups: [\"\"]\n  resources: [\"groups\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"developers\",\"admins\"]\n\n# Can impersonate the extras field \"scopes\" with the values \"view\" and \"development\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"userextras/scopes\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"view\", \"development\"]\n\n# Can impersonate the uid \"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"\n- apiGroups: [\"authentication.k8s.io\"]\n  resources: [\"uids\"]\n  verbs: [\"impersonate\"]\n  resourceNames: [\"06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b\"]\n```\n\n3.1 - Authenticating | k8s.io/client-go and tools using it such as kubectl and kubelet are able to execute an external command to receive user credentials.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19245"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1beta1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Required.\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\n3.1 - Authenticating | apiVersion: v1 kind: Config users: - name: my-user user: exec: # Command to execute. Required. command: \"example-client-go-exec-plugin\" # API version to use when decoding the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19246"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n- name: my-user\n  user:\n    exec:\n      # Command to execute. Required.\n      command: \"example-client-go-exec-plugin\"\n\n      # API version to use when decoding the ExecCredentials resource. Required.\n      #\n      # The API version returned by the plugin MUST match the version listed here.\n      #\n      # To integrate with tools that support multiple versions (such as client.authentication.k8s.io/v1),\n      # set an environment variable, pass an argument to the tool that indicates which version the exec plugin expects,\n      # or read the version from the ExecCredential object in the KUBERNETES_EXEC_INFO environment variable.\n      apiVersion: \"client.authentication.k8s.io/v1beta1\"\n\n      # Environment variables to set when executing the plugin. Optional.\n      env:\n      - name: \"FOO\"\n        value: \"bar\"\n\n      # Arguments to pass when executing the plugin. Optional.\n      args:\n      - \"arg1\"\n      - \"arg2\"\n\n      # Text shown to the user when the executable doesn't seem to be present. Optional.\n      installHint: |\n        example-client-go-exec-plugin is required to authenticate\n        to the current cluster.  It can be installed:\n\n        On macOS: brew install example-client-go-exec-plugin\n\n        On Ubuntu: apt-get install example-client-go-exec-plugin\n\n        On Fedora: dnf install example-client-go-exec-plugin\n\n        ...        \n\n      # Whether or not to provide cluster information, which could potentially contain\n      # very large CA data, to this exec plugin as a part of the KUBERNETES_EXEC_INFO\n      # environment variable.\n      provideClusterInfo: true\n\n      # The contract between the exec plugin and the standard input I/O stream. If the\n      # contract cannot be satisfied, this plugin will not be run and an error will be\n      # returned. Valid values are \"Never\" (this exec plugin never uses standard input),\n      # \"IfAvailable\" (this exec plugin wants to use standard input if it is available),\n      # or \"Always\" (this exec plugin requires standard input to function). Optional.\n      # Defaults to \"IfAvailable\".\n      interactiveMode: Never\nclusters:\n- name: my-cluster\n  cluster:\n    server: \"https://172.17.4.100:6443\"\n    certificate-authority: \"/etc/kubernetes/ca.pem\"\n    extensions:\n    - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config\n      extension:\n        arbitrary: config\n        this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo\n        you: [\"can\", \"put\", \"anything\", \"here\"]\ncontexts:\n- name: my-cluster\n  context:\n    cluster: my-cluster\n    user: my-user\ncurrent-context: my-cluster\n```\n\n3.1 - Authenticating | Relative command paths are interpreted as relative to the directory of the config file. If KUBECONFIG is set to /home/jane/kubeconfig and the exec command is ./bin/example-client-go-exec-plugin, the b", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19247"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n- name: my-user\n  user:\n    exec:\n      # Path relative to the directory of the kubeconfig\n      command: \"./bin/example-client-go-exec-plugin\"\n      apiVersion: \"client.authentication.k8s.io/v1\"\n      interactiveMode: Never\n```\n\n3.1 - Authenticating | The executed command prints an ExecCredential object to stdout. k8s.io/client-go authenticates against the Kubernetes API using the returned credentials in the status. The executed command is passed a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19248"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: SelfSubjectReview\nstatus:\n  userInfo:\n    username: jane.doe\n    uid: b79dbf30-0c6a-11ed-861d-0242ac120002\n    groups:\n    - students\n    - teachers\n    - system:authenticated\n    extra:\n      skills:\n      - reading\n      - learning\n      subjects:\n      - math\n      - sports\n```\n\n3.1 - Authenticating | This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster, for example, if you use webhook token authentication or authenticating proxy.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19249"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  # Name MUST be of form \"bootstrap-token-<token id>\"\n  name: bootstrap-token-07401b\n  namespace: kube-system\n\n# Type MUST be 'bootstrap.kubernetes.io/token'\ntype: bootstrap.kubernetes.io/token\nstringData:\n  # Human readable description. Optional.\n  description: \"The default bootstrap token generated by 'kubeadm init'.\"\n\n  # Token ID and secret. Required.\n  token-id: 07401b\n  token-secret: f395accd246ae52d\n\n  # Expiration. Optional.\n  expiration: 2017-03-10T03:22:11Z\n\n  # Allowed usages.\n  usage-bootstrap-authentication: \"true\"\n  usage-bootstrap-signing: \"true\"\n\n  # Extra groups to authenticate the token as. Must start with \"system:bootstrappers:\"\n  auth-extra-groups: system:bootstrappers:worker,system:bootstrappers:ingress\n```\n\n3.2 - Authenticating with Bootstrap Tokens | The type of the secret must be bootstrap.kubernetes.io/token and the name must be bootstrap-token-<token id>. It must also exist in the kube-system namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19250"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: cluster-info\n  namespace: kube-public\ndata:\n  jws-kubeconfig-07401b: eyJhbGciOiJIUzI1NiIsImtpZCI6IjA3NDAxYiJ9..tYEfbo6zDNo40MQE07aZcQX2m3EB2rO3NuXtxVMYm9U\n  kubeconfig: |\n    apiVersion: v1\n    clusters:\n    - cluster:\n        certificate-authority-data: <really long certificate data>\n        server: https://10.138.0.2:6443\n      name: \"\"\n    contexts: []\n    current-context: \"\"\n    kind: Config\n    preferences: {}\n    users: []\n```\n\n3.2 - Authenticating with Bootstrap Tokens | The kubeconfig member of the ConfigMap is a config file with only the cluster information filled out. The key thing being communicated here is the certificate-authority-data. This may be expanded in t", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19251"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\n#\n# DO NOT USE THE CONFIG AS IS. THIS IS AN EXAMPLE.\n#\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  - type: Webhook\n    # Name used to describe the authorizer\n    # This is explicitly used in monitoring machinery for metrics\n    # Note:\n    #   - Validation for this field is similar to how K8s labels are validated today.\n    # Required, with no default\n    name: webhook\n    webhook:\n      # The duration to cache 'authorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag\n      # Default: 5m0s\n      authorizedTTL: 30s\n      # If set to false, 'authorized' responses from the webhook are not cached\n      # and the specified authorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-authorized-ttl` flag to `0`.\n      # Note: Setting authorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheAuthorizedRequests: true\n      # The duration to cache 'unauthorized' responses from the webhook\n      # authorizer.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag\n      # Default: 30s\n      unauthorizedTTL: 30s\n      # If set to false, 'unauthorized' responses from the webhook are not cached\n      # and the specified unauthorizedTTL is ignored/has no effect.\n      # Same as setting `--authorization-webhook-cache-unauthorized-ttl` flag to `0`.\n      # Note: Setting unauthorizedTTL to `0` results in its default value being used.\n      # Default: true\n      cacheUnauthorizedRequests: true\n      # Timeout for the webhook request\n      # Maximum allowed is 30s.\n      # Required, with no default.\n      timeout: 3s\n      # The API version of the authorization.k8s.io SubjectAccessReview to\n      # send to and expect from the webhook.\n      # Same as setting `--authorization-webhook-version` flag\n      # Required, with no default\n      # Valid values: v1beta1, v1\n      subjectAccessReviewVersion: v1\n      # MatchConditionSubjectAccessReviewVersion specifies the SubjectAccessReview\n      # version the CEL expressions are evaluated against\n      # Valid values: v1\n      # Required, no default value\n      matchConditionSubjectAccessReviewVersion: v1\n      # Controls the authorization decision when a webhook request fails to\n      # complete or returns a malformed response or errors evaluating\n      # matchConditions.\n      # Valid values:\n      #   - NoOpinion: continue to subsequent authorizers to see if one of\n      #     them allows the request\n      #   - Deny: reject the request without consulting subsequent authorizers\n      # Required, with no default.\n      failurePolicy: Deny\n      connectionInfo:\n        # Controls how the webhook should communicate with the server.\n        # Valid values:\n        # - KubeConfigFile: use the file specified in kubeConfigFile to locate the\n        #   server.\n        # - InClusterConfig: use the in-cluster configuration to call the\n        #   SubjectAccessReview API hosted by kube-apiserver. This mode is not\n        #   allowed for kube-apiserver.\n        type: KubeConfigFile\n        # Path to KubeConfigFile for connection info\n        # Required, if connectionInfo.Type is KubeConfigFile\n        kubeConfigFile: /kube-system-authz-webhook.yaml\n        # matchConditions is a list of conditions that must be met for a request to be sent to this\n        # webhook. An empty list of matchConditions matches all requests.\n        # There are a maximum of 64 match conditions allowed.\n        #\n        # The exact matching logic is (in order):\n        #   1. If at least one matchCondition evaluates to FALSE, then the webhook is skipped.\n        #   2. If ALL matchConditions evaluate to TRUE, then the webhook is called.\n        #   3. If at least one matchCondition evaluates to an error (but none are FALSE):\n        #      - If failurePolicy=Deny, then the webhook rejects the request\n        #      - If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped\n      matchConditions:\n      # expression represents the expression which will be evaluated by CEL. Must evaluate to bool.\n      # CEL expressions have access to the contents of the SubjectAccessReview in v1 version.\n      # If version specified by subjectAccessReviewVersion in the request variable is v1beta1,\n      # the contents would be converted to the v1 version before evaluating the CEL expression.\n      #\n      # Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n      #\n      # only send resource requests to the webhook\n      - expression: has(request.resourceAttributes)\n      # only intercept requests to kube-system\n      - expression: request.resourceAttributes.namespace == 'kube-system'\n      # don't intercept requests from kube-system service accounts\n      - expression: \"!('system:serviceaccounts:kube-system' in request.groups)\"\n  - type: Node\n    name: node\n  - type: RBAC\n    name: rbac\n  - type: Webhook\n    name: in-cluster-authorizer\n    webhook:\n      authorizedTTL: 5m\n      unauthorizedTTL: 30s\n      timeout: 3s\n      subjectAccessReviewVersion: v1\n      failurePolicy: NoOpinion\n      connectionInfo:\n        type: InClusterConfig\n```\n\n3.3 - Authorization | When configuring the authorizer chain using a configuration file, make sure all the control plane nodes have the same file contents. Take a note of the API server configuration when upgrading / downgr", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19252"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace dev\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19253"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i create deployments --namespace prod\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19254"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list secrets --namespace dev --as dave\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19255"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth can-i list pods \\\n    --namespace target \\\n    --as system:serviceaccount:dev:dev-sa\n```\n\n3.3 - Authorization | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19256"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkubectl create -f - -o yaml << EOF\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    verb: create\n    namespace: dev\nEOF\n```\n\n3.3 - Authorization | The generated SelfSubjectAccessReview is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19257"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authorization.k8s.io/v1\nkind: SelfSubjectAccessReview\nmetadata:\n  creationTimestamp: null\nspec:\n  resourceAttributes:\n    group: apps\n    resource: deployments\n    namespace: dev\n    verb: create\nstatus:\n  allowed: true\n  denied: false\n```\n\n3.3 - Authorization | Role-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within your organization.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19258"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: RBAC\n  ...\n```\n\n3.4 - Using RBAC Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes RBAC; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19259"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-role.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19260"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-reader\nrules:\n- apiGroups: [\"\"] # \"\" indicates the core API group\n  resources: [\"pods\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | A ClusterRole can be used to grant the same permissions as a Role. Because ClusterRoles are cluster-scoped, you can also use them to grant access to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19261"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19262"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  # \"namespace\" omitted since ClusterRoles are not namespaced\n  name: secret-reader\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing Secret\n  # objects is \"secrets\"\n  resources: [\"secrets\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | The name of a Role or a ClusterRole object must be a valid path segment name.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19263"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-rolebinding-with-role.yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19264"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"jane\" to read pods in the \"default\" namespace.\n# You need to already have a Role named \"pod-reader\" in that namespace.\nkind: RoleBinding\nmetadata:\n  name: read-pods\n  namespace: default\nsubjects:\n# You can specify more than one \"subject\"\n- kind: User\n  name: jane # \"name\" is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  # \"roleRef\" specifies the binding to a Role / ClusterRole\n  kind: Role #this must be Role or ClusterRole\n  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | A RoleBinding can also reference a ClusterRole to grant the permissions defined in that ClusterRole to resources inside the RoleBinding's namespace. This kind of reference lets you define a set of com", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19265"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-rolebinding-with-clusterrole.yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19266"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This role binding allows \"dave\" to read secrets in the \"development\" namespace.\n# You need to already have a ClusterRole named \"secret-reader\".\nkind: RoleBinding\nmetadata:\n  name: read-secrets\n  #\n  # The namespace of the RoleBinding determines where the permissions are granted.\n  # This only grants permissions within the \"development\" namespace.\n  namespace: development\nsubjects:\n- kind: User\n  name: dave # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | To grant permissions across a whole cluster, you can use a ClusterRoleBinding. The following ClusterRoleBinding allows any user in the group \"manager\" to read secrets in any namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19267"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/simple-clusterrolebinding.yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19268"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\n# This cluster role binding allows anyone in the \"manager\" group to read secrets in any namespace.\nkind: ClusterRoleBinding\nmetadata:\n  name: read-secrets-global\nsubjects:\n- kind: Group\n  name: manager # Name is case sensitive\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: secret-reader\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | After you create a binding, you cannot change the Role or ClusterRole that it refers to. If you try to change a binding's roleRef, you get a validation error. If you do want to change the roleRef for", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19269"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: pod-and-pod-logs-reader\nrules:\n- apiGroups: [\"\"]\n  resources: [\"pods\", \"pods/log\"]\n  verbs: [\"get\", \"list\"]\n```\n\n3.4 - Using RBAC Authorization | You can also refer to resources by name for certain requests through the resourceNames list. When specified, requests can be restricted to individual instances of a resource. Here is an example that r", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19270"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: configmap-updater\nrules:\n- apiGroups: [\"\"]\n  #\n  # at the HTTP level, the name of the resource for accessing ConfigMap\n  # objects is \"configmaps\"\n  resources: [\"configmaps\"]\n  resourceNames: [\"my-configmap\"]\n  verbs: [\"update\", \"get\"]\n```\n\n3.4 - Using RBAC Authorization | Rather than referring to individual resources, apiGroups, and verbs, you can use the wildcard * symbol to refer to all such objects. For nonResourceURLs, you can use the wildcard * as a suffix glob ma", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19271"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  namespace: default\n  name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE\nrules:\n- apiGroups: [\"example.com\"]\n  resources: [\"*\"]\n  verbs: [\"*\"]\n```\n\n3.4 - Using RBAC Authorization | You can aggregate several ClusterRoles into one combined ClusterRole. A controller, running as part of the cluster control plane, watches for ClusterRole objects with an aggregationRule set. The aggre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19272"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring\naggregationRule:\n  clusterRoleSelectors:\n  - matchLabels:\n      rbac.example.com/aggregate-to-monitoring: \"true\"\nrules: [] # The control plane automatically fills in the rules\n```\n\n3.4 - Using RBAC Authorization | If you create a new ClusterRole that matches the label selector of an existing aggregated ClusterRole, that change triggers adding the new rules into the aggregated ClusterRole. Here is an example tha", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19273"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: monitoring-endpoints\n  labels:\n    rbac.example.com/aggregate-to-monitoring: \"true\"\n# When you create the \"monitoring-endpoints\" ClusterRole,\n# the rules below will be added to the \"monitoring\" ClusterRole.\nrules:\n- apiGroups: [\"\"]\n  resources: [\"services\", \"endpointslices\", \"pods\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | The default user-facing roles use ClusterRole aggregation. This lets you, as a cluster administrator, include rules for custom resources, such as those served by CustomResourceDefinitions or aggregate", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19274"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: aggregate-cron-tabs-edit\n  labels:\n    # Add these permissions to the \"admin\" and \"edit\" default roles.\n    rbac.authorization.k8s.io/aggregate-to-admin: \"true\"\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"]\n---\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: aggregate-cron-tabs-view\n  labels:\n    # Add these permissions to the \"view\" default role.\n    rbac.authorization.k8s.io/aggregate-to-view: \"true\"\nrules:\n- apiGroups: [\"stable.example.com\"]\n  resources: [\"crontabs\"]\n  verbs: [\"get\", \"list\", \"watch\"]\n```\n\n3.4 - Using RBAC Authorization | The following examples are excerpts from Role or ClusterRole objects, showing only the rules section.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19275"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: User\n  name: \"alice@example.com\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For a group named frontend-admins:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19276"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: \"frontend-admins\"\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For the default service account in the \"kube-system\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19277"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: ServiceAccount\n  name: default\n  namespace: kube-system\n```\n\n3.4 - Using RBAC Authorization | For all service accounts in the \"qa\" namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19278"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts:qa\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all service accounts in any namespace:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19279"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:serviceaccounts\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all authenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19280"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all unauthenticated users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19281"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | For all users:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19282"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsubjects:\n- kind: Group\n  name: system:authenticated\n  apiGroup: rbac.authorization.k8s.io\n- kind: Group\n  name: system:unauthenticated\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.4 - Using RBAC Authorization | API servers create a set of default ClusterRole and ClusterRoleBinding objects. Many of these are system: prefixed, which indicates that the resource is directly managed by the cluster control plane.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19283"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get clusterroles system:discovery -o yaml\n```\n\n3.4 - Using RBAC Authorization | Some of the default ClusterRoles are not system: prefixed. These are intended to be user-facing roles. They include super-user roles (cluster-admin), roles intended to be granted cluster-wide using Cl", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19284"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: role-grantor\nrules:\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"rolebindings\"]\n  verbs: [\"create\"]\n- apiGroups: [\"rbac.authorization.k8s.io\"]\n  resources: [\"clusterroles\"]\n  verbs: [\"bind\"]\n  # omit resourceNames to allow binding any ClusterRole\n  resourceNames: [\"admin\",\"edit\",\"view\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: role-grantor-binding\n  namespace: user-1-namespace\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: role-grantor\nsubjects:\n- apiGroup: rbac.authorization.k8s.io\n  kind: User\n  name: user-1\n```\n\n3.4 - Using RBAC Authorization | When bootstrapping the first roles and role bindings, it is necessary for the initial user to grant permissions they do not yet have. To bootstrap initial roles and role bindings:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19285"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19286"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19287"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=replicasets.apps\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19288"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role foo --verb=get,list,watch --resource=pods,pods/status\n```\n\n3.4 - Using RBAC Authorization | Create a Role named \"my-component-lease-holder\" with permissions to get/update a resource with a specific name:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19289"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create role my-component-lease-holder --verb=get,list,watch,update --resource=lease --resource-name=my-component\n```\n\n3.4 - Using RBAC Authorization | Creates a ClusterRole. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19290"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"pod-reader\" with resourceNames specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19291"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"foo\" with apiGroups specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19292"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=replicasets.apps\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"foo\" with subresource permissions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19293"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"foo\" with nonResourceURL specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19294"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole \"foo\" --verb=get --non-resource-url=/logs/*\n```\n\n3.4 - Using RBAC Authorization | Create a ClusterRole named \"monitoring\" with an aggregationRule specified:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19295"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrole monitoring --aggregation-rule=\"rbac.example.com/aggregate-to-monitoring=true\"\n```\n\n3.4 - Using RBAC Authorization | Grants a Role or ClusterRole within a specific namespace. Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19296"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding bob-admin-binding --clusterrole=admin --user=bob --namespace=acme\n```\n\n3.4 - Using RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to the service account in the namespace \"acme\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19297"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp --namespace=acme\n```\n\n3.4 - Using RBAC Authorization | Within the namespace \"acme\", grant the permissions in the \"view\" ClusterRole to a service account in the namespace \"myappnamespace\" named \"myapp\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19298"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding myappnamespace-myapp-view-binding --clusterrole=view --serviceaccount=myappnamespace:myapp --namespace=acme\n```\n\n3.4 - Using RBAC Authorization | Grants a ClusterRole across the entire cluster (all namespaces). Examples:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19299"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding root-cluster-admin-binding --clusterrole=cluster-admin --user=root\n```\n\n3.4 - Using RBAC Authorization | Across the entire cluster, grant the permissions in the \"system:node-proxier\" ClusterRole to a user named \"system:kube-proxy\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19300"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding kube-proxy-binding --clusterrole=system:node-proxier --user=system:kube-proxy\n```\n\n3.4 - Using RBAC Authorization | Across the entire cluster, grant the permissions in the \"view\" ClusterRole to a service account named \"myapp\" in the namespace \"acme\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19301"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp\n```\n\n3.4 - Using RBAC Authorization | Creates or updates rbac.authorization.k8s.io/v1 API objects from a manifest file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19302"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --dry-run=client\n```\n\n3.4 - Using RBAC Authorization | Apply a manifest file of RBAC objects, preserving any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19303"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml\n```\n\n3.4 - Using RBAC Authorization | Apply a manifest file of RBAC objects, removing any extra permissions (in roles) and any extra subjects (in bindings):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19304"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl auth reconcile -f my-rbac-rules.yaml --remove-extra-subjects --remove-extra-permissions\n```\n\n3.4 - Using RBAC Authorization | Default RBAC policies grant scoped permissions to control-plane components, nodes, and controllers, but grant no permissions to service accounts outside the kube-system namespace (beyond the permissio", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19305"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding my-sa-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:my-sa \\\n  --namespace=my-namespace\n```\n\n3.4 - Using RBAC Authorization | Grant a role to the \"default\" service account in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19306"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding default-view \\\n  --clusterrole=view \\\n  --serviceaccount=my-namespace:default \\\n  --namespace=my-namespace\n```\n\n3.4 - Using RBAC Authorization | Many add-ons run as the \"default\" service account in the kube-system namespace. To allow those add-ons to run with super-user access, grant cluster-admin permissions to the \"default\" service account i", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19307"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding add-on-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --serviceaccount=kube-system:default\n```\n\n3.4 - Using RBAC Authorization | Grant a role to all service accounts in a namespace", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19308"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create rolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n  --group=system:serviceaccounts:my-namespace \\\n  --namespace=my-namespace\n```\n\n3.4 - Using RBAC Authorization | Grant a limited role to all service accounts cluster-wide (discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19309"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-view \\\n  --clusterrole=view \\\n --group=system:serviceaccounts\n```\n\n3.4 - Using RBAC Authorization | Grant super-user access to all service accounts cluster-wide (strongly discouraged)", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19310"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding serviceaccounts-cluster-admin \\\n  --clusterrole=cluster-admin \\\n  --group=system:serviceaccounts\n```\n\n3.4 - Using RBAC Authorization | Kubernetes clusters created before Kubernetes v1.22 include write access to EndpointSlices (and the now-deprecated Endpoints API) in the aggregated \"edit\" and \"admin\" roles. As a mitigation for CVE-20", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19311"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/endpoints-aggregated.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\n3.4 - Using RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19312"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  annotations:\n    kubernetes.io/description: |-\n      Add endpoints write permissions to the edit and admin roles. This was\n      removed by default in 1.22 because of CVE-2021-25740. See\n      https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer\n      or Ingress implementations to expose backend IPs that would not otherwise\n      be accessible, and can circumvent network policies or security controls\n      intended to prevent/isolate access to those backends.\n      EndpointSlices were never included in the edit or admin roles, so there\n      is nothing to restore for the EndpointSlice API.      \n  labels:\n    rbac.authorization.k8s.io/aggregate-to-edit: \"true\"\n  name: custom:aggregate-to-edit:endpoints # you can change this if you wish\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"endpoints\"]\n    verbs: [\"create\", \"delete\", \"deletecollection\", \"patch\", \"update\"]\n```\n\n3.4 - Using RBAC Authorization | Clusters that originally ran older Kubernetes versions often used permissive ABAC policies, including granting full API access to all service accounts.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19313"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create clusterrolebinding permissive-binding \\\n  --clusterrole=cluster-admin \\\n  --user=admin \\\n  --user=kubelet \\\n  --group=system:serviceaccounts\n```\n\n3.4 - Using RBAC Authorization | After you have transitioned to use RBAC, you should adjust the access controls for your cluster to ensure that these meet your information security needs.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19314"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AuthorizationConfiguration\nauthorizers:\n  ...\n  - type: Node\n  ...\n```\n\n3.5 - Using Node Authorization | Or, start the API server with the --authorization-mode flag set to a comma-separated list that includes Node; for example:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19315"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Kubernetes API version\napiVersion: v1\n# kind of the API object\nkind: Config\n# clusters refers to the remote service.\nclusters:\n  - name: name-of-remote-authz-service\n    cluster:\n      # CA for verifying the remote service.\n      certificate-authority: /path/to/ca.pem\n      # URL of remote service to query. Must use 'https'. May not include parameters.\n      server: https://authz.example.com/authorize\n\n# users refers to the API Server's webhook configuration.\nusers:\n  - name: name-of-api-server\n    user:\n      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use\n      client-key: /path/to/key.pem          # key matching the cert\n\n# kubeconfig files require a context. Provide one for the API Server.\ncurrent-context: webhook\ncontexts:\n- context:\n    cluster: name-of-remote-authz-service\n    user: name-of-api-server\n  name: webhook\n```\n\n3.6 - Webhook Mode | When faced with an authorization decision, the API Server POSTs a JSON- serialized authorization.k8s.io/v1beta1 SubjectAccessReview object describing the action. This object contains fields describing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19316"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl --v=8 version\n```\n\n3.7 - Using ABAC Authorization | Alice can do anything to all resources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19317"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: EventRateLimit\n    path: eventconfig.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | There are four types of limits that can be specified in the configuration:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19318"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: eventratelimit.admission.k8s.io/v1alpha1\nkind: Configuration\nlimits:\n  - type: Namespace\n    qps: 50\n    burst: 100\n    cacheSize: 2000\n  - type: User\n    qps: 10\n    burst: 50\n```\n\n3.8 - Admission Control in Kubernetes | See the EventRateLimit Config API (v1alpha1) for more details.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19319"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    path: imagepolicyconfig.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | Alternatively, you can embed the configuration directly in the file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19320"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n  - name: ImagePolicyWebhook\n    configuration:\n      imagePolicy:\n        kubeConfigFile: <path-to-kubeconfig-file>\n        allowTTL: 50\n        denyTTL: 50\n        retryBackoff: 500\n        defaultAllow: true\n```\n\n3.8 - Admission Control in Kubernetes | The ImagePolicyWebhook config file must reference a kubeconfig formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19321"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: gluster-vol-default\nprovisioner: kubernetes.io/glusterfs\nparameters:\n  resturl: \"http://192.168.10.100:8080\"\n  restuser: \"\"\n  secretNamespace: \"\"\n  secretName: \"\"\nallowVolumeExpansion: true\n```\n\n3.8 - Admission Control in Kubernetes | For more information about persistent volume claims, see PersistentVolumeClaims.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19322"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: PodNodeSelector\n  path: podnodeselector.yaml\n...\n```\n\n3.8 - Admission Control in Kubernetes | PodNodeSelector uses the annotation key scheduler.alpha.kubernetes.io/node-selector to assign node selectors to namespaces.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19323"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  annotations:\n    scheduler.alpha.kubernetes.io/node-selector: name-of-node-selector\n  name: namespace3\n```\n\n3.8 - Admission Control in Kubernetes | This admission controller has the following behavior:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19324"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: apps-that-need-nodes-exclusively\n  annotations:\n    scheduler.alpha.kubernetes.io/defaultTolerations: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n    scheduler.alpha.kubernetes.io/tolerationsWhitelist: '[{\"operator\": \"Exists\", \"effect\": \"NoSchedule\", \"key\": \"dedicated-node\"}]'\n```\n\n3.8 - Admission Control in Kubernetes | This admission controller is disabled by default.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19325"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nmetadata:\n  name: \"pod-policy.example.com\"\nwebhooks:\n- name: \"pod-policy.example.com\"\n  rules:\n  - apiGroups:   [\"\"]\n    apiVersions: [\"v1\"]\n    operations:  [\"CREATE\"]\n    resources:   [\"pods\"]\n    scope:       \"Namespaced\"\n  clientConfig:\n    service:\n      namespace: \"example-namespace\"\n      name: \"example-service\"\n    caBundle: <CA_BUNDLE>\n  admissionReviewVersions: [\"v1\"]\n  sideEffects: None\n  timeoutSeconds: 5\n```\n\n3.9 - Dynamic Admission Control | The scope field specifies if only cluster-scoped resources (\"Cluster\") or namespace-scoped resources (\"Namespaced\") will match this rule. \"∗\" means that there are no scope restrictions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19326"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apiserver.config.k8s.io/v1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    apiVersion: apiserver.config.k8s.io/v1\n    kind: WebhookAdmissionConfiguration\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\n3.9 - Dynamic Admission Control | # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1 apiVersion: apiserver.k8s.io/v1alpha1 kind: AdmissionConfiguration plugins: - name: ValidatingAdmissionWebhook configuration: # Depre", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19327"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1\napiVersion: apiserver.k8s.io/v1alpha1\nkind: AdmissionConfiguration\nplugins:\n- name: ValidatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n- name: MutatingAdmissionWebhook\n  configuration:\n    # Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration\n    apiVersion: apiserver.config.k8s.io/v1alpha1\n    kind: WebhookAdmission\n    kubeConfigFile: \"<path-to-kubeconfig-file>\"\n```\n\n3.9 - Dynamic Admission Control | For more information about AdmissionConfiguration, see the AdmissionConfiguration (v1) reference. See the webhook configuration section for details about each config field.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19328"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nusers:\n# name should be set to the DNS name of the service or the host (including port) of the URL the webhook is configured to speak to.\n# If a non-443 port is used for services, it must be included in the name when configuring 1.16+ API servers.\n#\n# For a webhook configured to speak to a service on the default port (443), specify the DNS name of the service:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For a webhook configured to speak to a service on non-default port (e.g. 8443), specify the DNS name and port of the service in 1.16+:\n# - name: webhook1.ns1.svc:8443\n#   user: ...\n# and optionally create a second stanza using only the DNS name of the service for compatibility with 1.15 API servers:\n# - name: webhook1.ns1.svc\n#   user: ...\n#\n# For webhooks configured to speak to a URL, match the host (and port) specified in the webhook's URL. Examples:\n# A webhook with `url: https://www.example.com`:\n# - name: www.example.com\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:443`:\n# - name: www.example.com:443\n#   user: ...\n#\n# A webhook with `url: https://www.example.com:8443`:\n# - name: www.example.com:8443\n#   user: ...\n#\n- name: 'webhook1.ns1.svc'\n  user:\n    client-certificate-data: \"<pem encoded certificate>\"\n    client-key-data: \"<pem encoded key>\"\n# The `name` supports using * to wildcard-match prefixing segments.\n- name: '*.webhook-company.org'\n  user:\n    password: \"<password>\"\n    username: \"<name>\"\n# '*' is the default match.\n- name: '*'\n  user:\n    token: \"<token>\"\n```\n\n3.9 - Dynamic Admission Control | Of course you need to set up the webhook server to handle these authentication requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19329"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  admissionReviewVersions: [\"v1\", \"v1beta1\"]\n```\n\n3.9 - Dynamic Admission Control | admissionReviewVersions is a required field when creating webhook configurations. Webhooks are required to support at least one AdmissionReview version understood by the current and previous API serve", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19330"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\n...\nwebhooks:\n- name: my-webhook.example.com\n  rules:\n  - operations: [\"CREATE\", \"UPDATE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\", \"v1beta1\"]\n    resources: [\"deployments\", \"replicasets\"]\n    scope: \"Namespaced\"\n  ...\n```\n\n3.9 - Dynamic Admission Control | Match create requests for all resources (but not subresources) in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19331"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | Match update requests for all status subresources in all API groups and versions:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19332"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    rules:\n      - operations: [\"UPDATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*/status\"]\n        scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | Webhooks may optionally limit which requests are intercepted based on the labels of the objects they would be sent, by specifying an objectSelector. If specified, the objectSelector is evaluated again", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19333"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  objectSelector:\n    matchLabels:\n      foo: bar\n  rules:\n  - operations: [\"CREATE\"]\n    apiGroups: [\"*\"]\n    apiVersions: [\"*\"]\n    resources: [\"*\"]\n    scope: \"*\"\n```\n\n3.9 - Dynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19334"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: runlevel\n          operator: NotIn\n          values: [\"0\",\"1\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | This example shows a validating webhook that matches a CREATE of any namespaced resource inside a namespace that is associated with the \"environment\" of \"prod\" or \"staging\":", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19335"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    namespaceSelector:\n      matchExpressions:\n        - key: environment\n          operator: In\n          values: [\"prod\",\"staging\"]\n    rules:\n      - operations: [\"CREATE\"]\n        apiGroups: [\"*\"]\n        apiVersions: [\"*\"]\n        resources: [\"*\"]\n        scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | See labels concept for more examples of label selectors.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19336"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  matchPolicy: Equivalent\n  rules:\n  - operations: [\"CREATE\",\"UPDATE\",\"DELETE\"]\n    apiGroups: [\"apps\"]\n    apiVersions: [\"v1\"]\n    resources: [\"deployments\"]\n    scope: \"Namespaced\"\n```\n\n3.9 - Dynamic Admission Control | The matchPolicy for an admission webhooks defaults to Equivalent.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19337"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['*']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Ignore' # Fail-open (optional)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'exclude-leases' # Each match condition must have a unique name\n        expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n      - name: 'exclude-kubelet-requests'\n        expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n      - name: 'rbac' # Skip RBAC requests, which are handled by the second webhook.\n        expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  \n  # This example illustrates the use of the 'authorizer'. The authorization check is more expensive\n  # than a simple expression, so in this example it is scoped to only RBAC requests by using a second\n  # webhook. Both webhooks can be served by the same endpoint.\n  - name: rbac.my-webhook.example.com\n    matchPolicy: Equivalent\n    rules:\n      - operations: ['CREATE','UPDATE']\n        apiGroups: ['rbac.authorization.k8s.io']\n        apiVersions: ['*']\n        resources: ['*']\n    failurePolicy: 'Fail' # Fail-closed (the default)\n    sideEffects: None\n    clientConfig:\n      service:\n        namespace: my-namespace\n        name: my-webhook\n      caBundle: '<omitted>'\n    # You can have up to 64 matchConditions per webhook\n    matchConditions:\n      - name: 'breakglass'\n        # Skip requests made by users authorized to 'breakglass' on this webhook.\n        # The 'breakglass' API verb does not need to exist outside this check.\n        expression: '!authorizer.group(\"admissionregistration.k8s.io\").resource(\"validatingwebhookconfigurations\").name(\"my-webhook.example.com\").check(\"breakglass\").allowed()'\n```\n\n3.9 - Dynamic Admission Control | Match conditions have access to the following CEL variables:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19338"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    url: \"https://my-webhook.example.com:9443/my-webhook-path\"\n```\n\n3.9 - Dynamic Admission Control | The service stanza inside clientConfig is a reference to the service for this webhook. If the webhook is running within the cluster, then you should use service instead of url. The service namespace a", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19339"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  clientConfig:\n    caBundle: <CA_BUNDLE>\n    service:\n      namespace: my-service-namespace\n      name: my-service-name\n      path: /my-path\n      port: 1234\n```\n\n3.9 - Dynamic Admission Control | Webhooks typically operate only on the content of the AdmissionReview sent to them. Some webhooks, however, make out-of-band changes as part of processing admission requests.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19340"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    sideEffects: NoneOnDryRun\n```\n\n3.9 - Dynamic Admission Control | Because webhooks add to API request latency, they should evaluate as quickly as possible. timeoutSeconds allows configuring how long the API server should wait for a webhook to respond before treating", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19341"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingWebhookConfiguration\nwebhooks:\n  - name: my-webhook.example.com\n    timeoutSeconds: 2\n```\n\n3.9 - Dynamic Admission Control | The timeout for an admission webhook defaults to 10 seconds.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19342"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  reinvocationPolicy: IfNeeded\n```\n\n3.9 - Dynamic Admission Control | Mutating webhooks must be idempotent, able to successfully process an object they have already admitted and potentially modified. This is true for all mutating admission webhooks, since any change the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19343"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nwebhooks:\n- name: my-webhook.example.com\n  failurePolicy: Fail\n```\n\n3.9 - Dynamic Admission Control | The default failurePolicy for an admission webhooks is Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19344"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create namespace examplens\n```\n\n3.10 - Managing Service Accounts | Kubernetes distinguishes between the concept of a user account and a service account for a number of reasons:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19345"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create token my-sa --bound-object-kind=\"Pod\" --bound-object-name=\"test-pod\"\n```\n\n3.10 - Managing Service Accounts | Copy this token into a new file named tokenreview.yaml:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19346"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nspec:\n  token: <token from step 2>\n```\n\n3.10 - Managing Service Accounts | Submit this resource to the apiserver for review:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19347"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: authentication.k8s.io/v1\nkind: TokenReview\nmetadata:\n  creationTimestamp: null\nspec:\n  token: <token>\nstatus:\n  audiences:\n  - https://kubernetes.default.svc.cluster.local\n  authenticated: true\n  user:\n    extra:\n      authentication.kubernetes.io/credential-id:\n      - JTI=7ee52be0-9045-4653-aa5e-0da57b8dccdc\n      authentication.kubernetes.io/node-name:\n      - kind-control-plane\n      authentication.kubernetes.io/node-uid:\n      - 497e9d9a-47aa-4930-b0f6-9f2fb574c8c6\n      authentication.kubernetes.io/pod-name:\n      - test-pod\n      authentication.kubernetes.io/pod-uid:\n      - e87dbbd6-3d7e-45db-aafb-72b24627dff5\n    groups:\n    - system:serviceaccounts\n    - system:serviceaccounts:default\n    - system:authenticated\n    uid: f8b4161b-2e2b-11e9-86b7-2afc33b31a7e\n    username: system:serviceaccount:default:my-sa\n```\n\n3.10 - Managing Service Accounts | The schema for the Kubernetes-specific claims within JWT tokens is not currently documented, however the relevant code area can be found in the serviceaccount package in the Kubernetes codebase.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19348"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      sources:\n        - serviceAccountToken:\n            path: token # must match the path the app expects\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\n3.10 - Managing Service Accounts | That manifest snippet defines a projected volume that consists of three sources. In this case, each source also represents a single path within that volume. The three sources are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19349"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: build-robot\n  namespace: default\nsecrets:\n  - name: build-robot-secret # usually NOT present for a manually generated token\n```\n\n3.10 - Managing Service Accounts | Beginning from version 1.29, legacy ServiceAccount tokens that were generated automatically will be marked as invalid if they remain unused for a certain period of time (set to default at one year). T", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19350"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: build-robot-secret\n  namespace: default\n  labels:\n    kubernetes.io/legacy-token-last-used: 2022-10-24\n    kubernetes.io/legacy-token-invalid-since: 2023-10-25\n  annotations:\n    kubernetes.io/service-account.name: build-robot\ntype: kubernetes.io/service-account-token\n```\n\n3.10 - Managing Service Accounts | A ServiceAccount controller manages the ServiceAccounts inside namespaces, and ensures a ServiceAccount named \"default\" exists in every active namespace.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19351"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n...\n  - name: kube-api-access-<random-suffix>\n    projected:\n      defaultMode: 420 # decimal equivalent of octal 0644\n      sources:\n        - serviceAccountToken:\n            expirationSeconds: 3607\n            path: token\n        - configMap:\n            items:\n              - key: ca.crt\n                path: ca.crt\n            name: kube-root-ca.crt\n        - downwardAPI:\n            items:\n              - fieldRef:\n                  apiVersion: v1\n                  fieldPath: metadata.namespace\n                path: namespace\n```\n\n3.10 - Managing Service Accounts | That manifest snippet defines a projected volume that combines information from three sources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19352"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nsecret/serviceaccount/mysecretname.yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\n3.10 - Managing Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19353"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Secret\ntype: kubernetes.io/service-account-token\nmetadata:\n  name: mysecretname\n  annotations:\n    kubernetes.io/service-account.name: myserviceaccount\n```\n\n3.10 - Managing Service Accounts | To create a Secret based on this example, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19354"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens create -f https://k8s.io/examples/secret/serviceaccount/mysecretname.yaml\n```\n\n3.10 - Managing Service Accounts | To see the details for that Secret, run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19355"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens describe secret mysecretname\n```\n\n3.10 - Managing Service Accounts | The output is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19356"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete secret name-of-secret\n```\n\n3.10 - Managing Service Accounts | Otherwise, first find the Secret for the ServiceAccount.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19357"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  annotations:\n    kubectl.kubernetes.io/last-applied-configuration: |\n      {\"apiVersion\":\"v1\",\"kind\":\"ServiceAccount\",\"metadata\":{\"annotations\":{},\"name\":\"example-automated-thing\",\"namespace\":\"examplens\"}}      \n  creationTimestamp: \"2019-07-21T07:07:07Z\"\n  name: example-automated-thing\n  namespace: examplens\n  resourceVersion: \"777\"\n  selfLink: /api/v1/namespaces/examplens/serviceaccounts/example-automated-thing\n  uid: f23fd170-66f2-4697-b049-e1e266b7f835\nsecrets:\n  - name: example-automated-thing-token-zyxwv\n```\n\n3.10 - Managing Service Accounts | Then, delete the Secret you now know the name of:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19358"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n examplens delete secret/example-automated-thing-token-zyxwv\n```\n\n3.10 - Managing Service Accounts | Short lived ServiceAccount tokens automatically expire after the time-limit specified during their creation. There is no central record of tokens issued, so there is no way to revoke individual tokens", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19359"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete namespace examplens\n```\n\n3.10 - Managing Service Accounts | Kubernetes certificate and trust bundle APIs enable automation of X.509 credential provisioning by providing a programmatic interface for clients of the Kubernetes API to request and obtain X.509 cert", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19360"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/certificate-signing-request/clusterrole-create.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19361"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-creator\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - create\n  - get\n  - list\n  - watch\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow approving a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19362"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/certificate-signing-request/clusterrole-approve.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19363"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-approver\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/approval\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - approve\n```\n\n3.11 - Certificates and Certificate Signing Requests | To allow signing a CertificateSigningRequest:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19364"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/certificate-signing-request/clusterrole-sign.yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\n3.11 - Certificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19365"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: csr-signer\nrules:\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests\n  verbs:\n  - get\n  - list\n  - watch\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - certificatesigningrequests/status\n  verbs:\n  - update\n- apiGroups:\n  - certificates.k8s.io\n  resources:\n  - signers\n  resourceNames:\n  - example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain\n  verbs:\n  - sign\n```\n\n3.11 - Certificates and Certificate Signing Requests | Signers abstractly represent the entity or entities that might sign, or have signed, a security certificate.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19366"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  certificate: \"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JS...\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | Before a signer issues a certificate based on a CertificateSigningRequest, the signer typically checks that the issuance for that CSR has been approved.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19367"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve <certificate-signing-request-name>\n```\n\n3.11 - Certificates and Certificate Signing Requests | Likewise, to deny a CSR:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19368"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate deny <certificate-signing-request-name>\n```\n\n3.11 - Certificates and Certificate Signing Requests | Users of the REST API can approve CSRs by submitting an UPDATE request to the approval subresource of the CSR to be approved. For example, you could write an operator that watches for a particular kin", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19369"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Approved by my custom approver controller\n    reason: ApprovedByMyPolicy # You can set this to any string\n    type: Approved\n```\n\n3.11 - Certificates and Certificate Signing Requests | For Denied CSRs:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19370"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1\nkind: CertificateSigningRequest\n...\nstatus:\n  conditions:\n  - lastUpdateTime: \"2020-02-08T11:37:35Z\"\n    lastTransitionTime: \"2020-02-08T11:37:35Z\"\n    message: Denied by my custom approver controller\n    reason: DeniedByMyPolicy # You can set this to any string\n    type: Denied\n```\n\n3.11 - Certificates and Certificate Signing Requests | It's usual to set status.conditions.reason to a machine-friendly reason code using TitleCase; this is a convention but you can set it to anything you like. If you want to add a note for human consumpt", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19371"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get clustertrustbundles --as='system:serviceaccount:mynamespace:default'\n```\n\n3.11 - Certificates and Certificate Signing Requests | Signer-linked ClusterTrustBundles are associated with a signer name, like this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19372"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: example.com:mysigner:foo\nspec:\n  signerName: example.com/mysigner\n  trustBundle: \"<... PEM data ...>\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | These ClusterTrustBundles are intended to be maintained by a signer-specific controller in the cluster, so they have several security features:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19373"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: certificates.k8s.io/v1alpha1\nkind: ClusterTrustBundle\nmetadata:\n  name: foo\nspec:\n  # no signerName specified, so the field is blank\n  trustBundle: \"<... PEM data ...>\"\n```\n\n3.11 - Certificates and Certificate Signing Requests | They are primarily intended for cluster configuration use cases. Each signer-unlinked ClusterTrustBundle is an independent object, in contrast to the customary grouping behavior of signer-linked Clust", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19374"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# enable bootstrapping nodes to create CSR\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: create-csrs-for-bootstrapping\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:node-bootstrapper\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | While the apiserver receives the requests for certificates from the kubelet and authenticates those requests, the controller-manager is responsible for issuing actual signed certificates.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19375"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Approve all CSRs for the group \"system:bootstrappers\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-csrs-for-group\nsubjects:\n- kind: Group\n  name: system:bootstrappers\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:nodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | To enable the kubelet to renew its own client certificate, create a ClusterRoleBinding that binds the group in which the fully functioning node is a member system:nodes to the ClusterRole that grants", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19376"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# Approve renewal CSRs for the group \"system:nodes\"\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: auto-approve-renewals-for-nodes\nsubjects:\n- kind: Group\n  name: system:nodes\n  apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: ClusterRole\n  name: system:certificates.k8s.io:certificatesigningrequests:selfnodeclient\n  apiGroup: rbac.authorization.k8s.io\n```\n\n3.14 - TLS bootstrapping | The csrapproving controller that ships as part of kube-controller-manager and is enabled by default. The controller uses the SubjectAccessReview API to determine if a given user is authorized to reque", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19377"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority: /var/lib/kubernetes/ca.pem\n    server: https://my.server.example.com:6443\n  name: bootstrap\ncontexts:\n- context:\n    cluster: bootstrap\n    user: kubelet-bootstrap\n  name: bootstrap\ncurrent-context: bootstrap\npreferences: {}\nusers:\n- name: kubelet-bootstrap\n  user:\n    token: 07401b.f395accd246ae52d\n```\n\n3.14 - TLS bootstrapping | The important elements to note are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19378"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nmutatingadmissionpolicy/applyconfiguration-example.yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\n3.15 - Mutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19379"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"ApplyConfiguration\"\n      applyConfiguration:\n        expression: >\n          Object{\n            spec: Object.spec{\n              initContainers: [\n                Object.spec.initContainers{\n                  name: \"mesh-proxy\",\n                  image: \"mesh/proxy:v1.0.0\",\n                  args: [\"proxy\", \"sidecar\"],\n                  restartPolicy: \"Always\"\n                }\n              ]\n            }\n          }\n```\n\n3.15 - Mutating Admission Policy | The .spec.mutations field consists of a list of expressions that evaluate to resource patches. The emitted patches may be either apply configurations or JSON Patch patches. You cannot specify an empty", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19380"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: myapp\n  namespace: default\nspec:\n  ...\n  initContainers:\n  - name: mesh-proxy\n    image: mesh/proxy:v1.0.0\n    args: [\"proxy\", \"sidecar\"]\n    restartPolicy: Always\n  - name: myapp-initializer\n    image: example/initializer:v1.0.0\n  ...\n```\n\n3.15 - Mutating Admission Policy | Parameter resources allow a policy configuration to be separate from its definition. A policy can define paramKind, which outlines GVK of the parameter resource, and then a policy binding ties a polic", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19381"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nmutatingadmissionpolicy/json-patch-example.yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\n3.15 - Mutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19382"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1beta1\nkind: MutatingAdmissionPolicy\nmetadata:\n  name: \"sidecar-policy.example.com\"\nspec:\n  paramKind:\n    kind: Sidecar\n    apiVersion: mutations.example.com/v1\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\"]\n      resources:   [\"pods\"]\n  matchConditions:\n    - name: does-not-already-have-sidecar\n      expression: \"!object.spec.initContainers.exists(ic, ic.name == \\\"mesh-proxy\\\")\"\n  failurePolicy: Fail\n  reinvocationPolicy: IfNeeded\n  mutations:\n    - patchType: \"JSONPatch\"\n      jsonPatch:\n        expression: >\n          [\n            JSONPatch{\n              op: \"add\", path: \"/spec/initContainers/-\",\n              value: Object.spec.initContainers{\n                name: \"mesh-proxy\",\n                image: \"mesh-proxy/v1.0.0\",\n                restartPolicy: \"Always\"\n              }\n            }\n          ]\n```\n\n3.15 - Mutating Admission Policy | The expression will be evaluated by CEL to create a JSON patch. ref: https://github.com/google/cel-spec", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19383"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/basic-example-policy.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\n3.16 - Validating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19384"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= 5\"\n```\n\n3.16 - Validating Admission Policy | spec.validations contains CEL expressions which use the Common Expression Language (CEL) to validate the request. If an expression evaluates to false, the validation check is enforced according to the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19385"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/basic-example-binding.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19386"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"demo-binding-test.example.com\"\nspec:\n  policyName: \"demo-policy.example.com\"\n  validationActions: [Deny]\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19387"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/policy-with-param.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19388"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replicalimit-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas <= params.maxReplicas\"\n      reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The spec.paramKind field of the ValidatingAdmissionPolicy specifies the kind of resources used to parameterize this policy. For this example, it is configured by ReplicaLimit custom resources. Note in", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19389"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/binding-with-param.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19390"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-test.example.com\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-test.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchLabels:\n        environment: test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a parameter to the policy for all resources which are in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19391"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/replicalimit-param.yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\n3.16 - Validating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19392"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-test.example.com\"\n  namespace: \"default\"\nmaxReplicas: 3\n```\n\n3.16 - Validating Admission Policy | This policy parameter resource limits deployments to a max of 3 replicas.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19393"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/binding-with-param-prod.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19394"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"replicalimit-binding-nontest\"\nspec:\n  policyName: \"replicalimit-policy.example.com\"\n  validationActions: [Deny]\n  paramRef:\n    name: \"replica-limit-prod.example.com\"\n    namespace: \"default\"\n    parameterNotFoundAction: Deny\n  matchResources:\n    namespaceSelector:\n      matchExpressions:\n      - key: environment\n        operator: NotIn\n        values:\n        - test\n```\n\n3.16 - Validating Admission Policy | Notice this binding applies a different parameter to resources which are not in the test environment.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19395"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/replicalimit-param-prod.yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\n3.16 - Validating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19396"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: rules.example.com/v1\nkind: ReplicaLimit\nmetadata:\n  name: \"replica-limit-prod.example.com\"\nmaxReplicas: 100\n```\n\n3.16 - Validating Admission Policy | For each admission request, the API server evaluates CEL expressions of each (policy, binding, param) combination that match the request. For a request to be admitted it must pass all evaluations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19397"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1alpha1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: example-binding\nspec:\n  policyName: example-policy\n  paramRef:\n    selector:\n      matchLabels:\n        environment: test\n    parameterNotFoundAction: Allow\n  validationActions:\n  - Deny\n```\n\n3.16 - Validating Admission Policy | failurePolicy defines how mis-configurations and CEL expressions evaluating to error from the admission policy are handled. Allowed values are Ignore or Fail.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19398"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/failure-policy-ignore.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\n3.16 - Validating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19399"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nspec:\n...\nfailurePolicy: Ignore # The default is \"Fail\"\nvalidations:\n- expression: \"object.spec.xyz == params.x\"\n```\n\n3.16 - Validating Admission Policy | spec.validations[i].expression represents the expression which will be evaluated by CEL. To learn more, see the CEL language specification CEL expressions have access to the contents of the Admission", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19400"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/validating-admission-policy-match-conditions.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\n3.16 - Validating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19401"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n      - apiGroups:   [\"*\"]\n        apiVersions: [\"*\"]\n        operations:  [\"CREATE\", \"UPDATE\"]\n        resources:   [\"*\"]\n  matchConditions:\n    - name: 'exclude-leases' # Each match condition must have a unique name\n      expression: '!(request.resource.group == \"coordination.k8s.io\" && request.resource.resource == \"leases\")' # Match non-lease resources.\n    - name: 'exclude-kubelet-requests'\n      expression: '!(\"system:nodes\" in request.userInfo.groups)' # Match requests made by non-node users.\n    - name: 'rbac' # Skip RBAC requests.\n      expression: 'request.resource.group != \"rbac.authorization.k8s.io\"'\n  validations:\n    - expression: \"!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'\"\n```\n\n3.16 - Validating Admission Policy | Match conditions have access to the same CEL variables as validation expressions.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19402"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/validating-admission-policy-audit-annotation.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\n3.16 - Validating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19403"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"demo-policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n    - expression: \"object.spec.replicas > 50\"\n      messageExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n  auditAnnotations:\n    - key: \"high-replica-count\"\n      valueExpression: \"'Deployment spec.replicas set to ' + string(object.spec.replicas)\"\n```\n\n3.16 - Validating Admission Policy | When an API request is validated with this admission policy, the resulting audit event will look like:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19404"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/deployment-replicas-policy.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19405"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  paramKind:\n    apiVersion: rules.example.com/v1\n    kind: ReplicaLimit\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.spec.replicas <= params.maxReplicas\"\n    messageExpression: \"'object.spec.replicas must be no greater than ' + string(params.maxReplicas)\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | After creating a params object that limits the replicas to 3 and setting up the binding, when we try to create a deployment with 5 replicas, we will receive the following message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19406"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/typechecking.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19407"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"deploy-replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | The status will yield the following information:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19408"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nvalidatingadmissionpolicy/typechecking-multiple-match.yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19409"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"replica-policy.example.com\"\nspec:\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\",\"replicasets\"]\n  validations:\n  - expression: \"object.replicas > 1\" # should be \"object.spec.replicas > 1\"\n    message: \"must be replicated\"\n    reason: Invalid\n```\n\n3.16 - Validating Admission Policy | will have multiple types and type checking result of each type in the warning message.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19410"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\naccess/image-matches-namespace-environment.policy.yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\n3.16 - Validating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19411"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace.\n# Except for \"exempt\" deployments, or any containers that do not belong to the \"example.com\" organization (e.g. common sidecars).\n# For example, if the namespace has a label of {\"environment\": \"staging\"}, all container images must be either staging.example.com/*\n# or do not contain \"example.com\" at all, unless the deployment has {\"exempt\": \"true\"} label.\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"image-matches-namespace-environment.policy.example.com\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"apps\"]\n      apiVersions: [\"v1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"deployments\"]\n  variables:\n  - name: environment\n    expression: \"'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'\"\n  - name: exempt\n    expression: \"'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'\"\n  - name: containers\n    expression: \"object.spec.template.spec.containers\"\n  - name: containersToCheck\n    expression: \"variables.containers.filter(c, c.image.contains('example.com/'))\"\n  validations:\n  - expression: \"variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))\"\n    messageExpression: \"'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name\"\n```\n\n3.16 - Validating Admission Policy | With the policy bound to the namespace default, which is labeled environment: prod, the following attempt to create a deployment would be rejected.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19412"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl create deploy --image=dev.example.com/nginx invalid\n```\n\n3.16 - Validating Admission Policy | The error message is similar to this.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19413"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl label nodes <node-name> node.kubernetes.io/exclude-from-external-load-balancers=true\n```\n\n4 - Well-Known Labels, Annotations and Taints | Type: Annotation", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19414"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl.kubernetes.io/last-applied-configuration: >\n      {\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"example\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"matchLabels\":{\"app.kubernetes.io/name\":foo}},\"template\":{\"metadata\":{\"labels\":{\"app.kubernetes.io/name\":\"foo\"}},\"spec\":{\"containers\":[{\"image\":\"container-registry.example/foo-bar:1.42\",\"name\":\"foo-bar\",\"ports\":[{\"containerPort\":42}]}]}}}}\n```\n\n4 - Well-Known Labels, Annotations and Taints | Used on: all objects", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19415"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl taint nodes <node-name> node-role.kubernetes.io/control-plane:NoSchedule-\n```\n\n4 - Well-Known Labels, Annotations and Taints | Type: Taint", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19416"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw \"/api/v1/nodes/minikube/proxy/stats/summary\"\n```\n\n6.3 - Node metrics data | Here is the same API call using curl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19417"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cpu-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: cpu-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    args:\n    - \"stress\"\n    - \"--cpus\"\n    - \"1\"\n    resources:\n      limits:\n        cpu: \"500m\"\n      requests:\n        cpu: \"500m\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f cpu-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19418"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod cpu-pressure-pod\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | This example creates a Pod that continuously writes to files in the container's writable layer, causing the kernel's page cache to grow and forcing memory reclamation, which generates pressure.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19419"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: memory-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: memory-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n    - \"i=0; while true; do dd if=/dev/zero of=testfile.$i bs=1M count=50 &>/dev/null; i=$(((i+1)%5)); sleep 0.1; done\"\n    resources:\n      limits:\n        memory: \"200M\"\n      requests:\n        memory: \"200M\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply it to your cluster: kubectl apply -f memory-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19420"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod memory-pressure-pod\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | This Pod generates I/O pressure by repeatedly writing a file to disk and using sync to flush the data from memory, which creates I/O stalls.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19421"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: io-pressure-pod\nspec:\n  restartPolicy: Never\n  containers:\n  - name: io-stress\n    image: registry.k8s.io/e2e-test-images/agnhost:2.47\n    command: [\"/bin/sh\", \"-c\"]\n    args:\n      - \"while true; do dd if=/dev/zero of=testfile bs=1M count=128 &>/dev/null; sync; rm testfile &>/dev/null; done\"\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | Apply this to your cluster: kubectl apply -f io-pressure-pod.yaml", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19422"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete pod io-pressure-pod\n```\n\n6.4 - Understand Pressure Stall Information (PSI) Metrics | The task pages for Troubleshooting Clusters discuss how to use a metrics pipeline that rely on these data.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19423"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nauthorization:\n  mode: Webhook\n  webhook:\n    cacheAuthorizedTTL: \"5m\"\n    cacheUnauthorizedTTL: \"30s\"\nserializeImagePulls: false\naddress: \"192.168.0.1\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19424"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19425"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nauthorization:\n  mode: AlwaysAllow\n  webhook:\n    cacheAuthorizedTTL: \"8m\"\n    cacheUnauthorizedTTL: \"45s\"\naddress: \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | You can override the slices/lists values of the kubelet configuration. However, the entire list gets overridden during the merging process. For example, you can override the clusterDNS list as follows", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19426"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.9\"\n  - \"192.168.0.8\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19427"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19428"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nclusterDNS:\n  - \"192.168.0.2\"\n  - \"192.168.0.3\"\n  - \"192.168.0.5\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Individual fields in maps, regardless of their value types (boolean, string, etc.), can be selectively overridden. However, for map[string][]string, the entire list associated with a specific field ge", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19429"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 456\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | Contents of a file in --config-dir directory:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19430"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nfeatureGates:\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | The resulting configuration will be as follows:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19431"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubelet.config.k8s.io/v1beta1\nkind: KubeletConfiguration\nport: 20250\nserializeImagePulls: false\nfeatureGates:\n  AllAlpha: false\n  MemoryQoS: false\n  KubeletTracing: true\n  DynamicResourceAllocation: true\nstaticPodURLHeader:\n  kubelet-api-support:\n  - \"Authorization: 234APSDFA\"\n  - \"X-Custom-Header: 123\"\n  custom-static-pod:\n  - \"Authorization: 223EWRWER\"\n  - \"X-Custom-Header: 345\"\n```\n\n8.6 - Kubelet Configuration Directory Merging | This page provides details of version compatibility between the Kubernetes device plugin API, and different versions of Kubernetes itself.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19432"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl describe node <insert-node-name-here>\n```\n\n8.9 - Node Status | Each section of the output is described below.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19433"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\npods/security/seccomp/fields.yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\n8.10 - Seccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19434"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod\nspec:\n  securityContext:\n    seccompProfile:\n      type: Unconfined\n  ephemeralContainers:\n  - name: ephemeral-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  initContainers:\n  - name: init-container\n    image: debian\n    securityContext:\n      seccompProfile:\n        type: RuntimeDefault\n  containers:\n  - name: container\n    image: docker.io/library/debian:stable\n    securityContext:\n      seccompProfile:\n        type: Localhost\n        localhostProfile: my-profile.json\n```\n\n8.10 - Seccomp and Kubernetes | The Pod in the example above runs as Unconfined, while the ephemeral-container and init-container specifically defines RuntimeDefault. If the ephemeral or init container would not have set the securit", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19435"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get ipaddresses\n```\n\n9.3 - Virtual IPs and Service Proxies | Kubernetes also allow users to dynamically define the available IP ranges for Services using ServiceCIDR objects. During bootstrap, a default ServiceCIDR object named kubernetes is created from the va", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19436"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\n9.3 - Virtual IPs and Service Proxies | Users can create or delete new ServiceCIDR objects to manage the available IP ranges for Services:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19437"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\ncat <<'EOF' | kubectl apply -f -\napiVersion: networking.k8s.io/v1\nkind: ServiceCIDR\nmetadata:\n  name: newservicecidr\nspec:\n  cidrs:\n  - 10.96.0.0/24\nEOF\n```\n\n9.3 - Virtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19438"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get servicecidrs\n```\n\n9.3 - Virtual IPs and Service Proxies | Distributions or administrators of Kubernetes clusters may want to control that new Service CIDRs added to the cluster does not overlap with other networks on the cluster, that only belong to a specif", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19439"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicy\nmetadata:\n  name: \"servicecidrs-default\"\nspec:\n  failurePolicy: Fail\n  matchConstraints:\n    resourceRules:\n    - apiGroups:   [\"networking.k8s.io\"]\n      apiVersions: [\"v1\",\"v1beta1\"]\n      operations:  [\"CREATE\", \"UPDATE\"]\n      resources:   [\"servicecidrs\"]\n  matchConditions:\n  - name: 'exclude-default-servicecidr'\n    expression: \"object.metadata.name != 'kubernetes'\"\n  variables:\n  - name: allowed\n    expression: \"['10.96.0.0/16','2001:db8::/64']\"\n  validations:\n  - expression: \"object.spec.cidrs.all(i , variables.allowed.exists(j , cidr(j).containsCIDR(i)))\"\n---\napiVersion: admissionregistration.k8s.io/v1\nkind: ValidatingAdmissionPolicyBinding\nmetadata:\n  name: \"servicecidrs-binding\"\nspec:\n  policyName: \"servicecidrs-default\"\n  validationActions: [Deny,Audit]\n---\n```\n\n9.3 - Virtual IPs and Service Proxies | Kubernetes divides the ClusterIP range into two bands, based on the size of the configured service-cluster-ip-range by using the following formula min(max(16, cidrSize / 16), 256). That formula means", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19440"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete clusterrolebinding kubeadm:node-autoapprove-bootstrap\n```\n\n10.1.3 - kubeadm join | After that, kubeadm join will block until the admin has manually approved the CSR in flight:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19441"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl certificate approve node-csr-c69HXe7aYcqkS1bKmH4faEnHAWxn6i2bHZ2mD04jZyQ\n```\n\n10.1.3 - kubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19442"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public get cm cluster-info -o jsonpath='{.data.kubeconfig}' | tee cluster-info.yaml\n```\n\n10.1.3 - kubeadm join | The output is similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19443"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Config\nclusters:\n- cluster:\n    certificate-authority-data: <ca-cert>\n    server: https://<ip>:<port>\n  name: \"\"\ncontexts: []\ncurrent-context: \"\"\npreferences: {}\nusers: []\n```\n\n10.1.3 - kubeadm join | Use the cluster-info.yaml file as an argument to kubeadm join --discovery-file.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19444"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl -n kube-public delete rolebinding kubeadm:bootstrap-signer-clusterinfo\n```\n\n10.1.3 - kubeadm join | These commands should be run after kubeadm init but before kubeadm join.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19445"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker run --privileged --rm registry.k8s.io/kube-proxy:v1.34.0 sh -c \"kube-proxy --cleanup && echo DONE\"\n```\n\n10.1.7 - kubeadm reset | The output of the above command should print DONE at the end. Instead of Docker, you can use your preferred container runtime to start the container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19446"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] [flags]\n```\n\n11 - Command line tool (kubectl) | where command, TYPE, NAME, and flags are:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19447"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod pod1\nkubectl get pods pod1\nkubectl get po pod1\n```\n\n11 - Command line tool (kubectl) | NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, for example kubectl get pods.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19448"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config set-context --current --namespace=<namespace-name>\n```\n\n11 - Command line tool (kubectl) | The following table includes short descriptions and the general syntax for all of the kubectl operations:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19449"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] -o <output_format>\n```\n\n11 - Command line tool (kubectl) | Depending on the kubectl operation, the following output formats are supported:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19450"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod web-pod-13je7 -o yaml\n```\n\n11 - Command line tool (kubectl) | Remember: See the kubectl reference documentation for details about which output format is supported by each command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19451"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion\n```\n\n11 - Command line tool (kubectl) | Template file:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19452"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> -o custom-columns-file=template.txt\n```\n\n11 - Command line tool (kubectl) | where the template.txt file contains:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19453"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods <pod-name> --server-print=false\n```\n\n11 - Command line tool (kubectl) | The output is similar to:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19454"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl [command] [TYPE] [NAME] --sort-by=<jsonpath_exp>\n```\n\n11 - Command line tool (kubectl) | To print a list of pods sorted by name, you run:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19455"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods --sort-by=.metadata.name\n```\n\n11 - Command line tool (kubectl) | Use the following set of examples to help you familiarize yourself with running the commonly used kubectl operations:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19456"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl config view # Show Merged kubeconfig settings.\n\n# use multiple kubeconfig files at the same time and view merged config\nKUBECONFIG=~/.kube/config:~/.kube/kubconfig2\n\nkubectl config view\n\n# Show merged kubeconfig settings and raw certificate data and exposed secrets\nkubectl config view --raw \n\n# get the password for the e2e user\nkubectl config view -o jsonpath='{.users[?(@.name == \"e2e\")].user.password}'\n\n# get the certificate for the e2e user\nkubectl config view --raw -o jsonpath='{.users[?(.name == \"e2e\")].user.client-certificate-data}' | base64 -d\n\nkubectl config view -o jsonpath='{.users[].name}'    # display the first user\nkubectl config view -o jsonpath='{.users[*].name}'   # get a list of users\nkubectl config get-contexts                          # display list of contexts\nkubectl config get-contexts -o name                  # get all context names\nkubectl config current-context                       # display the current-context\nkubectl config use-context my-cluster-name           # set the default context to my-cluster-name\n\nkubectl config set-cluster my-cluster-name           # set a cluster entry in the kubeconfig\n\n# configure the URL to a proxy server to use for requests made by this client in the kubeconfig\nkubectl config set-cluster my-cluster-name --proxy-url=my-proxy-url\n\n# add a new user to your kubeconf that supports basic auth\nkubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword\n\n# permanently save the namespace for all subsequent kubectl commands in that context.\nkubectl config set-context --current --namespace=ggckad-s2\n\n# set a context utilizing a specific username and namespace.\nkubectl config set-context gce --user=cluster-admin --namespace=foo \\\n  && kubectl config use-context gce\n\nkubectl config unset users.foo                       # delete user foo\n\n# short alias to set/show context/namespace (only works for bash and bash-compatible shells, current context to be set before using kn to set namespace)\nalias kx='f() { [ \"$1\" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'\nalias kn='f() { [ \"$1\" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d\" \" -f6 ; } ; f'\n```\n\n11.2 - kubectl Quick Reference | apply manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running kubectl apply. This is the recommended way of managing Kubernetes", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19457"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\nkubectl apply -f ./my-manifest.yaml                 # create resource(s)\nkubectl apply -f ./my1.yaml -f ./my2.yaml           # create from multiple files\nkubectl apply -f ./dir                              # create resource(s) in all manifest files in dir\nkubectl apply -f https://example.com/manifest.yaml  # create resource(s) from url (Note: this is an example domain and does not contain a valid manifest)\nkubectl create deployment nginx --image=nginx       # start a single instance of nginx\n\n# create a Job which prints \"Hello World\"\nkubectl create job hello --image=busybox:1.28 -- echo \"Hello World\"\n\n# create a CronJob that prints \"Hello World\" every minute\nkubectl create cronjob hello --image=busybox:1.28   --schedule=\"*/1 * * * *\" -- echo \"Hello World\"\n\nkubectl explain pods                           # get the documentation for pod manifests\n\n# Create multiple YAML objects from stdin\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000000\"\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: busybox-sleep-less\nspec:\n  containers:\n  - name: busybox\n    image: busybox:1.28\n    args:\n    - sleep\n    - \"1000\"\nEOF\n\n# Create a secret with several keys\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\ntype: Opaque\ndata:\n  password: $(echo -n \"s33msi4\" | base64 -w0)\n  username: $(echo -n \"jane\" | base64 -w0)\nEOF\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19458"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl set image deployment/frontend www=image:v2               # Rolling update \"www\" containers of \"frontend\" deployment, updating the image\nkubectl rollout history deployment/frontend                      # Check the history of deployments including the revision\nkubectl rollout undo deployment/frontend                         # Rollback to the previous deployment\nkubectl rollout undo deployment/frontend --to-revision=2         # Rollback to a specific revision\nkubectl rollout status -w deployment/frontend                    # Watch rolling update status of \"frontend\" deployment until completion\nkubectl rollout restart deployment/frontend                      # Rolling restart of the \"frontend\" deployment\n\n\ncat pod.json | kubectl replace -f -                              # Replace a pod based on the JSON passed into stdin\n\n# Force replace, delete and then re-create the resource. Will cause a service outage.\nkubectl replace --force -f ./pod.json\n\n# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000\nkubectl expose rc nginx --port=80 --target-port=8000\n\n# Update a single-container pod's image version (tag) to v4\nkubectl get pod mypod -o yaml | sed 's/\\(image: myimage\\):.*$/\\1:v4/' | kubectl replace -f -\n\nkubectl label pods my-pod new-label=awesome                      # Add a Label\nkubectl label pods my-pod new-label-                             # Remove a label\nkubectl label pods my-pod new-label=new-value --overwrite        # Overwrite an existing value\nkubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq       # Add an annotation\nkubectl annotate pods my-pod icon-url-                           # Remove annotation\nkubectl autoscale deployment foo --min=2 --max=10                # Auto scale a deployment \"foo\"\n```\n\n11.2 - kubectl Quick Reference | Edit any API resource in your preferred editor.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19459"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl edit svc/docker-registry                      # Edit the service named docker-registry\nKUBE_EDITOR=\"nano\" kubectl edit svc/docker-registry   # Use an alternative editor\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19460"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl scale --replicas=3 rs/foo                                 # Scale a replicaset named 'foo' to 3\nkubectl scale --replicas=3 -f foo.yaml                            # Scale a resource specified in \"foo.yaml\" to 3\nkubectl scale --current-replicas=2 --replicas=3 deployment/mysql  # If the deployment named mysql's current size is 2, scale mysql to 3\nkubectl scale --replicas=5 rc/foo rc/bar rc/baz                   # Scale multiple replication controllers\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19461"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete -f ./pod.json                                      # Delete a pod using the type and name specified in pod.json\nkubectl delete pod unwanted --now                                 # Delete a pod with no grace period\nkubectl delete pod,service baz foo                                # Delete pods and services with same names \"baz\" and \"foo\"\nkubectl delete pods,services -l name=myLabel                      # Delete pods and services with label name=myLabel\nkubectl -n my-ns delete pod,svc --all                             # Delete all pods and services in namespace my-ns,\n# Delete all pods matching the awk pattern1 or pattern2\nkubectl get pods  -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs  kubectl delete -n mynamespace pod\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19462"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs my-pod                                 # dump pod logs (stdout)\nkubectl logs -l name=myLabel                        # dump pod logs, with label name=myLabel (stdout)\nkubectl logs my-pod --previous                      # dump pod logs (stdout) for a previous instantiation of a container\nkubectl logs my-pod -c my-container                 # dump pod container logs (stdout, multi-container case)\nkubectl logs -l name=myLabel -c my-container        # dump pod container logs, with label name=myLabel (stdout)\nkubectl logs my-pod -c my-container --previous      # dump pod container logs (stdout, multi-container case) for a previous instantiation of a container\nkubectl logs -f my-pod                              # stream pod logs (stdout)\nkubectl logs -f my-pod -c my-container              # stream pod container logs (stdout, multi-container case)\nkubectl logs -f -l name=myLabel --all-containers    # stream all pods logs with label name=myLabel (stdout)\nkubectl run -i --tty busybox --image=busybox:1.28 -- sh  # Run pod as interactive shell\nkubectl run nginx --image=nginx -n mynamespace      # Start a single instance of nginx pod in the namespace of mynamespace\nkubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml\n                                                    # Generate spec for running pod nginx and write it into a file called pod.yaml\nkubectl attach my-pod -i                            # Attach to Running Container\nkubectl port-forward my-pod 5000:6000               # Listen on port 5000 on the local machine and forward to port 6000 on my-pod\nkubectl exec my-pod -- ls /                         # Run command in existing pod (1 container case)\nkubectl exec --stdin --tty my-pod -- /bin/sh        # Interactive shell access to a running pod (1 container case)\nkubectl exec my-pod -c my-container -- ls /         # Run command in existing pod (multi-container case)\nkubectl debug my-pod -it --image=busybox:1.28       # Create an interactive debugging session within existing pod and immediately attach to it\nkubectl debug node/my-node -it --image=busybox:1.28 # Create an interactive debugging session on a node and immediately attach to it\nkubectl top pod                                     # Show metrics for all pods in the default namespace\nkubectl top pod POD_NAME --containers               # Show metrics for a given pod and its containers\nkubectl top pod POD_NAME --sort-by=cpu              # Show metrics for a given pod and sort it by 'cpu' or 'memory'\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19463"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cp /tmp/foo_dir my-pod:/tmp/bar_dir            # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the current namespace\nkubectl cp /tmp/foo my-pod:/tmp/bar -c my-container    # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container\nkubectl cp /tmp/foo my-namespace/my-pod:/tmp/bar       # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace my-namespace\nkubectl cp my-namespace/my-pod:/tmp/foo /tmp/bar       # Copy /tmp/foo from a remote pod to /tmp/bar locally\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19464"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs deploy/my-deployment                         # dump Pod logs for a Deployment (single-container case)\nkubectl logs deploy/my-deployment -c my-container         # dump Pod logs for a Deployment (multi-container case)\n\nkubectl port-forward svc/my-service 5000                  # listen on local port 5000 and forward to port 5000 on Service backend\nkubectl port-forward svc/my-service 5000:my-service-port  # listen on local port 5000 and forward to Service target port with name <my-service-port>\n\nkubectl port-forward deploy/my-deployment 5000:6000       # listen on local port 5000 and forward to port 6000 on a Pod created by <my-deployment>\nkubectl exec deploy/my-deployment -- ls                   # run command in first Pod and first container in Deployment (single- or multi-container cases)\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19465"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl cordon my-node                                                # Mark my-node as unschedulable\nkubectl drain my-node                                                 # Drain my-node in preparation for maintenance\nkubectl uncordon my-node                                              # Mark my-node as schedulable\nkubectl top node                                                      # Show metrics for all nodes\nkubectl top node my-node                                              # Show metrics for a given node\nkubectl cluster-info                                                  # Display addresses of the master and services\nkubectl cluster-info dump                                             # Dump current cluster state to stdout\nkubectl cluster-info dump --output-directory=/path/to/cluster-state   # Dump current cluster state to /path/to/cluster-state\n\n# View existing taints on which exist on current nodes.\nkubectl get nodes -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect'\n\n# If a taint with that key and effect already exists, its value is replaced as specified.\nkubectl taint nodes foo dedicated=special-user:NoSchedule\n```\n\n11.2 - kubectl Quick Reference | List all supported resource types along with their shortnames, API group, whether they are namespaced, and kind:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19466"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources\n```\n\n11.2 - kubectl Quick Reference | Other operations for exploring API resources:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19467"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl api-resources --namespaced=true      # All namespaced resources\nkubectl api-resources --namespaced=false     # All non-namespaced resources\nkubectl api-resources -o name                # All resources with simple output (only the resource name)\nkubectl api-resources -o wide                # All resources with expanded (aka \"wide\") output\nkubectl api-resources --verbs=list,get       # All resources that support the \"list\" and \"get\" request verbs\nkubectl api-resources --api-group=extensions # All resources in the \"extensions\" API group\n```\n\n11.2 - kubectl Quick Reference | To output details to your terminal window in a specific format, add the -o (or --output) flag to a supported kubectl command.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19468"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o json\nkubectl get pods -o=jsonpath='{@}'\nkubectl get pods -o=jsonpath='{.items[0]}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.name}'\nkubectl get pods -o=jsonpath=\"{.items[*]['metadata.name', 'status.capacity']}\"\nkubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.startTime}{\"\\n\"}{end}'\nkubectl get pods -o=jsonpath='{.items[0].metadata.labels.kubernetes\\.io/hostname}'\n```\n\n11.6 - JSONPath Support | Or, with a \"my_pod\" and \"my_namespace\" (adjust these names to your environment):", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19469"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{@}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.metadata.name}'\nkubectl get pod/my_pod -n my_namespace -o=jsonpath='{.status}'\n```\n\n11.6 - JSONPath Support | On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote aro", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19470"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{'\\t'}{.status.startTime}{'\\n'}{end}\"\nkubectl get pods -o=jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\t\\\"}{.status.startTime}{\\\"\\n\\\"}{end}\"\n```\n\n11.6 - JSONPath Support | JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as jq.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19471"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker run -d --restart=always -e DOMAIN=cluster --name nginx-app -p 80:80 nginx\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19472"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl run [-i] [--tty] --attach <name> --image=<image>\n```\n\n11.7 - kubectl for Docker Users | Unlike docker run ..., if you specify --attach, then you attach stdin, stdout and stderr. You cannot control which streams are attached (docker -a ...). To detach from the container, you can type the", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19473"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker attach 55c103fa1296\n...\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19474"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl attach -it nginx-app-5jyvm\n...\n```\n\n11.7 - kubectl for Docker Users | To detach from the container, you can type the escape sequence Ctrl+P followed by Ctrl+Q.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19475"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker exec 55c103fa1296 cat /etc/hostname\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19476"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl exec nginx-app-5jyvm -- cat /etc/hostname\n```\n\n11.7 - kubectl for Docker Users | To use interactive commands.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19477"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker exec -ti 55c103fa1296 /bin/sh\n# exit\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19478"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl exec -ti nginx-app-5jyvm -- /bin/sh\n# exit\n```\n\n11.7 - kubectl for Docker Users | For more information, see Get a Shell to a Running Container.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19479"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs -f nginx-app-zibvs\n```\n\n11.7 - kubectl for Docker Users | There is a slight difference between pods and containers; by default pods do not terminate if their processes exit. Instead the pods restart the process. This is similar to the docker run option --res", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19480"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl logs --previous nginx-app-zibvs\n```\n\n11.7 - kubectl for Docker Users | For more information, see Logging Architecture.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19481"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker stop a9ec34d98787\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19482"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\ndocker rm a9ec34d98787\n```\n\n11.7 - kubectl for Docker Users | kubectl:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19483"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get deployment nginx-app\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19484"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19485"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl delete deployment nginx-app\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19486"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get po -l app=nginx-app\n# Return nothing\n```\n\n11.7 - kubectl for Docker Users | There is no direct analog of docker login in kubectl. If you are interested in using Kubernetes with a private registry, see Using a Private Registry.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19487"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: getn\n  command: get\n  options:\n   - name: output\n     default: json\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19488"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n  - name: getn\n    command: get\n    options:\n      - name: output\n        default: json\n    prependArgs:\n      - namespace\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19489"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\naliases:\n- name: runx\n  command: run\n  options:\n    - name: image\n      default: busybox\n    - name: namespace\n      default: test-ns\n  appendArgs:\n    - --\n    - custom-arg\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19490"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n- command: delete\n  options:\n    - name: interactive\n      default: \"true\"\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings were used:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19491"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\ndefaults:\n  # (1) default server-side apply\n  - command: apply\n    options:\n      - name: server-side\n        default: \"true\"\n\n  # (2) default interactive deletion\n  - command: delete\n    options:\n      - name: interactive\n        default: \"true\"\n```\n\n11.9 - Kubectl user preferences (kuberc) | In this example, the following settings are enforced:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19492"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get flowschemas -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\nkubectl get prioritylevelconfigurations -o custom-columns=\"uid:{metadata.uid},name:{metadata.name}\"\n```\n\n13.1 - Flow control | to get a mapping of UIDs to names for both FlowSchemas and PriorityLevelConfigurations.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19493"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_priority_levels\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19494"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_queues\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19495"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw /debug/api_priority_and_fairness/dump_requests\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19496"}
{"instruction": "Write a bash example for reference", "response": "Here's a bash example:\n\n```bash\nkubectl get --raw '/debug/api_priority_and_fairness/dump_requests?includeRequestDetails=1'\n```\n\n13.1 - Flow control | The output will be in CSV and similar to this:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19497"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nclientConnection:\n  kubeconfig: /etc/srv/kubernetes/kube-scheduler/kubeconfig\n```\n\n16.1 - Scheduler Configuration | A scheduling Profile allows you to configure the different stages of scheduling in the kube-scheduler. Each stage is exposed in an extension point. Plugins provide scheduling behaviors by implementing", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19498"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - plugins:\n      score:\n        disabled:\n        - name: PodTopologySpread\n        enabled:\n        - name: MyCustomPluginA\n          weight: 2\n        - name: MyCustomPluginB\n          weight: 1\n```\n\n16.1 - Scheduler Configuration | You can use * as name in the disabled array to disable all default plugins for that extension point. This can also be used to rearrange plugins order, if desired.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19499"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: default-scheduler\n  - schedulerName: no-scoring-scheduler\n    plugins:\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\n16.1 - Scheduler Configuration | Pods that want to be scheduled according to a specific profile can include the corresponding scheduler name in its .spec.schedulerName.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19500"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: MyPlugin\n```\n\n16.1 - Scheduler Configuration | This would equate to manually enabling MyPlugin for all of its extension points, like so:", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19501"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      preScore:\n        enabled:\n        - name: MyPlugin\n      score:\n        enabled:\n        - name: MyPlugin\n      preFilter:\n        enabled:\n        - name: MyPlugin\n      filter:\n        enabled:\n        - name: MyPlugin\n```\n\n16.1 - Scheduler Configuration | One benefit of using multiPoint here is that if MyPlugin implements another extension point in the future, the multiPoint config will automatically enable it for the new extension.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19502"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: non-multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'MyPlugin'\n      preScore:\n        disabled:\n        - name: '*'\n      score:\n        disabled:\n        - name: '*'\n```\n\n16.1 - Scheduler Configuration | Starting from kubescheduler.config.k8s.io/v1beta3, all default plugins are enabled internally through MultiPoint. However, individual extension points are still available to allow flexible reconfigura", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19503"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      score:\n        enabled:\n        - name: 'DefaultScore2'\n          weight: 5\n```\n\n16.1 - Scheduler Configuration | In this example, it's unnecessary to specify the plugins in MultiPoint explicitly because they are default plugins. And the only plugin specified in Score is DefaultScore2. This is because plugins set", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19504"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n      multiPoint:\n        enabled:\n        - name: 'CustomQueueSort'\n        - name: 'CustomPlugin1'\n          weight: 3\n        - name: 'CustomPlugin2'\n        disabled:\n        - name: 'DefaultQueueSort'\n      filter:\n        disabled:\n        - name: 'DefaultPlugin1'\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n```\n\n16.1 - Scheduler Configuration | Note that there is no error for re-declaring a MultiPoint plugin in a specific extension point. The re-declaration is ignored (and logged), as specific extension points take precedence.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19505"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n  - schedulerName: multipoint-scheduler\n    plugins:\n\n      # Disable the default QueueSort plugin\n      queueSort:\n        enabled:\n        - name: 'CustomQueueSort'\n        disabled:\n        - name: 'DefaultQueueSort'\n\n      # Enable custom Filter plugins\n      filter:\n        enabled:\n        - name: 'CustomPlugin1'\n        - name: 'CustomPlugin2'\n        - name: 'DefaultPlugin2'\n        disabled:\n        - name: 'DefaultPlugin1'\n\n      # Enable and reorder custom score plugins\n      score:\n        enabled:\n        - name: 'DefaultPlugin2'\n          weight: 1\n        - name: 'DefaultPlugin1'\n          weight: 3\n```\n\n16.1 - Scheduler Configuration | While this is a complicated example, it demonstrates the flexibility of MultiPoint config as well as its seamless integration with the existing methods for configuring extension points.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19506"}
{"instruction": "Write a yaml example for reference", "response": "Here's a yaml example:\n\n```yaml\napiVersion: kubescheduler.config.k8s.io/v1beta2\nkind: KubeSchedulerConfiguration\nprofiles:\n- pluginConfig:\n  - args:\n      scoringStrategy:\n        resources:\n        - name: cpu\n          weight: 1\n        type: MostAllocated\n    name: NodeResourcesFit\n```\n\n16.1 - Scheduler Configuration | The scheduler plugin NodeLabel is deprecated; instead, use the NodeAffinity plugin (enabled by default) to achieve similar behavior.", "category": "reference_code", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/_print/", "id": "k8s_00789_code_19507"}
{"instruction": "What is the reference documentation for kubelet?", "response": "kubeletSynopsisThe kubelet is the primary \"node agent\" that runs on each node. It can register the node with the apiserver using one of: the hostname; a flag to override the hostname; or specific logic for a cloud provider.The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn't manage containers which were not created by Kubernetes.Other than from an PodSpec from the apiserver, there are two ways that a container manifest can be provided to the Kubelet.File: Path passed as a flag on the command line. Files under this path will be monitored periodically for updates. The monitoring period is 20s by default and is configurable via a flag.HTTP endpoint: HTTP endpoint passed as a parameter on the command line. This endpoint is checked every 20 seconds (also configurable with a flag).kubelet [flags] Options--address string Default: 0.0.0.0The IP address for the Kubelet to serve on (set to '0.0.0.0' or '::' for listening on all interfaces and IP address families) (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--allowed-unsafe-sysctls stringsComma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in *). Use these at your own risk. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--anonymous-auth Default: trueEnables anonymous requests to the Kubelet server. Requests that are not rejected by another authentication method are treated as anonymous requests. Anonymous requests have a username of system:anonymous, and a group name of system:unauthenticated. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authentication-token-webhookUse the TokenReview API to determine authentication for bearer tokens. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authentication-token-webhook-cache-ttl duration Default: 2m0sThe duration to cache responses from the webhook token authenticator. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authorization-mode string Default: \"AlwaysAllow\"Authorization mode for Kubelet server. Valid options are AlwaysAllow or Webhook. Webhook mode uses the SubjectAccessReview API to determine authorization. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authorization-webhook-cache-authorized-ttl duration Default: 5m0sThe duration to cache 'authorized' responses from the webhook authorizer. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)--authorization-webhook-cache-unauthorized-ttl duration Default: 30sThe duration to cache 'unauthorized' responses from the webhook authorizer. (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more informat", "category": "reference", "subcategory": "general-reference", "source": "https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet", "id": "k8s_00790"}
{"instruction": "What is the reference documentation for api overview?", "response": "Kubernetes API Reference Docs Overview API Groups Workloads APIs Container v1 core CronJob v1 batch Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status DaemonSet v1 apps Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Deployment v1 apps Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Misc Operations Read Scale Replace Scale Patch Scale Job v1 batch Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Pod v1 core Write Operations Create Create Eviction Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Resize Operations Read Resize Patch Resize Replace Resize EphemeralContainers Operations Patch EphemeralContainers Read EphemeralContainers Replace EphemeralContainers Proxy Operations Create Connect Portforward Create Connect Proxy Create Connect Proxy Path Delete Connect Proxy Delete Connect Proxy Path Get Connect Portforward Get Connect Proxy Get Connect Proxy Path Head Connect Proxy Head Connect Proxy Path Replace Connect Proxy Replace Connect Proxy Path Misc Operations Read Log Get Connect Exec Create Connect Exec Get Connect Attach Create Connect Attach ReplicaSet v1 apps Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Misc Operations Read Scale Replace Scale Patch Scale ReplicationController v1 core Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Misc Operations Read Scale Replace Scale Patch Scale StatefulSet v1 apps Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Misc Operations Read Scale Replace Scale Patch Scale Service APIs Endpoints v1 core Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces EndpointSlice v1 discovery.k8s.io Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Ingress v1 networking.k8s.io Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status IngressClass v1 networking.k8s.io Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List Watch Watch List Service v1 core Write Operations Create Patch Replace Delete Delete Collection Read Operations Read List List All Namespaces Watch Watch List Watch List All Namespaces Status Operations Patch Status Read Status Replace Status Proxy Operations Create Connect Proxy Create Connect Proxy Path Delete Connect Proxy Delete Connect Proxy Path Get Connect Proxy Get Connect Proxy Path Head Connect Proxy Head Connect Proxy Path Replace Connect Proxy Replace Connect Proxy Path Config and Storage APIs ConfigMap v1 core Write Operations Create Patch Repla", "category": "reference", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  # Unique key of the DaemonSet instance\n  name: daemonset-example\nspec:\n  selector:\n    matchLabels:\n      app: daemonset-example\n  template:\n    metadata:\n      labels:\n        app: daemonset-example\n    spec:\n      containers:\n      # This container is run once on each Node in the cluster\n      - name: daemonset-example\n        image: ubuntu:trusty\n        command:\n        - /bin/sh\n        args:\n        - -c\n        # This script is run through `sh -c <script>`\n        - >-\n          while [ true ]; do\n          echo \"DaemonSet running on $(hostname)\" ;\n          sleep 10 ;\n          done\n```\n\nDaemonSet v1 apps | create a DaemonSet", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19510"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: daemonset-example\nspec:\n  selector:\n    matchLabels:\n      app: daemonset-example\n  template:\n    metadata:\n      labels:\n        app: daemonset-example\n    spec:\n      containers:\n      - name: daemonset-example\n        image: ubuntu:trusty\n        command:\n        - /bin/sh\n        args:\n        - -c\n        - >-\n          while [ true ]; do\n          echo \"DaemonSet running on $(hostname)\" ;\n          sleep 10 ;\n          done\n' | kubectl create -f -\n```\n\nDaemonSet v1 apps | create a DaemonSet", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19511"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: daemonset-example\nspec:\n  selector:\n    matchLabels:\n      app: daemonset-example\n  template:\n    metadata:\n      labels:\n        app: daemonset-example\n    spec:\n      containers:\n      - name: daemonset-example\n        image: ubuntu:trusty\n        command:\n        - /bin/sh\n        args:\n        - -c\n        - >-\n          while [ true ]; do\n          echo \"DaemonSet running on $(hostname)\" ;\n          sleep 10 ;\n          done\n' http://127.0.0.1:8001/apis/apps/v1/namespaces/default/daemonsets\n```\n\nDaemonSet v1 apps | create a DaemonSet", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19512"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  # Unique key of the Deployment instance\n  name: deployment-example\nspec:\n  # 3 Pods should exist at all times.\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        # Apply this label to pods and default\n        # the Deployment label selector to this value\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        # Run this image\n        image: nginx:1.14\n```\n\nDeployment v1 apps | create a Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19513"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14\n        ports:\n        - containerPort: 80\n' | kubectl create -f -\n```\n\nDeployment v1 apps | create a Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19514"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14\n        ports:\n        - containerPort: 80\n' http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments\n```\n\nDeployment v1 apps | create a Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19515"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16\n        ports:\n        - containerPort: 80\n' | kubectl replace -f -\n```\n\nDeployment v1 apps | replace the specified Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19516"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X PUT -H 'Content-Type: application/yaml' --data '\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16\n        ports:\n        - containerPort: 80\n' http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments/deployment-example\n```\n\nDeployment v1 apps | replace the specified Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19517"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  # Unique key of the Job instance\n  name: example-job\nspec:\n  template:\n    metadata:\n      name: example-job\n    spec:\n      containers:\n      - name: pi\n        image: perl\n        command: [\"perl\"]\n        args: [\"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      # Do not restart containers after they exit\n      restartPolicy: Never\n```\n\nJob v1 batch | create a Job", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19518"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  template:\n    metadata:\n      name: example-job\n    spec:\n      containers:\n      - name: pi\n        image: perl\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n' | kubectl create -f -\n```\n\nJob v1 batch | create a Job", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19519"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  template:\n    metadata:\n      name: example-job\n    spec:\n      containers:\n      - name: pi\n        image: perl\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n' http://127.0.0.1:8001/apis/batch/v1/namespaces/default/jobs\n```\n\nJob v1 batch | create a Job", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19520"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-example\nspec:\n  containers:\n  - name: ubuntu\n    image: ubuntu:trusty\n    command: [\"echo\"]\n    args: [\"Hello World\"]\n```\n\nPod v1 core | Warning:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19521"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  # Unique key of the ReplicaSet instance\n  name: replicaset-example\nspec:\n  # 3 Pods should exist at all times.\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      # Run the nginx image\n      - name: nginx\n        image: nginx:1.14\n```\n\nReplicaSet v1 apps | Warning:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19522"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  # Unique key of the ReplicationController instance\n  name: replicationcontroller-example\nspec:\n  # 3 Pods should exist at all times.\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      # Run the nginx image\n      - name: nginx\n        image: nginx:1.14\n```\n\nReplicationController v1 core | Warning:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19523"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\nkind: Service\napiVersion: v1\nmetadata:\n  # Unique key of the Service instance\n  name: service-example\nspec:\n  ports:\n    # Accept traffic sent to port 80\n    - name: http\n      port: 80\n      targetPort: 80\n  selector:\n    # Loadbalance traffic across Pods matching\n    # this label selector\n    app: nginx\n  # Create an HA proxy in the cloud provider\n  # with an External IP address - *Only supported\n  # by some cloud providers*\n  type: LoadBalancer\n```\n\nService v1 core | create a Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19524"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'kind: Service\napiVersion: v1\nmetadata:\n  name: service-example\nspec:\n  ports:\n    - name: http\n      port: 80\n      targetPort: 80\n  selector:\n      app: nginx\n  type: LoadBalancer\n' | kubectl create -f -\n```\n\nService v1 core | create a Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19525"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\nkind: Service\napiVersion: v1\nmetadata:\n  name: service-example\nspec:\n  ports:\n    - name: http\n      port: 80\n      targetPort: 80\n  selector:\n      app: nginx\n  type: LoadBalancer\n' http://127.0.0.1:8001/api/v1/namespaces/default/services\n```\n\nService v1 core | create a Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19526"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: v1\nkind: Service\nmetadata:\n  name: deployment-example\n  resourceVersion: \"2205995\"\nspec:\n  clusterIP: 10.183.250.161\n  ports:\n  - name: http\n    nodePort: 32417\n    port: 80\n    protocol: TCP\n    targetPort: 8080\n  selector:\n    app: nginx\n  sessionAffinity: None\n  type: LoadBalancer\n' | kubectl replace -f -\n```\n\nService v1 core | replace the specified Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19527"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X PUT -H 'Content-Type: application/yaml' --data '\napiVersion: v1\nkind: Service\nmetadata:\n  name: deployment-example\n  resourceVersion: \"2205995\"\nspec:\n  clusterIP: 10.183.250.161\n  ports:\n  - name: http\n    nodePort: 32417\n    port: 80\n    protocol: TCP\n    targetPort: 8080\n  selector:\n    app: nginx\n  sessionAffinity: None\n  type: LoadBalancer\n' http://127.0.0.1:8001/api/v1/namespaces/default/services/deployment-example\n```\n\nService v1 core | replace the specified Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19528"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  # Unique key of the DaemonSet instance\n  name: daemonset-example\nspec:\n  selector:\n    matchLabels:\n      app: daemonset-example\n  template:\n    metadata:\n      labels:\n        app: daemonset-example\n    spec:\n      containers:\n      # This container is run once on each Node in the cluster\n      - name: daemonset-example\n        image: ubuntu:trusty\n        command:\n        - /bin/sh\n        args:\n        - -c\n        # This script is run through `sh -c <script>`\n        - >-\n          while [ true ]; do\n          echo \"DaemonSet running on $(hostname)\" ;\n          sleep 10 ;\n          done\n```\n\nDaemonSet v1 apps | create a DaemonSet", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19529"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: daemonset-example\nspec:\n  selector:\n    matchLabels:\n      app: daemonset-example\n  template:\n    metadata:\n      labels:\n        app: daemonset-example\n    spec:\n      containers:\n      - name: daemonset-example\n        image: ubuntu:trusty\n        command:\n        - /bin/sh\n        args:\n        - -c\n        - >-\n          while [ true ]; do\n          echo \"DaemonSet running on $(hostname)\" ;\n          sleep 10 ;\n          done\n' | kubectl create -f -\n```\n\nDaemonSet v1 apps | create a DaemonSet", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19530"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\napiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n  name: daemonset-example\nspec:\n  selector:\n    matchLabels:\n      app: daemonset-example\n  template:\n    metadata:\n      labels:\n        app: daemonset-example\n    spec:\n      containers:\n      - name: daemonset-example\n        image: ubuntu:trusty\n        command:\n        - /bin/sh\n        args:\n        - -c\n        - >-\n          while [ true ]; do\n          echo \"DaemonSet running on $(hostname)\" ;\n          sleep 10 ;\n          done\n' http://127.0.0.1:8001/apis/apps/v1/namespaces/default/daemonsets\n```\n\nDaemonSet v1 apps | create a DaemonSet", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19531"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  # Unique key of the Deployment instance\n  name: deployment-example\nspec:\n  # 3 Pods should exist at all times.\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        # Apply this label to pods and default\n        # the Deployment label selector to this value\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        # Run this image\n        image: nginx:1.14\n```\n\nDeployment v1 apps | create a Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19532"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14\n        ports:\n        - containerPort: 80\n' | kubectl create -f -\n```\n\nDeployment v1 apps | create a Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19533"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.14\n        ports:\n        - containerPort: 80\n' http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments\n```\n\nDeployment v1 apps | create a Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19534"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16\n        ports:\n        - containerPort: 80\n' | kubectl replace -f -\n```\n\nDeployment v1 apps | replace the specified Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19535"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X PUT -H 'Content-Type: application/yaml' --data '\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: deployment-example\nspec:\n  replicas: 3\n  revisionHistoryLimit: 10\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.16\n        ports:\n        - containerPort: 80\n' http://127.0.0.1:8001/apis/apps/v1/namespaces/default/deployments/deployment-example\n```\n\nDeployment v1 apps | replace the specified Deployment", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19536"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  # Unique key of the Job instance\n  name: example-job\nspec:\n  template:\n    metadata:\n      name: example-job\n    spec:\n      containers:\n      - name: pi\n        image: perl\n        command: [\"perl\"]\n        args: [\"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      # Do not restart containers after they exit\n      restartPolicy: Never\n```\n\nJob v1 batch | create a Job", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19537"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  template:\n    metadata:\n      name: example-job\n    spec:\n      containers:\n      - name: pi\n        image: perl\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n' | kubectl create -f -\n```\n\nJob v1 batch | create a Job", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19538"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: example-job\nspec:\n  template:\n    metadata:\n      name: example-job\n    spec:\n      containers:\n      - name: pi\n        image: perl\n        command: [\"perl\",  \"-Mbignum=bpi\", \"-wle\", \"print bpi(2000)\"]\n      restartPolicy: Never\n' http://127.0.0.1:8001/apis/batch/v1/namespaces/default/jobs\n```\n\nJob v1 batch | create a Job", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19539"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: pod-example\nspec:\n  containers:\n  - name: ubuntu\n    image: ubuntu:trusty\n    command: [\"echo\"]\n    args: [\"Hello World\"]\n```\n\nPod v1 core | Warning:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19540"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: apps/v1\nkind: ReplicaSet\nmetadata:\n  # Unique key of the ReplicaSet instance\n  name: replicaset-example\nspec:\n  # 3 Pods should exist at all times.\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      # Run the nginx image\n      - name: nginx\n        image: nginx:1.14\n```\n\nReplicaSet v1 apps | Warning:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19541"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\napiVersion: v1\nkind: ReplicationController\nmetadata:\n  # Unique key of the ReplicationController instance\n  name: replicationcontroller-example\nspec:\n  # 3 Pods should exist at all times.\n  replicas: 3\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      # Run the nginx image\n      - name: nginx\n        image: nginx:1.14\n```\n\nReplicationController v1 core | Warning:", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19542"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\nkind: Service\napiVersion: v1\nmetadata:\n  # Unique key of the Service instance\n  name: service-example\nspec:\n  ports:\n    # Accept traffic sent to port 80\n    - name: http\n      port: 80\n      targetPort: 80\n  selector:\n    # Loadbalance traffic across Pods matching\n    # this label selector\n    app: nginx\n  # Create an HA proxy in the cloud provider\n  # with an External IP address - *Only supported\n  # by some cloud providers*\n  type: LoadBalancer\n```\n\nService v1 core | create a Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19543"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'kind: Service\napiVersion: v1\nmetadata:\n  name: service-example\nspec:\n  ports:\n    - name: http\n      port: 80\n      targetPort: 80\n  selector:\n      app: nginx\n  type: LoadBalancer\n' | kubectl create -f -\n```\n\nService v1 core | create a Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19544"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X POST -H 'Content-Type: application/yaml' --data '\nkind: Service\napiVersion: v1\nmetadata:\n  name: service-example\nspec:\n  ports:\n    - name: http\n      port: 80\n      targetPort: 80\n  selector:\n      app: nginx\n  type: LoadBalancer\n' http://127.0.0.1:8001/api/v1/namespaces/default/services\n```\n\nService v1 core | create a Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19545"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ echo 'apiVersion: v1\nkind: Service\nmetadata:\n  name: deployment-example\n  resourceVersion: \"2205995\"\nspec:\n  clusterIP: 10.183.250.161\n  ports:\n  - name: http\n    nodePort: 32417\n    port: 80\n    protocol: TCP\n    targetPort: 8080\n  selector:\n    app: nginx\n  sessionAffinity: None\n  type: LoadBalancer\n' | kubectl replace -f -\n```\n\nService v1 core | replace the specified Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19546"}
{"instruction": "Write a yaml example for api overview", "response": "Here's a yaml example:\n\n```yaml\n$ kubectl proxy\n$ curl -X PUT -H 'Content-Type: application/yaml' --data '\napiVersion: v1\nkind: Service\nmetadata:\n  name: deployment-example\n  resourceVersion: \"2205995\"\nspec:\n  clusterIP: 10.183.250.161\n  ports:\n  - name: http\n    nodePort: 32417\n    port: 80\n    protocol: TCP\n    targetPort: 8080\n  selector:\n    app: nginx\n  sessionAffinity: None\n  type: LoadBalancer\n' http://127.0.0.1:8001/api/v1/namespaces/default/services/deployment-example\n```\n\nService v1 core | replace the specified Service", "category": "reference_code", "subcategory": "api-reference", "source": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/", "id": "k8s_00791_code_19547"}
